public inbox for [email protected]
help / color / mirror / Atom feedFrom: Igor Korot <[email protected]>
To: Laurenz Albe <[email protected]>
Cc: pgsql-generallists.postgresql.org <[email protected]>
Subject: Re: libpq simple SELECT
Date: Wed, 17 Dec 2025 09:42:09 -0800
Message-ID: <CA+FnnTzWJtJwUjWBbm9naV9BUWdzTnQ8dKCtPOqaL0+1UOWcAQ@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CA+FnnTzP_9Mh9S7NJL5WFJmbOi2wxw4g=MdoUo-SuXEp3Fyg-g@mail.gmail.com>
<[email protected]>
Lauren’s,,
On Tue, Dec 16, 2025 at 11:34 PM Laurenz Albe <[email protected]>
wrote:
> On Tue, 2025-12-16 at 21:49 -0800, Igor Korot wrote:
> > I just tried the following code:
> >
> > [code]
> > std::wstring query1 = L"SELECT t.table_catalog AS catalog,
> > t.table_schema AS schema, t.table_name AS table, u.usename AS owner,
> > c.oid AS table_id FROM information_schema.tables t,
> > pg_catalog.pg_class c, pg_catalog.pg_user u WHERE t.table_name =
> > c.relname AND c.relowner = usesysid AND (t.table_type = 'BASE TABLE'
> > OR t.table_type = 'VIEW' OR t.table_type = 'LOCAL TEMPORARY') ORDER BY
> > table_name;";
> > res = PQexec( m_db, m_pimpl->m_myconv.to_bytes( query1.c_str()
> > ).c_str() );
> > for( int i = 0; i < PQntuples( res ); i++ )
> > {
> > some code handling the results
> > }
> > [/code]
> >
> > The loop is executed exactly 1 time.
> >
> > My question is - according to the comment above I don't have to use
> cursor,
> > but it looks like it's unavoidable?
>
> I see no cursor in your example...
That is my question.
The code shows cursor but the comment indicate that the cursor is not
required.
So do I have to use it? And if not - how to get the results?
Thank you.
>
> Yours,
> Laurenz Albe
>
view thread (4+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: libpq simple SELECT
In-Reply-To: <CA+FnnTzWJtJwUjWBbm9naV9BUWdzTnQ8dKCtPOqaL0+1UOWcAQ@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox