Query Dynamo DB table loading all settings from a single item.

@param DynamoDbClient $dynamodb  DB connection
@param array          $options
@return array|mixed
356847
protected function loadDataFromItem(DynamoDbClient $dynamodb, array $options)
    {
        $field = $options['key_field'] ?? 'key';
        expect_type($field, 'string', \BadMethodCallException::class);

        $key = $options['key_value'];
        expect_type($key, 'string', \BadMethodCallException::class);

        try {
            $result = $dynamodb->getItem([
                'TableName' => $options["table"],
                'Key' => [
                    $field => ['S' => $key]
                ]
            ]);
            
            if (!isset($result['Item']) && !(bool)($options['optional'] ?? false)) {
                throw new LoadException("Failed to load '{$options['key_value']}' configuration from DynamoDB: "
                    . "No item found with $field '$key'");
            }
            
            $item = isset($result['Item']) ? $result['Item'] : null;
        } catch (DynamoDbException $e) {
            if (!(bool)($options['optional'] ?? false)) {
                throw new LoadException("Failed to load '{$options['key_value']}' configuration from DynamoDB", 0, $e);
            }
        }

        if (!isset($item)) {
            return [];
        }
        
        $marshaler = new Marshaler();
        $data = $marshaler->unmarshalItem($item);
        
        return $this->mapData($data, $options);
    }
476394
public static function getConnection(array $options): Client
    {
        if (self::$connection === null) {
            $builder = new ClientBuilder([
                'cw.endpoint_uri' => $options['environment'] == 0 ? CodesWholesale::SANDBOX_ENDPOINT : CodesWholesale::LIVE_ENDPOINT,
                'cw.client_id' => $options['environment'] == 0 ? self::SANDBOX_CLIENT_ID : $options['client_id'],
                'cw.client_secret' => $options['environment'] == 0 ? self::SANDBOX_CLIENT_SECRET : $options['client_secret'],
                'cw.token_storage' => isset($options['db']) && $options['db'] instanceof \PDO ? new TokenDatabaseStorage($options['db'], $options['prefix']) : new TokenSessionStorage(),
                'cw.client.headers' => [
                    'User-Agent' => $options['client_headers'],
                ],
                'cw.signature' => isset($options['signature']) ? $options['signature'] : self::SANDBOX_SIGNATURE
            ]);

            self::$connection = $builder->build();
       }
        
        return self::$connection;
    }
1205493
public function getCollection($id, array $options = [])
    {
        $this->setOptions($options);
        $coll = new Collection($this->client, $this->database);
        $coll->setHeaders($this->getHeaders());
        $rs = $coll->get($id);
        $this->checkResponse($rs);
        unset($rs['_curl_info']);

        return $rs;
    }
246184
public function load($source, $options = [])
    {
        $defaults = ['wrap' => false];
        $options += $defaults;

        $wrap = $options['wrap'];

        if ($wrap) {
            $source = "<?php {$source}?>";
        }

        $this->_data = [];
        $this->_current = 0;
        foreach (token_get_all($source) as $token) {
            $this->_data[] = is_array($token) ? $token : [$token, $token, null];
        }
        if ($wrap) {
            $this->_data = array_slice($this->_data, 1, count($this->_data) - 2);
        }
        $this->_count = count($this->_data);
    }
538920
public function runQuery($cql, array $options = [])
    {
        $pageInfo = $this->extractPaginationInfo($cql);
        $statement = $this->prepareStatement($cql);
        $rows = $this->executeStatement($statement, $options);

        return static::rowsToArray($rows, $pageInfo);
    }
1003729
public function getForDynamoDB()
    {
        $parameters = array();

        // Items to put
        foreach ($this->itemsToPut as $item) {
            /** @var $item \Riverline\DynamoDB\Item */
            if (!isset($parameters[$item->getTable()])) {
                $parameters[$item->getTable()] = array();
            }

            $attributes = array();
            foreach ($item as $name => $attribute) {
                /** @var $attribute \Riverline\DynamoDB\Attribute */
                if ("" !== $attribute->getValue()) {
                    // Only not empty string
                    $attributes[$name] = $attribute->getForDynamoDB();
                }
            }

            $parameters[$item->getTable()][] = array(
                'PutRequest' => array('Item' => $attributes)
            );
        }

        // Keys to delete
        foreach ($this->keysToDelete as $key) {
            list ($table, $hash, $range) = $key;

            if (!isset($parameters[$table])) {
                $parameters[$table] = array();
            }

            $hash = new Attribute($hash);
            $key = array(
                'HashKeyElement' => $hash->getForDynamoDB()
            );

            if (!is_null($range)) {
                $range = new Attribute($range);
                $key['RangeKeyElement'] = $range->getForDynamoDB();
            }

            $parameters[$table][] = array(
                'DeleteRequest' => array('Key' => $key)
            );
        }

        return array('RequestItems' => $parameters);
    }
