Hello!

I am facing a problem with a firebird SELECT. When I try to count the number of rows returned it returns the value -2

Does anyone know why?

Qt Code:
  1. bool queryRetornoDB::retornaValidadeUsuarioSistema()
  2. {
  3. bool retorno;
  4. //retorno = true;
  5. retorno = false;
  6.  
  7. QSqlQuery resultadoQuery;
  8.  
  9. QString query = "SELECT * FROM usuario u";
  10.  
  11. resultadoQuery.exec(query);
  12.  
  13. int resultadoQueryNumLinhas = this->retornaQueryNumLinhas(resultadoQuery);
  14.  
  15. qDebug() << "Valida usuário: ";
  16. qDebug() << resultadoQueryNumLinhas;
  17. }
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. int queryRetornoDB::retornaQueryNumLinhas(QSqlQuery query)
  2. {
  3. query.last();
  4. int linhas = query.at() + 1;
  5. return linhas;
  6. }
To copy to clipboard, switch view to plain text mode 

Thanks