_prepare example


    public function __construct($adapter$sql)
    {
        $this->_adapter = $adapter;
        if ($sql instanceof Zend_Db_Select) {
            $sql = $sql->assemble();
        }
        $this->_parseParameters($sql);
        $this->_prepare($sql);

        $this->_queryId = $this->_adapter->getProfiler()->queryStart($sql);
    }

    /** * Internal method called by abstract statment constructor to setup * the driver level statement * * @return void */
    protected function _prepare($sql)
    {
/** @var Query $query */
        $query = new $queryClass($this->db);

        $query->setQuery($sql);

        if (empty($this->db->swapPre) && ! empty($this->db->DBPrefix)) {
            $query->swapPrefix($this->db->DBPrefix, $this->db->swapPre);
        }

        $this->query = $query;

        return $this->_prepare($query->getOriginalQuery()$options);
    }

    /** * The database-dependent portion of the prepare statement. * * @return $this */
    abstract public function _prepare(string $sql, array $options = []);

    /** * Takes a new set of data and runs it against the currently * prepared query. Upon success, will return a Results object. * * @return bool|ResultInterface * @phpstan-return bool|ResultInterface<TConnection, TResult> * * @throws DatabaseException */
Home | Imprint | This part of the site doesn't use cookies.