1207005
public function query($collectionName, $options = [])
    {
        $databaseName = $this->databaseName === null ? $this->db->defaultDatabaseName : $this->databaseName;

        $token = $this->log(
            'find',
            array_merge(
                [
                    'ns' => $databaseName . '.' . $collectionName,
                    'filter' => $this->document,
                ],
                $options
            ),
            __METHOD__
        );

        $readConcern = $this->getReadConcern();
        if ($readConcern !== null) {
            $options['readConcern'] = $readConcern;
        }

        try {
            $this->beginProfile($token, __METHOD__);

            $query = new \MongoDB\Driver\Query($this->document, $options);
            $this->db->open();
            $cursor = $this->db->manager->executeQuery($databaseName . '.' . $collectionName, $query, $this->getReadPreference());
            $cursor->setTypeMap($this->db->typeMap);

            $this->endProfile($token, __METHOD__);
        } catch (RuntimeException $e) {
            $this->endProfile($token, __METHOD__);
            throw new Exception($e->getMessage(), $e->getCode(), $e);
        }

        return $cursor;
    }
260716
public function fetchKeyValues($fields=null, $options=null)
    {
        $this->getQuery()->type('select');
        if ($options) {
            $this->getQuery()->set(static::formatQueryOptions($options));
        }
        if ($fields) {
            $this->getQuery()->remove('fields')->set('fields', $fields);
        }
        $fields = StringHelper::explode(',', $this->getQuery()['fields']);
        $fields = array_map(function ($v) {
            $vs = preg_split('/(as)?\s+/', trim($v));
            return $vs[count($vs)-1];
        }, $fields);
        
        $rows = $this->query();
        
        if ($rows) foreach ($rows as $v) {
            if (count($fields) > 2) {
                $result[$v[$fields[0]]][$v[$fields[1]]] = $v[$fields[2]];
            } else {
                $result[$v[$fields[0]]] = $v[$fields[1]];
            }
        }
        
        return $rows ? $result : null;
    }
331947
public function search($query = '', $options = null)
    {
        $this->setOptionsAndQuery($options, $query);

        $query = $this->getQuery();
        $path = $this->getPath();

        $params = $this->getOptions();

        // Send scroll_id via raw HTTP body to handle cases of very large (> 4kb) ids.
        if ('_search/scroll' == $path) {
            $data = [self::OPTION_SCROLL_ID => $params[self::OPTION_SCROLL_ID]];
            unset($params[self::OPTION_SCROLL_ID]);
        } else {
            $data = $query->toArray();
        }

        $response = $this->getClient()->request(
            $path,
            Request::GET,
            $data,
            $params
        );

        return $this->_builder->buildResultSet($response, $query);
    }
