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 6995DD1B8D4 for ; Thu, 29 Jan 2004 13:09:58 +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 15156-09 for ; Thu, 29 Jan 2004 09:09:33 -0400 (AST) Received: from mail1.dr.myx.net (mail1.dr.myx.net [217.10.193.161]) by svr1.postgresql.org (Postfix) with ESMTP id 10A44D1D223 for ; Thu, 29 Jan 2004 09:09:19 -0400 (AST) Received: from appserver (unknown [82.137.2.202]) by mail1.dr.myx.net (mydomain.myx.net) with ESMTP id 40C3A300996; Thu, 29 Jan 2004 15:09:26 +0200 (EET) Message-ID: <031501c3e669$71b30ca0$6500a8c0@wylog.local> From: "Viorel Dragomir" To: "MUKTA" , References: <00a801c3e669$004f08c0$ea08a8c0@mukta> Subject: Re: Date: Thu, 29 Jan 2004 15:11:44 +0200 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0312_01C3E67A.34BD84E0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.7 tagged_above=0.0 required=5.0 tests=HTML_40_50, REFERENCES X-Spam-Level: X-Archive-Number: 200401/255 X-Sequence-Number: 16648 This is a multi-part message in MIME format. ------=_NextPart_000_0312_01C3E67A.34BD84E0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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=3DPQexecute(Conn, string); Why don't you use PHP? Is easier. Have a nice day ----- Original Message -----=20 From: MUKTA=20 To: pgsql-sql@postgresql.org=20 Sent: Thursday, January 29, 2004 15:08 Subject: [SQL]=20 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=20 res=3DPQexecute(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? d= o i have to build functions (in sql) or somehting?help! Thanx ------=_NextPart_000_0312_01C3E67A.34BD84E0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
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 us= e values=20 of tha a, b...
You can make this string with sprintf
sprintf(string, "INSERT into table=20 values(%d,%d,%d,%d)", a, b, c, d);
 
Then you launch:
res=3DPQexecute(Conn, string);
 
Why don't you use PHP? Is easier.
 
Have a nice day
----- Original Message -----
Fro= m:=20 = MUKTA=20
To: pgsql-sql@postgresql.org
Sent: Thursday, January 29, 2004= =20 15:08
Subject: [SQL]

Hi I have an urgent problem
I want to insert values into a table usi= ng the C=20 syscalls provided by the libpq library, but i find that i can not insert = into=20 the table when i use variables instead of values...like so:
int a,b,c,d;
using the C function
 
res=3DPQexecute(Conn,"INSERT into table= =20 values(a,b,c,d));....
 
executing above statement with plain integers does fine and inserts = them=20 into table..
 
Is there some special way to insert vari= ables=20 rather than plain values? do i have to build functions (in sql) or=20 somehting?help!
Thanx
------=_NextPart_000_0312_01C3E67A.34BD84E0--