library/src/databases/bpdb/BP-DB.cc
// this is a utility version of BP_DBLookupTableColumnByName that takes a field in the form of table.column, and
// automatically splits it before calling BP_DBLookupTableColumnByName to attempt lookup.
this is a utility version of BP_DBLookupTableColumnByName that takes a field in the form of table.column, and
automatically splits it before calling BP_DBLookupTableColumnByName to attempt lookup.
this is a utility version of BP_DBLookupTableColumnByName that takes a field in the form of table . column and automatically splits it before calling BP_DBLookupTableColumnByName to attempt lookup .
P_BP_HASH_TABLE_KEYED_ENTRY BP_DBLookupTableColumnByJoinedFieldName(P_BPDB bpdb, char *joined_table_column_field)
{
	if(!bpdb)
		return NULL;
	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_BP_HASH_TABLE_KEYED_ENTRY column_lookup = BP_DBLookupTableColumnByName(bpdb, table_and_field[0], table_and_field[1]);
		BP_DestroyPointerArray((void **) table_and_field, 2);
		bpfree(table_and_field);
		return column_lookup;
	}
	BP_DestroyPointerArray((void **) table_and_field, 2);
	bpfree(table_and_field);
	return NULL;
}
P_BP_HASH_TABLE_KEYED_ENTRY BP_DBLookupTableColumnByJoinedFieldName ( P_BPDB bpdb , char * joined_table_column_field ) { if ( ! bpdb ) return NULL ; 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_BP_HASH_TABLE_KEYED_ENTRY column_lookup = BP_DBLookupTableColumnByName ( bpdb , table_and_field [ 0 ] , table_and_field [ 1 ] ) ; BP_DestroyPointerArray ( ( void * * ) table_and_field , 2 ) ; bpfree ( table_and_field ) ; return column_lookup ; } BP_DestroyPointerArray ( ( void * * ) table_and_field , 2 ) ; bpfree ( table_and_field ) ; return NULL ; }
this is a utility version of BP_DBLookupTableColumnByName that takes a field in the form of table.column, and
automatically splits it before calling BP_DBLookupTableColumnByName to attempt lookup.
this is a utility version of BP_DBLookupTableColumnByName that takes a field in the form of table . column and automatically splits it before calling BP_DBLookupTableColumnByName to attempt lookup .
// ensure we have a bpdb element // 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 indicating successNULL