Return all rows
@param array $params Parameter array
@param \PDO $db Database connection to use, default to slave resource
@return mixed
503458
public static function _getValues ($params = array (), &$db = FALSE)
	{
		
		// Set select

		if (!isset ($params['select']))
		{
			$params['select']	= '*';
		}
		
		// Set from

		if (!isset ($params['from']))
		{
			$params['from']		= '`' . static::$dbTable . '`';
		}
		
		// Get database slave for read

		if ($db === FALSE)
		{
			$db	=& self::_getDbSlave ();
		}
		
		// Return value

		return $db->getValues ($params);

	}
1293222
public function execute(array $params = []) : array
    {
        foreach ($params as $paramName => $paramValue) {
            $type = is_int($paramValue) ? \PDO::PARAM_INT : \PDO::PARAM_STR;
            $this->getStatement()->bindValue($paramName, $paramValue, $type);
        }
        $this->getStatement()->execute();

        return $this->getStatement()->fetchAll(\PDO::FETCH_ASSOC);
    }
507998
public function getRows(array $params = [])
    {
        $query = $this->createQueryBuilder('pc');

        if (array_key_exists('idPlayer', $params)) {
            $query->where('pc.idPlayer= :idPlayer')
                ->setParameter('idPlayer', $params['idPlayer']);
        }

        if (array_key_exists('limit', $params)) {
            $query->setMaxResults($params['limit']);
        }

        if (array_key_exists('orderBy', $params)) {
            $query->orderBy($params['orderBy']['column'], $params['orderBy']['order']);
        }

        return $query->getQuery()->getResult();
    }
534479
public function execute($params = null) {
		if ($params === null) {
			$params = [];
		}

		try {
			$this->stmt->execute($params);

			return new QueryResult($this->stmt, $this->pdo);
		} catch (PDOException $e) {
			throw $this->exAdapter->adapt($e, $this->stmt, $params);
		}
	}
1304266
public function fetchAll($sql, array $params = [], $types = [])
    {
        return $this->executeQuery($sql, $params, $types)->fetchAll();
    }
810069
public function query($sql=null, array $params=[]) {
		if($sql === null) {
			$sql = $this->buildSQL();
			$params = $this->getParameters();
		}

		$this->replaceArrayParams($sql, $params);

		return $this->query = $this->db->query($sql, $params);
	}
1151066
public function execute($params = [])
    {
        return $this->getDb()
            ->createCommand()
            ->setText($this->buildSql())
            ->execute(array_merge($this->getParams(), $params));
    }
1047025
protected function getSQLResultFromConnection($connection, $sql, array $params = array())
    {
        $result = $connection->fetchAll($sql, $params);
        return $result;
    }
1249497
public function getAll($sql, array $args = [])
    {
        $query = $this->query($sql, $args);
        if (!$query) {
            return [];
        }
        
        $rs = $query->fetchAll(\PDO::FETCH_ASSOC);
        return $rs;
    }
468385
public function execQuery($statement, $params = array()) {
        $start = microtime(true);
        $query = $this->prepare($statement.'');
        try {
            $query->execute($params);
        } catch (\PDOException $e){
            $this->error($e->getMessage(), array(
                'File' => __FILE__,
                'Line' => __LINE__ - 4,
                'Query' => $statement .'',
                'Params' => $params,
                'Trace' => $e->getTraceAsString()
            ));
            return 0;
        }
        $this->debug($statement, array(
            'params' => $params,
            'execute' => true,
            'rows' => $count = $query->rowCount(),
            'time' => microtime(true) - $start,
            'dns' => $this->dns
        ));
        return $count;
    }
1177010
public function query($sql, array $params = array())
    {
        //$helper = $this->getHelper();
        $con = $this->establishConnection();
        $sth = $con->prepare($sql, array(Connection::ATTR_CURSOR => Connection::CURSOR_SCROLL));

        // bind params
        foreach($params as $key => $value){
            $type = Connection::PARAM_STR;
            if ( is_null($value) ) {
                $type = Connection::PARAM_NULL;
            } elseif ( is_int($value) ) {
                $type = Connection::PARAM_INT;
            } elseif ( is_bool($value) ) {
                $type = Connection::PARAM_BOOL;
            } elseif ( is_resource($value) ) {
                $type = Connection::PARAM_LOB;
            }
            if ( is_int($key) ) {
                $sth->bindValue($key + 1, $value, $type);
            } else {
                $sth->bindValue($key, $value, $type);
            }
        }

        $result = $sth->execute();
        return $sth;
    }
