From 4efeedd314e466cffd5260b0348796e9cee0c495 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Sun, 9 Jun 2013 17:46:41 -0400 Subject: [PATCH] Minor coding style fix. --- framework/yii/db/Command.php | 8 ++++---- framework/yii/db/mysql/QueryBuilder.php | 10 +++++----- framework/yii/db/pgsql/QueryBuilder.php | 31 +++++++++++++++---------------- 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/framework/yii/db/Command.php b/framework/yii/db/Command.php index 1564b50..e3ea0d2 100644 --- a/framework/yii/db/Command.php +++ b/framework/yii/db/Command.php @@ -652,7 +652,7 @@ class Command extends \yii\base\Component $sql = $this->db->getQueryBuilder()->alterColumn($table, $column, $type); return $this->setSql($sql); } - + /** * Creates a SQL command for adding a primary key constraint to an existing table. * The method will properly quote the table and column names. @@ -660,19 +660,19 @@ class Command extends \yii\base\Component * @param string $table the table that the primary key constraint will be added to. * @param string|array $columns comma separated string or array of columns that the primary key will consist of. * @return Command the command object itself. - */ + */ public function addPrimaryKey($name, $table, $columns) { $sql = $this->db->getQueryBuilder()->addPrimaryKey($name, $table, $columns); return $this->setSql($sql); } - + /** * Creates a SQL command for removing a primary key constraint to an existing table. * @param string $name the name of the primary key constraint to be removed. * @param string $table the table that the primary key constraint will be removed from. * @return Command the command object itself - */ + */ public function dropPrimarykey($name, $table) { $sql = $this->db->getQueryBuilder()->dropPrimarykey($name, $table); diff --git a/framework/yii/db/mysql/QueryBuilder.php b/framework/yii/db/mysql/QueryBuilder.php index e785bae..b4ac996 100644 --- a/framework/yii/db/mysql/QueryBuilder.php +++ b/framework/yii/db/mysql/QueryBuilder.php @@ -92,13 +92,13 @@ class QueryBuilder extends \yii\db\QueryBuilder * 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. * @param string $table the table that the primary key constraint will be removed from. - * @return string the SQL statement for removing a primary key constraint from an existing table. * + * @return string the SQL statement for removing a primary key constraint from an existing table. */ - public function dropPrimarykey($name, $table) + public function dropPrimaryKey($name, $table) { - return 'ALTER TABLE ' . $this->db->quoteTableName($table) . ' DROP PRIMARY KEY'; + return 'ALTER TABLE ' . $this->db->quoteTableName($table) . ' DROP PRIMARY KEY'; } - + /** * Creates a SQL statement for resetting the sequence value of a table's primary key. * The sequence will be reset such that the primary key of the next new row inserted @@ -124,7 +124,7 @@ class QueryBuilder extends \yii\db\QueryBuilder } elseif ($table === null) { throw new InvalidParamException("Table not found: $tableName"); } else { - throw new InvalidParamException("There is not sequence associated with table '$tableName'.'"); + throw new InvalidParamException("There is not sequence associated with table '$tableName'."); } } diff --git a/framework/yii/db/pgsql/QueryBuilder.php b/framework/yii/db/pgsql/QueryBuilder.php index 4c3e8f2..9701fd6 100644 --- a/framework/yii/db/pgsql/QueryBuilder.php +++ b/framework/yii/db/pgsql/QueryBuilder.php @@ -21,21 +21,20 @@ class QueryBuilder extends \yii\db\QueryBuilder * @var array mapping from abstract column types (keys) to physical column types (values). */ public $typeMap = array( - Schema::TYPE_PK => 'serial not null primary key', - Schema::TYPE_STRING => 'varchar(255)', - Schema::TYPE_TEXT => 'text', - Schema::TYPE_SMALLINT => 'smallint', - Schema::TYPE_INTEGER => 'integer', - Schema::TYPE_BIGINT => 'bigint', - Schema::TYPE_FLOAT => 'double precision', - Schema::TYPE_DECIMAL => 'numeric(10,0)', - Schema::TYPE_DATETIME => 'timestamp', - Schema::TYPE_TIMESTAMP => 'timestamp', - Schema::TYPE_TIME => 'time', - Schema::TYPE_DATE => 'date', - Schema::TYPE_BINARY => 'bytea', - Schema::TYPE_BOOLEAN => 'boolean', - Schema::TYPE_MONEY => 'numeric(19,4)', + Schema::TYPE_PK => 'serial not null primary key', + Schema::TYPE_STRING => 'varchar(255)', + Schema::TYPE_TEXT => 'text', + Schema::TYPE_SMALLINT => 'smallint', + Schema::TYPE_INTEGER => 'integer', + Schema::TYPE_BIGINT => 'bigint', + Schema::TYPE_FLOAT => 'double precision', + Schema::TYPE_DECIMAL => 'numeric(10,0)', + Schema::TYPE_DATETIME => 'timestamp', + Schema::TYPE_TIMESTAMP => 'timestamp', + Schema::TYPE_TIME => 'time', + Schema::TYPE_DATE => 'date', + Schema::TYPE_BINARY => 'bytea', + Schema::TYPE_BOOLEAN => 'boolean', + Schema::TYPE_MONEY => 'numeric(19,4)', ); - }