Re: libpq/INSERT

Поиск
Список
Период
Сортировка
От Oliver Elphick
Тема Re: libpq/INSERT
Дата
Msg-id 200104241614.f3OGEXU02899@linda.lfix.co.uk
обсуждение исходный текст
Ответ на libpq/INSERT  ("Andy Champion" <andychampion@hotmail.com>)
Список pgsql-interfaces
"Andy Champion" wrote: ><html><DIV>

Please turn off html mode in your mailer.
 >Hi, i'm trying to insert data pulled into a postgresql database but i'm     > having some problems with the inserts.
>>i know that this: >  sprintf(insert_string, "INSERT INTO udpdata VALUES (1234);\n"); > >is a valid statment, but how
doi alter this so that instead of the 123     >4 i insert the value of a variable? 
 
It sounds as though you need a basic course in C programming.

sprintf(insert_string, "INSERT INTO udpdata VALUES (%s);\n", string_variable);
sprintf(insert_string, "INSERT INTO udpdata VALUES (%d);\n", integer_variable);

You could find this out by reading the manual for sprintf...

-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47  6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
========================================   "Now unto him that is able to do exceeding abundantly      above all that we
askor think, according to the power     that worketh in us, Unto him be glory in the church by     Christ Jesus
throughoutall ages, world without end.      Amen."          Ephesians 3:20,21 
 




В списке pgsql-interfaces по дате отправления:

Предыдущее
От: liam
Дата:
Сообщение: Re: libpq/INSERT
Следующее
От: "Brett W. McCoy"
Дата:
Сообщение: Re: libpq/INSERT