1361195
public static function _genQuery ($params, &$db = FALSE)
	{
		
		// Set select

		if (!isset ($params['select']))
		{
			$params['select']	= '*';
		}
		
		// Set from

		if (!isset ($params['from']))
		{
			$params['from']		= '`' . static::$dbTable . '`';
		}
		
		// Get database slave for read

		if ($db === FALSE)
		{
			$db	=& self::_getDbSlave ();
		}
		
		if (!($db instanceof \PDO))
		{
			throw new Exception ('Invalid or no database resource set');
		}
		
		// Return value

		return $db->genQuery ($params);
		
	}
1328447
public function getServiceDataDatabase(array $params) {

        $dataPostgresql = new \Cityware\Monitoring\Models\Services\DataPostgreSql($params);

        $databases = $dataPostgresql->getDataPgSqlDatabaseStatus();

        $return = Array();

        foreach ($databases as $key => $value) {

            $hitRatio = (($value['blks_hit'] + $value['blks_read']) > 0) ? (($value['blks_hit'] * 100) / ($value['blks_hit'] + $value['blks_read'])) : 0;


            $return[$key]['nam_database'] = $value['datname'];
            $return[$key]['des_hash'] = hash('crc32b', $value['datname']);
            $return[$key]['num_datid'] = $value['datid'];
            $return[$key]['num_commit'] = $value['xact_commit'];
            $return[$key]['num_rollback'] = $value['xact_rollback'];
            $return[$key]['num_blks_read'] = $value['blks_read'];
            $return[$key]['num_blks_hit'] = $value['blks_hit'];
            $return[$key]['num_database_size'] = $value['db_size'];
            $return[$key]['num_database_age'] = $value['db_age'];
            $return[$key]['num_connection_ratio'] = $value['connection_ratio'];
            $return[$key]['num_transactions_per_second'] = $value['transactions_per_second'];
            $return[$key]['num_hit_ratio'] = $hitRatio;
            $return[$key]['num_tup_returned'] = $value['tup_returned'];
            $return[$key]['num_tup_fetched'] = $value['tup_fetched'];
            $return[$key]['num_tup_inserted'] = $value['tup_inserted'];
            $return[$key]['num_tup_updated'] = $value['tup_updated'];
            $return[$key]['num_tup_deleted'] = $value['tup_deleted'];
            $return[$key]['num_backends'] = $value['numbackends'];
            $return[$key]['num_total_connections'] = $value['total_connections'];
            $return[$key]['num_total_seq_scan'] = $value['seq_scan'];
            $return[$key]['num_total_idx_scan'] = $value['idx_scan'];
            $return[$key]['num_total_autovacuum'] = $value['autovacuum_count'];
            $return[$key]['num_total_autoanalyze'] = $value['autoanalyze_count'];
        }

        return $return;
    }
275847
public function fetchAllKeyPair(string $sql, array $params = [], array $types = []): array
    {
        $stmt = $this->conn->executeQuery($sql, $params, $types);

        return $stmt->fetchAll(PDO::FETCH_KEY_PAIR);
    }
383077
public function getResultsAsObjects($sql, $params = null)
    {
        $stmt = $this->execute($sql, $params);

        return $stmt->fetchAll(PDO::FETCH_OBJ);
    }
594384
public function getRow($sql, $params = null)
    {
        return $this->_socket->getRow($sql, $params = null);
    }
1185988
protected function fetchAll( $sql, $params = null ) {
		$this->logger->debug( $sql, $params ?: [] );
		$stmt = $this->dbh->prepare( $sql );
		$this->bind( $stmt, $params );
		$stmt->execute();
		return $stmt->fetchAll();
	}