[odb-users] How to transfer query results between methods.

Harrie9 harriev9 at gmail.com
Wed Dec 31 08:34:44 EST 2014


Hello,

I am having the next code fragment (method):

odb::result<relation> relationManager::getRelations()
{
  typedef odb::query<relation> query;
  typedef odb::result<relation> result;

  // Show action

  {
    transaction t (db->begin ());
    
    result r (db->query<relation> ());
    
    qDebug() << "Number of rows fetched" << r.size();    

    t.commit ();
    
    return r;
  }
  
}


This method fetches relation information from the database. It works
(the debug log show 34 row).

However the calling method show the number of rows is zero.

I expect the information is lost due to destruction of the r object.

My question is: how should I pass this information between method calls?

Greetings,
Harrie



More information about the odb-users mailing list