Re: LIBPQ Question

Поиск
Список
Период
Сортировка
От Tomasz Myrta
Тема Re: LIBPQ Question
Дата
Msg-id 3F9CC61C.8010103@klaster.net
обсуждение исходный текст
Ответ на LIBPQ Question  ("creid" <creid@netbcg.com>)
Ответы Re: LIBPQ Question
Список pgsql-interfaces
Dnia 2003-10-27 00:08, Użytkownik creid napisał:

> Problem:  Assigning a COUNT(*) result into an integer variable in my C
> program consistently fails except when I assign the same result to a char
> variable.  I can only assume that the internal data type the COUNT function
> uses is integer.
> 
> Can anyone help put me in the proper mindset so I may deal with this,
> seemingly simple issue, to resolution.
> 
> I need the integer result to to help me satisfy a dynamic memory
> requirement... COUNT(*) result will tell me how many rows of data I need to
> malloc and I cannot perform a math operation on a char variable.

All libpq results are strings.
some_int_value=atoi(PQgetvalue(...))

Anyway why do you need count(*) ? When you retrieve your rows, you can 
always check how many are them using PQntuples(...) and then malloc your 
memory tables.

Regards,
Tomasz Myrta



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

Предыдущее
От: Tomasz Myrta
Дата:
Сообщение: Re: LIBPQ
Следующее
От: Igor Shevchenko
Дата:
Сообщение: Re: LIBPQ Question