library/src/databases/bpdb/BP-DB.cc
// Attempt to lookup sql generator.
Attempt to lookup sql generator.
Attempt to lookup sql generator .
P_BPDB_SQLGEN BP_DBLookupSQLGeneratorByUUID(P_BPDB bpdb, char *uuid)
{
	if(!bpdb)
		return NULL;
	if(!uuid)
		return NULL;
	if(!BP_StringIsUUID(uuid))
		return NULL;
	if(!bpdb->sqlgen_reg)
		return NULL;
	if(!bpdb->sqlgen_reg->hive)
		return NULL;
	if(!bpdb->sqlgen_reg->total_data_entries_in_hive)
		return NULL;
	P_BP_HTKE sqlgen_entry = BP_HashRegLookupTableEntryByDataKeyIndexAndTablePathQuery(bpdb->sqlgen_reg, "/sql_generators", uuid);
	if(!sqlgen_entry)
		return NULL;
	if(!sqlgen_entry->data)
	{
		BP_DBAddErrorMsg(bpdb, "BP_DBLookupSQLGeneratorByUUID encountered a sqlgen_entry with a null data parameter.  This indicates a corruption was detected.");
		return NULL;
	}
	P_BPDB_SQLGEN sqlgen = (P_BPDB_SQLGEN) sqlgen_entry->data;
	return sqlgen;
}
P_BPDB_SQLGEN BP_DBLookupSQLGeneratorByUUID ( P_BPDB bpdb , char * uuid ) { if ( ! bpdb ) return NULL ; if ( ! uuid ) return NULL ; if ( ! BP_StringIsUUID ( uuid ) ) return NULL ; if ( ! bpdb -> sqlgen_reg ) return NULL ; if ( ! bpdb -> sqlgen_reg -> hive ) return NULL ; if ( ! bpdb -> sqlgen_reg -> total_data_entries_in_hive ) return NULL ; P_BP_HTKE sqlgen_entry = BP_HashRegLookupTableEntryByDataKeyIndexAndTablePathQuery ( bpdb -> sqlgen_reg , " " , uuid ) ; if ( ! sqlgen_entry ) return NULL ; if ( ! sqlgen_entry -> data ) { BP_DBAddErrorMsg ( bpdb , " " ) ; return NULL ; } P_BPDB_SQLGEN sqlgen = ( P_BPDB_SQLGEN ) sqlgen_entry -> data ; return sqlgen ; }
Attempt to lookup sql generator.
Attempt to lookup sql generator .
// run basic checks // run reg checks // if we have no lookup, exit with failure // if there is a lookup, but no data, we've found a corruption // set sqlgen data // return the sqlgenerator pointer so that it can be used