Browse Source

Fixes #13577: `yii\db\QueryBuilder::truncateTable` should work consistent over all databases

tags/2.0.12
Bob Olde Hampsink 8 years ago committed by Alexander Makarov
parent
commit
30b7fc8dc1
  1. 2
      docs/guide-es/db-dao.md
  2. 2
      docs/guide-fr/db-dao.md
  3. 2
      docs/guide-ja/db-dao.md
  4. 2
      docs/guide-pl/db-active-record.md
  5. 2
      docs/guide-pt-BR/db-active-record.md
  6. 2
      docs/guide-ru/db-dao.md
  7. 2
      docs/guide-zh-CN/db-dao.md
  8. 2
      docs/guide/db-dao.md
  9. 1
      framework/CHANGELOG.md
  10. 11
      framework/db/pgsql/QueryBuilder.php

2
docs/guide-es/db-dao.md

@ -14,7 +14,7 @@ Yii DAO soporta las siguientes bases de datos:
- [MySQL](http://www.mysql.com/)
- [MariaDB](https://mariadb.com/)
- [SQLite](http://sqlite.org/)
- [PostgreSQL](http://www.postgresql.org/)
- [PostgreSQL](http://www.postgresql.org/): versión 8.4 o superior.
- [CUBRID](http://www.cubrid.org/): versión 9.3 o superior.
- [Oracle](http://www.oracle.com/us/products/database/overview/index.html)
- [MSSQL](https://www.microsoft.com/en-us/sqlserver/default.aspx): versión 2008 o superior.

2
docs/guide-fr/db-dao.md

@ -10,7 +10,7 @@ Les objets d'accès aux bases de données de Yii prennent en charge les bases de
- [MySQL](http://www.mysql.com/)
- [MariaDB](https://mariadb.com/)
- [SQLite](http://sqlite.org/)
- [PostgreSQL](http://www.postgresql.org/)
- [PostgreSQL](http://www.postgresql.org/): version 8.4 or higher.
- [CUBRID](http://www.cubrid.org/): version 9.3 or higher.
- [Oracle](http://www.oracle.com/us/products/database/overview/index.html)
- [MSSQL](https://www.microsoft.com/en-us/sqlserver/default.aspx): version 2008 or higher.

2
docs/guide-ja/db-dao.md

@ -13,7 +13,7 @@ Yii は下記の DBMS のサポートを内蔵しています。
- [MySQL](http://www.mysql.com/)
- [MariaDB](https://mariadb.com/)
- [SQLite](http://sqlite.org/)
- [PostgreSQL](http://www.postgresql.org/)
- [PostgreSQL](http://www.postgresql.org/): バージョン 8.4 以上。
- [CUBRID](http://www.cubrid.org/): バージョン 9.3 以上。
- [Oracle](http://www.oracle.com/us/products/database/overview/index.html)
- [MSSQL](https://www.microsoft.com/en-us/sqlserver/default.aspx): バージョン 2008 以上。

2
docs/guide-pl/db-active-record.md

@ -27,7 +27,7 @@ $db->createCommand('INSERT INTO `customer` (`name`) VALUES (:name)', [
Yii zapewnia wsparcie Active Record dla następujących typów relacyjnych baz danych:
* MySQL 4.1 lub nowszy: poprzez [[yii\db\ActiveRecord]]
* PostgreSQL 7.3 lub nowszy: poprzez [[yii\db\ActiveRecord]]
* PostgreSQL 8.4 lub nowszy: poprzez [[yii\db\ActiveRecord]]
* SQLite 2 i 3: poprzez [[yii\db\ActiveRecord]]
* Microsoft SQL Server 2008 lub nowszy: poprzez [[yii\db\ActiveRecord]]
* Oracle: poprzez [[yii\db\ActiveRecord]]

2
docs/guide-pt-BR/db-active-record.md

@ -22,7 +22,7 @@ $db->createCommand('INSERT INTO `customer` (`name`) VALUES (:name)', [
O Yii fornece suporte Active Record para os seguintes bancos de dados relacionais:
* MySQL 4.1 ou superior: via [[yii\db\ActiveRecord]]
* PostgreSQL 7.3 ou superior: via [[yii\db\ActiveRecord]]
* PostgreSQL 8.4 ou superior: via [[yii\db\ActiveRecord]]
* SQLite 2 e 3: via [[yii\db\ActiveRecord]]
* Microsoft SQL Server 2008 ou superior: via [[yii\db\ActiveRecord]]
* Oracle: via [[yii\db\ActiveRecord]]

2
docs/guide-ru/db-dao.md

@ -15,7 +15,7 @@ Yii DAO из коробки поддерживает следующие базы
- [MySQL](http://www.mysql.com/)
- [MariaDB](https://mariadb.com/)
- [SQLite](http://sqlite.org/)
- [PostgreSQL](http://www.postgresql.org/)
- [PostgreSQL](http://www.postgresql.org/): версии 8.4 или выше.
- [CUBRID](http://www.cubrid.org/): версии 9.3 или выше.
- [Oracle](http://www.oracle.com/us/products/database/overview/index.html)
- [MSSQL](https://www.microsoft.com/en-us/sqlserver/default.aspx): версии 2008 или выше.

2
docs/guide-zh-CN/db-dao.md

@ -7,7 +7,7 @@ Yii 默认支持以下数据库 (DBMS):
- [MySQL](http://www.mysql.com/)
- [MariaDB](https://mariadb.com/)
- [SQLite](http://sqlite.org/)
- [PostgreSQL](http://www.postgresql.org/)
- [PostgreSQL](http://www.postgresql.org/): 版本 >= 8.4
- [CUBRID](http://www.cubrid.org/): 版本 >= 9.3 . (由于PHP PDO 扩展的一个[bug](http://jira.cubrid.org/browse/APIS-658) 引用值会无效,所以你需要在 CUBRID的客户端和服务端都使用 9.3 )
- [Oracle](http://www.oracle.com/us/products/database/overview/index.html)
- [MSSQL](https://www.microsoft.com/en-us/sqlserver/default.aspx): 版本>=2005.

2
docs/guide/db-dao.md

@ -14,7 +14,7 @@ Yii DAO supports the following databases out of box:
- [MySQL](http://www.mysql.com/)
- [MariaDB](https://mariadb.com/)
- [SQLite](http://sqlite.org/)
- [PostgreSQL](http://www.postgresql.org/)
- [PostgreSQL](http://www.postgresql.org/): version 8.4 or higher
- [CUBRID](http://www.cubrid.org/): version 9.3 or higher.
- [Oracle](http://www.oracle.com/us/products/database/overview/index.html)
- [MSSQL](https://www.microsoft.com/en-us/sqlserver/default.aspx): version 2008 or higher.

1
framework/CHANGELOG.md

@ -12,6 +12,7 @@ Yii Framework 2 Change Log
- Bug #11230: Include `defaultRoles` in `yii\rbac\DbManager->getRolesByUser()` results (developeruz)
- Bug #13343: Fixed `yii\i18n\Formatter::asTime()` to process time-only values without time zone conversion (bizley)
- Bug #11404: `yii\base\Model::loadMultiple()` returns true even if `yii\base\Model::load()` returns false (zvook)
- Bug #13577: `yii\db\QueryBuilder::truncateTable` should work consistent over all databases (boboldehampsink)
- Enh #13577: Implemented `yii\db\mssql\QueryBuilder::resetSequence()` (boboldehampsink)
- Bug #13513: Fixed RBAC migration to work correctly on Oracle DBMS (silverfire)
- Enh #13550: Refactored unset call order in `yii\di\ServiceLocator::set()` (Lanrik)

11
framework/db/pgsql/QueryBuilder.php

@ -206,6 +206,17 @@ class QueryBuilder extends \yii\db\QueryBuilder
}
/**
* Builds a SQL statement for truncating a DB table.
* Explicitly restarts identity for PGSQL to be consistent with other databases which all do this by default.
* @param string $table the table to be truncated. The name will be properly quoted by the method.
* @return string the SQL statement for truncating a DB table.
*/
public function truncateTable($table)
{
return 'TRUNCATE TABLE ' . $this->db->quoteTableName($table) . ' RESTART IDENTITY';
}
/**
* Builds a SQL statement for changing the definition of a column.
* @param string $table the table whose column is to be changed. The table name will be properly quoted by the method.
* @param string $column the name of the column to be changed. The name will be properly quoted by the method.

Loading…
Cancel
Save