X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 4DC9DD1B492 for ; Thu, 29 Jan 2004 13:36:26 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 28873-01 for ; Thu, 29 Jan 2004 09:36:04 -0400 (AST) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.173]) by svr1.postgresql.org (Postfix) with ESMTP id 07B92D1C9CD for ; Thu, 29 Jan 2004 09:35:55 -0400 (AST) Received: from [212.227.126.203] (helo=mrvnet.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 1AmCKw-0003g9-00; Thu, 29 Jan 2004 14:36:02 +0100 Received: from [172.23.4.146] (helo=config19.kundenserver.de) by mrvnet.kundenserver.de with esmtp (Exim 3.35 #1) id 1AmCKv-00088Y-00; Thu, 29 Jan 2004 14:36:01 +0100 Received: from www-data by config19.kundenserver.de with local (Exim 3.35 #1 (Debian)) id 1AmCKv-0007tU-00; Thu, 29 Jan 2004 14:36:01 +0100 To: =?iso-8859-1?Q?Viorel_Dragomir?= Subject: Re: From: Cc: Message-Id: <6312635$107538310640190b424983f6.38446324@config19.schlund.de> X-Binford: 6100 (more power) X-Originating-From: 6312635 X-Mailer: Webmail X-Routing: DE X-Received: from config19 by 80.128.69.141 with HTTP id 6312635 for bc@vio.ro; Thu, 29 Jan 2004 14:36:01 +0100 Content-Type: text/plain; charset="iso-8859-1" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Priority: 3 Date: Thu, 29 Jan 2004 14:36:01 +0100 X-Provags-ID: kundenserver.de abuse@kundenserver.de ident:@172.23.4.146 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/258 X-Sequence-Number: 16651 You might also consider using ecpg which allows a syntax like: int a, b, c; EXEC SQL INSERT INTO mytable ( :a, :b, :c ); See http://www.postgresql.org/docs/current/interactive/ecpg.html for details. HTH Jürgen Viorel Dragomir schrieb am 29.01.2004, 14:11:44: > So, you are an artist. Isn't it? :) > Your query is actually a string. > This is your string: INSERT into table values(a,b,c,d) > > You must change your string to actually use values of tha a, b... > You can make this string with sprintf > sprintf(string, "INSERT into table values(%d,%d,%d,%d)", a, b, c, d); > > Then you launch: > res=PQexecute(Conn, string); > > Why don't you use PHP? Is easier. > > Have a nice day > ----- Original Message ----- > From: MUKTA > To: pgsql-sql@postgresql.org > Sent: Thursday, January 29, 2004 15:08 > Subject: [SQL] > > > Hi I have an urgent problem > I want to insert values into a table using the C syscalls provided by the libpq library, but i find that i can not insert into the table when i use variables instead of values...like so: > int a,b,c,d; > using the C function > > res=PQexecute(Conn,"INSERT into table values(a,b,c,d));.... > > executing above statement with plain integers does fine and inserts them into table.. > > Is there some special way to insert variables rather than plain values? do i have to build functions (in sql) or somehting?help! > Thanx