Пример #1
0
     # Checking for whitelisting
     if (NQ_WHITELIST_COLUMNS) {
         $whitelist = get_whitelist_columns($G_CONTROLLER_DBLINK, $G_APP_DATA['id'], $table_settings['id'], $G_TOKEN_DATA['id']);
         if (NQ_WHITELIST_EXISTENTIAL ? count($whitelist) > 0 : true) {
             $query->whitelist_columns($whitelist);
         }
     }
     # Excluding from the table
     $query->blacklist_columns($G_COLUMNS_EXCLUDED);
     # Adding our select columns
     $select_columns = $G_COLUMNS_SELECTED;
     if ($select_columns != '*' && !in_array($attached['column'], $select_columns)) {
         $select_columns[] = $attached['column'];
         $unset_link_id = true;
     }
     $query->add_select_columns($select_columns, false, $table_settings['alias'], true);
     # Where columns
     $query->add_where_columns([$attached['column'] => '[]' . implode(',', $column_values)], false, $table_settings['alias']);
     # Order by
     if ($G_ORDER_BY !== false) {
         $query->add_order_by($G_ORDER_BY, $G_ORDER_DESC, false, $table_settings['alias']);
     }
 }
 # Getting our results
 $query->set_table($partition_data['table_name'], false, false, $partition_data['database']);
 $select_query = $query->get_select_query($G_APP_DATA['db_attach_multi_limit'], false, COLUMNS_SORTED);
 $select_result = mysqli_multi_result_query($dblink, $select_query);
 # Saving the indices before processing (optimization)
 $acol = $attached['column'];
 $aname = $attached['name'];
 # Processing our results
Пример #2
0
while ($from_partition_data = mysqli_fetch_assoc($partition_results)) {
    # Connecting to the partition database
    $from_partition_data['dblink'] = mysqli_shared_connect($from_partition_data['host'], $from_partition_data['username'], $from_partition_data['password'], $G_SHARED_DBLINKS);
    # We need a new query class on first partition
    if ($from_query == false) {
        # Creating our new parser
        $from_query = new MySQLParser($from_partition_data['dblink'], $from_partition_data['table_name'], $from_partition_data['database']);
        # Checking for whitelisting
        if (NQ_WHITELIST_COLUMNS) {
            $whitelist = get_whitelist_columns($G_CONTROLLER_DBLINK, $G_APP_DATA['id'], $G_FROM_TABLE_SETTINGS['id'], $G_TOKEN_PRIVILEGE_DATA['id']);
            if (NQ_WHITELIST_EXISTENTIAL ? count($whitelist) > 0 : true) {
                $from_query->whitelist_columns($whitelist);
            }
        }
        # Adding our select columns
        $from_query->add_select_columns($G_FROM_TABLE_COLUMNS);
        # Where columns
        $from_query->add_where_columns($_CGET);
        # Order by
        if (isset($_CGET['order'])) {
            $order_sort = isset($_CGET['ordersort']) ? explode(',', $_CGET['ordersort']) : [];
            $from_query->add_order_by(explode(',', $_CGET['order']), $order_sort);
        }
        # Group by
        if (isset($_CGET['group'])) {
            $from_query->add_group_by(explode(',', $_CGET['group']));
        }
        # Where columns
        $from_query->add_where_columns($_CGET);
        # Overwriting with our global session where values
        if (isset($G_TOKEN_SESSION_DATA->{NQ_SESSION_GROUP}->global->{$G_FROM_TABLE_SETTINGS['alias']})) {
Пример #3
0
 # Connecting to the partition database
 $from_partition_data['dblink'] = mysqli_shared_connect($from_partition_data['host'], $from_partition_data['username'], $from_partition_data['password'], $G_SHARED_DBLINKS);
 # We need a new query class on first partition
 if ($from_query == false) {
     # Creating our new parser
     $from_query = new MySQLParser($from_partition_data['dblink'], $from_partition_data['table_name'], $from_partition_data['database']);
     # Checking for whitelisting
     if (NQ_WHITELIST_COLUMNS) {
         $whitelist = get_whitelist_columns($G_CONTROLLER_DBLINK, $G_APP_DATA['id'], $G_FROM_TABLE_SETTINGS['id'], $G_TOKEN_PRIVILEGE_DATA['id']);
         if (NQ_WHITELIST_EXISTENTIAL ? count($whitelist) > 0 : true) {
             $from_query->whitelist_columns($whitelist);
         }
     }
     # Adding our select columns
     foreach ($G_FROM_TABLE_COLUMNS as $col) {
         $from_query->add_select_columns($col);
     }
     # Where columns
     $from_query->add_where_columns($_CGET);
     # Order by
     if (isset($_CGET['order'])) {
         $order_sort = isset($_CGET['ordersort']) ? explode(',', $_CGET['ordersort']) : [];
         $from_query->add_order_by(explode(',', $_CGET['order']), $order_sort);
     }
     # Group by
     if (isset($_CGET['group'])) {
         $from_query->add_group_by(explode(',', $_CGET['group']));
     }
     # Where columns
     $from_query->add_where_columns($_CGET);
     # Overwriting with our global session where values