library/src/databases/bpdb/query_helpers/BP-DBSelectQueryHelpers.cc
// if no select info structure is passed into the select-from
if no select info structure is passed into the select-from
if no select info structure is passed into the select - from
BP_ERROR_T BP_DBSyntaxGenSelectInfoStructFromInternalRegistries(P_BPDB_SQLGEN syngen)
{
	if(!syngen)
		return ERR_FAILURE;
	if(!syngen->select_info)
		return ERR_FAILURE;
	P_BP_HTKE field_names                    = BP_HashRegLookupTableByPathQuery(syngen->select_info->select_query_parts_hreg, "/field_names");
	P_BP_HTKE primary_select_from_table_name = BP_HashRegLookupTableByPathQuery(syngen->select_info->select_query_parts_hreg, "/primary_select_from_table_name");
	P_BP_HTKE where_clauses                  = BP_HashRegLookupTableByPathQuery(syngen->select_info->select_query_parts_hreg, "/where_clauses");
	P_BP_HTKE group_by_clauses               = BP_HashRegLookupTableByPathQuery(syngen->select_info->select_query_parts_hreg, "/group_by_clauses");
	P_BP_HTKE limit_clause                   = BP_HashRegLookupTableByPathQuery(syngen->select_info->select_query_parts_hreg, "/limit_clause");
	P_BP_HTKE order_clause                   = BP_HashRegLookupTableByPathQuery(syngen->select_info->select_query_parts_hreg, "/order_clause");
	printf("\n [+] Getting here woo!");
	printf("\n\t field_names: %p", field_names);
	printf("\n\t primary_select_from_table_name: %p", primary_select_from_table_name);
	printf("\n\t where_clauses: %p", where_clauses);
	printf("\n\t group_by_clauses: %p", group_by_clauses);
	printf("\n\t limit_clause: %p", limit_clause);
	printf("\n\t order_clause: %p", limit_clause);
	P_BPDB_SQLGEN_SELECT tmp_select_info = NULL;
	P_BP_LINKL select_name_builder_linkl = BP_CreateLinkL(".", BP_TRUE);
	if(field_names)
	{
		if(field_names->type == BP_HASH_TABLE_KEYED_ENTRY_TYPE_NAMED_HASH_TABLE)
		{
			BP_HASH_ITER_OPEN((P_BP_HTKE) field_names->data, field_name)
			{
				tq_strdup(select_name_builder_linkl, (char *) field_name->data, BPLN);
			}
			BP_HASH_ITER_CLOSE;
		}
	}
	char ** field_names_ptr_arr = (char **) BP_LinkLToBPCallocPointerArray(select_name_builder_linkl);
	return ERR_SUCCESS;
}
BP_ERROR_T BP_DBSyntaxGenSelectInfoStructFromInternalRegistries ( P_BPDB_SQLGEN syngen ) { if ( ! syngen ) return ERR_FAILURE ; if ( ! syngen -> select_info ) return ERR_FAILURE ; P_BP_HTKE field_names = BP_HashRegLookupTableByPathQuery ( syngen -> select_info -> select_query_parts_hreg , " " ) ; P_BP_HTKE primary_select_from_table_name = BP_HashRegLookupTableByPathQuery ( syngen -> select_info -> select_query_parts_hreg , " " ) ; P_BP_HTKE where_clauses = BP_HashRegLookupTableByPathQuery ( syngen -> select_info -> select_query_parts_hreg , " " ) ; P_BP_HTKE group_by_clauses = BP_HashRegLookupTableByPathQuery ( syngen -> select_info -> select_query_parts_hreg , " " ) ; P_BP_HTKE limit_clause = BP_HashRegLookupTableByPathQuery ( syngen -> select_info -> select_query_parts_hreg , " " ) ; P_BP_HTKE order_clause = BP_HashRegLookupTableByPathQuery ( syngen -> select_info -> select_query_parts_hreg , " " ) ; printf ( " \n " ) ; printf ( " \n \t " , field_names ) ; printf ( " \n \t " , primary_select_from_table_name ) ; printf ( " \n \t " , where_clauses ) ; printf ( " \n \t " , group_by_clauses ) ; printf ( " \n \t " , limit_clause ) ; printf ( " \n \t " , limit_clause ) ; P_BPDB_SQLGEN_SELECT tmp_select_info = NULL ; P_BP_LINKL select_name_builder_linkl = BP_CreateLinkL ( " " , BP_TRUE ) ; if ( field_names ) { if ( field_names -> type == BP_HASH_TABLE_KEYED_ENTRY_TYPE_NAMED_HASH_TABLE ) { BP_HASH_ITER_OPEN ( ( P_BP_HTKE ) field_names -> data , field_name ) { tq_strdup ( select_name_builder_linkl , ( char * ) field_name -> data , BPLN ) ; } BP_HASH_ITER_CLOSE ; } } char * * field_names_ptr_arr = ( char * * ) BP_LinkLToBPCallocPointerArray ( select_name_builder_linkl ) ; return ERR_SUCCESS ; }
if no select info structure is passed into the select-from
if no select info structure is passed into the select - from
// set syngen information // retrieve query parts // select info // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Process Field Names %%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // create select name builder inkl // field names // iterate trhough field names // add to tailqueue // convert tailqueue to field names // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Process Primary Table Name %%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*
	BP_HASH_ITER_OPEN()
	{

	}
	BP_HASH_ITER_CLOSE;
	*/ // return indicating success