获取关联数组
@param string $sql
@param array $parameters
@return array
160246
public function getArray($sql, $parameters = array()) {
        $this->execute($sql);
        $result = array();
        while (!!$objs = mysql_fetch_assoc($this->result) ) {
            $result[] = $objs;
        }
        return $result;
    }
415754
private function executeSql(PDO $pdo, $sql, array $parameters = null) {
        $this->lastPdo = $pdo;
        $this->lastSql = $sql;
        $this->lastParameters = $parameters;

        try {
            $pdoStmt = $pdo->prepare($sql);
            $pdoStmt->execute($parameters);
            return $pdoStmt;
        } catch (Exception $ex) {
            $errMsg = '执行SQL语句出错，错误消息：' . $ex->getMessage() . ', SQL：' . $this->getLastSql();
            $this->logger->error($errMsg);

            return false;
        }
    }
226221
public function query(string $sql, array $params = []) {
        X::logger()->trace("$sql with params " . $this->serializeArray($params));
        try {
            $st = $this->pdo->prepare($sql);
            if ($st === false) {
                $e = $this->pdo->errorInfo();
                throw new DataBaseException($e[2], $e[1]);
            }
            if ($st->execute($params)) {
                $this->_affectedRows = $st->rowCount();
                $this->_lastInsertId = $this->pdo->lastInsertId();
                return $st->fetchAll(PDO::FETCH_ASSOC);
            }

            $e = $st->errorInfo();
            throw new DataBaseException($e[2], $e[1]);
        } catch (PDOException $ex) {
            X::logger()->trace($ex);
            throw new DataBaseException($ex->getMessage(), $ex->getCode());
        }
    }
1171730
public function run($sql, array $params = array())
    {
        $sth = $this->pdo->prepare($sql);

        foreach ($params as $key => $value) {
            $key = is_numeric($key) ? $key + 1 : ":$key";
            $sth->bindValue($key, $value);
        }

        $sth->execute($params);
        $this->executed[] = $sql;
        return $sth;
    }
602007
public function update($sql, $parameters = array()) {
        DB::addQueryLog($sql, $parameters);
        return $this->getEngine()->update($sql, $parameters);
    }
671394
public function query($sql, array $parameters = [])
    {
        $resource = $this
            ->getSession()
            ->getClientUsingPooler('prepared_query', $sql)
            ->execute($parameters)
            ;

        return new ConvertedResultIterator(
            $resource,
            $this->getSession()
        );
    }
319083
public function execute($sql = null, $parameters = array()) {
		if (empty($sql)) {
			return null;
		}
		$this->prepare($sql);
		$this->bind($parameters);
        Factory::log()->info(sprintf('MYSQLI: %s => %s', $sql,
            $this->getError()));
		return $this->result->execute();
	}
1287492
public function setSql($sql, array $params = [])
    {
        $this->sql = (string) $sql;

        $this->setSqlParameters($params);
    }
143445
public function sql(string $sql, array $params = []) {
        $r = $this->model->db->query($sql, $params);
        if (!is_array($r) || 0 === count($r)) {
            return [];
        }
        return $this->model->setup($r);
    }
678145
public function execute(&$SQL, $parameters = array(), &$count = false)
    {
        if (is_array($SQL)) {
            $SQL = implode(' ', $SQL);
        }
        echo $SQL.PHP_EOL;
        if (is_string($SQL)) {
            $SQL = new Request($this->PDO, $SQL);
        }
        $result = $SQL->execute($parameters);
        return $result;
    }
338892
public static Sql getSql(String query, Map<String, Object> parameters) {
		SqlBuilder builder = new SqlBuilder();
		String sql = builder.replaceVariables(query, parameters);
		return new Sql(sql, parameters);
	}
574106
public static function findAll( $sql, $parameters = null, $connection = null, $fetchMode = \PDO::FETCH_ASSOC )
    {
        if ( false === ( $_reader = self::query( $sql, $parameters, $connection, $fetchMode ) ) )
        {
            return null;
        }

        return $_reader->fetchAll();
    }
477467
public function log(string $sql, array $parameters = []): void
    {
        $message = sprintf('[SQL]: %s', $this->removeWhitespace($sql));
        $this->logger->log($this->logLevel, $message, $parameters);
    }
1048580
public function getResults($sql, $params = null)
    {
        $this->log('getResults', $sql, $params);

        return $this->_socket->getResults($sql, $params);
    }
607851
public function execute($sql = null, $parameters = array()) {
        if (empty($sql)) {
            return null;
        }
        foreach ($parameters as $key => $item) {
            Str::bindParam($sql, $key + 1, $item, is_numeric($item) ? 'INT' : 'STR');
        }
        $this->result = mysql_query($sql, $this->driver);
        Factory::log()->info(sprintf('MYSQL: %s => %s', $sql,
            $this->getError()));
        return $this->result;
    }
550459
public function getResultsAsObjects($sql, $params = null)
    {
        $this->log('getResults', $sql, $params);

        return $this->_socket->getResultsAsObjects($sql, $params);
    }
420754
public function sqlFetch(string $sql, array $params = []): ?array
    {
        return $this->prepare($sql, $params)->fetch(\PDO::FETCH_ASSOC);
    }