sqldata/sqldb.cpp
// Get the length of column data in the buffer
Get the length of column data in the buffer
Get the length of column data in the buffer
int SqlDb::GetColumnDataLen(SqlCol *cols, int row, int column, int db_type, SqlApiBase *db_api)
{
	if(cols == NULL || db_api == NULL)
		return -1;
	size_t len = (size_t)-1;
	if(db_type == SQLDATA_ORACLE)
	{
		if(cols[column]._ind2 == NULL || cols[column]._len_ind2 == NULL)
			return -1;
		if(cols[column]._ind2[row] == -1)
			len = (size_t)-1;
		else
		if(cols[column]._native_dt == SQLT_CLOB || cols[column]._native_dt == SQLT_BLOB)
		{
			int rc = db_api->GetLobLength((size_t)row, (size_t)column, &len);
			if(rc == -1)
				return -1;
		}
		else
			len = (size_t)cols[column]._len_ind2[row];
	}
	else
	if(db_type == SQLDATA_SYBASE)
	{
		if(cols[column]._ind2 == NULL || cols[column]._len_ind4 == NULL)
			return -1;
		if(cols[column]._ind2[row] == -1)
			len = (size_t)-1;
		else
			len = (size_t)cols[column]._len_ind4[row];
	}
	else
	if(db_type == SQLDATA_MYSQL)
	{
		if(cols[column].ind != NULL && cols[column].ind[row] != -1)
			len = cols[column].ind[row];
	}
	else
	if(db_type == SQLDATA_POSTGRESQL)
	{
		if(cols[column].ind != NULL && cols[column].ind[row] != -1)
			len = cols[column].ind[row];
	}
	else
	if(db_type == SQLDATA_SQL_SERVER || db_type == SQLDATA_INFORMIX)
	{
		if(cols[column].ind != NULL && cols[column].ind[row] != -1)
			len = cols[column].ind[row];
	}
	return (int)len;
}
int SqlDb :: GetColumnDataLen ( SqlCol * cols , int row , int column , int db_type , SqlApiBase * db_api ) { if ( cols == NULL || db_api == NULL ) return -1 ; size_t len = ( size_t ) -1 ; if ( db_type == SQLDATA_ORACLE ) { if ( cols [ column ] . _ind2 == NULL || cols [ column ] . _len_ind2 == NULL ) return -1 ; if ( cols [ column ] . _ind2 [ row ] == -1 ) len = ( size_t ) -1 ; else if ( cols [ column ] . _native_dt == SQLT_CLOB || cols [ column ] . _native_dt == SQLT_BLOB ) { int rc = db_api -> GetLobLength ( ( size_t ) row , ( size_t ) column , & len ) ; if ( rc == -1 ) return -1 ; } else len = ( size_t ) cols [ column ] . _len_ind2 [ row ] ; } else if ( db_type == SQLDATA_SYBASE ) { if ( cols [ column ] . _ind2 == NULL || cols [ column ] . _len_ind4 == NULL ) return -1 ; if ( cols [ column ] . _ind2 [ row ] == -1 ) len = ( size_t ) -1 ; else len = ( size_t ) cols [ column ] . _len_ind4 [ row ] ; } else if ( db_type == SQLDATA_MYSQL ) { if ( cols [ column ] . ind != NULL && cols [ column ] . ind [ row ] != -1 ) len = cols [ column ] . ind [ row ] ; } else if ( db_type == SQLDATA_POSTGRESQL ) { if ( cols [ column ] . ind != NULL && cols [ column ] . ind [ row ] != -1 ) len = cols [ column ] . ind [ row ] ; } else if ( db_type == SQLDATA_SQL_SERVER || db_type == SQLDATA_INFORMIX ) { if ( cols [ column ] . ind != NULL && cols [ column ] . ind [ row ] != -1 ) len = cols [ column ] . ind [ row ] ; } return ( int ) len ; }
Get the length of column data in the buffer
Get the length of column data in the buffer
// Check for NULL // Get length for the CLOB or BLOB // LOB contains data // Get the length for non-NULL non-LOB value // Check for NULL