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?
bool queryRetornoDB::retornaValidadeUsuarioSistema()
{
bool retorno;
//retorno = true;
retorno = false;
QString query
= "SELECT * FROM usuario u";
resultadoQuery.exec(query);
int resultadoQueryNumLinhas = this->retornaQueryNumLinhas(resultadoQuery);
qDebug() << "Valida usuário: ";
qDebug() << resultadoQueryNumLinhas;
}
bool queryRetornoDB::retornaValidadeUsuarioSistema()
{
bool retorno;
//retorno = true;
retorno = false;
QSqlQuery resultadoQuery;
QString query = "SELECT * FROM usuario u";
resultadoQuery.exec(query);
int resultadoQueryNumLinhas = this->retornaQueryNumLinhas(resultadoQuery);
qDebug() << "Valida usuário: ";
qDebug() << resultadoQueryNumLinhas;
}
To copy to clipboard, switch view to plain text mode
int queryRetornoDB
::retornaQueryNumLinhas(QSqlQuery query
) {
query.last();
int linhas = query.at() + 1;
return linhas;
}
int queryRetornoDB::retornaQueryNumLinhas(QSqlQuery query)
{
query.last();
int linhas = query.at() + 1;
return linhas;
}
To copy to clipboard, switch view to plain text mode
Thanks
Bookmarks