libpq doing strange things

Поиск
Список
Период
Сортировка
От Daniel Andersen
Тема libpq doing strange things
Дата
Msg-id S37UHOr0GtgBQZfv4eq00051a02@smtp01.iprimus.net.au
обсуждение исходный текст
Список pgsql-interfaces
Hi,

Is there some undocumented feature in libpq to do with executing update 
queries? I just programmed my mail server to put a mark next to a users name 
whenever they check their email, but for some reason the update query does 
not execute properly. It returns PGRES_COMMAND_OK, and if i check the text 
output of the query it says its updated one record. I know that the 
connection is working ok, because it extracts the password and username from 
the database ok in the query before. Is there any other way to check what is 
going wrong, or is there something else i should be doing i don't know about? 
all i do is load the query into a string using sprintf, and then use that 
string to execute the query like PGexec (conn, string)
Heres the exact query and commands in case it helps:

       snprintf (ptr, 256, "update accounting set mail = 1 where time_stamp 
in (select max (time_stamp) from accounting where username='%s') and 
username='%s';", pinfo->userid, pinfo->userid);       syslog(LOG_ERR,ptr);       res2 = PQexec (conn, ptr);       if
(PQresultStatus(res2)!= PGRES_TUPLES_OK) syslog(LOG_ERR, 
 
PQresStatus(PQresultStatus(res2)));

and the output in the syslog is like:

Jan  4 09:21:49 spa teapop[17449]: update accounting set mail = 1 where 
time_stamp in (select max (time_stamp) from accounting where username='bsn') 
and username='bsn';
Jan  4 09:21:49 spa teapop[17449]: PGRES_COMMAND_OK

which seems like it should be doing ok. Can anyone shed some light on what 
might be causing this problem?

Thanks,Daniel Andersen


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

Предыдущее
От: Jakob Lund
Дата:
Сообщение: PQfinish also kills my dll
Следующее
От: Michael Meskes
Дата:
Сообщение: Re: ECPG: How to use #define and string host variable