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_DBLookupTableColumnMetadataFromColumnName
(
		P_BPDB bpdb,
		char *table_name,
		char *column_name
)
{
	if(!table_name)
		return NULL;
	if(!BP_StringIsReasonableForTableNameDB(table_name, bpstrlen(table_name)))
		return NULL;
	if(!BP_StringIsReasonableForColumnNameDB(column_name, bpstrlen(column_name)))
		return NULL;
	char * table_path[10];
	BP_ZERO_STACK(table_path);
	table_path[0] = "tables";
	table_path[1] = table_name;
	table_path[2] = "columns";
	table_path[3] = column_name;
	table_path[4] = BP_SQL_TABLE_COLUMN_METADATA_RESERVED_TABLE_NAME;
	table_path[5] = NULL;
	P_BP_HASH_TABLE_KEYED_ENTRY table_column_metadata_entry = (P_BP_HASH_TABLE_KEYED_ENTRY) BP_HashRegLookupTableEntryByPath(bpdb->system_hreg, (char **) &table_path);
	if(table_column_metadata_entry)
	if(table_column_metadata_entry->data)
		return (P_BPDB_SQL_TABLE_COLUMN_METADATA) table_column_metadata_entry->data;
	return NULL;
}
P_BPDB_SQL_TABLE_COLUMN_METADATA BP_DBLookupTableColumnMetadataFromColumnName ( P_BPDB bpdb , char * table_name , char * column_name ) { if ( ! table_name ) return NULL ; if ( ! BP_StringIsReasonableForTableNameDB ( table_name , bpstrlen ( table_name ) ) ) return NULL ; if ( ! BP_StringIsReasonableForColumnNameDB ( column_name , bpstrlen ( column_name ) ) ) return NULL ; char * table_path [ 10 ] ; BP_ZERO_STACK ( table_path ) ; table_path [ 0 ] = " " ; table_path [ 1 ] = table_name ; table_path [ 2 ] = " " ; table_path [ 3 ] = column_name ; table_path [ 4 ] = BP_SQL_TABLE_COLUMN_METADATA_RESERVED_TABLE_NAME ; table_path [ 5 ] = NULL ; P_BP_HASH_TABLE_KEYED_ENTRY table_column_metadata_entry = ( P_BP_HASH_TABLE_KEYED_ENTRY ) BP_HashRegLookupTableEntryByPath ( bpdb -> system_hreg , ( char * * ) & table_path ) ; if ( table_column_metadata_entry ) if ( table_column_metadata_entry -> data ) return ( P_BPDB_SQL_TABLE_COLUMN_METADATA ) table_column_metadata_entry -> data ; return NULL ; }
attempt to lookup table column metatadata by name
attempt to lookup table column metatadata by name
// ensure we have a table name // ensure name is reasonable for table // ensure string is reasonable for the column name // create table path stack // set table name for lookup // lookup table // return metadata if found ok // return NULL if lookup fails