Browse Source

Minor coding style fix.

tags/2.0.0-beta
Qiang Xue 12 years ago
parent
commit
4efeedd314
  1. 6
      framework/yii/db/mysql/QueryBuilder.php
  2. 31
      framework/yii/db/pgsql/QueryBuilder.php

6
framework/yii/db/mysql/QueryBuilder.php

@ -92,9 +92,9 @@ class QueryBuilder extends \yii\db\QueryBuilder
* Builds a SQL statement for removing a primary key constraint to an existing table. * 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 $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. * @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';
} }
@ -124,7 +124,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
} elseif ($table === null) { } elseif ($table === null) {
throw new InvalidParamException("Table not found: $tableName"); throw new InvalidParamException("Table not found: $tableName");
} else { } else {
throw new InvalidParamException("There is not sequence associated with table '$tableName'.'"); throw new InvalidParamException("There is not sequence associated with table '$tableName'.");
} }
} }

31
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). * @var array mapping from abstract column types (keys) to physical column types (values).
*/ */
public $typeMap = array( public $typeMap = array(
Schema::TYPE_PK => 'serial not null primary key', Schema::TYPE_PK => 'serial not null primary key',
Schema::TYPE_STRING => 'varchar(255)', Schema::TYPE_STRING => 'varchar(255)',
Schema::TYPE_TEXT => 'text', Schema::TYPE_TEXT => 'text',
Schema::TYPE_SMALLINT => 'smallint', Schema::TYPE_SMALLINT => 'smallint',
Schema::TYPE_INTEGER => 'integer', Schema::TYPE_INTEGER => 'integer',
Schema::TYPE_BIGINT => 'bigint', Schema::TYPE_BIGINT => 'bigint',
Schema::TYPE_FLOAT => 'double precision', Schema::TYPE_FLOAT => 'double precision',
Schema::TYPE_DECIMAL => 'numeric(10,0)', Schema::TYPE_DECIMAL => 'numeric(10,0)',
Schema::TYPE_DATETIME => 'timestamp', Schema::TYPE_DATETIME => 'timestamp',
Schema::TYPE_TIMESTAMP => 'timestamp', Schema::TYPE_TIMESTAMP => 'timestamp',
Schema::TYPE_TIME => 'time', Schema::TYPE_TIME => 'time',
Schema::TYPE_DATE => 'date', Schema::TYPE_DATE => 'date',
Schema::TYPE_BINARY => 'bytea', Schema::TYPE_BINARY => 'bytea',
Schema::TYPE_BOOLEAN => 'boolean', Schema::TYPE_BOOLEAN => 'boolean',
Schema::TYPE_MONEY => 'numeric(19,4)', Schema::TYPE_MONEY => 'numeric(19,4)',
); );
} }

Loading…
Cancel
Save