Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions extensions/sphinx/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace yii\sphinx;

use yii\base\InvalidParamException;
use yii\base\Object;
use yii\db\Exception;
use yii\db\Expression;
Expand Down Expand Up @@ -760,12 +761,12 @@ protected function buildCompositeInCondition($indexes, $operator, $columns, $val
* operator is `LIKE` or `OR LIKE` and empty if operator is `NOT LIKE` or `OR NOT LIKE`.
* @param array $params the binding parameters to be populated
* @return string the generated SQL expression
* @throws Exception if wrong number of operands have been given.
* @throws InvalidParamException if wrong number of operands have been given.
*/
public function buildLikeCondition($indexes, $operator, $operands, &$params)
{
if (!isset($operands[0], $operands[1])) {
throw new Exception("Operator '$operator' requires two operands.");
throw new InvalidParamException("Operator '$operator' requires two operands.");
}

list($column, $values) = $operands;
Expand Down
8 changes: 4 additions & 4 deletions framework/yii/db/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ public function dropTable($table)
{
return "DROP TABLE " . $this->db->quoteTableName($table);
}

/**
* Builds a SQL statement for adding a primary key constraint to an existing table.
* @param string $name the name of the primary key constraint.
Expand All @@ -317,12 +317,12 @@ public function addPrimaryKey($name, $table, $columns)
foreach ($columns as $i => $col) {
$columns[$i] = $this->db->quoteColumnName($col);
}

return 'ALTER TABLE ' . $this->db->quoteTableName($table) . ' ADD CONSTRAINT '
. $this->db->quoteColumnName($name) . ' PRIMARY KEY ('
. implode(', ', $columns). ' )';
}

/**
* Builds a SQL statement for removing a primary key constraint to an existing table.
* @param string $name the name of the primary key constraint to be removed.
Expand Down Expand Up @@ -999,7 +999,7 @@ protected function buildCompositeInCondition($operator, $columns, $values, &$par
* operator is `LIKE` or `OR LIKE` and empty if operator is `NOT LIKE` or `OR NOT LIKE`.
* @param array $params the binding parameters to be populated
* @return string the generated SQL expression
* @throws Exception if wrong number of operands have been given.
* @throws InvalidParamException if wrong number of operands have been given.
*/
public function buildLikeCondition($operator, $operands, &$params)
{
Expand Down