pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedLibpq question
7+ messages / 7 participants
[nested] [flat]
* Libpq question
@ 1998-10-05 19:32 brian@fidessa.vingulf.org
0 siblings, 0 replies; 7+ messages in thread
From: brian@fidessa.vingulf.org @ 1998-10-05 19:32 UTC (permalink / raw)
To: pgsql-interfaces
Can someone explain what this line in the latest HISTORY file means:
Libpq now allows asynchronous clients(Tom)
Was there some sort of limitation in the old libpq with regard to
client connections I wasn't aware of?
Thanks,
Brian
^ permalink raw reply [nested|flat] 7+ messages in thread
* LIBPQ Question
@ 2003-10-26 23:08 creid <creid@netbcg.com>
2003-10-27 00:38 ` Re: LIBPQ Question .@babolo.ru
2003-10-27 07:15 ` Re: LIBPQ Question Tomasz Myrta <jasiek@klaster.net>
0 siblings, 2 replies; 7+ messages in thread
From: creid @ 2003-10-26 23:08 UTC (permalink / raw)
To: pgsql-interfaces
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.
Thanks
Cliff
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: LIBPQ Question
2003-10-26 23:08 LIBPQ Question creid <creid@netbcg.com>
@ 2003-10-27 00:38 ` .@babolo.ru
1 sibling, 0 replies; 7+ messages in thread
From: . @ 2003-10-27 00:38 UTC (permalink / raw)
To: creid <creid@netbcg.com>; +Cc: pgsql-interfaces
> 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.
As far as I remember count() has bigint result
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: LIBPQ Question
2003-10-26 23:08 LIBPQ Question creid <creid@netbcg.com>
@ 2003-10-27 07:15 ` Tomasz Myrta <jasiek@klaster.net>
2003-10-27 07:25 ` Re: LIBPQ Question Igor Shevchenko <igor@carcass.ath.cx>
1 sibling, 1 reply; 7+ messages in thread
From: Tomasz Myrta @ 2003-10-27 07:15 UTC (permalink / raw)
To: creid <creid@netbcg.com>; +Cc: 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
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: LIBPQ Question
2003-10-26 23:08 LIBPQ Question creid <creid@netbcg.com>
2003-10-27 07:15 ` Re: LIBPQ Question Tomasz Myrta <jasiek@klaster.net>
@ 2003-10-27 07:25 ` Igor Shevchenko <igor@carcass.ath.cx>
0 siblings, 0 replies; 7+ messages in thread
From: Igor Shevchenko @ 2003-10-27 07:25 UTC (permalink / raw)
To: Tomasz Myrta <jasiek@klaster.net>; +Cc: pgsql-interfaces
On Monday 27 October 2003 09:15, Tomasz Myrta wrote:
> 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(...))
Not true anymore with protocol v3, which added the binary format. Text format
is still the default.
> 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
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
> joining column's datatypes do not match
--
Best regards,
Igor Shevchenko
^ permalink raw reply [nested|flat] 7+ messages in thread
* libpq question..
@ 2003-12-01 05:47 Kenneth Suralta <ksuralta@ntsp.nec.co.jp>
2003-12-01 07:15 ` Re: libpq question.. Alberto Cabello Sanchez <alberto@unex.es>
0 siblings, 1 reply; 7+ messages in thread
From: Kenneth Suralta @ 2003-12-01 05:47 UTC (permalink / raw)
To: pgsql-interfaces
Hello everyone,
Does anybody know how to determine the user-defined tables
in a database using C (libpq) ???
Best regards,
Kenneth
--
Nothing in the world can take the place of perseverance. Talent will
not; nothing is more common than unsuccessful men with talent. Genius
will not; unrewarded genius is almost a proverb. Persistence and
determination alone are omnipotent. -- Calvin Coolidge
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: libpq question..
2003-12-01 05:47 libpq question.. Kenneth Suralta <ksuralta@ntsp.nec.co.jp>
@ 2003-12-01 07:15 ` Alberto Cabello Sanchez <alberto@unex.es>
0 siblings, 0 replies; 7+ messages in thread
From: Alberto Cabello Sanchez @ 2003-12-01 07:15 UTC (permalink / raw)
To: Kenneth Suralta <ksuralta@ntsp.nec.co.jp>; +Cc: pgsql-interfaces
> Does anybody know how to determine the user-defined tables
> in a database using C (libpq) ???
You can query the database:
SELECT tablename FROM pg_tables WHERE tablename NOT LIKE 'pg_%'
and browse the result.
Hope this helps.
--
-----------------------
Alberto Cabello Sánchez
alberto@unex.es
Servicio de Informática
924 289 351
-----------------------
^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2003-12-01 07:15 UTC | newest]
Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1998-10-05 19:32 Libpq question brian@fidessa.vingulf.org
2003-10-26 23:08 LIBPQ Question creid <creid@netbcg.com>
2003-10-27 00:38 ` Re: LIBPQ Question .@babolo.ru
2003-10-27 07:15 ` Re: LIBPQ Question Tomasz Myrta <jasiek@klaster.net>
2003-10-27 07:25 ` Re: LIBPQ Question Igor Shevchenko <igor@carcass.ath.cx>
2003-12-01 05:47 libpq question.. Kenneth Suralta <ksuralta@ntsp.nec.co.jp>
2003-12-01 07:15 ` Re: libpq question.. Alberto Cabello Sanchez <alberto@unex.es>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox