sqldata/sqlociapi.cpp
// Set version of the connected database
Set version of the connected database
Set version of the connected database
void SqlOciApi::SetVersion()
{
	const char *query = "SELECT banner FROM v$version WHERE banner LIKE 'Oracle%'";
	size_t col_count = 0;
	size_t allocated_rows = 0;
	int rows_fetched = 0; 
	size_t time_read = 0;
	SqlCol *cols = NULL;
	int rc = OpenCursor(query, 1, 0, &col_count, &allocated_rows, &rows_fetched, &cols, &time_read, true);
	if(rc >= 0)
	{
		int len = -1;
		if(cols != NULL && cols[0]._ind2 != NULL && cols[0]._len_ind2 != NULL && cols[0]._ind2[0] != -1)
			len = cols[0]._len_ind2[0];
		if(len != -1 && len < 127)
			_version.assign(cols[0]._data, (size_t)len);
	}
	CloseCursor();
}
void SqlOciApi :: SetVersion ( ) { const char * query = " " ; size_t col_count = 0 ; size_t allocated_rows = 0 ; int rows_fetched = 0 ; size_t time_read = 0 ; SqlCol * cols = NULL ; int rc = OpenCursor ( query , 1 , 0 , & col_count , & allocated_rows , & rows_fetched , & cols , & time_read , true ) ; if ( rc >= 0 ) { int len = -1 ; if ( cols != NULL && cols [ 0 ] . _ind2 != NULL && cols [ 0 ] . _len_ind2 != NULL && cols [ 0 ] . _ind2 [ 0 ] != -1 ) len = cols [ 0 ] . _len_ind2 [ 0 ] ; if ( len != -1 && len < 127 ) _version . assign ( cols [ 0 ] . _data , ( size_t ) len ) ; } CloseCursor ( ) ; }
Set version of the connected database
Set version of the connected database
// Oracle 11g R2 Express returns - Oracle Database 11g Express Edition Release 11.2.0.2.0 - Beta  // Open cursor  // Get the value