Reset the cursor to start from the record 1

From: Igor Korot <ikorot01(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Reset the cursor to start from the record 1
Date: 2018-06-05 21:08:41
Message-ID: CA+FnnTznMxRSr98RdbVCXWnScSZOjyJ5HnJ5f3eBJRd20D0iMg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi, ALL,
I'd like to do the following:

[code]
PGresult res = PQprepare();
if( PQresultStatus( res ) != PGRES_COMMAND_OK )
{
// error handling
}
else
{
PGresult res1 = PQexecPrepared();
status = PQresultStatus( res1 );
if( status != PGRES_COMMAND_OK && status != PGRES_TUPLES_OK )
{
// error handling
}
else if( status == PGRES_TUPLES_OK )
{
for( int j = 0; j < PQntuples( res1 ); j++ )
{
// process the recordset
}
for( int j = 0; j < PQntuples( res1); j++ )
{
// process the same recordset again
}
}
}
[/code]

Is there a function which just reset the record pointer to 1, so I can reprocess
those records?

Thank you.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ozz Nixon 2018-06-05 21:34:39 RE: Code of Conduct plan
Previous Message Sven R. Kunze 2018-06-05 21:06:48 Re: Code of Conduct plan