Return-Path: postarch
Received: by postgres.Berkeley.EDU (5.61/1.29)
	id AA16162; Mon, 30 Mar 92 14:36:40 -0800
Message-Id: <9203302236.AA16162@postgres.Berkeley.EDU>
From: postarch (Postgres Mailing Archive)
Subject: Re: LibPQ
To: postgres@postgres.berkeley.edu
Sender: pg_adm@postgres.berkeley.edu
Reply-To: mer@postgres.berkeley.edu
In-Reply-To: Your message of "Fri, 27 Mar 92 11:14:47 PST."
             <9203271914.AA10905@postgres.Berkeley.EDU> 
Date: Mon, 30 Mar 92 14:36:30 PST

you write:

> 1. Can I populate a database from a C program by giving a  -\i  command
> and a script file name, in much the same way as the demo database is
> initialized. If so how ?
> 
> 2. I have written an application which inserts records into a database
> by creating a string eg
> 
> append Station  (StaName = "System ",Class = "- ",Parent = "- ")
> 
> and then using the PQexec command from a C program to execute it. This
> works but has 2 problems 

When you use \i in the monitor it is functionally equivalent to what you are
doing in your hand coded program.
> 
>     a) The performance is very poor ie several seconds per record. (
>     it is also poor if I use PQputline )

This seems a little fishy.  But one way to get around using individual append
queries is to use the copy command.

>     b) When this record append Station  (StaName = "Sta1 ",Class = "- ",Parent = "System
> ")
>        is entered a get the following error. This I think has to do
>        with the fact that the string goes over onto a new line 
> 
> WARN:Mar 27 14:05:31:*** scanner error: Unterminated char/string constant
> 
> Does anyone have any ideas as to how to overcome the above error ...

Don't put your string on two lines!!  If you need to break up the query the
following will work:

	append Station  (StaName = "Sta1 ",
			 Class = "- ",
			 Parent = "System")


Jeff Meredith
mer@postgres.berkeley.edu
