Skip site navigation (1) Skip section navigation (2)


From: <email(at)juergen-cappel(dot)de>
To: Viorel Dragomir <bc(at)vio(dot)ro>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re:
Date: 2004-01-29 13:36:01
Message-ID: 6312635$ (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
You might also consider using ecpg which allows a syntax like:

int a, b, c;
EXEC SQL INSERT INTO mytable ( :a, :b, :c );

See for



Viorel Dragomir <bc(at)vio(dot)ro> 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(at)postgresql(dot)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 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

pgsql-sql by date

Next:From: Bruno Wolff IIIDate: 2004-01-29 14:06:55
Subject: Re: query not using index for descending records?
Previous:From: Achilleus MantziosDate: 2004-01-29 13:29:11
Subject: Re: query not using index for descending records?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group