library/src/databases/bpdb/BP-DB.cc
// attempt to lookup table column metatadata by name
attempt to lookup table column metatadata by name
attempt to lookup table column metatadata by name
P_BPDB_SQL_TABLE_COLUMN_METADATA BP_DBLookupTableColumnMetadataFromJoinedFieldName(P_BPDB bpdb, char *joined_table_column_field)
{
	BP_BOOL field_is_ok = BP_StringIsReasonableForSelectFieldSpecifierDB(joined_table_column_field, bpstrlen(joined_table_column_field));
	if(field_is_ok == BP_FALSE)
		return NULL;
	char ** table_and_field = BP_SplitBuffer(joined_table_column_field, ".");
	if(!table_and_field)
		return NULL;
	if(table_and_field[0] && table_and_field[1])
	{
		P_BPDB_SQL_TABLE_COLUMN_METADATA column_metadata_lookup = BP_DBLookupTableColumnMetadataFromColumnName(bpdb, table_and_field[0], table_and_field[1]);
		BP_DestroyPointerArray((void **) table_and_field, 2);
		bpfree(table_and_field);
		return column_metadata_lookup;
	}
	BP_DestroyPointerArray((void **) table_and_field, 2);
	bpfree(table_and_field);
	return NULL;
}
P_BPDB_SQL_TABLE_COLUMN_METADATA BP_DBLookupTableColumnMetadataFromJoinedFieldName ( P_BPDB bpdb , char * joined_table_column_field ) { BP_BOOL field_is_ok = BP_StringIsReasonableForSelectFieldSpecifierDB ( joined_table_column_field , bpstrlen ( joined_table_column_field ) ) ; if ( field_is_ok == BP_FALSE ) return NULL ; char * * table_and_field = BP_SplitBuffer ( joined_table_column_field , " " ) ; if ( ! table_and_field ) return NULL ; if ( table_and_field [ 0 ] && table_and_field [ 1 ] ) { P_BPDB_SQL_TABLE_COLUMN_METADATA column_metadata_lookup = BP_DBLookupTableColumnMetadataFromColumnName ( bpdb , table_and_field [ 0 ] , table_and_field [ 1 ] ) ; BP_DestroyPointerArray ( ( void * * ) table_and_field , 2 ) ; bpfree ( table_and_field ) ; return column_metadata_lookup ; } BP_DestroyPointerArray ( ( void * * ) table_and_field , 2 ) ; bpfree ( table_and_field ) ; return NULL ; }
attempt to lookup table column metatadata by name
attempt to lookup table column metatadata by name
// check if the string is reasonable // if the field isn't ok, exit indicating failure // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Separate Field from Table and Check %%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // create table and field // ensure we have table and column // attempt to retrieve column data // destroy the pointer array // destroy the table and field entry // return the looked up data (or null if lookup fails) // destroy the pointer array // destroy the table and field entry // return NULL if the lookup fails