mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-18 15:31:06 +08:00
renamed Command::queryRow() to queryOne().
This commit is contained in:
@@ -66,10 +66,10 @@ class DbDependency extends Dependency
|
||||
if ($db->enableQueryCache) {
|
||||
// temporarily disable and re-enable query caching
|
||||
$db->enableQueryCache = false;
|
||||
$result = $db->createCommand($this->sql, $this->params)->queryRow();
|
||||
$result = $db->createCommand($this->sql, $this->params)->queryOne();
|
||||
$db->enableQueryCache = true;
|
||||
} else {
|
||||
$result = $db->createCommand($this->sql, $this->params)->queryRow();
|
||||
$result = $db->createCommand($this->sql, $this->params)->queryOne();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ class ActiveQuery extends Query
|
||||
public function one($db = null)
|
||||
{
|
||||
$command = $this->createCommand($db);
|
||||
$row = $command->queryRow();
|
||||
$row = $command->queryOne();
|
||||
if ($row !== false && !$this->asArray) {
|
||||
/** @var $class ActiveRecord */
|
||||
$class = $this->modelClass;
|
||||
|
||||
@@ -19,7 +19,7 @@ use yii\caching\Cache;
|
||||
*
|
||||
* To execute a non-query SQL (such as INSERT, DELETE, UPDATE), call [[execute()]].
|
||||
* To execute a SQL statement that returns result data set (such as SELECT),
|
||||
* use [[queryAll()]], [[queryRow()]], [[queryColumn()]], [[queryScalar()]], or [[query()]].
|
||||
* use [[queryAll()]], [[queryOne()]], [[queryColumn()]], [[queryScalar()]], or [[query()]].
|
||||
* For example,
|
||||
*
|
||||
* ~~~
|
||||
@@ -335,7 +335,7 @@ class Command extends \yii\base\Component
|
||||
* results in nothing.
|
||||
* @throws Exception execution failed
|
||||
*/
|
||||
public function queryRow($fetchMode = null)
|
||||
public function queryOne($fetchMode = null)
|
||||
{
|
||||
return $this->queryInternal('fetch', $fetchMode);
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ class Query extends Component
|
||||
*/
|
||||
public function one($db = null)
|
||||
{
|
||||
return $this->createCommand($db)->queryRow();
|
||||
return $this->createCommand($db)->queryOne();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -50,7 +50,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
|
||||
public function renameColumn($table, $oldName, $newName)
|
||||
{
|
||||
$quotedTable = $this->db->quoteTableName($table);
|
||||
$row = $this->db->createCommand('SHOW CREATE TABLE ' . $quotedTable)->queryRow();
|
||||
$row = $this->db->createCommand('SHOW CREATE TABLE ' . $quotedTable)->queryOne();
|
||||
if ($row === false) {
|
||||
throw new Exception("Unable to find column '$oldName' in table '$table'.");
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ class Schema extends \yii\db\Schema
|
||||
*/
|
||||
protected function findConstraints($table)
|
||||
{
|
||||
$row = $this->db->createCommand('SHOW CREATE TABLE ' . $this->quoteSimpleTableName($table->name))->queryRow();
|
||||
$row = $this->db->createCommand('SHOW CREATE TABLE ' . $this->quoteSimpleTableName($table->name))->queryOne();
|
||||
if (isset($row['Create Table'])) {
|
||||
$sql = $row['Create Table'];
|
||||
} else {
|
||||
|
||||
@@ -303,7 +303,7 @@ class DbManager extends Manager
|
||||
$row = $query->from($this->assignmentTable)
|
||||
->where(array('user_id' => $userId, 'item_name' => $itemName))
|
||||
->createCommand($this->db)
|
||||
->queryRow();
|
||||
->queryOne();
|
||||
if ($row !== false) {
|
||||
if (($data = @unserialize($row['data'])) === false) {
|
||||
$data = null;
|
||||
@@ -479,7 +479,7 @@ class DbManager extends Manager
|
||||
$row = $query->from($this->itemTable)
|
||||
->where(array('name' => $name))
|
||||
->createCommand($this->db)
|
||||
->queryRow();
|
||||
->queryOne();
|
||||
|
||||
if ($row !== false) {
|
||||
if (($data = @unserialize($row['data'])) === false) {
|
||||
|
||||
@@ -111,7 +111,7 @@ class DbSession extends Session
|
||||
$row = $query->from($this->sessionTable)
|
||||
->where(array('id' => $oldID))
|
||||
->createCommand($this->db)
|
||||
->queryRow();
|
||||
->queryOne();
|
||||
if ($row !== false) {
|
||||
if ($deleteOldSession) {
|
||||
$this->db->createCommand()
|
||||
|
||||
Reference in New Issue
Block a user