@param string $sql
@param array  $params

@return array
960872
private function selectQuery($sql, array $params = array())
    {
        $stmt = $this->getConnection()->prepare($sql);
        $stmt->execute($params);

        return $stmt->fetchAll(PDO::FETCH_ASSOC);
    }
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;
    }
1312102
public function sqlFetchColumn(string $sql, array $params = [], string $column = '0')
    {
        $stmt = $this->prepare($sql, $params);

        if (ctype_digit((string) $column)) {
            return $stmt->fetchColumn($column);
        }

        if ($record = $stmt->fetch()) {
            return array_key_exists($column, $record) ? $record[$column] : null;
        }

        return null;
    }
177434
public function getRow($sql, $params = [])
    {
        if ($sql instanceof Criteria\Criteria) return $this->getRow($sql->toSQL(), $sql->getParams());

        $sth = $this->query($sql, $params, Database::TARGET_SLAVE);
        $row = $sth->fetch(Connection::FETCH_OBJ);
        $sth->closeCursor();
        return $row;
    }
380950
public static function exec($sql, $params = [])
    {
        BLLog::log('[SQL] ' . $sql);
        BLLog::log('[Params] ' . var_export($params, true));
        $stmt = self::getHandle()->prepare($sql);
        $stmt->execute($params);
        return $stmt;
    }
417998
private function addSelect($sql, array $params = [])
    {
        $this->values = [];

        $this->select = [
            'sql'    => $sql,
            'params' => $params,
        ];

        return $this;
    }
1047948
protected function emulate_bound_params($sql, array $params=null) {
        if (empty($params)) {
            return $sql;
        }
        // ok, we have verified sql statement with ? and correct number of params
        $parts = array_reverse(explode('?', $sql));
        $return = array_pop($parts);
        foreach ($params as $param) {
            if (is_bool($param)) {
                $return .= (int)$param;
            } else if (is_null($param)) {
                $return .= 'NULL';
            } else if (is_number($param)) {
                $return .= "'".$param."'"; // we have to always use strings because mysql is using weird automatic int casting
            } else if (is_float($param)) {
                $return .= $param;
            } else {
                $param = $this->mysqli->real_escape_string($param);
                $return .= "'$param'";
            }
            $return .= array_pop($parts);
        }
        return $return;
    }
1122909
public function getColumn($sql, $params = null)
    {
        $stmt = $this->execute($sql, $params);
        $column = [];

        while ($row = $stmt->fetch()) {
            $column[] = $row[0];
        }

        return $column;
    }
594619
public function command(string $sql, array $params = [])
    {
        return $this->execute($this->prepare($sql, $params));
    }
217497
public function sqlExecute(string $sql, array $params = []): int
    {
        return $this->connection()->sqlExecute($sql, $params);
    }
879937
public function sqlGenerate(string $sql, array $params = []): \Generator
    {
        yield from $this->connection()->sqlGenerate($sql, $params);
    }
1192366
public function getValue($sql, $params = null)
    {
        $this->log('getValue', $sql, $params);

        return $this->_socket->getValue($sql, $params);
    }
117115
public function orWhereRaw(string $sql, string ...$params)
    {
        $instance = $this->whereStrategyInstance();

        $instance->whereStrategy()->orWhereRaw($sql, ...$params);

        return $instance;
    }
1277492
public function execute($sql, array $params=array())
	{
		if ($params) {
			$stmt = $this->prepare($sql);
			if (!$stmt) { return false; }

			$flag = $stmt->execute($params);
			if (!$flag) { return false; }
		} else {
			$stmt = $this->query($sql);
			if (!$stmt) { return false; }
		}

		return $stmt->rowCount();
	}
321066
public function query($sql = null,$params = array())
	{
		if(!isset($this->operationOption['params']))
		{
			$this->operationOption['params'] = array();
		}
		$this->prepareQuery($sql ? $sql : $this->buildSelectSQL(),$params);
		if(false === $this->lastStmt)
		{
			return false;
		}
		else
		{
			return $this->lastStmt->fetchAll(PDO::FETCH_ASSOC);
		}
	}
555583
protected function fetch( $sql, $params = null ) {
		$stmt = $this->dbh->prepare( $sql );
		$this->bind( $stmt, $params );
		$stmt->execute();
		return $stmt->fetch();
	}
1135163
public function insert($sql, $params = array()) {
		$this->query($sql, $params);

		return $this->pdo->lastInsertId();
	}