libpq status question

Поиск
Список
Период
Сортировка
От Louis Castoria
Тема libpq status question
Дата
Msg-id 435E65A1.7030907@e9.com
обсуждение исходный текст
Ответы Re: libpq status question  (Volkan YAZICI <volkan.yazici@gmail.com>)
Список pgsql-interfaces
I'm confused about something and need some help.  I wrote a c routine 
that uses libpq.  The result codes  are good when I use a select or 
insert.  if  I use an update  sql command  string like "update 
largetable set t01='update1', t02='update2' where mainkey='12'" and the 
mainkey of 12 does not exist the result code is a 0 if the mainkey 
exists I get a result of 0.  How can I tell if the update was 
successfully or not.  Here is the code.

void                                                                           

pgsql_exec_query( int *dbhandle, char *query, int *qryhandle, int 
*status ) {        char 
*r,*n=query;                                                            int nfields, i, 
j;                                                           PGconn *conn = (PGconn 
*)*dbhandle;                                          PGresult 
*res;                                                               while ( *n != ';' || *(n+1) != ';' ) 
n++;                                    
*n=0;                                                                        res = 
0;                                                                     res = PQexec(conn, 
query);                                                   printf("Result = %d ", (int) 
res);                                           *status = 
PQresultStatus(res);                                               printf("status = %f", (int) 
status);                                         *qryhandle = (int) 
res;                                               
}                                                                              







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

Предыдущее
От: Louis Castoria
Дата:
Сообщение: Status question
Следующее
От: Volkan YAZICI
Дата:
Сообщение: Re: libpq status question