This discussion is archived
0 Replies Latest reply: Jul 27, 2012 7:29 AM by 952215 RSS

OCCI Statement class getCursor() returns an empty ResultSet?

952215 Newbie
Currently Being Moderated
I have a question regarding getCursor() method of Statement class. When I call Statement::getCursor() to retrieve a ResultSet when there's actually no data in database, it still returns me a valid ResultSet:"
oracle::occi::ResultSet* occiRS = _stmt->getCursor( columnIndex );

if( !occiRS || oracle::occi::ResultSet::END_OF_FETCH == occiRS->status() ) {
const std::string err = "No valid ResultSet found!";
throw Exception( err );
}

while( occiRS->next() )
{
int i = occiRS->getInt( 1 );
...
}
"

Above code doesn't throw any exception, which means ResultSet pointer is valid and its status shows DATA_AVAILABLE. But when I iterate through there's no data retrieved. Why would getCursor() return a valid ResultSet when there's actually no data? Is there any other ways to check whether there's valid data in ResultSet?

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points