From d2cb245dc32615ee6c24eb8286ee97a3072f8587 Mon Sep 17 00:00:00 2001 From: Qiang Xue <qiang.xue@gmail.com> Date: Fri, 11 Jul 2014 14:18:27 -0400 Subject: [PATCH] Finished sphinx support --- extensions/sphinx/Command.php | 2 +- extensions/sphinx/Connection.php | 1 - extensions/sphinx/Schema.php | 7 +++---- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/extensions/sphinx/Command.php b/extensions/sphinx/Command.php index 2cd680e..7318bba 100644 --- a/extensions/sphinx/Command.php +++ b/extensions/sphinx/Command.php @@ -191,7 +191,7 @@ class Command extends \yii\db\Command * @param string $index the name of the index from which to take the text processing settings * @param string $text the text to break down to keywords. * @param boolean $fetchStatistic whether to return document and hit occurrence statistics - * @return string the SQL statement for call keywords. + * @return static the command object itself */ public function callKeywords($index, $text, $fetchStatistic = false) { diff --git a/extensions/sphinx/Connection.php b/extensions/sphinx/Connection.php index e6dbf3c..9ba141b 100644 --- a/extensions/sphinx/Connection.php +++ b/extensions/sphinx/Connection.php @@ -109,7 +109,6 @@ class Connection extends \yii\db\Connection */ public function createCommand($sql = null, $params = []) { - $this->open(); $command = new Command([ 'db' => $this, 'sql' => $sql, diff --git a/extensions/sphinx/Schema.php b/extensions/sphinx/Schema.php index 7578790..b91069d 100644 --- a/extensions/sphinx/Schema.php +++ b/extensions/sphinx/Schema.php @@ -323,12 +323,11 @@ class Schema extends Object */ public function quoteValue($str) { - if (!is_string($str)) { + if (is_string($str)) { + return $this->db->getReadPdo()->quote($str); + } else { return $str; } - $this->db->open(); - - return $this->db->pdo->quote($str); } /** -- libgit2 0.27.1