201266
function all(options, cb) {
  var q
    , page = Number(options.page) || 1
    , limit = Number(options.limit) || conf.objects_by_page
    , offset = (page - 1) * limit;

  count(function(err, count) {
    if(err) { return cb(err); }

    q = select('LEFT JOIN');
    q += ' LIMIT ' + limit + ' OFFSET ' + offset;

    db.getClient(function(err, client, done) {
      client.query(q, function(err, r) {
        if(err) {
          cb(err);
          done(err);
        } else {
          cb(null, {
            rows: r.rows,
            count: count,
            limit: limit,
            offset: offset,
            page: page
          });
          done();
        }
      });
    });
  });
}
1174381
public function toDynamoDbQuery(
        $columns = [],
        $limit = DynamoDbQueryBuilder::MAX_LIMIT
    ) {
        $this->applyScopes();

        $this->resetExpressions();

        $op = 'Scan';
        $queryBuilder = DynamoDb::table($this->model->getTable());

        if (! empty($this->wheres)) {
            $analyzer = $this->getConditionAnalyzer();

            if ($keyConditions = $analyzer->keyConditions()) {
                $op = 'Query';
                $queryBuilder->setKeyConditionExpression($this->keyConditionExpression->parse($keyConditions));
            }

            if ($filterConditions = $analyzer->filterConditions()) {
                $queryBuilder->setFilterExpression($this->filterExpression->parse($filterConditions));
            }

            if ($index = $analyzer->index()) {
                $queryBuilder->setIndexName($index->name);
            }
        }

        if ($this->index) {
            // If user specifies the index manually, respect that
            $queryBuilder->setIndexName($this->index);
        }

        if ($limit !== static::MAX_LIMIT) {
            $queryBuilder->setLimit($limit);
        }

        if (!empty($columns)) {
            // Either we try to get the count or specific columns
            if ($columns == ['count(*)']) {
                $queryBuilder->setSelect('COUNT');
            } else {
                $queryBuilder->setProjectionExpression($this->projectionExpression->parse($columns));
            }
        }

        if (!empty($this->lastEvaluatedKey)) {
            $queryBuilder->setExclusiveStartKey($this->lastEvaluatedKey);
        }

        $queryBuilder
            ->setExpressionAttributeNames($this->expressionAttributeNames->all())
            ->setExpressionAttributeValues($this->expressionAttributeValues->all());

        $raw = new RawDynamoDbQuery($op, $queryBuilder->prepare($this->client)->query);

        if ($this->decorator) {
            call_user_func($this->decorator, $raw);
        }

        return $raw;
    }
325531
public function query($sql, $params = [], $options = [])
    {
        $conn = $this->getConn(!empty($options['forceMaster']) ? true : false);

        $stmt = $this->prepare($conn, $sql, $params);

        $rows = $stmt->fetchAll(\PDO::FETCH_ASSOC);
        if ($rows === false) {
            $this->throwException();
        }
        if (!empty($options['getRow'])) {
            $rows = isset($rows[0]) ? $rows[0] : null;
        }
        return $rows;
    }
99540
public function create(DynamoDbClient $client, string $tableName): void
    {
        try {
            $client->describeTable(['TableName' => $tableName]);
            return;
        } catch (DynamoDbException $e) {
            // table doesn't exist, create it below
        }

        try {
            $client->createTable([
                'TableName'               => $tableName,
                'AttributeDefinitions'    => [
                    ['AttributeName' => self::HASH_KEY_NAME, 'AttributeType' => 'S'],
                ],
                'KeySchema'               => [
                    ['AttributeName' => self::HASH_KEY_NAME, 'KeyType' => 'HASH'],
                ],
                'TimeToLiveSpecification' => [
                    'Enabled'       => true,
                    'AttributeName' => self::TTL_KEY_NAME,
                ],
                'ProvisionedThroughput'   => [
                    'ReadCapacityUnits'  => 2,
                    'WriteCapacityUnits' => 2,
                ],
            ]);

            $client->waitUntil('TableExists', ['TableName' => $tableName]);
        } catch (\Throwable $e) {
            throw new SchedulerOperationFailed(
                sprintf(
                    '%s::Unable to create table [%s] in region [%s].',
                    ClassUtils::getShortName($this),
                    $tableName,
                    $client->getRegion()
                ),
                Code::INTERNAL,
                $e
            );
        }
    }
797896
public function select(array $where = [], array $nosql_options = [])
    {
        // Set statement
        $query = $this->getSelect($where);
        $statement = $this->getInstance()->prepare($query);

        // Bind where values
        foreach ($where as $key => $value) {
            $statement->bindValue(":where_$key", $value, $this->isPdoInt($value));
        }

        // Execute operation
        $statement->execute();

        // Return object
        return $statement->fetchAll(PDO::FETCH_OBJ);
    }
30018
public function listDocuments($collection, array $options = [])
    {
        $this->setOptions($options);
        $doc = new Document($this->client, $this->database, $collection);
        $doc->setHeaders($this->getHeaders());
        $rs = $doc->getAll();
        $this->checkResponse($rs);
        unset($rs['_curl_info']);

        return $rs;
    }
