library/src/databases/bpdb/BP-DBSQLSyntaxGenerators.cc
// Get current result value by field name.  Returned result is
// standard mysql/mariadb bind structure.
Get current result value by field name.  Returned result is
standard mysql/mariadb bind structure.
Get current result value by field name . Returned result is standard mysql / mariadb bind structure .
MYSQL_BIND * BP_DBSGLookupResultByFieldName
(
	P_BPDB_SQLGEN        syngen,
	P_BPDB_SQLGEN_SELECT select_info,
	char               * field_name
)
{
	if(!syngen)
		return NULL;
	if(!syngen->bpdb)
		return NULL;
	if(!select_info)
	{
		BP_DBAddErrorMsg(syngen->bpdb, "BP_DBSGLookupResultByFieldName reports that it was run with a NULL select_info parameter.");
		return NULL;
	}
	if(!field_name)
	{
		BP_DBAddErrorMsg(syngen->bpdb, "BP_DBSGLookupResultByFieldName reports that it was run with a NULL field_name parameter.");
		return NULL;
	}
	BP_HASH_TABLE_ENTER_CRITICAL_SECTION(select_info->fetched_record_hreg);
	char * lookup_path[] = {field_name, "result_data_ptr", NULL};
	P_BP_HASH_TABLE_KEYED_ENTRY result_data_ptr_lookup = BP_HashRegLookupTableEntryByPath(select_info->fetched_record_hreg, (char **) &lookup_path);
	if(!result_data_ptr_lookup)
		BP_HASH_TABLE_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(select_info->fetched_record_hreg, NULL);
	MYSQL_BIND ** result_ptr_arr = (MYSQL_BIND **) result_data_ptr_lookup->data;
	MYSQL_BIND * ret_ptr = *result_ptr_arr;
	BP_HASH_TABLE_LEAVE_CRITICAL_SECTION(select_info->fetched_record_hreg);
	return ret_ptr;
}
MYSQL_BIND * BP_DBSGLookupResultByFieldName ( P_BPDB_SQLGEN syngen , P_BPDB_SQLGEN_SELECT select_info , char * field_name ) { if ( ! syngen ) return NULL ; if ( ! syngen -> bpdb ) return NULL ; if ( ! select_info ) { BP_DBAddErrorMsg ( syngen -> bpdb , " " ) ; return NULL ; } if ( ! field_name ) { BP_DBAddErrorMsg ( syngen -> bpdb , " " ) ; return NULL ; } BP_HASH_TABLE_ENTER_CRITICAL_SECTION ( select_info -> fetched_record_hreg ) ; char * lookup_path [ ] = { field_name , " " , NULL } ; P_BP_HASH_TABLE_KEYED_ENTRY result_data_ptr_lookup = BP_HashRegLookupTableEntryByPath ( select_info -> fetched_record_hreg , ( char * * ) & lookup_path ) ; if ( ! result_data_ptr_lookup ) BP_HASH_TABLE_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( select_info -> fetched_record_hreg , NULL ) ; MYSQL_BIND * * result_ptr_arr = ( MYSQL_BIND * * ) result_data_ptr_lookup -> data ; MYSQL_BIND * ret_ptr = * result_ptr_arr ; BP_HASH_TABLE_LEAVE_CRITICAL_SECTION ( select_info -> fetched_record_hreg ) ; return ret_ptr ; }
Get current result value by field name.
Get current result value by field name .
// run basic checks // lock system hash registry before modification // set lookup path // retrive table metadata by path // create result pointer array to deref from // set the return pointer here from deref // leave critical section // return the ret ptr