Re: newbie libpq question...

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: newbie libpq question...
Дата
Msg-id 20041114012339.GA73251@winnie.fuhr.org
обсуждение исходный текст
Ответ на newbie libpq question...  (Doug Homoelle <homoelle@ll.mit.edu>)
Список pgsql-interfaces
On Mon, Nov 08, 2004 at 05:23:59PM -0500, Doug Homoelle wrote:
> 
>     res = PQexec(conn, "select blah blah blah");
>     test_int=PQntuples(res);
>     fprintf(stdout,"number of rows: %f\n",test_int);
>     test_int=PQnfields(res);
>     fprintf(stdout,"number of cols: %f\n",test_int);
> 
> where "blah blah blah" is the selection criteria, I get zero rows and
> zero columns.

You're using floating-point (%f) conversions to print integers; use
%d or %i instead.  Some compilers have options to warn you of such
mistakes -- with gcc, for example, you can use -Wall.

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/


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

Предыдущее
От: Doug Homoelle
Дата:
Сообщение: newbie libpq question...
Следующее
От: Palle Girgensohn
Дата:
Сообщение: Where is src/interfaces/libpgtcl?