library/src/databases/bpdb/BP-DBSQLSyntaxGenerators.cc
// Attempts to create a hash table within the select_info structure by associating
// potentially retrieved tables
Attempts to create a hash table within the select_info structure by associating
potentially retrieved tables
Attempts to create a hash table within the select_info structure by associating potentially retrieved tables
BP_ERROR_T BP_DBAddSelectResultReferences
(
	P_BPDB_SQLGEN        syngen,
	P_BPDB_SQLGEN_SELECT select_info
)
{
	if(!syngen)
		return ERR_FAILURE;
	if(!syngen->bpdb)
		return ERR_FAILURE;
	if(!select_info)
	{
		BP_DBAddErrorMsg(syngen->bpdb, "BP_DBAddSelectResultReferences was called with a NULL select_info parameter");
		return ERR_FAILURE;
	}
	if(!select_info->bind_results)
	{
		BP_DBAddErrorMsg(syngen->bpdb, "BP_DBAddSelectResultReferences was called with a NULL select_info->bind_results parameter");
		return ERR_FAILURE;
	}
	if(!select_info->bind_results_n)
	{
		BP_DBAddErrorMsg(syngen->bpdb, "BP_DBAddSelectResultReferences was called with a NULL select_info->bind_results_n count");
		return ERR_FAILURE;
	}
	size_t results_iter = 0;
	for
	(
		;
		results_iter < select_info->bind_results_n;
		results_iter++
	)
	{
		if(!select_info->field_names[results_iter])
			break;
		if
		(
			!BP_DBAddSelectResultReferenceToResultHashTable
			(
				syngen,
				select_info,
				select_info->field_names[results_iter],
				&select_info->bind_results[results_iter]
			)
		)
		{
			BP_DBAddErrorMsg(syngen->bpdb, "BP_DBAddSelectResultReferences attempted to call BP_DBAddSelectResultReferenceToResultHashTable but it failed.");
		}
	}
	return ERR_SUCCESS;
}
BP_ERROR_T BP_DBAddSelectResultReferences ( P_BPDB_SQLGEN syngen , P_BPDB_SQLGEN_SELECT select_info ) { if ( ! syngen ) return ERR_FAILURE ; if ( ! syngen -> bpdb ) return ERR_FAILURE ; if ( ! select_info ) { BP_DBAddErrorMsg ( syngen -> bpdb , " " ) ; return ERR_FAILURE ; } if ( ! select_info -> bind_results ) { BP_DBAddErrorMsg ( syngen -> bpdb , " " ) ; return ERR_FAILURE ; } if ( ! select_info -> bind_results_n ) { BP_DBAddErrorMsg ( syngen -> bpdb , " " ) ; return ERR_FAILURE ; } size_t results_iter = 0 ; for ( ; results_iter < select_info -> bind_results_n ; results_iter ++ ) { if ( ! select_info -> field_names [ results_iter ] ) break ; if ( ! BP_DBAddSelectResultReferenceToResultHashTable ( syngen , select_info , select_info -> field_names [ results_iter ] , & select_info -> bind_results [ results_iter ] ) ) { BP_DBAddErrorMsg ( syngen -> bpdb , " " ) ; } } return ERR_SUCCESS ; }
Attempts to create a hash table within the select_info structure by associating
potentially retrieved tables
Attempts to create a hash table within the select_info structure by associating potentially retrieved tables
// ensure we got a syntax generator and select info // return indicating failure if results don't exist // results iter // break if we've hit our cap // add result to hash table // return indicating success