library/src/databases/bpdb/query_helpers/BP-DBSelectQueryHelpers.cc
// sets the primary selection table (not a joined table, must be set, must be valid)
sets the primary selection table (not a joined table, must be set, must be valid)
sets the primary selection table ( not a joined table must be set must be valid )
BP_ERROR_T BP_DBSyntaxGenSelectInfoSetPrimaryTable(P_BPDB_SQLGEN syngen, char *primary_select_table)
{
	if(!syngen)
		return ERR_SUCCESS;
	if(!primary_select_table)
		return ERR_SUCCESS;
	if(!BP_StringIsReasonableForTableNameDB(primary_select_table, bpstrlen(primary_select_table)))
		return ERR_FAILURE;
	if(!bpstrlen(primary_select_table))
		return ERR_FAILURE;
	if(!syngen->select_info)
		return ERR_FAILURE;
	if(!syngen->select_info->select_query_parts_hreg)
		return ERR_FAILURE;
	P_BP_HTKE query_parts_hreg_table = BP_HashRegLookupTableByPathQuery(syngen->select_info->select_query_parts_hreg, "/primary_select_from_table_name");
	if(!query_parts_hreg_table)
		return ERR_FAILURE;
	if(query_parts_hreg_table->data)
	{
		BP_HASH_ITER_OPEN((P_BP_HASH_TABLE_KEYED_ENTRY) query_parts_hreg_table->data, table_entry)
		{
			BP_HashRegDestroyEntry(syngen->select_info->select_query_parts_hreg, table_entry);
		}
		BP_HASH_ITER_CLOSE;
	}
	BP_ERROR_T ret_val = BP_HashRegAddDataToTableByPathQuery
	(
			syngen->select_info->select_query_parts_hreg,
			"/primary_select_from_table_name",
			primary_select_table,
			BP_HASH_TABLE_KEYED_ENTRY_TYPE_UTF8_STRING,
			primary_select_table,
			bpstrlen(primary_select_table)
	);
	return ret_val;
}
BP_ERROR_T BP_DBSyntaxGenSelectInfoSetPrimaryTable ( P_BPDB_SQLGEN syngen , char * primary_select_table ) { if ( ! syngen ) return ERR_SUCCESS ; if ( ! primary_select_table ) return ERR_SUCCESS ; if ( ! BP_StringIsReasonableForTableNameDB ( primary_select_table , bpstrlen ( primary_select_table ) ) ) return ERR_FAILURE ; if ( ! bpstrlen ( primary_select_table ) ) return ERR_FAILURE ; if ( ! syngen -> select_info ) return ERR_FAILURE ; if ( ! syngen -> select_info -> select_query_parts_hreg ) return ERR_FAILURE ; P_BP_HTKE query_parts_hreg_table = BP_HashRegLookupTableByPathQuery ( syngen -> select_info -> select_query_parts_hreg , " " ) ; if ( ! query_parts_hreg_table ) return ERR_FAILURE ; if ( query_parts_hreg_table -> data ) { BP_HASH_ITER_OPEN ( ( P_BP_HASH_TABLE_KEYED_ENTRY ) query_parts_hreg_table -> data , table_entry ) { BP_HashRegDestroyEntry ( syngen -> select_info -> select_query_parts_hreg , table_entry ) ; } BP_HASH_ITER_CLOSE ; } BP_ERROR_T ret_val = BP_HashRegAddDataToTableByPathQuery ( syngen -> select_info -> select_query_parts_hreg , " " , primary_select_table , BP_HASH_TABLE_KEYED_ENTRY_TYPE_UTF8_STRING , primary_select_table , bpstrlen ( primary_select_table ) ) ; return ret_val ; }
sets the primary selection table (not a joined table, must be set, must be valid)
sets the primary selection table ( not a joined table must be set must be valid )
// run basic checks // lookup table entry // clear the table if we have entries // iterate through entries within the table // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Add Entry after Clearing %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // attempt to add the value // return indicating data addition information