yii\sphinx\Command::prepare PHP Метод

prepare() публичный Метод

public prepare ( $forRead = null )
    public function prepare($forRead = null)
    {
        if ($this->pdoStatement && empty($this->floatParams)) {
            $this->bindPendingParams();
            return;
        }
        $sql = $this->getSql();
        if ($this->db->getTransaction()) {
            // master is in a transaction. use the same connection.
            $forRead = false;
        }
        if ($forRead || $forRead === null && $this->db->getSchema()->isReadQuery($sql)) {
            $pdo = $this->db->getSlavePdo();
        } else {
            $pdo = $this->db->getMasterPdo();
        }
        if (!empty($this->floatParams)) {
            $sql = $this->parseFloatParams($sql);
        }
        try {
            $this->pdoStatement = $pdo->prepare($sql);
            $this->bindPendingParams();
        } catch (\Exception $e) {
            $message = $e->getMessage() . "\nFailed to prepare SphinxQL: {$sql}";
            $errorInfo = $e instanceof \PDOException ? $e->errorInfo : null;
            throw new Exception($message, $errorInfo, (int) $e->getCode(), $e);
        }
    }