With the following code I always got that value on Oracle databases
SQLHSTMT hStmt = SQL_NULL_HANDLE;
SQLRETURN sret;
SQLLEN rowCount = 0;
const SQLHDBC conn = this->getConnection();
if (conn == NULL)
{
ret = false;
}
SQLAllocHandle(SQL_HANDLE_STMT, conn, &hStmt);
std::string metaTableName="meta_table";
sret=SQLTables( hStmt,
NULL, 0, /* no specific catalog */
NULL, 0, /* no specific schema */
(SQLCHAR *)metaTableName.c_str(), SQL_NTS,
NULL, 0); /* no specific type - table or view */
if ((sret != SQL_SUCCESS) && (sret != SQL_SUCCESS_WITH_INFO))
{
std::cout << "Problem retrieving " << metaTableName << " table from database!" << std::endl);
ret= false;
}
SQLRowCount(hStmt,&rowCount);
std::cout <<std::endl << "Rows: " <<rowCount<<std::endl ;
No error messages so no apparent cause of this behaviour
Using oracle libs:
oracle-instantclient11.2-odbc-11.2.0.1.0-1.x86_64
Any ideas about the reasons of such a behaviour?
SQLRowCount returns the number of rows affected by an UPDATE, INSERT, or DELETE statement; an SQL_ADD, SQL_UPDATE_BY_BOOKMARK, or SQL_DELETE_BY_BOOKMARK operation in SQLBulkOperations; or an SQL_UPDATE or SQL_DELETE operation in SQLSetPos – the value being returned when you are not doing any of these can be ignored.
More information about SQLRowCount can be found the the Micrsoft ODBC documentation