sqldata/sqlmysqlapi.cpp
// Execute SHOW WARNINGS and log results
Execute SHOW WARNINGS and log results
Execute SHOW WARNINGS and log results
void SqlMysqlApi::ShowWarnings(const char *prefix)
{
	size_t col_count = 0;
	size_t allocated_rows = 0;
	int rows_fetched = 0; 
	SqlCol *cols = NULL;
	int rc = OpenCursor("SHOW WARNINGS", 100, 0, &col_count, &allocated_rows, &rows_fetched, &cols, NULL, true);
	if(rc >= 0 && rows_fetched > 0)
	{
		LOG_P("\n    SHOW WARNINGS: %s", prefix);
		for(int i = 0; i < rows_fetched; i++)
		{
			std::string warn = "\n      ";
			SQLLEN len = (SQLLEN)cols[0].ind[i];
			if(len != -1)
			{
				warn += cols[0]._name;
				warn += ": ";
				warn.append(cols[0]._data + cols[0]._fetch_len * i, (size_t)len);
				warn += "; ";
			}
			len = (SQLLEN)cols[1].ind[i];
			if(len != -1)
			{
				warn += cols[1]._name;
				warn += ": ";
				warn.append(cols[1]._data + cols[1]._fetch_len * i, (size_t)len);
				warn += "; ";
			}
			len = (SQLLEN)cols[2].ind[i];
			if(len != -1)
			{
				warn += cols[2]._name;
				warn += ": ";
				warn.append(cols[2]._data + cols[2]._fetch_len * i, (size_t)len);
			}
			LOG(warn.c_str());
		}
	}
	CloseCursor();
}
void SqlMysqlApi :: ShowWarnings ( const char * prefix ) { size_t col_count = 0 ; size_t allocated_rows = 0 ; int rows_fetched = 0 ; SqlCol * cols = NULL ; int rc = OpenCursor ( " " , 100 , 0 , & col_count , & allocated_rows , & rows_fetched , & cols , NULL , true ) ; if ( rc >= 0 && rows_fetched > 0 ) { LOG_P ( " \n " , prefix ) ; for ( int i = 0 ; i < rows_fetched ; i ++ ) { std :: string warn = " \n " ; SQLLEN len = ( SQLLEN ) cols [ 0 ] . ind [ i ] ; if ( len != -1 ) { warn += cols [ 0 ] . _name ; warn += " " ; warn . append ( cols [ 0 ] . _data + cols [ 0 ] . _fetch_len * i , ( size_t ) len ) ; warn += " " ; } len = ( SQLLEN ) cols [ 1 ] . ind [ i ] ; if ( len != -1 ) { warn += cols [ 1 ] . _name ; warn += " " ; warn . append ( cols [ 1 ] . _data + cols [ 1 ] . _fetch_len * i , ( size_t ) len ) ; warn += " " ; } len = ( SQLLEN ) cols [ 2 ] . ind [ i ] ; if ( len != -1 ) { warn += cols [ 2 ] . _name ; warn += " " ; warn . append ( cols [ 2 ] . _data + cols [ 2 ] . _fetch_len * i , ( size_t ) len ) ; } LOG ( warn . c_str ( ) ) ; } } CloseCursor ( ) ; }
Execute SHOW WARNINGS and log results
Execute SHOW WARNINGS and log results
// Level // Code // Code