pg.ddx.io pgsql-hackers-win32@postgresql.org mailing list archive
help / color / mirror / Atom feedretreive record set
5+ messages / 2 participants
[nested] [flat]
* retreive record set
@ 2005-08-01 07:38 Michael GUIARD <michael@nestor-tech.com>
0 siblings, 0 replies; 5+ messages in thread
From: Michael GUIARD @ 2005-08-01 07:38 UTC (permalink / raw)
To: pgsql-hackers-win32
Hi !
I'd like to get my request results in a record set as a C structure using libpq.
Is it possible or do I have to use ECPG only ?
How PGresult pointer stores the results ?
Actually I can convert all my result fields from PGresult to my C structure but I think also it is a little bit stupid if PGresult does its own conversion before ... no ?
thanks
Mike
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: retreive record set
@ 2005-08-01 08:03 Magnus Hagander <mha@sollentuna.net>
2005-08-01 08:41 ` Re: retreive record set Michael GUIARD <michael@nestor-tech.com>
2005-08-01 11:32 ` Re: retreive record set Michael GUIARD <michael@nestor-tech.com>
0 siblings, 2 replies; 5+ messages in thread
From: Magnus Hagander @ 2005-08-01 08:03 UTC (permalink / raw)
To: Michael GUIARD <m.guiard@nestor-tech.com>; pgsql-hackers-win32
> Hi !
>
> I'd like to get my request results in a record set as a C
> structure using libpq.
> Is it possible or do I have to use ECPG only ?
>
> How PGresult pointer stores the results ?
> Actually I can convert all my result fields from PGresult to
> my C structure but I think also it is a little bit stupid if
> PGresult does its own conversion before ... no ?
You are not suppsed to know how PGresult stores the data, you are only
permitted to access it through the accessor functions. This is so it's
possible to change the underlying implementation without breaking your
apps...
You *can* access the data directly, all the rqeuired structs are in the
include files (but not in the libpq-fe.h file - you need the full
includes). I would stronly advise you not to, though.
//Magnus
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: retreive record set
2005-08-01 08:03 Re: retreive record set Magnus Hagander <mha@sollentuna.net>
@ 2005-08-01 08:41 ` Michael GUIARD <michael@nestor-tech.com>
1 sibling, 0 replies; 5+ messages in thread
From: Michael GUIARD @ 2005-08-01 08:41 UTC (permalink / raw)
To: Magnus Hagander <mha@sollentuna.net>; +Cc: pgsql-hackers-win32
Hi Magnus,
I understood that I am not supposed to know how PGresult stores the data,
but I do not know how to fill my structure directly rather than to fill it
field by field.
I saw ecpg gives methods to do this (with descriptors), but I do not
understand all about it, and I think it is too complicated for my small
needs. Further, I do not want to change the implementation of postgreqsl
libpq.
So if I have no other choice than convert all result fields to fill my
structure I will do this ...
what is your advices about this ?
thanks a lot
Mike
----- Original Message -----
From: "Magnus Hagander" <mha@sollentuna.net>
To: "Michael GUIARD" <m.guiard@nestor-tech.com>;
<pgsql-hackers-win32@postgresql.org>
Sent: Monday, August 01, 2005 10:03 AM
Subject: RE: [pgsql-hackers-win32] retreive record set
> Hi !
>
> I'd like to get my request results in a record set as a C
> structure using libpq.
> Is it possible or do I have to use ECPG only ?
>
> How PGresult pointer stores the results ?
> Actually I can convert all my result fields from PGresult to
> my C structure but I think also it is a little bit stupid if
> PGresult does its own conversion before ... no ?
You are not suppsed to know how PGresult stores the data, you are only
permitted to access it through the accessor functions. This is so it's
possible to change the underlying implementation without breaking your
apps...
You *can* access the data directly, all the rqeuired structs are in the
include files (but not in the libpq-fe.h file - you need the full
includes). I would stronly advise you not to, though.
//Magnus
---------------------------------------------------------------------------------------
Wanadoo vous informe que cet e-mail a ete controle par l'anti-virus mail.
Aucun virus connu a ce jour par nos services n'a ete detecte.
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: retreive record set
2005-08-01 08:03 Re: retreive record set Magnus Hagander <mha@sollentuna.net>
@ 2005-08-01 11:32 ` Michael GUIARD <michael@nestor-tech.com>
1 sibling, 0 replies; 5+ messages in thread
From: Michael GUIARD @ 2005-08-01 11:32 UTC (permalink / raw)
To: pgsql-hackers-win32
I understood that I am not supposed to know how PGresult stores the data,
but I do not know how to fill my structure directly rather than to fill it
field by field using conversion.
I saw ecpg gives methods to do this (with descriptors), but I do not
understand all about it, and I think it is too complicated for my small
needs. Further, I do not want to change the implementation of postgreqsl
libpq.
So if I have no other choice than convert all result fields to fill my
structure I will do this ...
...any advices ?
thanks a lot
Mike
----- Original Message -----
From: "Magnus Hagander" <mha@sollentuna.net>
To: "Michael GUIARD" <m.guiard@nestor-tech.com>;
<pgsql-hackers-win32@postgresql.org>
Sent: Monday, August 01, 2005 10:03 AM
Subject: RE: [pgsql-hackers-win32] retreive record set
> Hi !
>
> I'd like to get my request results in a record set as a C
> structure using libpq.
> Is it possible or do I have to use ECPG only ?
>
> How PGresult pointer stores the results ?
> Actually I can convert all my result fields from PGresult to
> my C structure but I think also it is a little bit stupid if
> PGresult does its own conversion before ... no ?
You are not suppsed to know how PGresult stores the data, you are only
permitted to access it through the accessor functions. This is so it's
possible to change the underlying implementation without breaking your
apps...
You *can* access the data directly, all the rqeuired structs are in the
include files (but not in the libpq-fe.h file - you need the full
includes). I would stronly advise you not to, though.
//Magnus
---------------------------------------------------------------------------------------
Wanadoo vous informe que cet e-mail a ete controle par l'anti-virus mail.
Aucun virus connu a ce jour par nos services n'a ete detecte.
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: retreive record set
@ 2005-08-06 17:29 Magnus Hagander <mha@sollentuna.net>
0 siblings, 0 replies; 5+ messages in thread
From: Magnus Hagander @ 2005-08-06 17:29 UTC (permalink / raw)
To: Michael GUIARD <m.guiard@nestor-tech.com>; +Cc: pgsql-hackers-win32
> Hi Magnus,
>
> I understood that I am not supposed to know how PGresult
> stores the data, but I do not know how to fill my structure
> directly rather than to fill it field by field.
> I saw ecpg gives methods to do this (with descriptors), but I
> do not understand all about it, and I think it is too
> complicated for my small needs. Further, I do not want to
> change the implementation of postgreqsl libpq.
>
> So if I have no other choice than convert all result fields
> to fill my structure I will do this ...
>
> what is your advices about this ?
AFAIK there is no way in libpq to bind directly to variables. You'll
have to do a loop with pqgetvalue() to fill your struct.
//Magnus
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2005-08-06 17:29 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-08-01 07:38 retreive record set Michael GUIARD <michael@nestor-tech.com>
2005-08-01 08:03 Re: retreive record set Magnus Hagander <mha@sollentuna.net>
2005-08-01 08:41 ` Michael GUIARD <michael@nestor-tech.com>
2005-08-01 11:32 ` Michael GUIARD <michael@nestor-tech.com>
2005-08-06 17:29 Re: retreive record set Magnus Hagander <mha@sollentuna.net>
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