882379
private function getDataRs(array $options = array(), $useLimit = true) {

        /* Arquivo de configuração do datagrid */
        $configGrid = ZendConfigFile::fromFile($this->sessionAdapter->moduleIni . $this->request['__CONTROLLER__'] . DS . ((isset($options['iniGridName']) and ! empty($options['iniGridName'])) ? $options['iniGridName'] . ".ini" : "datagrid.ini"));
        $getParamsFieldGrid = $configGrid['gridfieldsconfig'];
        $getParamsGrid = $configGrid['gridconfig'];

        /* Colunas do datagrid */
        $columNames = Array();
        $primaryKey = null;
        foreach ($getParamsFieldGrid as $key => $value) {
            if (!isset($value['notshowfield']) or $value['notshowfield'] != 'true') {
                $columNames[] = $key;
                if (strtolower($value['type']) == 'primarykey') {
                    $primaryKey = $key;
                }
            }
        }

        /* Colunas do datagrid para busca */
        $columNamesSearchSort = Array();
        foreach ($getParamsFieldGrid as $key => $value) {
            $columNamesSearchSort[] = $key;
        }

        /* Seleciona a tabela padrão do datagrid */
        $db = \Cityware\Db\Factory::factory('zend');
        $platform = $db->getAdapter()->getPlatform();



        if (isset($getParamsGrid['grid']['schema']) and $getParamsGrid['grid']['schema'] != "") {
            $db->from($getParamsGrid['grid']['table'], $getParamsGrid['grid']['tableAlias'], $getParamsGrid['grid']['schema']);
        } else {
            $db->from($getParamsGrid['grid']['table'], $getParamsGrid['grid']['tableAlias']);
        }

        if (isset($getParamsGrid['grid']['tableAlias']) and ! empty($getParamsGrid['grid']['tableAlias'])) {
            $aliasDefaultTable = "{$getParamsGrid['grid']['tableAlias']}.";
        } else {
            $aliasDefaultTable = null;
        }

        /* Define o WHERE no select da tabela do datagrid */
        if (isset($getParamsGrid['grid']['where'])) {
            $whereVerify = $getParamsGrid['grid']['where'];
            if (!empty($whereVerify)) {
                foreach ($whereVerify as $key => $value) {
                    /* Verifica se na where contem variável PHP e prepara o mesmo senão define somente a where */
                    $db->where($this->preparePhpTagWhere($value));
                }
            }
        }

        /* Define o WHERE condicional no select da tabela do datagrid */
        if (isset($getParamsGrid['grid']['condwherecolumn'])) {
            $whereVerify = $getParamsGrid['grid']['condwherecolumn'];
            if (!empty($whereVerify)) {
                foreach ($whereVerify as $key => $value) {
                    /* Verifica se na where contem variável PHP e prepara o mesmo senão define somente a where */
                    if (isset($getParamsGrid['grid']['condwhererequest'][$key]) and ! empty($getParamsGrid['grid']['condwhererequest'][$key])) {
                        if (isset($this->request[$getParamsGrid['grid']['condwhererequest'][$key]])) {
                            $db->where($aliasDefaultTable . $value . " = '" . $this->request[$getParamsGrid['grid']['condwhererequest'][$key]] . "'");
                        }
                    } else {
                        if (isset($this->request[$value])) {
                            $db->where($aliasDefaultTable . $value . " = '" . $this->request[$value] . "'");
                        }
                    }
                }
            }
        }

        /* Prepara campos de acordo com as refencias Join do banco caso houver */
        $referenceJoin = Array();
        $index = 1;
        foreach ($getParamsFieldGrid as $key => $value) {
            /* Verifica se o campo é relacionado e monta a query com base nos dados de relacionamento */
            if ((isset($getParamsFieldGrid[$key]['relationship']) and $getParamsFieldGrid[$key]['relationship'] == 'true')) {

                /* Monta o JOIN do campo para multiplos joins */
                foreach ($getParamsFieldGrid[$key]['jointablefk'] as $keyJoin => $valueJoin) {
                    /* Verifica se foi definido o tipo de relacionamento JOIN */
                    if (isset($getParamsFieldGrid[$key]['jointype'][$keyJoin]) and ! empty($getParamsFieldGrid[$key]['jointype'][$keyJoin])) {
                        $relationtype = strtolower($getParamsFieldGrid[$key]['jointype'][$keyJoin]);
                    } else {
                        $relationtype = 'inner';
                    }

                    /* Define o ALIAS da tabela de JOIN */
                    $aliasJoin = (isset($getParamsFieldGrid[$key]['joinalias'][$keyJoin]) and ! empty($getParamsFieldGrid[$key]['joinalias'][$keyJoin])) ? $getParamsFieldGrid[$key]['joinalias'][$keyJoin] : "f{$index}";

                    /* Define o SCHEMA da tabela de relacionamento do JOIN */
                    $schema = (isset($getParamsFieldGrid[$key]['joinschema'][$keyJoin]) and ! empty($getParamsFieldGrid[$key]['joinschema'][$keyJoin])) ? $getParamsFieldGrid[$key]['joinschema'][$keyJoin] : null;

                    /* Define a condição do JOIN nos modos normal e invertido */
                    if (isset($getParamsFieldGrid[$key]['joininverse'][$keyJoin]) and $getParamsFieldGrid[$key]['joininverse'][$keyJoin] == 'true') {
                        $condition = "{$aliasJoin}.{$getParamsFieldGrid[$key]['joinfieldpk'][$keyJoin]} = {$getParamsGrid['grid']['tableAlias']}.{$getParamsFieldGrid[$key]['joinfieldfk'][$keyJoin]}";
                    } else {
                        $condition = "{$aliasDefaultTable}{$getParamsFieldGrid[$key]['joinfieldfk'][$keyJoin]} = {$aliasJoin}.{$getParamsFieldGrid[$key]['joinfieldpk'][$keyJoin]}";
                    }

                    /* Define os paramentros do JOIN */
                    $db->join($getParamsFieldGrid[$key]['jointablefk'][$keyJoin], $aliasJoin, $condition, $relationtype, $schema);

                    /* Define os campos selecionados pelo JOIN */
                    if (isset($getParamsFieldGrid[$key]['joinfieldshow'][$keyJoin]) and ! empty($getParamsFieldGrid[$key]['joinfieldshow'][$keyJoin])) {
                        $db->select("{$aliasJoin}.{$getParamsFieldGrid[$key]['joinfieldshow'][$keyJoin]}", $getParamsFieldGrid[$key]['name']);


                        /* Define a referência do JOIN para o datatables */
                        $referenceJoin['join'][$getParamsFieldGrid[$key]['name']]['field'] = $getParamsFieldGrid[$key]['joinfieldshow'][$keyJoin];
                        $referenceJoin['join'][$getParamsFieldGrid[$key]['name']]['table'] = $getParamsFieldGrid[$key]['jointablefk'][$keyJoin];
                        $referenceJoin['join'][$getParamsFieldGrid[$key]['name']]['alias'] = $aliasJoin;
                    }
                    $index++;
                }
            } else {
                /* Define os campos selecionado da tabela principal */
                if (!isset($getParamsFieldGrid[$key]['notshowfield']) or $getParamsFieldGrid[$key]['notshowfield'] != 'true') {
                    $aliasWhereDefaultTable = str_replace(".", "", $aliasDefaultTable);
                    $db->select("{$aliasDefaultTable}{$key}");
                }
            }
        }

        /* Habilita ou desabilita o select para lixeira */
        if (isset($options['trash']) and $options['trash'] == true) {
            $aliasWhereDefaultTable = str_replace(".", "", $aliasDefaultTable);
            $db->where($platform->quoteIdentifier($aliasWhereDefaultTable) . '.' . $platform->quoteIdentifier("ind_status") . " = 'L'");
        } else {
            $aliasWhereDefaultTable = str_replace(".", "", $aliasDefaultTable);
            $db->where($platform->quoteIdentifier($aliasWhereDefaultTable) . '.' . $platform->quoteIdentifier("ind_status") . " IN ('A','B')");
        }

        /* Define parametros de busca */
        $whereSearch = null;
        $searchParamns = $this->prepareSearchParam();
        if (!empty($searchParamns)) {
            for ($i = 0; $i < count($searchParamns); $i++) {
                $indexColumn = $searchParamns[$i]['indexColumn'];
                $valueColumn = $searchParamns[$i]['valueColumn'];

                /* Verifica se o campo é de relacionamento e redefine o campo de busca para o campo de visualização
                 * se não for define o campo de busca como campo da tabela principal */
                if (isset($getParamsFieldGrid[$indexColumn]['relationship']) and $getParamsFieldGrid[$indexColumn]['relationship'] == 'true') {
                    $fieldKey = "{$referenceJoin['join'][$indexColumn]['alias']}.{$referenceJoin['join'][$indexColumn]['field']}";
                } else {
                    $fieldKey = "{$aliasDefaultTable}{$getParamsFieldGrid[$indexColumn]['name']}";
                }

                switch (strtolower($getParamsFieldGrid[$indexColumn]['type'])) {
                    case 'integer': case 'int2': case 'int4': case 'int8': case 'primarykey': case 'double': case 'float': case 'float4': case 'float8': case 'decimal':
                        $whereSearch = "CAST({$fieldKey} AS TEXT) iLIKE '%{$valueColumn}%'";
                        break;
                    case 'text': case 'string': case 'varchar': case 'char':
                        $whereSearch = "CAST({$fieldKey} AS TEXT) iLIKE '%{$valueColumn}%'";
                        break;
                    case 'datetime': case 'timestamp': case 'date':
                        $whereValue = \Cityware\Format\FieldGrid::fieldMask($valueColumn, 'DATE', 'Y-m-d');
                        $whereSearch = "CAST({$fieldKey} AS TEXT) iLIKE '%{$whereValue}%'";
                        break;
                    case 'status':
                        $whereValue = $this->prepareSearchStatus($valueColumn, $getParamsFieldGrid, $indexColumn);
                        $whereSearch = "{$fieldKey} IN ('{$whereValue}')";
                        break;
                    default:
                        $whereSearch = "CAST({$fieldKey} AS TEXT) iLIKE '%{$valueColumn}%'";
                        break;
                }
                /* Definição de busca do datagrid */
                if (!empty($whereSearch)) {
                    $db->where($whereSearch);
                }
            }
        }

        /* Ordenação do datagrid */
        $orderParamns = $this->prepareOrderParam();

        if (!empty($orderParamns)) {

            for ($i = 0; $i < count($orderParamns); $i++) {

                if (isset($getParamsGrid['grid']['disableckeckall']) and $getParamsGrid['grid']['disableckeckall'] == 'true') {
                    $indexColumn = $orderParamns[$i]['indexColumn'];
                } else {
                    $indexColumn = $orderParamns[$i]['indexColumn'] - 1;
                }
                $valueColumn = $orderParamns[$i]['valueColumn'];

                $typeOrder = ($valueColumn == 'asc' ) ? 'ASC' : 'DESC';

                /* Verifica se o campo é de relacionamento e redefine o campo de ordenação para o campo de visualização
                 * se não for define o campo de busca como campo da tabela principal */
                if (isset($getParamsFieldGrid[$columNamesSearchSort[$indexColumn]]['relationship']) and $getParamsFieldGrid[$columNamesSearchSort[$indexColumn]]['relationship'] == 'true') {
                    $fieldKey = "{$referenceJoin['join'][$columNamesSearchSort[$indexColumn]]['alias']}.{$referenceJoin['join'][$columNamesSearchSort[$indexColumn]]['field']}";
                } else {
                    $fieldKey = "{$aliasDefaultTable}{$getParamsFieldGrid[$columNamesSearchSort[$indexColumn]]['name']}";
                }

                /* Define a ordenação */
                $db->orderBy("{$fieldKey} {$typeOrder}");
            }
        } else {
            /* Define a ordenação */
            $orderColumn = (isset($getParamsGrid['grid']['ordercolumn']) and ! empty($getParamsGrid['grid']['ordercolumn'])) ? $getParamsGrid['grid']['ordercolumn'] : $primaryKey;
            $db->orderBy("{$aliasDefaultTable}{$orderColumn} {$getParamsGrid['grid']['orderdefault']}");
        }

        /* Executa o select do datagrid */
        $db->setDebug(false);
        $db->setExplan(false);

        if (!isset($getParamsGrid['grid']['disablelimit']) or $getParamsGrid['grid']['disablelimit'] != 'true') {
            /* Paginação do datagrid */
            if ($useLimit) {
                $limitOffset = $this->prepareLimitOffset();
                $db->limit($limitOffset['limit'], $limitOffset['offset']);
            }

            $page = (isset($this->request['ajaxPage']) and ! empty($this->request['ajaxPage'])) ? $this->request['ajaxPage'] : 0;
            $limitPage = (isset($this->request['itensPage']) and ! empty($this->request['itensPage'])) ? $this->request['itensPage'] : 10;

            $this->rsDatagrid = $db->executeSelectQuery(true, $page, $limitPage);
        } else {
            $this->rsDatagrid = $db->executeSelectQuery(true, 1, 99999999999);
        }


        return $this->rsDatagrid;
    }
918255
public function queryList($query, $options = array())
    {
        $statement = $this->_runQuery($query, $options);
        return $statement->fetch(\PDO::FETCH_NUM);
    }