记录execute操作及相关参数
@param string $sql 一条已经写好的SQL
@param array|string $bind 要绑定的参数
@return Statement
189939
public function execute(string $sql, $bind = []): Statement
    {
        $this->operation = 'execute';
        $this->sql = $sql;
        $this->params = $bind;
        return $this;
    }
459290
public function executeFast(string $sql, $bind = [])
    {
        if (!$bind) {
            return $this->connectWrite()->exec($sql);
        }
        return $this->bindExecute($this->connectWrite(), $sql, $bind);
    }
1192491
public function select($table, $where = [], array $bind = [])
    {
        $table = $this->quote()->identifier($table);
        $sql   = "SELECT * FROM $table";
        if (is_array($where)) {
            $where = $this->createWhereExpression($where);
        }
        $sql .= (($where) ? " WHERE {$where}" : '');

        return $this->query($sql, $bind);
    }
486305
public function query($sql, $bind = [], $fetchMode = \PDO::FETCH_ASSOC, $useMaster = false)
    {
        $sql = $this->_replaceQuoteCharacters($sql);

        try {
            $statement = $bind ? $this->_execute($sql, $bind) : @$this->_getPdo()->query($sql);
        } catch (\PDOException $e) {
            $failed = true;

            if ($this->_transaction_level === 0 && !$this->_ping()) {
                try {
                    $this->close();
                    $statement = $bind ? $this->_execute($sql, $bind) : @$this->_getPdo()->query($sql);
                    $failed = false;
                } catch (\PDOException $e) {

                }
            }

            if ($failed) {
                throw new DbException([
                    ':message => ' . PHP_EOL . 'SQL: ":sql"' . PHP_EOL . ' BIND: :bind',
                    'message' => $e->getMessage(),
                    'sql' => $sql,
                    'bind' => json_encode($bind, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT)
                ], 0, $e);
            }
        }

        return $statement->fetchAll($fetchMode);
    }
4830
public function prepareSQL($sql, $binds = [])
    {
        $prepare = $this->getConnection()->prepare($sql);

        if (!$prepare) {
            throw new Exception('Cannot prepare statement');
        }

        $this->bindBinds($prepare, $binds);

        $prepare->setFetchMode(\PDO::FETCH_OBJ);

        return $prepare;
    }
180057
public function queryFastHandle(string $sql, $bind = []): \PDOStatement
    {
        if (!$bind) {
            return $this->connectWrite()->query($sql, \PDO::FETCH_ASSOC);
        }

        $stmt = $this->connectWrite()->prepare($sql);
        $ret = $stmt->execute($bind);

        //通常是参数绑定问题
        if (!$ret) {
            trigger_error('PDO语句参数绑定错误:' . $stmt->errorCode(), E_USER_ERROR);
        }
        return $stmt;
    }
1150230
public function fetchPairs($sql, $bind = array())
    {
        $stmt = $this->query($sql, $bind);
        $data = array();
        while ($row = $stmt->fetch(Zend_Db::FETCH_NUM)) {
            $data[$row[0]] = $row[1];
        }
        return $data;
    }
13119
public function query(string $sql, $bind = []): Result
    {
        $result = parent::query($sql, $bind);
        return new Result($this->tableName, $result);
    }
868850
public static function execute($sql, $bind = []) {
        /* @var $connection Connection */
        $connection = Pool::get(Connection::class);
        try {
            $connection->execute($sql, $bind);
            Pool::release($connection);
        } catch (\RuntimeException $e) {
            Pool::release($connection);
            throw $e;
        } catch (\Error $e) {
            Pool::release($connection);
            throw $e;
        }

    }
944900
public function queryFast(string $sql, $bind = []): array
    {
        $connect = $this->connectWrite();

        // 先记日志,以免错误导致无日志
        FileLog::instance()->sqlBefore('queryFast', $sql);

        //快速查询不记录查询结果日志
        if (!$bind) {
            return $connect->query($sql, \PDO::FETCH_ASSOC)->fetchAll();
        }

        //带参数绑定
        return $this->bindQuery($connect, $sql, $bind);
    }
528625
public function executeRaw($sql) {
        if (!is_string($sql)) throw new IllegalTypeException('Illegal type of parameter $sql: '.gettype($sql));
        if (!$this->isConnected())
            $this->connect();

        // execute statement
        $result = null;
        try {
            $result = pg_query($this->hConnection, $sql);         // wraps multi-statement queries in a transaction
            !$result && trigger_error(pg_last_error($this->hConnection), E_USER_ERROR);
        }
        catch (\Exception $ex) {
            if (!$ex instanceof IRosasurferException)
                $ex = new DatabaseException($ex->getMessage(), $ex->getCode(), $ex);
            throw $ex->addMessage('Database: '.$this->getConnectionDescription().NL.'SQL: "'.$sql.'"');
        }

        $status_string = pg_result_status($result, PGSQL_STATUS_STRING);

        // reset last_insert_id on INSERTs, afterwards it's resolved on request as it requires an extra SQL query
        if (strStartsWithI($status_string, 'INSERT '))
            $this->lastInsertId = null;

        // track last_affected_rows
        $pattern = '/^(INSERT|UPDATE|DELETE)\b/i';
        if (preg_match($pattern, $status_string))
            $this->lastAffectedRows = pg_affected_rows($result);

        return $result;

    }
1080740
public function bind($sql, array $params=array())
    {
        return $this->_bindInto('\?', $sql, $params, function($binder, $param) use ($sql) {
            return $binder->sqlValue($param);
        });
    }
540734
public function query($sql, $bind = [], $master = false, $class = false)
    {
        return $this->connection->query($sql, $bind, $master, $class);
    }
183325
def exec_query(sql, name = 'SQL', binds = [])
      # NOTE: we allow to execute SQL as requested returning a results.
      # e.g. this allows to use SQLServer's EXEC with a result set ...
      sql = to_sql(sql, binds) if sql.respond_to?(:to_sql)

      sql = repair_special_columns(sql)
      if prepared_statements?
        log(sql, name, binds) { @connection.execute_query(sql, binds) }
      else
        log(sql, name) { @connection.execute_query(sql) }
      end
    end
1054226
public static function query($sql,$bind=[])
    {
        try{
            $bind=is_array($bind) ? $bind : [$bind];
            self::$db=Connect::boot();
            Connect::comSql($sql);
            $sth = self::$db->prepare($sql);
            $sth->execute($bind);
            $sth->setFetchMode(\PDO::FETCH_ASSOC);

            return $sth;
        } catch (\PDOException $e) {
            throw new Exception($e->getMessage());
            //View::throwError($error);
        }
    }
1176928
public function query($sql, $bind = array())
    {
        // connect to the database if needed
        $this->_connect();

        // is the $sql a Zend_Db_Select object?
        if ($sql instanceof Zend_Db_Select) {
            if (empty($bind)) {
                $bind = $sql->getBind();
            }

            $sql = $sql->assemble();
        }

        // make sure $bind to an array;
        // don't use (array) typecasting because
        // because $bind may be a Zend_Db_Expr object
        if (!is_array($bind)) {
            $bind = array($bind);
        }

        // prepare and execute the statement with profiling
        $stmt = $this->prepare($sql);
        $stmt->execute($bind);

        // return the results embedded in the prepared statement object
        $stmt->setFetchMode($this->_fetchMode);
        return $stmt;
    }
860553
public static function execute($sql, $data = [])
    {
        $statement = self::$pdo->prepare($sql);
        $statement->execute($data);
        return $statement;
    }