diff --git a/.gitignore b/.gitignore index 77c9164..2e30075 100644 --- a/.gitignore +++ b/.gitignore @@ -18,8 +18,6 @@ Thumbs.db # composer vendor dir /vendor -# cubrid install dir -/cubrid # composer itself is not needed composer.phar diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a0f20c4..066a740 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -42,7 +42,7 @@ db: - tests/full script: - docker-compose up --build -d - - docker-compose run --rm php vendor/bin/phpunit -v --group db --exclude caching,mysql,pgsql,mssql,cubrid,oci + - docker-compose run --rm php vendor/bin/phpunit -v --group db --exclude caching,mysql,pgsql mysql: @@ -71,20 +71,6 @@ pgsql: - docker-compose run --rm php vendor/bin/phpunit -v --group pgsql -cubrid: - stage: test - only: - - tests/cubrid - - tests/extra - script: - - cd cubrid - - docker-compose up --build -d - # wait for db (retry X times) - - docker-compose run --rm php bash -c 'while [ true ]; do curl cubrid:1523; if [ $? == 56 ]; then break; fi; ((c++)) && ((c==20)) && break; sleep 3; done' - - sleep 5 - - docker-compose run --rm php /project/vendor/bin/phpunit -v --group cubrid - - mssql: stage: test only: @@ -110,5 +96,5 @@ travis: - docker-compose up --build -d # wait for dbs ... - sleep 10 - - docker-compose run --rm php vendor/bin/phpunit -v --exclude mssql,cubrid,oci,wincache,xcache,zenddata,cubrid + - docker-compose run --rm php vendor/bin/phpunit -v --exclude wincache,xcache,zenddata diff --git a/.travis.yml b/.travis.yml index 048c3f1..0276ecd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -131,7 +131,7 @@ script: # PHP tests - | if [ $TASK_TESTS_PHP == 1 ]; then - vendor/bin/phpunit --verbose $PHPUNIT_FLAGS --exclude-group mssql,oci,wincache,xcache,zenddata,cubrid + vendor/bin/phpunit --verbose $PHPUNIT_FLAGS --exclude-group wincache,xcache,zenddata fi after_script: diff --git a/docs/guide-es/db-dao.md b/docs/guide-es/db-dao.md index 309a796..bb2f554 100644 --- a/docs/guide-es/db-dao.md +++ b/docs/guide-es/db-dao.md @@ -15,7 +15,6 @@ Yii DAO soporta las siguientes bases de datos: - [MariaDB](https://mariadb.com/) - [SQLite](http://sqlite.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. @@ -65,7 +64,6 @@ propiedad [[yii\db\Connection::dsn|dsn]]. El formato del DSN varia para cada dif * MySQL, MariaDB: `mysql:host=localhost;dbname=mydatabase` * SQLite: `sqlite:/path/to/database/file` * PostgreSQL: `pgsql:host=localhost;port=5432;dbname=mydatabase` -* CUBRID: `cubrid:dbname=demodb;host=localhost;port=33000` * MS SQL Server (mediante sqlsrv driver): `sqlsrv:Server=localhost;Database=mydatabase` * MS SQL Server (mediante dblib driver): `dblib:host=localhost;dbname=mydatabase` * MS SQL Server (mediante mssql driver): `mssql:host=localhost;dbname=mydatabase` diff --git a/docs/guide-fr/db-active-record.md b/docs/guide-fr/db-active-record.md index 542c685..ec7f822 100644 --- a/docs/guide-fr/db-active-record.md +++ b/docs/guide-fr/db-active-record.md @@ -26,7 +26,6 @@ Yii assure la prise en charge de l'enregistrement actif (*Active Record*) pour l * SQLite 2 et 3 : via [[yii\db\ActiveRecord]] * Microsoft SQL Server 2008 ou versions postérieures : via [[yii\db\ActiveRecord]] * Oracle : via [[yii\db\ActiveRecord]] -* CUBRID 9.3 ou versions postérieures : via [[yii\db\ActiveRecord]] (Notez que, à cause d'un [bogue](http://jira.cubrid.org/browse/APIS-658) dans l'extension CUBRID 9:3, l'entourage des valeurs par des marques de citation ne fonctionne pas, c'est pourquoi vous avez besoin de CUBRID 9.3 à la fois comme client et comme serveur) * Sphinx : via [[yii\sphinx\ActiveRecord]], requiert l'extension `yii2-sphinx` * ElasticSearch : via [[yii\elasticsearch\ActiveRecord]], requiert l'extension `yii2-elasticsearch` diff --git a/docs/guide-fr/db-dao.md b/docs/guide-fr/db-dao.md index af899f1..8b11dc3 100644 --- a/docs/guide-fr/db-dao.md +++ b/docs/guide-fr/db-dao.md @@ -11,7 +11,6 @@ Les objets d'accès aux bases de données de Yii prennent en charge les bases de - [MariaDB](https://mariadb.com/) - [SQLite](http://sqlite.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. @@ -57,7 +56,6 @@ Lorsque vous conifigurez une connexion à une base de données, vous devez toujo * MySQL, MariaDB: `mysql:host=localhost;dbname=mydatabase` * SQLite: `sqlite:/path/to/database/file` * PostgreSQL: `pgsql:host=localhost;port=5432;dbname=mydatabase` -* CUBRID: `cubrid:dbname=demodb;host=localhost;port=33000` * MS SQL Server (via sqlsrv driver): `sqlsrv:Server=localhost;Database=mydatabase` * MS SQL Server (via dblib driver): `dblib:host=localhost;dbname=mydatabase` * MS SQL Server (via mssql driver): `mssql:host=localhost;dbname=mydatabase` diff --git a/docs/guide-pl/db-active-record.md b/docs/guide-pl/db-active-record.md index 2d2a686..f8fa9af 100644 --- a/docs/guide-pl/db-active-record.md +++ b/docs/guide-pl/db-active-record.md @@ -31,9 +31,6 @@ Yii zapewnia wsparcie Active Record dla następujących typów relacyjnych baz d * SQLite 2 i 3: poprzez [[yii\db\ActiveRecord]] * Microsoft SQL Server 2008 lub nowszy: poprzez [[yii\db\ActiveRecord]] * Oracle: poprzez [[yii\db\ActiveRecord]] -* CUBRID 9.3 lub nowszy: poprzez [[yii\db\ActiveRecord]] (zwróć uwagę, że z powodu [błędu](http://jira.cubrid.org/browse/APIS-658) - w rozszerzeniu PDO cubrid, umieszczanie wartości w cudzysłowie nie będzie działać, zatem wymagane jest zainstalowanie CUBRID 9.3 zarówno - jako klienta jak i serwer) * Sphinx: poprzez [[yii\sphinx\ActiveRecord]], wymaga rozszerzenia `yii2-sphinx` * ElasticSearch: poprzez [[yii\elasticsearch\ActiveRecord]], wymaga rozszerzenia `yii2-elasticsearch` diff --git a/docs/guide-pt-BR/db-active-record.md b/docs/guide-pt-BR/db-active-record.md index 368a781..d56c950 100644 --- a/docs/guide-pt-BR/db-active-record.md +++ b/docs/guide-pt-BR/db-active-record.md @@ -26,7 +26,6 @@ O Yii fornece suporte Active Record para os seguintes bancos de dados relacionai * SQLite 2 e 3: via [[yii\db\ActiveRecord]] * Microsoft SQL Server 2008 ou superior: via [[yii\db\ActiveRecord]] * Oracle: via [[yii\db\ActiveRecord]] -* CUBRID 9.3 ou superior: via [[yii\db\ActiveRecord]] (observe que devido a um [bug](http://jira.cubrid.org/browse/APIS-658) na extensão PDO do cubrid, o tratamento de aspas não funciona, então você precisa do CUBRID 9.3 como o cliente, bem como servidor) * Sphinx: via [[yii\sphinx\ActiveRecord]], requer a extensão `yii2-sphinx` * ElasticSearch: via [[yii\elasticsearch\ActiveRecord]], requer a extensão `yii2-elasticsearch`. Adicionalmente, o Yii também suporta o uso de Active Record com os seguintes bancos de dados NoSQL: diff --git a/docs/guide-ru/db-active-record.md b/docs/guide-ru/db-active-record.md index a1706f9..da4bbed 100644 --- a/docs/guide-ru/db-active-record.md +++ b/docs/guide-ru/db-active-record.md @@ -32,9 +32,6 @@ Yii поддерживает работу с Active Record для следующ * SQLite 2 и 3: посредством [[yii\db\ActiveRecord]] * Microsoft SQL Server 2008 и выше: посредством [[yii\db\ActiveRecord]] * Oracle: посредством [[yii\db\ActiveRecord]] -* CUBRID 9.3 и выше: посредством [[yii\db\ActiveRecord]] (Имейте ввиду, что вследствие - [бага](http://jira.cubrid.org/browse/APIS-658) в PDO-расширении для CUBRID, заключение значений в кавычки не работает, - поэтому необходимо использовать CUBRID версии 9.3 как на клиентской стороне, так и на сервере) * Sphinx: посредством [[yii\sphinx\ActiveRecord]], потребуется расширение `yii2-sphinx` * ElasticSearch: посредством [[yii\elasticsearch\ActiveRecord]], потребуется расширение `yii2-elasticsearch` diff --git a/docs/guide-ru/db-dao.md b/docs/guide-ru/db-dao.md index 15f4b95..91c7147 100644 --- a/docs/guide-ru/db-dao.md +++ b/docs/guide-ru/db-dao.md @@ -16,7 +16,6 @@ Yii DAO из коробки поддерживает следующие базы - [MariaDB](https://mariadb.com/) - [SQLite](http://sqlite.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 или выше. @@ -68,7 +67,6 @@ return [ * MySQL, MariaDB: `mysql:host=localhost;dbname=mydatabase` * SQLite: `sqlite:/path/to/database/file` * PostgreSQL: `pgsql:host=localhost;port=5432;dbname=mydatabase` -* CUBRID: `cubrid:dbname=demodb;host=localhost;port=33000` * MS SQL Server (via sqlsrv driver): `sqlsrv:Server=localhost;Database=mydatabase` * MS SQL Server (via dblib driver): `dblib:host=localhost;dbname=mydatabase` * MS SQL Server (via mssql driver): `mssql:host=localhost;dbname=mydatabase` diff --git a/docs/guide/db-active-record.md b/docs/guide/db-active-record.md index e1d2293..128860b 100644 --- a/docs/guide/db-active-record.md +++ b/docs/guide/db-active-record.md @@ -34,8 +34,6 @@ Yii provides the Active Record support for the following relational databases: * SQLite 2 and 3: via [[yii\db\ActiveRecord]] * Microsoft SQL Server 2008 or later: via [[yii\db\ActiveRecord]] * Oracle: via [[yii\db\ActiveRecord]] -* CUBRID 9.3 or later: via [[yii\db\ActiveRecord]] (Note that due to a [bug](http://jira.cubrid.org/browse/APIS-658) in - the cubrid PDO extension, quoting of values will not work, so you need CUBRID 9.3 as the client as well as the server) * Sphinx: via [[yii\sphinx\ActiveRecord]], requires the `yii2-sphinx` extension * ElasticSearch: via [[yii\elasticsearch\ActiveRecord]], requires the `yii2-elasticsearch` extension diff --git a/docs/guide/db-dao.md b/docs/guide/db-dao.md index da4f3ec..958d5e0 100644 --- a/docs/guide/db-dao.md +++ b/docs/guide/db-dao.md @@ -15,7 +15,6 @@ Yii DAO supports the following databases out of box: - [MariaDB](https://mariadb.com/) - [SQLite](http://sqlite.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. @@ -67,7 +66,6 @@ for more details. Below are some examples: * MySQL, MariaDB: `mysql:host=localhost;dbname=mydatabase` * SQLite: `sqlite:/path/to/database/file` * PostgreSQL: `pgsql:host=localhost;port=5432;dbname=mydatabase` -* CUBRID: `cubrid:dbname=demodb;host=localhost;port=33000` * MS SQL Server (via sqlsrv driver): `sqlsrv:Server=localhost;Database=mydatabase` * MS SQL Server (via dblib driver): `dblib:host=localhost;dbname=mydatabase` * MS SQL Server (via mssql driver): `mssql:host=localhost;dbname=mydatabase` diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 99387ea..d953889 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -26,6 +26,7 @@ Yii Framework 2 Change Log - Chg: Removed methods marked as deprecated in 2.0.x (samdark) - Chg #8452: Packages 'captcha', 'jquery', 'rest', 'mssql' and 'oracle' have been extracted into extensions (klimov-paul) - Chg #15383: PJAX support removed (klimov-paul) +- Chg #15383: CUBRID database support removed (klimov-paul) - Chg #14784: Signature of `yii\web\RequestParserInterface::parse()` changed to accept `yii\web\Request` instance as a sole argument (klimov-paul) - Chg #10771: Consistent behavior of `run()` method in all framework widgets. All return the result now for better extensibility (pkirill99, cebe) - Chg #11397: Minimum required version of PHP is 7.1 now (samdark) diff --git a/framework/UPGRADE.md b/framework/UPGRADE.md index a1e6df1..6bf0fba 100644 --- a/framework/UPGRADE.md +++ b/framework/UPGRADE.md @@ -76,6 +76,8 @@ Upgrade from Yii 2.0.x Include it in your composer.json if you use it. * Oracle DB package has been moved into separate extension https://github.com/yiisoft/yii2-oracle. Include it in your composer.json if you use it. +* CUBRID support has been removed, package `yii\db\cubrid\*` is no longer available. + If you need to use CUBRID further you should create your own integration for it. * Masked input field widget was moved into separate extension https://github.com/yiisoft/yii2-maskedinput. Include it in your composer.json if you use it. * PJAX support has been removed: widget `yii\widget\Pjax`, method `yii\web\Request::getIsPjax()`, PJAX related checks and diff --git a/framework/db/ColumnSchemaBuilder.php b/framework/db/ColumnSchemaBuilder.php index edb28ef..469076e 100644 --- a/framework/db/ColumnSchemaBuilder.php +++ b/framework/db/ColumnSchemaBuilder.php @@ -224,7 +224,7 @@ class ColumnSchemaBuilder extends BaseObject /** * Adds an `AFTER` constraint to the column. - * Note: MySQL, Oracle and Cubrid support only. + * Note: MySQL, Oracle support only. * @param string $after the column after which $this column will be added. * @return $this * @since 2.0.8 @@ -237,7 +237,7 @@ class ColumnSchemaBuilder extends BaseObject /** * Adds an `FIRST` constraint to the column. - * Note: MySQL, Oracle and Cubrid support only. + * Note: MySQL, Oracle support only. * @return $this * @since 2.0.8 */ diff --git a/framework/db/Connection.php b/framework/db/Connection.php index 8dc243d..484f7ca 100644 --- a/framework/db/Connection.php +++ b/framework/db/Connection.php @@ -239,7 +239,7 @@ class Connection extends Component public $queryCache = 'cache'; /** * @var string the charset used for database connection. The property is only used - * for MySQL, PostgreSQL and CUBRID databases. Defaults to null, meaning using default charset + * for MySQL and PostgreSQL databases. Defaults to null, meaning using default charset * as configured by the database. * * For Oracle Database, the charset must be specified in the [[dsn]], for example for UTF-8 by appending `;charset=UTF-8` @@ -279,7 +279,6 @@ class Connection extends Component 'mysql' => mysql\Schema::class, // MySQL 'sqlite' => sqlite\Schema::class, // sqlite 3 'sqlite2' => sqlite\Schema::class, // sqlite 2 - 'cubrid' => cubrid\Schema::class, // CUBRID ]; /** * @var string Custom PDO wrapper class. If not set, it will use [[PDO]] or [[\yii\db\mssql\PDO]] when MSSQL is used. @@ -316,7 +315,6 @@ class Connection extends Component 'oci' => 'yii\db\Command', // Oracle driver 'mssql' => 'yii\db\Command', // older MSSQL driver on MS Windows hosts 'dblib' => 'yii\db\Command', // dblib drivers on GNU/Linux (and maybe other OSes) hosts - 'cubrid' => 'yii\db\Command', // CUBRID ]; /** * @var bool whether to enable [savepoint](http://en.wikipedia.org/wiki/Savepoint). @@ -689,7 +687,7 @@ class Connection extends Component if ($this->emulatePrepare !== null && constant('PDO::ATTR_EMULATE_PREPARES')) { $this->pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, $this->emulatePrepare); } - if ($this->charset !== null && in_array($this->getDriverName(), ['pgsql', 'mysql', 'mysqli', 'cubrid'], true)) { + if ($this->charset !== null && in_array($this->getDriverName(), ['pgsql', 'mysql', 'mysqli'], true)) { $this->pdo->exec('SET NAMES ' . $this->pdo->quote($this->charset)); } $this->trigger(self::EVENT_AFTER_OPEN); diff --git a/framework/db/cubrid/ColumnSchemaBuilder.php b/framework/db/cubrid/ColumnSchemaBuilder.php deleted file mode 100644 index 1b077ec..0000000 --- a/framework/db/cubrid/ColumnSchemaBuilder.php +++ /dev/null @@ -1,72 +0,0 @@ - - * @since 2.0.8 - */ -class ColumnSchemaBuilder extends AbstractColumnSchemaBuilder -{ - /** - * {@inheritdoc} - */ - protected function buildUnsignedString() - { - return $this->isUnsigned ? ' UNSIGNED' : ''; - } - - /** - * {@inheritdoc} - */ - protected function buildAfterString() - { - return $this->after !== null ? - ' AFTER ' . $this->db->quoteColumnName($this->after) : - ''; - } - - /** - * {@inheritdoc} - */ - protected function buildFirstString() - { - return $this->isFirst ? ' FIRST' : ''; - } - - /** - * {@inheritdoc} - */ - protected function buildCommentString() - { - return $this->comment !== null ? ' COMMENT ' . $this->db->quoteValue($this->comment) : ''; - } - - /** - * {@inheritdoc} - */ - public function __toString() - { - switch ($this->getTypeCategory()) { - case self::CATEGORY_PK: - $format = '{type}{check}{comment}{append}{pos}'; - break; - case self::CATEGORY_NUMERIC: - $format = '{type}{length}{unsigned}{notnull}{unique}{default}{check}{comment}{append}{pos}'; - break; - default: - $format = '{type}{length}{notnull}{unique}{default}{check}{comment}{append}{pos}'; - } - - return $this->buildCompleteString($format); - } -} diff --git a/framework/db/cubrid/QueryBuilder.php b/framework/db/cubrid/QueryBuilder.php deleted file mode 100644 index 1a7ba19..0000000 --- a/framework/db/cubrid/QueryBuilder.php +++ /dev/null @@ -1,290 +0,0 @@ - - * @since 2.0 - */ -class QueryBuilder extends \yii\db\QueryBuilder -{ - /** - * @var array mapping from abstract column types (keys) to physical column types (values). - */ - public $typeMap = [ - Schema::TYPE_PK => 'int NOT NULL AUTO_INCREMENT PRIMARY KEY', - Schema::TYPE_UPK => 'int UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY', - Schema::TYPE_BIGPK => 'bigint NOT NULL AUTO_INCREMENT PRIMARY KEY', - Schema::TYPE_UBIGPK => 'bigint UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY', - Schema::TYPE_CHAR => 'char(1)', - Schema::TYPE_STRING => 'varchar(255)', - Schema::TYPE_TEXT => 'varchar', - Schema::TYPE_TINYINT => 'smallint', - Schema::TYPE_SMALLINT => 'smallint', - Schema::TYPE_INTEGER => 'int', - Schema::TYPE_BIGINT => 'bigint', - Schema::TYPE_FLOAT => 'float(7)', - Schema::TYPE_DOUBLE => 'double(15)', - Schema::TYPE_DECIMAL => 'decimal(10,0)', - Schema::TYPE_DATETIME => 'datetime', - Schema::TYPE_TIMESTAMP => 'timestamp', - Schema::TYPE_TIME => 'time', - Schema::TYPE_DATE => 'date', - Schema::TYPE_BINARY => 'blob', - Schema::TYPE_BOOLEAN => 'smallint', - Schema::TYPE_MONEY => 'decimal(19,4)', - ]; - - - /** - * {@inheritdoc} - */ - protected function defaultExpressionBuilders() - { - return array_merge(parent::defaultExpressionBuilders(), [ - 'yii\db\conditions\LikeCondition' => 'yii\db\cubrid\conditions\LikeConditionBuilder', - ]); - } - - /** - * {@inheritdoc} - * @see https://www.cubrid.org/manual/en/9.3.0/sql/query/merge.html - */ - public function upsert($table, $insertColumns, $updateColumns, &$params) - { - /** @var Constraint[] $constraints */ - [$uniqueNames, $insertNames, $updateNames] = $this->prepareUpsertColumns($table, $insertColumns, $updateColumns, $constraints); - if (empty($uniqueNames)) { - return $this->insert($table, $insertColumns, $params); - } - - $onCondition = ['or']; - $quotedTableName = $this->db->quoteTableName($table); - foreach ($constraints as $constraint) { - $constraintCondition = ['and']; - foreach ($constraint->columnNames as $name) { - $quotedName = $this->db->quoteColumnName($name); - $constraintCondition[] = "$quotedTableName.$quotedName=\"EXCLUDED\".$quotedName"; - } - $onCondition[] = $constraintCondition; - } - $on = $this->buildCondition($onCondition, $params); - [, $placeholders, $values, $params] = $this->prepareInsertValues($table, $insertColumns, $params); - $mergeSql = 'MERGE INTO ' . $this->db->quoteTableName($table) . ' ' - . 'USING (' . (!empty($placeholders) ? 'VALUES (' . implode(', ', $placeholders) . ')' : ltrim($values, ' ')) . ') AS "EXCLUDED" (' . implode(', ', $insertNames) . ') ' - . "ON ($on)"; - $insertValues = []; - foreach ($insertNames as $name) { - $quotedName = $this->db->quoteColumnName($name); - if (strrpos($quotedName, '.') === false) { - $quotedName = '"EXCLUDED".' . $quotedName; - } - $insertValues[] = $quotedName; - } - $insertSql = 'INSERT (' . implode(', ', $insertNames) . ')' - . ' VALUES (' . implode(', ', $insertValues) . ')'; - if ($updateColumns === false) { - return "$mergeSql WHEN NOT MATCHED THEN $insertSql"; - } - - if ($updateColumns === true) { - $updateColumns = []; - foreach ($updateNames as $name) { - $quotedName = $this->db->quoteColumnName($name); - if (strrpos($quotedName, '.') === false) { - $quotedName = '"EXCLUDED".' . $quotedName; - } - $updateColumns[$name] = new Expression($quotedName); - } - } - [$updates, $params] = $this->prepareUpdateSets($table, $updateColumns, $params); - $updateSql = 'UPDATE SET ' . implode(', ', $updates); - return "$mergeSql WHEN MATCHED THEN $updateSql WHEN NOT MATCHED THEN $insertSql"; - } - - /** - * 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 - * will have the specified value or 1. - * @param string $tableName the name of the table whose primary key sequence will be reset - * @param mixed $value the value for the primary key of the next new row inserted. If this is not set, - * the next new row's primary key will have a value 1. - * @return string the SQL statement for resetting sequence - * @throws InvalidArgumentException if the table does not exist or there is no sequence associated with the table. - */ - public function resetSequence($tableName, $value = null) - { - $table = $this->db->getTableSchema($tableName); - if ($table !== null && $table->sequenceName !== null) { - $tableName = $this->db->quoteTableName($tableName); - if ($value === null) { - $key = reset($table->primaryKey); - $value = (int) $this->db->createCommand("SELECT MAX(`$key`) FROM " . $this->db->schema->quoteTableName($tableName))->queryScalar() + 1; - } else { - $value = (int) $value; - } - - return 'ALTER TABLE ' . $this->db->schema->quoteTableName($tableName) . " AUTO_INCREMENT=$value;"; - } elseif ($table === null) { - throw new InvalidArgumentException("Table not found: $tableName"); - } - - throw new InvalidArgumentException("There is not sequence associated with table '$tableName'."); - } - - /** - * {@inheritdoc} - */ - public function buildLimit($limit, $offset) - { - $sql = ''; - // limit is not optional in CUBRID - // http://www.cubrid.org/manual/90/en/LIMIT%20Clause - // "You can specify a very big integer for row_count to display to the last row, starting from a specific row." - if ($this->hasLimit($limit)) { - $sql = 'LIMIT ' . $limit; - if ($this->hasOffset($offset)) { - $sql .= ' OFFSET ' . $offset; - } - } elseif ($this->hasOffset($offset)) { - $sql = "LIMIT 9223372036854775807 OFFSET $offset"; // 2^63-1 - } - - return $sql; - } - - /** - * {@inheritdoc} - * @since 2.0.8 - */ - public function selectExists($rawSql) - { - return 'SELECT CASE WHEN EXISTS(' . $rawSql . ') THEN 1 ELSE 0 END'; - } - - /** - * {@inheritdoc} - * @see http://www.cubrid.org/manual/93/en/sql/schema/table.html#drop-index-clause - */ - public function dropIndex($name, $table) - { - /** @var Schema $schema */ - $schema = $this->db->getSchema(); - foreach ($schema->getTableUniques($table) as $unique) { - if ($unique->name === $name) { - return $this->dropUnique($name, $table); - } - } - - return 'DROP INDEX ' . $this->db->quoteTableName($name) . ' ON ' . $this->db->quoteTableName($table); - } - - /** - * {@inheritdoc} - * @throws NotSupportedException this is not supported by CUBRID. - */ - public function addCheck($name, $table, $expression) - { - throw new NotSupportedException(__METHOD__ . ' is not supported by CUBRID.'); - } - - /** - * {@inheritdoc} - * @throws NotSupportedException this is not supported by CUBRID. - */ - public function dropCheck($name, $table) - { - throw new NotSupportedException(__METHOD__ . ' is not supported by CUBRID.'); - } - - /** - * {@inheritdoc} - * @since 2.0.8 - */ - public function addCommentOnColumn($table, $column, $comment) - { - $definition = $this->getColumnDefinition($table, $column); - $definition = trim(preg_replace("/COMMENT '(.*?)'/i", '', $definition)); - - return 'ALTER TABLE ' . $this->db->quoteTableName($table) - . ' CHANGE ' . $this->db->quoteColumnName($column) - . ' ' . $this->db->quoteColumnName($column) - . (empty($definition) ? '' : ' ' . $definition) - . ' COMMENT ' . $this->db->quoteValue($comment); - } - - /** - * {@inheritdoc} - * @since 2.0.8 - */ - public function addCommentOnTable($table, $comment) - { - return 'ALTER TABLE ' . $this->db->quoteTableName($table) . ' COMMENT ' . $this->db->quoteValue($comment); - } - - /** - * {@inheritdoc} - * @since 2.0.8 - */ - public function dropCommentFromColumn($table, $column) - { - return $this->addCommentOnColumn($table, $column, ''); - } - - /** - * {@inheritdoc} - * @since 2.0.8 - */ - public function dropCommentFromTable($table) - { - return $this->addCommentOnTable($table, ''); - } - - - /** - * Gets column definition. - * - * @param string $table table name - * @param string $column column name - * @return null|string the column definition - * @throws Exception in case when table does not contain column - * @since 2.0.8 - */ - private function getColumnDefinition($table, $column) - { - $row = $this->db->createCommand('SHOW CREATE TABLE ' . $this->db->quoteTableName($table))->queryOne(); - if ($row === false) { - throw new Exception("Unable to find column '$column' in table '$table'."); - } - if (isset($row['Create Table'])) { - $sql = $row['Create Table']; - } else { - $row = array_values($row); - $sql = $row[1]; - } - $sql = preg_replace('/^[^(]+\((.*)\).*$/', '\1', $sql); - $sql = str_replace(', [', ",\n[", $sql); - if (preg_match_all('/^\s*\[(.*?)\]\s+(.*?),?$/m', $sql, $matches)) { - foreach ($matches[1] as $i => $c) { - if ($c === $column) { - return $matches[2][$i]; - } - } - } - - return null; - } -} diff --git a/framework/db/cubrid/Schema.php b/framework/db/cubrid/Schema.php deleted file mode 100644 index 81ed900..0000000 --- a/framework/db/cubrid/Schema.php +++ /dev/null @@ -1,418 +0,0 @@ - - * @since 2.0 - */ -class Schema extends \yii\db\Schema implements ConstraintFinderInterface -{ - use ConstraintFinderTrait; - - /** - * @var array mapping from physical column types (keys) to abstract column types (values) - * Please refer to [CUBRID manual](http://www.cubrid.org/manual/91/en/sql/datatype.html) for - * details on data types. - */ - public $typeMap = [ - // Numeric data types - 'short' => self::TYPE_SMALLINT, - 'smallint' => self::TYPE_SMALLINT, - 'int' => self::TYPE_INTEGER, - 'integer' => self::TYPE_INTEGER, - 'bigint' => self::TYPE_BIGINT, - 'numeric' => self::TYPE_DECIMAL, - 'decimal' => self::TYPE_DECIMAL, - 'float' => self::TYPE_FLOAT, - 'real' => self::TYPE_FLOAT, - 'double' => self::TYPE_DOUBLE, - 'double precision' => self::TYPE_DOUBLE, - 'monetary' => self::TYPE_MONEY, - // Date/Time data types - 'date' => self::TYPE_DATE, - 'time' => self::TYPE_TIME, - 'timestamp' => self::TYPE_TIMESTAMP, - 'datetime' => self::TYPE_DATETIME, - // String data types - 'char' => self::TYPE_CHAR, - 'varchar' => self::TYPE_STRING, - 'char varying' => self::TYPE_STRING, - 'nchar' => self::TYPE_CHAR, - 'nchar varying' => self::TYPE_STRING, - 'string' => self::TYPE_STRING, - // BLOB/CLOB data types - 'blob' => self::TYPE_BINARY, - 'clob' => self::TYPE_BINARY, - // Bit string data types - 'bit' => self::TYPE_INTEGER, - 'bit varying' => self::TYPE_INTEGER, - // Collection data types (considered strings for now) - 'set' => self::TYPE_STRING, - 'multiset' => self::TYPE_STRING, - 'list' => self::TYPE_STRING, - 'sequence' => self::TYPE_STRING, - 'enum' => self::TYPE_STRING, - ]; - /** - * @var array map of DB errors and corresponding exceptions - * If left part is found in DB error message exception class from the right part is used. - */ - public $exceptionMap = [ - 'Operation would have caused one or more unique constraint violations' => IntegrityException::class, - ]; - - /** - * {@inheritdoc} - */ - protected $tableQuoteCharacter = '"'; - - - /** - * {@inheritdoc} - */ - protected function findTableNames($schema = '') - { - $pdo = $this->db->getSlavePdo(); - $tables = $pdo->cubrid_schema(\PDO::CUBRID_SCH_TABLE); - $tableNames = []; - foreach ($tables as $table) { - // do not list system tables - if ($table['TYPE'] != 0) { - $tableNames[] = $table['NAME']; - } - } - - return $tableNames; - } - - /** - * {@inheritdoc} - */ - protected function loadTableSchema($name) - { - $pdo = $this->db->getSlavePdo(); - - $tableInfo = $pdo->cubrid_schema(\PDO::CUBRID_SCH_TABLE, $name); - - if (!isset($tableInfo[0]['NAME'])) { - return null; - } - - $table = new TableSchema(); - $table->fullName = $table->name = $tableInfo[0]['NAME']; - - $sql = 'SHOW FULL COLUMNS FROM ' . $this->quoteSimpleTableName($table->name); - $columns = $this->db->createCommand($sql)->queryAll(); - - foreach ($columns as $info) { - $column = $this->loadColumnSchema($info); - $table->columns[$column->name] = $column; - } - - $primaryKeys = $pdo->cubrid_schema(\PDO::CUBRID_SCH_PRIMARY_KEY, $table->name); - foreach ($primaryKeys as $key) { - $column = $table->columns[$key['ATTR_NAME']]; - $column->isPrimaryKey = true; - $table->primaryKey[] = $column->name; - if ($column->autoIncrement) { - $table->sequenceName = ''; - } - } - - $foreignKeys = $pdo->cubrid_schema(\PDO::CUBRID_SCH_IMPORTED_KEYS, $table->name); - foreach ($foreignKeys as $key) { - if (isset($table->foreignKeys[$key['FK_NAME']])) { - $table->foreignKeys[$key['FK_NAME']][$key['FKCOLUMN_NAME']] = $key['PKCOLUMN_NAME']; - } else { - $table->foreignKeys[$key['FK_NAME']] = [ - $key['PKTABLE_NAME'], - $key['FKCOLUMN_NAME'] => $key['PKCOLUMN_NAME'], - ]; - } - } - - return $table; - } - - /** - * {@inheritdoc} - */ - protected function loadTablePrimaryKey($tableName) - { - $primaryKey = $this->db->getSlavePdo()->cubrid_schema(\PDO::CUBRID_SCH_PRIMARY_KEY, $tableName); - if (empty($primaryKey)) { - return null; - } - - ArrayHelper::multisort($primaryKey, 'KEY_SEQ', SORT_ASC, SORT_NUMERIC); - return new Constraint([ - 'name' => $primaryKey[0]['KEY_NAME'], - 'columnNames' => ArrayHelper::getColumn($primaryKey, 'ATTR_NAME'), - ]); - } - - /** - * {@inheritdoc} - */ - protected function loadTableForeignKeys($tableName) - { - static $actionTypes = [ - 0 => 'CASCADE', - 1 => 'RESTRICT', - 2 => 'NO ACTION', - 3 => 'SET NULL', - ]; - - $foreignKeys = $this->db->getSlavePdo()->cubrid_schema(\PDO::CUBRID_SCH_IMPORTED_KEYS, $tableName); - $foreignKeys = ArrayHelper::index($foreignKeys, null, 'FK_NAME'); - ArrayHelper::multisort($foreignKeys, 'KEY_SEQ', SORT_ASC, SORT_NUMERIC); - $result = []; - foreach ($foreignKeys as $name => $foreignKey) { - $result[] = new ForeignKeyConstraint([ - 'name' => $name, - 'columnNames' => ArrayHelper::getColumn($foreignKey, 'FKCOLUMN_NAME'), - 'foreignTableName' => $foreignKey[0]['PKTABLE_NAME'], - 'foreignColumnNames' => ArrayHelper::getColumn($foreignKey, 'PKCOLUMN_NAME'), - 'onDelete' => isset($actionTypes[$foreignKey[0]['DELETE_RULE']]) ? $actionTypes[$foreignKey[0]['DELETE_RULE']] : null, - 'onUpdate' => isset($actionTypes[$foreignKey[0]['UPDATE_RULE']]) ? $actionTypes[$foreignKey[0]['UPDATE_RULE']] : null, - ]); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - protected function loadTableIndexes($tableName) - { - return $this->loadTableConstraints($tableName, 'indexes'); - } - - /** - * {@inheritdoc} - */ - protected function loadTableUniques($tableName) - { - return $this->loadTableConstraints($tableName, 'uniques'); - } - - /** - * {@inheritdoc} - * @throws NotSupportedException if this method is called. - */ - protected function loadTableChecks($tableName) - { - throw new NotSupportedException('CUBRID does not support check constraints.'); - } - - /** - * {@inheritdoc} - * @throws NotSupportedException if this method is called. - */ - protected function loadTableDefaultValues($tableName) - { - throw new NotSupportedException('CUBRID does not support default value constraints.'); - } - - /** - * {@inheritdoc} - */ - public function releaseSavepoint($name) - { - // does nothing as cubrid does not support this - } - - /** - * Creates a query builder for the CUBRID database. - * @return QueryBuilder query builder instance - */ - public function createQueryBuilder() - { - return new QueryBuilder($this->db); - } - - /** - * Loads the column information into a [[ColumnSchema]] object. - * @param array $info column information - * @return \yii\db\ColumnSchema the column schema object - */ - protected function loadColumnSchema($info) - { - $column = $this->createColumnSchema(); - - $column->name = $info['Field']; - $column->allowNull = $info['Null'] === 'YES'; - $column->isPrimaryKey = false; // primary key will be set by loadTableSchema() later - $column->autoIncrement = stripos($info['Extra'], 'auto_increment') !== false; - - $column->dbType = $info['Type']; - $column->unsigned = strpos($column->dbType, 'unsigned') !== false; - - $column->type = self::TYPE_STRING; - if (preg_match('/^([\w ]+)(?:\(([^\)]+)\))?$/', $column->dbType, $matches)) { - $type = strtolower($matches[1]); - $column->dbType = $type . (isset($matches[2]) ? "({$matches[2]})" : ''); - if (isset($this->typeMap[$type])) { - $column->type = $this->typeMap[$type]; - } - if (!empty($matches[2])) { - if ($type === 'enum') { - $values = preg_split('/\s*,\s*/', $matches[2]); - foreach ($values as $i => $value) { - $values[$i] = trim($value, "'"); - } - $column->enumValues = $values; - } else { - $values = explode(',', $matches[2]); - $column->size = $column->precision = (int) $values[0]; - if (isset($values[1])) { - $column->scale = (int) $values[1]; - } - if ($column->size === 1 && $type === 'bit') { - $column->type = 'boolean'; - } elseif ($type === 'bit') { - if ($column->size > 32) { - $column->type = 'bigint'; - } elseif ($column->size === 32) { - $column->type = 'integer'; - } - } - } - } - } - - $column->phpType = $this->getColumnPhpType($column); - - if ($column->isPrimaryKey) { - return $column; - } - - if ($column->type === 'timestamp' && $info['Default'] === 'SYS_TIMESTAMP' || - $column->type === 'datetime' && $info['Default'] === 'SYS_DATETIME' || - $column->type === 'date' && $info['Default'] === 'SYS_DATE' || - $column->type === 'time' && $info['Default'] === 'SYS_TIME' - ) { - $column->defaultValue = new Expression($info['Default']); - } elseif (isset($type) && $type === 'bit') { - $column->defaultValue = hexdec(trim($info['Default'], 'X\'')); - } else { - $column->defaultValue = $column->phpTypecast($info['Default']); - } - - return $column; - } - - /** - * Determines the PDO type for the given PHP data value. - * @param mixed $data the data whose PDO type is to be determined - * @return int the PDO type - * @see http://www.php.net/manual/en/pdo.constants.php - */ - public function getPdoType($data) - { - static $typeMap = [ - // php type => PDO type - 'boolean' => \PDO::PARAM_INT, // PARAM_BOOL is not supported by CUBRID PDO - 'integer' => \PDO::PARAM_INT, - 'string' => \PDO::PARAM_STR, - 'resource' => \PDO::PARAM_LOB, - 'NULL' => \PDO::PARAM_NULL, - ]; - $type = gettype($data); - - return isset($typeMap[$type]) ? $typeMap[$type] : \PDO::PARAM_STR; - } - - /** - * {@inheritdoc} - * @see http://www.cubrid.org/manual/91/en/sql/transaction.html#database-concurrency - */ - public function setTransactionIsolationLevel($level) - { - // translate SQL92 levels to CUBRID levels: - switch ($level) { - case Transaction::SERIALIZABLE: - $level = '6'; // SERIALIZABLE - break; - case Transaction::REPEATABLE_READ: - $level = '5'; // REPEATABLE READ CLASS with REPEATABLE READ INSTANCES - break; - case Transaction::READ_COMMITTED: - $level = '4'; // REPEATABLE READ CLASS with READ COMMITTED INSTANCES - break; - case Transaction::READ_UNCOMMITTED: - $level = '3'; // REPEATABLE READ CLASS with READ UNCOMMITTED INSTANCES - break; - } - parent::setTransactionIsolationLevel($level); - } - - /** - * {@inheritdoc} - */ - public function createColumnSchemaBuilder($type, $length = null) - { - return new ColumnSchemaBuilder($type, $length, $this->db); - } - - /** - * Loads multiple types of constraints and returns the specified ones. - * @param string $tableName table name. - * @param string $returnType return type: - * - indexes - * - uniques - * @return mixed constraints. - */ - private function loadTableConstraints($tableName, $returnType) - { - $constraints = $this->db->getSlavePdo()->cubrid_schema(\PDO::CUBRID_SCH_CONSTRAINT, $tableName); - $constraints = ArrayHelper::index($constraints, null, ['TYPE', 'NAME']); - ArrayHelper::multisort($constraints, 'KEY_ORDER', SORT_ASC, SORT_NUMERIC); - $result = [ - 'indexes' => [], - 'uniques' => [], - ]; - foreach ($constraints as $type => $names) { - foreach ($names as $name => $constraint) { - $isUnique = in_array((int) $type, [0, 2], true); - $result['indexes'][] = new IndexConstraint([ - 'isPrimary' => (bool) $constraint[0]['PRIMARY_KEY'], - 'isUnique' => $isUnique, - 'name' => $name, - 'columnNames' => ArrayHelper::getColumn($constraint, 'ATTR_NAME'), - ]); - if ($isUnique) { - $result['uniques'][] = new Constraint([ - 'name' => $name, - 'columnNames' => ArrayHelper::getColumn($constraint, 'ATTR_NAME'), - ]); - } - } - } - foreach ($result as $type => $data) { - $this->setTableMetadata($tableName, $type, $data); - } - - return $result[$returnType]; - } -} diff --git a/framework/db/cubrid/conditions/LikeConditionBuilder.php b/framework/db/cubrid/conditions/LikeConditionBuilder.php deleted file mode 100644 index c6ea75e..0000000 --- a/framework/db/cubrid/conditions/LikeConditionBuilder.php +++ /dev/null @@ -1,29 +0,0 @@ - '!%', - '_' => '!_', - '!' => '!!', - ]; -} diff --git a/tests/README.md b/tests/README.md index ff680f5..39a7859 100644 --- a/tests/README.md +++ b/tests/README.md @@ -85,18 +85,10 @@ Run a group of unit tests docker-compose run php vendor/bin/phpunit -v --group caching,db docker-compose run php vendor/bin/phpunit -v --exclude base,caching,db,i18n,log,mutex,rbac,validators,web - docker-compose run php vendor/bin/phpunit -v --exclude mssql,oci,wincache,xcache,zenddata,cubrid + docker-compose run php vendor/bin/phpunit -v --exclude wincache,xcache,zenddata > Note: Documentation about [installing additional extensions](https://github.com/yiisoft/yii2-docker/blob/master/docs/install-extensions.md) can be found at `yiisoft/yii2-docker`. -### Cubrid - -> Note: Images for testing Cubrid are based on PHP 5, due to incompatibilities with PHP 7 - - cd tests/cubrid - docker-compose up -d - docker-compose run php vendor/bin/phpunit -v --group cubrid - ### MSSQL > Note: Images for testing MSSQL are based on `bylexus/apache-php7` (Ubuntu) since drivers are not available for Debian or Alpine. diff --git a/tests/cubrid/Dockerfile b/tests/cubrid/Dockerfile deleted file mode 100644 index 6d3de1a..0000000 --- a/tests/cubrid/Dockerfile +++ /dev/null @@ -1,31 +0,0 @@ -FROM php:5-fpm - -# /usr/local/lib/php/extensions/no-debug-non-zts-20131226/cubrid.so -RUN pecl install pdo_cubrid-9.3.0.0001 -RUN echo "extension=pdo_cubrid.so" > /usr/local/etc/php/conf.d/cubrid.ini - - -# Install system packages for composer (git) -RUN apt-get update && \ - apt-get -y install \ - git \ - --no-install-recommends && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -# Register the COMPOSER_HOME environment variable -ENV COMPOSER_HOME /composer -# Add global binary directory to PATH and make sure to re-export it -ENV PATH /usr/local/bin:$PATH -# Allow Composer to be run as root -ENV COMPOSER_ALLOW_SUPERUSER 1 -# Install composer -RUN curl -sS https://getcomposer.org/installer | php -- \ - --filename=composer.phar \ - --install-dir=/usr/local/bin - - -# Project source-code -WORKDIR /project -ADD composer.* /project/ -RUN /usr/local/bin/composer.phar install --prefer-dist -ADD ./ /project diff --git a/tests/cubrid/docker-compose.yml b/tests/cubrid/docker-compose.yml deleted file mode 100644 index 8085334..0000000 --- a/tests/cubrid/docker-compose.yml +++ /dev/null @@ -1,17 +0,0 @@ -version: '2' -services: - - php: - build: - context: ../.. - dockerfile: tests/cubrid/Dockerfile - ports: - - 80 - #volumes: - # - ../..:/project - depends_on: - - cubrid - - cubrid: - image: lighthopper/cubrid:9.3.6.0002 - command: ./create-start-demodb.sh \ No newline at end of file diff --git a/tests/data/config-docker.php b/tests/data/config-docker.php index 86c3f83..4741be1 100644 --- a/tests/data/config-docker.php +++ b/tests/data/config-docker.php @@ -21,12 +21,6 @@ */ $config = [ 'databases' => [ - 'cubrid' => [ - 'dsn' => 'cubrid:dbname=demodb;host=cubrid;port=33000', - 'username' => 'dba', - 'password' => '', - 'fixture' => __DIR__ . '/cubrid.sql', - ], 'mysql' => [ 'dsn' => 'mysql:host=mysql;dbname=yiitest', 'username' => 'travis', @@ -37,24 +31,12 @@ $config = [ 'dsn' => 'sqlite::memory:', 'fixture' => __DIR__ . '/sqlite.sql', ], - 'sqlsrv' => [ - 'dsn' => 'sqlsrv:Server=mssql;Database=yii2test', - 'username' => 'sa', - 'password' => 'Microsoft-12345', - 'fixture' => __DIR__ . '/mssql.sql', - ], 'pgsql' => [ 'dsn' => 'pgsql:host=postgres;dbname=yiitest;port=5432;', 'username' => 'postgres', 'password' => 'postgres', 'fixture' => __DIR__ . '/postgres.sql', ], - 'oci' => [ - 'dsn' => 'oci:dbname=LOCAL_XE;charset=AL32UTF8;', - 'username' => '', - 'password' => '', - 'fixture' => __DIR__ . '/oci.sql', - ], ], ]; diff --git a/tests/data/config.php b/tests/data/config.php index a0532ed..5d1c913 100644 --- a/tests/data/config.php +++ b/tests/data/config.php @@ -20,12 +20,6 @@ */ $config = [ 'databases' => [ - 'cubrid' => [ - 'dsn' => 'cubrid:dbname=demodb;host=localhost;port=33000', - 'username' => 'dba', - 'password' => '', - 'fixture' => __DIR__ . '/cubrid.sql', - ], 'mysql' => [ 'dsn' => 'mysql:host=127.0.0.1;dbname=yiitest', 'username' => 'travis', diff --git a/tests/data/cubrid.sql b/tests/data/cubrid.sql deleted file mode 100644 index f0c5897..0000000 --- a/tests/data/cubrid.sql +++ /dev/null @@ -1,310 +0,0 @@ -/** - * This is the database schema for testing CUBRID support of Yii DAO and Active Record. - * The database setup in config.php is required to perform then relevant tests: - */ - -DROP TABLE IF EXISTS "composite_fk"; -DROP TABLE IF EXISTS "order_item"; -DROP TABLE IF EXISTS "order_item_with_null_fk"; -DROP TABLE IF EXISTS "item"; -DROP TABLE IF EXISTS "order"; -DROP TABLE IF EXISTS "order_with_null_fk"; -DROP TABLE IF EXISTS "category"; -DROP TABLE IF EXISTS "customer"; -DROP TABLE IF EXISTS "profile"; -DROP TABLE IF EXISTS "null_values"; -DROP TABLE IF EXISTS "negative_default_values"; -DROP TABLE IF EXISTS "type"; -DROP TABLE IF EXISTS "constraints"; -DROP TABLE IF EXISTS "animal"; -DROP TABLE IF EXISTS "default_pk"; -DROP TABLE IF EXISTS "document"; -DROP TABLE IF EXISTS "dossier"; -DROP TABLE IF EXISTS "employee"; -DROP TABLE IF EXISTS "department"; -DROP VIEW IF EXISTS "animal_view"; -DROP TABLE IF EXISTS "T_constraints_4"; -DROP TABLE IF EXISTS "T_constraints_3"; -DROP TABLE IF EXISTS "T_constraints_2"; -DROP TABLE IF EXISTS "T_constraints_1"; -DROP TABLE IF EXISTS "T_upsert"; - -CREATE TABLE "constraints" -( - "id" integer not null, - "field1" varchar(255) -); - - -CREATE TABLE "profile" ( - "id" int(11) NOT NULL AUTO_INCREMENT, - "description" varchar(128) NOT NULL, - PRIMARY KEY ("id") -); - -CREATE TABLE "customer" ( - "id" int(11) NOT NULL AUTO_INCREMENT, - "email" varchar(128) NOT NULL, - "name" varchar(128), - "address" string, - "status" int (11) DEFAULT 0, - "profile_id" int(11), - PRIMARY KEY ("id") -); - -CREATE TABLE "category" ( - "id" int(11) NOT NULL AUTO_INCREMENT, - "name" varchar(128) NOT NULL, - PRIMARY KEY ("id") -); - -CREATE TABLE "item" ( - "id" int(11) NOT NULL AUTO_INCREMENT, - "name" varchar(128) NOT NULL, - "category_id" int(11) NOT NULL, - PRIMARY KEY ("id"), - CONSTRAINT "FK_item_category_id" FOREIGN KEY ("category_id") REFERENCES "category" ("id") -); - -CREATE TABLE "order" ( - "id" int(11) NOT NULL AUTO_INCREMENT, - "customer_id" int(11) NOT NULL, - "created_at" int(11) NOT NULL, - "total" decimal(10,0) NOT NULL, - PRIMARY KEY ("id"), - CONSTRAINT "FK_order_customer_id" FOREIGN KEY ("customer_id") REFERENCES "customer" ("id") -); - -CREATE TABLE "order_with_null_fk" ( - "id" int(11) NOT NULL AUTO_INCREMENT, - "customer_id" int(11), - "created_at" int(11) NOT NULL, - "total" decimal(10,0) NOT NULL, - PRIMARY KEY ("id") -); - -CREATE TABLE "order_item" ( - "order_id" int(11) NOT NULL, - "item_id" int(11) NOT NULL, - "quantity" int(11) NOT NULL, - "subtotal" decimal(10,0) NOT NULL, - PRIMARY KEY ("order_id","item_id"), - CONSTRAINT "FK_order_item_order_id" FOREIGN KEY ("order_id") REFERENCES "order" ("id"), - CONSTRAINT "FK_order_item_item_id" FOREIGN KEY ("item_id") REFERENCES "item" ("id") -); - -CREATE TABLE "order_item_with_null_fk" ( - "order_id" int(11), - "item_id" int(11), - "quantity" int(11) NOT NULL, - "subtotal" decimal(10,0) NOT NULL -); - -CREATE TABLE null_values ( - "id" INT(11) NOT NULL AUTO_INCREMENT, - "var1" INT NULL, - "var2" INT NULL, - "var3" INT DEFAULT NULL, - "stringcol" VARCHAR (32) DEFAULT NULL, - PRIMARY KEY (id) -); - -CREATE TABLE "negative_default_values" ( - tinyint_col smallint default '-123', - smallint_col smallint default '-123', - int_col int default '-123', - bigint_col bigint default '-123', - float_col double default '-12345.6789', - numeric_col decimal(5,2) default '-33.22' -); - - -CREATE TABLE "type" ( - "int_col" int(11) NOT NULL, - "int_col2" int(11) DEFAULT '1', - "tinyint_col" smallint DEFAULT '1', - "smallint_col" smallint DEFAULT '1', - "char_col" char(100) NOT NULL, - "char_col2" varchar(100) DEFAULT 'something', - "char_col3" string, - "enum_col" enum('a','B','c,D'), - "float_col" double NOT NULL, - "float_col2" double DEFAULT '1.23', - "blob_col" blob, - "numeric_col" decimal(5,2) DEFAULT '33.22', - "time" timestamp NOT NULL DEFAULT '2002-01-01 00:00:00', - "bool_col" tinyint NOT NULL, - "bool_col2" tinyint DEFAULT '1', - "ts_default" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - "bit_col" BIT(8) NOT NULL DEFAULT b'10000010' -); - -CREATE TABLE "composite_fk" ( - "id" int(11) NOT NULL, - "order_id" int(11) NOT NULL, - "item_id" int(11) NOT NULL, - PRIMARY KEY ("id"), - CONSTRAINT "FK_composite_fk_order_item" FOREIGN KEY ("order_id","item_id") REFERENCES "order_item" ("order_id","item_id") -); - -CREATE TABLE "animal" ( - "id" int(11) NOT NULL AUTO_INCREMENT, - "type" varchar(255) NOT NULL, - PRIMARY KEY ("id") -); - -CREATE TABLE "default_pk" ( - "id" int(11) NOT NULL DEFAULT 5, - "type" varchar(255) NOT NULL, - PRIMARY KEY ("id") -); - -CREATE TABLE "document" ( - "id" int(11) NOT NULL AUTO_INCREMENT, - "title" varchar(255) NOT NULL, - "content" string, - "version" int(11) NOT NULL DEFAULT 0, - PRIMARY KEY ("id") -); - -CREATE TABLE "department" ( - "id" int(11) NOT NULL AUTO_INCREMENT, - "title" VARCHAR(255) NOT NULL, - PRIMARY KEY ("id") -); - -CREATE TABLE "employee" ( - "id" int(11) NOT NULL, - "department_id" int(11) NOT NULL, - "first_name" VARCHAR(255) NOT NULL, - "last_name" VARCHAR(255) NOT NULL, - PRIMARY KEY ("id", "department_id") -); - -CREATE TABLE "dossier" ( - "id" int(11) NOT NULL AUTO_INCREMENT, - "department_id" int(11) NOT NULL, - "employee_id" int(11) NOT NULL, - "summary" VARCHAR(255) NOT NULL, - PRIMARY KEY ("id") -); - -CREATE VIEW "animal_view" AS SELECT * FROM "animal"; - -INSERT INTO "animal" ("type") VALUES ('yiiunit\data\ar\Cat'); -INSERT INTO "animal" ("type") VALUES ('yiiunit\data\ar\Dog'); - -INSERT INTO "profile" (description) VALUES ('profile customer 1'); -INSERT INTO "profile" (description) VALUES ('profile customer 3'); - -INSERT INTO "customer" (email, name, address, status, profile_id) VALUES ('user1@example.com', 'user1', 'address1', 1, 1); -INSERT INTO "customer" (email, name, address, status) VALUES ('user2@example.com', 'user2', 'address2', 1); -INSERT INTO "customer" (email, name, address, status, profile_id) VALUES ('user3@example.com', 'user3', 'address3', 2, 2); - -INSERT INTO "category" (name) VALUES ('Books'); -INSERT INTO "category" (name) VALUES ('Movies'); - -INSERT INTO "item" (name, category_id) VALUES ('Agile Web Application Development with Yii1.1 and PHP5', 1); -INSERT INTO "item" (name, category_id) VALUES ('Yii 1.1 Application Development Cookbook', 1); -INSERT INTO "item" (name, category_id) VALUES ('Ice Age', 2); -INSERT INTO "item" (name, category_id) VALUES ('Toy Story', 2); -INSERT INTO "item" (name, category_id) VALUES ('Cars', 2); - -INSERT INTO "order" (customer_id, created_at, total) VALUES (1, 1325282384, 110.0); -INSERT INTO "order" (customer_id, created_at, total) VALUES (2, 1325334482, 33.0); -INSERT INTO "order" (customer_id, created_at, total) VALUES (2, 1325502201, 40.0); - -INSERT INTO "order_with_null_fk" (customer_id, created_at, total) VALUES (1, 1325282384, 110.0); -INSERT INTO "order_with_null_fk" (customer_id, created_at, total) VALUES (2, 1325334482, 33.0); -INSERT INTO "order_with_null_fk" (customer_id, created_at, total) VALUES (2, 1325502201, 40.0); - -INSERT INTO "order_item" (order_id, item_id, quantity, subtotal) VALUES (1, 1, 1, 30.0); -INSERT INTO "order_item" (order_id, item_id, quantity, subtotal) VALUES (1, 2, 2, 40.0); -INSERT INTO "order_item" (order_id, item_id, quantity, subtotal) VALUES (2, 4, 1, 10.0); -INSERT INTO "order_item" (order_id, item_id, quantity, subtotal) VALUES (2, 5, 1, 15.0); -INSERT INTO "order_item" (order_id, item_id, quantity, subtotal) VALUES (2, 3, 1, 8.0); -INSERT INTO "order_item" (order_id, item_id, quantity, subtotal) VALUES (3, 2, 1, 40.0); - -INSERT INTO "order_item_with_null_fk" (order_id, item_id, quantity, subtotal) VALUES (1, 1, 1, 30.0); -INSERT INTO "order_item_with_null_fk" (order_id, item_id, quantity, subtotal) VALUES (1, 2, 2, 40.0); -INSERT INTO "order_item_with_null_fk" (order_id, item_id, quantity, subtotal) VALUES (2, 4, 1, 10.0); -INSERT INTO "order_item_with_null_fk" (order_id, item_id, quantity, subtotal) VALUES (2, 5, 1, 15.0); -INSERT INTO "order_item_with_null_fk" (order_id, item_id, quantity, subtotal) VALUES (2, 3, 1, 8.0); -INSERT INTO "order_item_with_null_fk" (order_id, item_id, quantity, subtotal) VALUES (3, 2, 1, 40.0); - -INSERT INTO "document" (title, content, version) VALUES ('Yii 2.0 guide', 'This is Yii 2.0 guide', 0); - -INSERT INTO "department" (id, title) VALUES (1, 'IT'); -INSERT INTO "department" (id, title) VALUES (2, 'accounting'); - -INSERT INTO "employee" (id, department_id, first_name, last_name) VALUES (1, 1, 'John', 'Doe'); -INSERT INTO "employee" (id, department_id, first_name, last_name) VALUES (1, 2, 'Ann', 'Smith'); -INSERT INTO "employee" (id, department_id, first_name, last_name) VALUES (2, 2, 'Will', 'Smith'); - -INSERT INTO "dossier" (id, department_id, employee_id, summary) VALUES (1, 1, 1, 'Excellent employee.'); -INSERT INTO "dossier" (id, department_id, employee_id, summary) VALUES (2, 2, 1, 'Brilliant employee.'); -INSERT INTO "dossier" (id, department_id, employee_id, summary) VALUES (3, 2, 2, 'Good employee.'); - -/* bit test, see https://github.com/yiisoft/yii2/issues/9006 */ - -DROP TABLE IF EXISTS `bit_values`; - -CREATE TABLE `bit_values` ( - `id` INT(11) NOT NULL AUTO_INCREMENT, - `val` bit(1) NOT NULL, - PRIMARY KEY (`id`) -); - -INSERT INTO `bit_values` (id, val) VALUES (1, b'0'), (2, b'1'); - -CREATE TABLE "T_constraints_1" -( - "C_id" INT NOT NULL PRIMARY KEY, - "C_not_null" INT NOT NULL, - "C_check" VARCHAR(255) NULL CHECK ("C_check" <> ''), - "C_unique" INT NOT NULL, - "C_default" INT NOT NULL DEFAULT 0, - CONSTRAINT "CN_unique" UNIQUE ("C_unique") -); - -CREATE TABLE "T_constraints_2" -( - "C_id_1" INT NOT NULL, - "C_id_2" INT NOT NULL, - "C_index_1" INT NULL, - "C_index_2_1" INT NULL, - "C_index_2_2" INT NULL, - CONSTRAINT "CN_constraints_2_multi" UNIQUE ("C_index_2_1", "C_index_2_2"), - CONSTRAINT "CN_pk" PRIMARY KEY ("C_id_1", "C_id_2") -); - -CREATE INDEX "CN_constraints_2_single" ON "T_constraints_2" ("C_index_1"); - -CREATE TABLE "T_constraints_3" -( - "C_id" INT NOT NULL, - "C_fk_id_1" INT NOT NULL, - "C_fk_id_2" INT NOT NULL, - CONSTRAINT "CN_constraints_3" FOREIGN KEY ("C_fk_id_1", "C_fk_id_2") REFERENCES "T_constraints_2" ("C_id_1", "C_id_2") ON DELETE RESTRICT ON UPDATE RESTRICT -); - -CREATE TABLE "T_constraints_4" -( - "C_id" INT NOT NULL PRIMARY KEY, - "C_col_1" INT NULL, - "C_col_2" INT NOT NULL, - CONSTRAINT "CN_constraints_4" UNIQUE ("C_col_1", "C_col_2") -); - -CREATE TABLE "T_upsert" -( - "id" INT NOT NULL PRIMARY KEY AUTO_INCREMENT, - "ts" INT NULL, - "email" VARCHAR(128) NOT NULL UNIQUE, - "recovery_email" VARCHAR(128) NULL, - "address" STRING NULL, - "status" TINYINT NOT NULL DEFAULT 0, - "orders" INT NOT NULL DEFAULT 0, - "profile_id" INT NULL, - UNIQUE ("email", "recovery_email") -); diff --git a/tests/data/travis/README.md b/tests/data/travis/README.md index 78080da..611e831 100644 --- a/tests/data/travis/README.md +++ b/tests/data/travis/README.md @@ -6,7 +6,5 @@ The scripts are: - [`apc-setup.sh`](apcu-setup.sh) Installs and configures the [apc pecl extension](http://pecl.php.net/package/apc) - - [`cubrid-setup.sh`](cubrid-setup.sh) - Prepares the [CUBRID](http://www.cubrid.org/) server instance by installing the server and PHP PDO driver - [`memcache-setup.sh`](memcache-setup.sh) Compiles and installs the [memcache pecl extension](http://pecl.php.net/package/memcache) diff --git a/tests/data/travis/cubrid-setup.sh b/tests/data/travis/cubrid-setup.sh deleted file mode 100755 index 8f6793a..0000000 --- a/tests/data/travis/cubrid-setup.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/sh -e -# -# install CUBRID DBMS - -CWD=$(pwd) - -# cubrid dbms -mkdir -p cubrid/$CUBRID_VERSION -cd cubrid -if (test -f $CUBRID_VERSION-linux.x86_64.tar.gz); then - echo "CUBRID is already downloaded" -else - wget http://ftp.cubrid.org/CUBRID_Engine/$CUBRID_VERSION-linux.x86_64.tar.gz -O $CUBRID_VERSION-linux.x86_64.tar.gz - cd $CUBRID_VERSION - tar xzf ../../$CUBRID_VERSION-linux.x86_64.tar.gz - cd ../.. -fi - -echo "setting cubrid env" -CUBRID=$CWD/cubrid/$CUBRID_VERSION/CUBRID -CUBRID_DATABASES=$CUBRID/databases -CUBRID_LANG=en_US - -ld_lib_path=`printenv LD_LIBRARY_PATH` || echo "LD_LIBRARY_PATH is empty" -if [ "$ld_lib_path" = "" ] -then - LD_LIBRARY_PATH=$CUBRID/lib -else - LD_LIBRARY_PATH=$CUBRID/lib:$LD_LIBRARY_PATH -fi - -SHLIB_PATH=$LD_LIBRARY_PATH -LIBPATH=$LD_LIBRARY_PATH -PATH=$CUBRID/bin:$CUBRID/cubridmanager:$PATH - -export CUBRID -export CUBRID_DATABASES -export CUBRID_LANG -export LD_LIBRARY_PATH -export SHLIB_PATH -export LIBPATH -export PATH - -# start cubrid -echo "starting cubrid..." -cubrid service start || echo "starting CUBRID services failed with exit code $?" -# create and start the demo db -$CUBRID/demo/make_cubrid_demo.sh || echo "setting up CUBRID demodb failed with exit code $?" -cubrid server start demodb || (echo "starting CUBRID demodb failed with exit code $?" && cat demodb_loaddb.log) - -echo "" -echo "Installed CUBRID $CUBRID_VERSION" -echo "" - -# cubrid pdo -install_pdo_cubrid() { - if (test "! (-f PDO_CUBRID-$CUBRID_PDO_VERSION.tgz)"); then - wget "http://pecl.php.net/get/PDO_CUBRID-$CUBRID_PDO_VERSION.tgz" -O PDO_CUBRID-$CUBRID_PDO_VERSION.tgz - fi - tar -zxf "PDO_CUBRID-$CUBRID_PDO_VERSION.tgz" - sh -c "cd PDO_CUBRID-$CUBRID_PDO_VERSION && phpize && ./configure --prefix=$CWD/cubrid/PDO_CUBRID-$CUBRID_PDO_VERSION && make" - - echo "extension=$CWD/cubrid/PDO_CUBRID-$CUBRID_PDO_VERSION/modules/pdo_cubrid.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - - return $? -} - -install_pdo_cubrid > ~/pdo_cubrid.log || ( echo "=== PDO CUBRID BUILD FAILED ==="; cat ~/pdo_cubrid.log; exit 1 ) - -echo "" -echo "Installed CUBRID PDO $CUBRID_PDO_VERSION" -echo "" - -cd .. diff --git a/tests/data/travis/cubrid-solo.rb b/tests/data/travis/cubrid-solo.rb deleted file mode 100755 index f5f0004..0000000 --- a/tests/data/travis/cubrid-solo.rb +++ /dev/null @@ -1,5 +0,0 @@ -file_cache_path "/tmp/chef-solo" -data_bag_path "/tmp/chef-solo/data_bags" -encrypted_data_bag_secret "/tmp/chef-solo/data_bag_key" -cookbook_path [ "/tmp/chef-solo/cookbooks" ] -role_path "/tmp/chef-solo/roles" \ No newline at end of file diff --git a/tests/framework/ar/ActiveRecordTestTrait.php b/tests/framework/ar/ActiveRecordTestTrait.php index 7410df7..4c9ed4f 100644 --- a/tests/framework/ar/ActiveRecordTestTrait.php +++ b/tests/framework/ar/ActiveRecordTestTrait.php @@ -1073,7 +1073,7 @@ trait ActiveRecordTestTrait } /** - * Some PDO implementations(e.g. cubrid) do not support boolean values. + * Some PDO implementations do not support boolean values. * Make sure this does not affect AR layer. */ public function testBooleanAttribute() diff --git a/tests/framework/db/ActiveRecordTest.php b/tests/framework/db/ActiveRecordTest.php index 5a70178..6d73e1f 100644 --- a/tests/framework/db/ActiveRecordTest.php +++ b/tests/framework/db/ActiveRecordTest.php @@ -32,7 +32,6 @@ use yiiunit\data\ar\Profile; use yiiunit\data\ar\ProfileWithConstructor; use yiiunit\data\ar\Type; use yiiunit\framework\ar\ActiveRecordTestTrait; -use yiiunit\framework\db\cubrid\ActiveRecordTest as CubridActiveRecordTest; use yiiunit\TestCase; abstract class ActiveRecordTest extends DatabaseTestCase @@ -1167,13 +1166,6 @@ abstract class ActiveRecordTest extends DatabaseTestCase $this->assertEquals(33.22, $model->numeric_col); $this->assertEquals(true, $model->bool_col2); - if ($this instanceof CubridActiveRecordTest) { - // cubrid has non-standard timestamp representation - $this->assertEquals('12:00:00 AM 01/01/2002', $model->time); - } else { - $this->assertEquals('2002-01-01 00:00:00', $model->time); - } - $model = new Type(); $model->char_col2 = 'not something'; diff --git a/tests/framework/db/CommandTest.php b/tests/framework/db/CommandTest.php index b0b2a58..133cf46 100644 --- a/tests/framework/db/CommandTest.php +++ b/tests/framework/db/CommandTest.php @@ -636,7 +636,6 @@ SQL; case 'pgsql': $expression = "EXTRACT(YEAR FROM TIMESTAMP 'now')"; break; - case 'cubrid': case 'mysql': $expression = 'YEAR(NOW())'; break; diff --git a/tests/framework/db/DatabaseTestCase.php b/tests/framework/db/DatabaseTestCase.php index c09bcea..525d2a9 100644 --- a/tests/framework/db/DatabaseTestCase.php +++ b/tests/framework/db/DatabaseTestCase.php @@ -118,7 +118,6 @@ abstract class DatabaseTestCase extends TestCase case 'mysql': case 'sqlite': return str_replace(['[[', ']]'], '`', $sql); - case 'cubrid': case 'oci': return str_replace(['[[', ']]'], '"', $sql); case 'pgsql': diff --git a/tests/framework/db/QueryBuilderTest.php b/tests/framework/db/QueryBuilderTest.php index e344fe2..27cfc08 100644 --- a/tests/framework/db/QueryBuilderTest.php +++ b/tests/framework/db/QueryBuilderTest.php @@ -8,7 +8,6 @@ namespace yiiunit\framework\db; use yii\db\conditions\BetweenColumnsCondition; -use yii\db\cubrid\QueryBuilder as CubridQueryBuilder; use yii\db\Expression; use yii\db\mysql\QueryBuilder as MysqlQueryBuilder; use yii\db\pgsql\QueryBuilder as PgsqlQueryBuilder; @@ -57,8 +56,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase return new SqliteQueryBuilder($connection); case 'pgsql': return new PgsqlQueryBuilder($connection); - case 'cubrid': - return new CubridQueryBuilder($connection); } throw new \Exception('Test is not implemented for ' . $this->driverName); } @@ -77,9 +74,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'bigint(20)', 'postgres' => 'bigint', 'sqlite' => 'bigint', - 'oci' => 'NUMBER(20)', - 'sqlsrv' => 'bigint', - 'cubrid' => 'bigint', ], ], [ @@ -89,9 +83,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'bigint(20) NOT NULL', 'postgres' => 'bigint NOT NULL', 'sqlite' => 'bigint NOT NULL', - 'oci' => 'NUMBER(20) NOT NULL', - 'sqlsrv' => 'bigint NOT NULL', - 'cubrid' => 'bigint NOT NULL', ], ], [ @@ -101,9 +92,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'bigint(20) CHECK (value > 5)', 'postgres' => 'bigint CHECK (value > 5)', 'sqlite' => 'bigint CHECK (value > 5)', - 'oci' => 'NUMBER(20) CHECK (value > 5)', - 'sqlsrv' => 'bigint CHECK (value > 5)', - 'cubrid' => 'bigint CHECK (value > 5)', ], ], [ @@ -113,9 +101,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'bigint(8)', 'postgres' => 'bigint', 'sqlite' => 'bigint', - 'oci' => 'NUMBER(8)', - 'sqlsrv' => 'bigint', - 'cubrid' => 'bigint', ], ], [ @@ -125,9 +110,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'bigint(8) CHECK (value > 5)', 'postgres' => 'bigint CHECK (value > 5)', 'sqlite' => 'bigint CHECK (value > 5)', - 'oci' => 'NUMBER(8) CHECK (value > 5)', - 'sqlsrv' => 'bigint CHECK (value > 5)', - 'cubrid' => 'bigint CHECK (value > 5)', ], ], [ @@ -146,9 +128,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'blob', 'postgres' => 'bytea', 'sqlite' => 'blob', - 'oci' => 'BLOB', - 'sqlsrv' => 'varbinary(max)', - 'cubrid' => 'blob', ], ], [ @@ -157,8 +136,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase [ 'mysql' => 'tinyint(1) NOT NULL DEFAULT 1', 'sqlite' => 'boolean NOT NULL DEFAULT 1', - 'sqlsrv' => 'tinyint(1) NOT NULL DEFAULT 1', - 'cubrid' => 'smallint NOT NULL DEFAULT 1', ], ], [ @@ -168,9 +145,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'tinyint(1)', 'postgres' => 'boolean', 'sqlite' => 'boolean', - 'oci' => 'NUMBER(1)', - 'sqlsrv' => 'tinyint(1)', - 'cubrid' => 'smallint', ], ], [ @@ -179,7 +153,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase [ 'mysql' => 'char(1) CHECK (value LIKE "test%")', 'sqlite' => 'char(1) CHECK (value LIKE "test%")', - 'cubrid' => 'char(1) CHECK (value LIKE "test%")', ], ], [ @@ -189,8 +162,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'char(1) NOT NULL', 'postgres' => 'char(1) NOT NULL', 'sqlite' => 'char(1) NOT NULL', - 'oci' => 'CHAR(1) NOT NULL', - 'cubrid' => 'char(1) NOT NULL', ], ], [ @@ -199,7 +170,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase [ 'mysql' => 'char(6) CHECK (value LIKE "test%")', 'sqlite' => 'char(6) CHECK (value LIKE "test%")', - 'cubrid' => 'char(6) CHECK (value LIKE "test%")', ], ], [ @@ -209,8 +179,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'char(6)', 'postgres' => 'char(6)', 'sqlite' => 'char(6)', - 'oci' => 'CHAR(6)', - 'cubrid' => 'char(6)', ], ], [ @@ -220,8 +188,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'char(1)', 'postgres' => 'char(1)', 'sqlite' => 'char(1)', - 'oci' => 'CHAR(1)', - 'cubrid' => 'char(1)', ], ], //[ @@ -231,8 +197,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase // 'mysql' => , // 'postgres' => , // 'sqlite' => , - // 'sqlsrv' => , - // 'cubrid' => , // ], //], [ @@ -242,9 +206,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'date NOT NULL', 'postgres' => 'date NOT NULL', 'sqlite' => 'date NOT NULL', - 'oci' => 'DATE NOT NULL', - 'sqlsrv' => 'date NOT NULL', - 'cubrid' => 'date NOT NULL', ], ], [ @@ -254,9 +215,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'date', 'postgres' => 'date', 'sqlite' => 'date', - 'oci' => 'DATE', - 'sqlsrv' => 'date', - 'cubrid' => 'date', ], ], //[ @@ -266,8 +224,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase // 'mysql' => , // 'postgres' => , // 'sqlite' => , - // 'sqlsrv' => , - // 'cubrid' => , // ], //], [ @@ -277,9 +233,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'datetime NOT NULL', 'postgres' => 'timestamp(0) NOT NULL', 'sqlite' => 'datetime NOT NULL', - 'oci' => 'TIMESTAMP NOT NULL', - 'sqlsrv' => 'datetime NOT NULL', - 'cubrid' => 'datetime NOT NULL', ], ], [ @@ -289,9 +242,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'datetime', 'postgres' => 'timestamp(0)', 'sqlite' => 'datetime', - 'oci' => 'TIMESTAMP', - 'sqlsrv' => 'datetime', - 'cubrid' => 'datetime', ], ], [ @@ -301,9 +251,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'decimal(10,0) CHECK (value > 5.6)', 'postgres' => 'numeric(10,0) CHECK (value > 5.6)', 'sqlite' => 'decimal(10,0) CHECK (value > 5.6)', - 'oci' => 'NUMBER CHECK (value > 5.6)', - 'sqlsrv' => 'decimal(18,0) CHECK (value > 5.6)', - 'cubrid' => 'decimal(10,0) CHECK (value > 5.6)', ], ], [ @@ -313,9 +260,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'decimal(10,0) NOT NULL', 'postgres' => 'numeric(10,0) NOT NULL', 'sqlite' => 'decimal(10,0) NOT NULL', - 'oci' => 'NUMBER NOT NULL', - 'sqlsrv' => 'decimal(18,0) NOT NULL', - 'cubrid' => 'decimal(10,0) NOT NULL', ], ], [ @@ -325,9 +269,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'decimal(12,4) CHECK (value > 5.6)', 'postgres' => 'numeric(12,4) CHECK (value > 5.6)', 'sqlite' => 'decimal(12,4) CHECK (value > 5.6)', - 'oci' => 'NUMBER CHECK (value > 5.6)', - 'sqlsrv' => 'decimal(12,4) CHECK (value > 5.6)', - 'cubrid' => 'decimal(12,4) CHECK (value > 5.6)', ], ], [ @@ -337,9 +278,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'decimal(12,4)', 'postgres' => 'numeric(12,4)', 'sqlite' => 'decimal(12,4)', - 'oci' => 'NUMBER', - 'sqlsrv' => 'decimal(12,4)', - 'cubrid' => 'decimal(12,4)', ], ], [ @@ -349,9 +287,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'decimal(10,0)', 'postgres' => 'numeric(10,0)', 'sqlite' => 'decimal(10,0)', - 'oci' => 'NUMBER', - 'sqlsrv' => 'decimal(18,0)', - 'cubrid' => 'decimal(10,0)', ], ], [ @@ -361,9 +296,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'double CHECK (value > 5.6)', 'postgres' => 'double precision CHECK (value > 5.6)', 'sqlite' => 'double CHECK (value > 5.6)', - 'oci' => 'NUMBER CHECK (value > 5.6)', - 'sqlsrv' => 'float CHECK (value > 5.6)', - 'cubrid' => 'double(15) CHECK (value > 5.6)', ], ], [ @@ -373,9 +305,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'double NOT NULL', 'postgres' => 'double precision NOT NULL', 'sqlite' => 'double NOT NULL', - 'oci' => 'NUMBER NOT NULL', - 'sqlsrv' => 'float NOT NULL', - 'cubrid' => 'double(15) NOT NULL', ], ], [ @@ -385,9 +314,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'double CHECK (value > 5.6)', 'postgres' => 'double precision CHECK (value > 5.6)', 'sqlite' => 'double CHECK (value > 5.6)', - 'oci' => 'NUMBER CHECK (value > 5.6)', - 'sqlsrv' => 'float CHECK (value > 5.6)', - 'cubrid' => 'double(16) CHECK (value > 5.6)', ], ], [ @@ -396,9 +322,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase [ 'mysql' => 'double', 'sqlite' => 'double', - 'oci' => 'NUMBER', - 'sqlsrv' => 'float', - 'cubrid' => 'double(16)', ], ], [ @@ -408,9 +331,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'double', 'postgres' => 'double precision', 'sqlite' => 'double', - 'oci' => 'NUMBER', - 'sqlsrv' => 'float', - 'cubrid' => 'double(15)', ], ], [ @@ -420,9 +340,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'float CHECK (value > 5.6)', 'postgres' => 'double precision CHECK (value > 5.6)', 'sqlite' => 'float CHECK (value > 5.6)', - 'oci' => 'NUMBER CHECK (value > 5.6)', - 'sqlsrv' => 'float CHECK (value > 5.6)', - 'cubrid' => 'float(7) CHECK (value > 5.6)', ], ], [ @@ -432,9 +349,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'float NOT NULL', 'postgres' => 'double precision NOT NULL', 'sqlite' => 'float NOT NULL', - 'oci' => 'NUMBER NOT NULL', - 'sqlsrv' => 'float NOT NULL', - 'cubrid' => 'float(7) NOT NULL', ], ], [ @@ -444,9 +358,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'float CHECK (value > 5.6)', 'postgres' => 'double precision CHECK (value > 5.6)', 'sqlite' => 'float CHECK (value > 5.6)', - 'oci' => 'NUMBER CHECK (value > 5.6)', - 'sqlsrv' => 'float CHECK (value > 5.6)', - 'cubrid' => 'float(16) CHECK (value > 5.6)', ], ], [ @@ -455,9 +366,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase [ 'mysql' => 'float', 'sqlite' => 'float', - 'oci' => 'NUMBER', - 'sqlsrv' => 'float', - 'cubrid' => 'float(16)', ], ], [ @@ -467,9 +375,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'float', 'postgres' => 'double precision', 'sqlite' => 'float', - 'oci' => 'NUMBER', - 'sqlsrv' => 'float', - 'cubrid' => 'float(7)', ], ], [ @@ -479,9 +384,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'int(11) CHECK (value > 5)', 'postgres' => 'integer CHECK (value > 5)', 'sqlite' => 'integer CHECK (value > 5)', - 'oci' => 'NUMBER(10) CHECK (value > 5)', - 'sqlsrv' => 'int CHECK (value > 5)', - 'cubrid' => 'int CHECK (value > 5)', ], ], [ @@ -491,9 +393,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'int(11) NOT NULL', 'postgres' => 'integer NOT NULL', 'sqlite' => 'integer NOT NULL', - 'oci' => 'NUMBER(10) NOT NULL', - 'sqlsrv' => 'int NOT NULL', - 'cubrid' => 'int NOT NULL', ], ], [ @@ -503,9 +402,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'int(8) CHECK (value > 5)', 'postgres' => 'integer CHECK (value > 5)', 'sqlite' => 'integer CHECK (value > 5)', - 'oci' => 'NUMBER(8) CHECK (value > 5)', - 'sqlsrv' => 'int CHECK (value > 5)', - 'cubrid' => 'int CHECK (value > 5)', ], ], [ @@ -515,9 +411,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'int(8)', 'postgres' => 'integer', 'sqlite' => 'integer', - 'oci' => 'NUMBER(8)', - 'sqlsrv' => 'int', - 'cubrid' => 'int', ], ], [ @@ -527,9 +420,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'int(11)', 'postgres' => 'integer', 'sqlite' => 'integer', - 'oci' => 'NUMBER(10)', - 'sqlsrv' => 'int', - 'cubrid' => 'int', ], ], [ @@ -539,9 +429,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'decimal(19,4) CHECK (value > 0.0)', 'postgres' => 'numeric(19,4) CHECK (value > 0.0)', 'sqlite' => 'decimal(19,4) CHECK (value > 0.0)', - 'oci' => 'NUMBER(19,4) CHECK (value > 0.0)', - 'sqlsrv' => 'decimal(19,4) CHECK (value > 0.0)', - 'cubrid' => 'decimal(19,4) CHECK (value > 0.0)', ], ], [ @@ -551,9 +438,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'decimal(19,4) NOT NULL', 'postgres' => 'numeric(19,4) NOT NULL', 'sqlite' => 'decimal(19,4) NOT NULL', - 'oci' => 'NUMBER(19,4) NOT NULL', - 'sqlsrv' => 'decimal(19,4) NOT NULL', - 'cubrid' => 'decimal(19,4) NOT NULL', ], ], [ @@ -563,9 +447,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'decimal(16,2) CHECK (value > 0.0)', 'postgres' => 'numeric(16,2) CHECK (value > 0.0)', 'sqlite' => 'decimal(16,2) CHECK (value > 0.0)', - 'oci' => 'NUMBER(16,2) CHECK (value > 0.0)', - 'sqlsrv' => 'decimal(16,2) CHECK (value > 0.0)', - 'cubrid' => 'decimal(16,2) CHECK (value > 0.0)', ], ], [ @@ -575,9 +456,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'decimal(16,2)', 'postgres' => 'numeric(16,2)', 'sqlite' => 'decimal(16,2)', - 'oci' => 'NUMBER(16,2)', - 'sqlsrv' => 'decimal(16,2)', - 'cubrid' => 'decimal(16,2)', ], ], [ @@ -587,9 +465,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'decimal(19,4)', 'postgres' => 'numeric(19,4)', 'sqlite' => 'decimal(19,4)', - 'oci' => 'NUMBER(19,4)', - 'sqlsrv' => 'decimal(19,4)', - 'cubrid' => 'decimal(19,4)', ], ], [ @@ -599,9 +474,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY CHECK (value > 5)', 'postgres' => 'serial NOT NULL PRIMARY KEY CHECK (value > 5)', 'sqlite' => 'integer PRIMARY KEY AUTOINCREMENT NOT NULL CHECK (value > 5)', - 'oci' => 'NUMBER(10) NOT NULL PRIMARY KEY CHECK (value > 5)', - 'sqlsrv' => 'int IDENTITY PRIMARY KEY CHECK (value > 5)', - 'cubrid' => 'int NOT NULL AUTO_INCREMENT PRIMARY KEY CHECK (value > 5)', ], ], [ @@ -609,7 +481,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase $this->primaryKey(8)->check('value > 5'), [ 'mysql' => 'int(8) NOT NULL AUTO_INCREMENT PRIMARY KEY CHECK (value > 5)', - 'oci' => 'NUMBER(8) NOT NULL PRIMARY KEY CHECK (value > 5)', ], ], [ @@ -617,7 +488,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase $this->primaryKey(8), [ 'mysql' => 'int(8) NOT NULL AUTO_INCREMENT PRIMARY KEY', - 'oci' => 'NUMBER(8) NOT NULL PRIMARY KEY', ], ], [ @@ -627,9 +497,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY', 'postgres' => 'serial NOT NULL PRIMARY KEY', 'sqlite' => 'integer PRIMARY KEY AUTOINCREMENT NOT NULL', - 'oci' => 'NUMBER(10) NOT NULL PRIMARY KEY', - 'sqlsrv' => 'int IDENTITY PRIMARY KEY', - 'cubrid' => 'int NOT NULL AUTO_INCREMENT PRIMARY KEY', ], ], [ @@ -639,9 +506,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'tinyint(2)', 'postgres' => 'smallint', 'sqlite' => 'tinyint', - 'oci' => 'NUMBER(2)', - 'sqlsrv' => 'tinyint', - 'cubrid' => 'smallint', ], ], [ @@ -651,7 +515,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'tinyint(3) UNSIGNED', 'postgres' => 'smallint UNSIGNED', 'sqlite' => 'tinyint UNSIGNED', - 'cubrid' => 'smallint UNSIGNED', ], ], [ @@ -661,9 +524,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'tinyint(3)', 'postgres' => 'smallint', 'sqlite' => 'tinyint', - 'oci' => 'NUMBER(3)', - 'sqlsrv' => 'smallint', - 'cubrid' => 'smallint', ], ], [ @@ -673,9 +533,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'smallint(8)', 'postgres' => 'smallint', 'sqlite' => 'smallint', - 'oci' => 'NUMBER(8)', - 'sqlsrv' => 'smallint', - 'cubrid' => 'smallint', ], ], [ @@ -685,9 +542,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'smallint(6)', 'postgres' => 'smallint', 'sqlite' => 'smallint', - 'oci' => 'NUMBER(5)', - 'sqlsrv' => 'smallint', - 'cubrid' => 'smallint', ], ], [ @@ -696,8 +550,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase [ 'mysql' => 'varchar(255) CHECK (value LIKE "test%")', 'sqlite' => 'varchar(255) CHECK (value LIKE "test%")', - 'sqlsrv' => 'varchar(255) CHECK (value LIKE "test%")', - 'cubrid' => 'varchar(255) CHECK (value LIKE "test%")', ], ], [ @@ -705,7 +557,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase $this->string()->check('value LIKE \'test%\''), [ 'postgres' => 'varchar(255) CHECK (value LIKE \'test%\')', - 'oci' => 'VARCHAR2(255) CHECK (value LIKE \'test%\')', ], ], [ @@ -715,9 +566,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'varchar(255) NOT NULL', 'postgres' => 'varchar(255) NOT NULL', 'sqlite' => 'varchar(255) NOT NULL', - 'oci' => 'VARCHAR2(255) NOT NULL', - 'sqlsrv' => 'varchar(255) NOT NULL', - 'cubrid' => 'varchar(255) NOT NULL', ], ], [ @@ -726,8 +574,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase [ 'mysql' => 'varchar(32) CHECK (value LIKE "test%")', 'sqlite' => 'varchar(32) CHECK (value LIKE "test%")', - 'sqlsrv' => 'varchar(32) CHECK (value LIKE "test%")', - 'cubrid' => 'varchar(32) CHECK (value LIKE "test%")', ], ], [ @@ -735,7 +581,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase $this->string(32)->check('value LIKE \'test%\''), [ 'postgres' => 'varchar(32) CHECK (value LIKE \'test%\')', - 'oci' => 'VARCHAR2(32) CHECK (value LIKE \'test%\')', ], ], [ @@ -745,9 +590,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'varchar(32)', 'postgres' => 'varchar(32)', 'sqlite' => 'varchar(32)', - 'oci' => 'VARCHAR2(32)', - 'sqlsrv' => 'varchar(32)', - 'cubrid' => 'varchar(32)', ], ], [ @@ -757,9 +599,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'varchar(255)', 'postgres' => 'varchar(255)', 'sqlite' => 'varchar(255)', - 'oci' => 'VARCHAR2(255)', - 'sqlsrv' => 'varchar(255)', - 'cubrid' => 'varchar(255)', ], ], [ @@ -768,8 +607,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase [ 'mysql' => 'text CHECK (value LIKE "test%")', 'sqlite' => 'text CHECK (value LIKE "test%")', - 'sqlsrv' => 'text CHECK (value LIKE "test%")', - 'cubrid' => 'varchar CHECK (value LIKE "test%")', ], ], [ @@ -777,7 +614,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase $this->text()->check('value LIKE \'test%\''), [ 'postgres' => 'text CHECK (value LIKE \'test%\')', - 'oci' => 'CLOB CHECK (value LIKE \'test%\')', ], ], [ @@ -787,9 +623,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'text NOT NULL', 'postgres' => 'text NOT NULL', 'sqlite' => 'text NOT NULL', - 'oci' => 'CLOB NOT NULL', - 'sqlsrv' => 'text NOT NULL', - 'cubrid' => 'varchar NOT NULL', ], ], [ @@ -798,8 +631,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase [ 'mysql' => 'text CHECK (value LIKE "test%")', 'sqlite' => 'text CHECK (value LIKE "test%")', - 'sqlsrv' => 'text CHECK (value LIKE "test%")', - 'cubrid' => 'varchar CHECK (value LIKE "test%")', ], Schema::TYPE_TEXT . ' CHECK (value LIKE "test%")', ], @@ -808,7 +639,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase $this->text(255)->check('value LIKE \'test%\''), [ 'postgres' => 'text CHECK (value LIKE \'test%\')', - 'oci' => 'CLOB CHECK (value LIKE \'test%\')', ], Schema::TYPE_TEXT . ' CHECK (value LIKE \'test%\')', ], @@ -819,9 +649,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'text NOT NULL', 'postgres' => 'text NOT NULL', 'sqlite' => 'text NOT NULL', - 'oci' => 'CLOB NOT NULL', - 'sqlsrv' => 'text NOT NULL', - 'cubrid' => 'varchar NOT NULL', ], Schema::TYPE_TEXT . ' NOT NULL', ], @@ -832,9 +659,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'text', 'postgres' => 'text', 'sqlite' => 'text', - 'oci' => 'CLOB', - 'sqlsrv' => 'text', - 'cubrid' => 'varchar', ], Schema::TYPE_TEXT, ], @@ -845,9 +669,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'text', 'postgres' => 'text', 'sqlite' => 'text', - 'oci' => 'CLOB', - 'sqlsrv' => 'text', - 'cubrid' => 'varchar', ], ], //[ @@ -857,8 +678,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase // 'mysql' => , // 'postgres' => , // 'sqlite' => , - // 'sqlsrv' => , - // 'cubrid' => , // ], //], [ @@ -868,9 +687,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'time NOT NULL', 'postgres' => 'time(0) NOT NULL', 'sqlite' => 'time NOT NULL', - 'oci' => 'TIMESTAMP NOT NULL', - 'sqlsrv' => 'time NOT NULL', - 'cubrid' => 'time NOT NULL', ], ], [ @@ -880,9 +696,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'time', 'postgres' => 'time(0)', 'sqlite' => 'time', - 'oci' => 'TIMESTAMP', - 'sqlsrv' => 'time', - 'cubrid' => 'time', ], ], //[ @@ -892,8 +705,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase // 'mysql' => , // 'postgres' => , // 'sqlite' => , - // 'sqlsrv' => , - // 'cubrid' => , // ], //], [ @@ -903,9 +714,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'timestamp NOT NULL', 'postgres' => 'timestamp(0) NOT NULL', 'sqlite' => 'timestamp NOT NULL', - 'oci' => 'TIMESTAMP NOT NULL', - 'sqlsrv' => 'timestamp NOT NULL', - 'cubrid' => 'timestamp NOT NULL', ], ], [ @@ -915,9 +723,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'timestamp', 'postgres' => 'timestamp(0)', 'sqlite' => 'timestamp', - 'oci' => 'TIMESTAMP', - 'sqlsrv' => 'timestamp', - 'cubrid' => 'timestamp', ], ], [ @@ -927,8 +732,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase 'mysql' => 'timestamp NULL DEFAULT NULL', 'postgres' => 'timestamp(0) NULL DEFAULT NULL', 'sqlite' => 'timestamp NULL DEFAULT NULL', - 'sqlsrv' => 'timestamp NULL DEFAULT NULL', - 'cubrid' => 'timestamp NULL DEFAULT NULL', ], ], [ @@ -955,8 +758,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase [ 'mysql' => "int(11) COMMENT 'test comment'", 'postgres' => 'integer', - 'sqlsrv' => 'int', - 'cubrid' => "int COMMENT 'test comment'", ], ], [ @@ -965,8 +766,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase [ 'mysql' => "int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT 'test comment'", 'postgres' => 'serial NOT NULL PRIMARY KEY', - 'sqlsrv' => 'int IDENTITY PRIMARY KEY', - 'cubrid' => "int NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT 'test comment'", ], ], [ @@ -975,9 +774,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase [ 'mysql' => 'int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST', 'postgres' => 'serial NOT NULL PRIMARY KEY', - 'oci' => 'NUMBER(10) NOT NULL PRIMARY KEY', - 'sqlsrv' => 'int IDENTITY PRIMARY KEY', - 'cubrid' => 'int NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST', ], ], [ @@ -986,9 +782,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase [ 'mysql' => 'int(11) FIRST', 'postgres' => 'integer', - 'oci' => 'NUMBER(10)', - 'sqlsrv' => 'int', - 'cubrid' => 'int FIRST', ], ], [ @@ -997,9 +790,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase [ 'mysql' => 'varchar(255) FIRST', 'postgres' => 'varchar(255)', - 'oci' => 'VARCHAR2(255)', - 'sqlsrv' => 'varchar(255)', - 'cubrid' => 'varchar(255) FIRST', ], ], [ @@ -1008,9 +798,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase [ 'mysql' => 'int(11) NOT NULL FIRST', 'postgres' => 'integer NOT NULL', - 'oci' => 'NUMBER(10) NOT NULL', - 'sqlsrv' => 'int NOT NULL', - 'cubrid' => 'int NOT NULL FIRST', ], ], [ @@ -1019,9 +806,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase [ 'mysql' => 'varchar(255) NOT NULL FIRST', 'postgres' => 'varchar(255) NOT NULL', - 'oci' => 'VARCHAR2(255) NOT NULL', - 'sqlsrv' => 'varchar(255) NOT NULL', - 'cubrid' => 'varchar(255) NOT NULL FIRST', ], ], ]; @@ -1168,7 +952,6 @@ abstract class QueryBuilderTest extends DatabaseTestCase [new Expression('NOT (any_expression(:a))', [':a' => 1]), 'NOT (any_expression(:a))', [':a' => 1]], ]; switch ($this->driverName) { - case 'sqlsrv': case 'sqlite': $conditions = array_merge($conditions, [ [['in', ['id', 'name'], [['id' => 1, 'name' => 'foo'], ['id' => 2, 'name' => 'bar']]], '(([[id]] = :qp0 AND [[name]] = :qp1) OR ([[id]] = :qp2 AND [[name]] = :qp3))', [':qp0' => 1, ':qp1' => 'foo', ':qp2' => 2, ':qp3' => 'bar']], diff --git a/tests/framework/db/cubrid/ActiveDataProviderTest.php b/tests/framework/db/cubrid/ActiveDataProviderTest.php deleted file mode 100644 index 2124ab0..0000000 --- a/tests/framework/db/cubrid/ActiveDataProviderTest.php +++ /dev/null @@ -1,18 +0,0 @@ -getConnection()); - } - - /** - * @return array - */ - public function typesProvider() - { - return [ - ['integer UNSIGNED', Schema::TYPE_INTEGER, null, [ - ['unsigned'], - ]], - ['integer(10) UNSIGNED', Schema::TYPE_INTEGER, 10, [ - ['unsigned'], - ]], - ['integer(10) COMMENT \'test\'', Schema::TYPE_INTEGER, 10, [ - ['comment', 'test'], - ]], - ]; - } -} diff --git a/tests/framework/db/cubrid/CommandTest.php b/tests/framework/db/cubrid/CommandTest.php deleted file mode 100644 index 75b9746..0000000 --- a/tests/framework/db/cubrid/CommandTest.php +++ /dev/null @@ -1,100 +0,0 @@ -getConnection(); - - // bindParam - $sql = 'INSERT INTO customer(email, name, address) VALUES (:email, :name, :address)'; - $command = $db->createCommand($sql); - $email = 'user4@example.com'; - $name = 'user4'; - $address = 'address4'; - $command->bindParam(':email', $email); - $command->bindParam(':name', $name); - $command->bindParam(':address', $address); - $command->execute(); - - $sql = 'SELECT name FROM customer WHERE email=:email'; - $command = $db->createCommand($sql); - $command->bindParam(':email', $email); - $this->assertEquals($name, $command->queryScalar()); - - $sql = "INSERT INTO type (int_col, char_col, char_col2, enum_col, float_col, blob_col, numeric_col, bool_col) VALUES (:int_col, '', :char_col, :enum_col, :float_col, CHAR_TO_BLOB(:blob_col), :numeric_col, :bool_col)"; - $command = $db->createCommand($sql); - $intCol = 123; - $charCol = 'abc'; - $enumCol = 'a'; - $floatCol = 1.23; - $blobCol = "\x10\x11\x12"; - $numericCol = '1.23'; - $boolCol = true; - $command->bindParam(':int_col', $intCol); - $command->bindParam(':char_col', $charCol); - $command->bindParam(':enum_col', $enumCol); - $command->bindParam(':float_col', $floatCol); - $command->bindParam(':blob_col', $blobCol); - $command->bindParam(':numeric_col', $numericCol); - $command->bindParam(':bool_col', $boolCol); - $this->assertEquals(1, $command->execute()); - - $sql = 'SELECT * FROM type'; - $row = $db->createCommand($sql)->queryOne(); - $this->assertEquals($intCol, $row['int_col']); - $this->assertEquals($enumCol, $row['enum_col']); - $this->assertEquals($charCol, $row['char_col2']); - $this->assertEquals($floatCol, $row['float_col']); - $this->assertEquals($blobCol, fread($row['blob_col'], 3)); - $this->assertEquals($numericCol, $row['numeric_col']); - $this->assertEquals($boolCol, $row['bool_col']); - - // bindValue - $sql = 'INSERT INTO customer(email, name, address) VALUES (:email, \'user5\', \'address5\')'; - $command = $db->createCommand($sql); - $command->bindValue(':email', 'user5@example.com'); - $command->execute(); - - $sql = 'SELECT email FROM customer WHERE name=:name'; - $command = $db->createCommand($sql); - $command->bindValue(':name', 'user5'); - $this->assertEquals('user5@example.com', $command->queryScalar()); - } - - public function testAutoQuoting() - { - $db = $this->getConnection(false); - - $sql = 'SELECT [[id]], [[t.name]] FROM {{customer}} t'; - $command = $db->createCommand($sql); - $this->assertEquals('SELECT "id", "t"."name" FROM "customer" t', $command->sql); - } - - public function batchInsertSqlProvider() - { - $data = parent::batchInsertSqlProvider(); - $data['issue11242']['expected'] = 'INSERT INTO "type" ("int_col", "float_col", "char_col") VALUES (NULL, NULL, \'Kyiv {{city}}, Ukraine\')'; - $data['wrongBehavior']['expected'] = 'INSERT INTO "type" ("int_col", "float_col", "char_col") VALUES (\'\', \'\', \'Kyiv {{city}}, Ukraine\')'; - - return $data; - } - - public function testAddDropCheck() - { - $this->markTestSkipped('CUBRID does not support adding/dropping check constraints.'); - } -} diff --git a/tests/framework/db/cubrid/ConnectionTest.php b/tests/framework/db/cubrid/ConnectionTest.php deleted file mode 100644 index 41cb42f..0000000 --- a/tests/framework/db/cubrid/ConnectionTest.php +++ /dev/null @@ -1,72 +0,0 @@ -getConnection(false); - $this->assertEquals(123, $connection->quoteValue(123)); - $this->assertEquals("'string'", $connection->quoteValue('string')); - $this->assertEquals("'It''s interesting'", $connection->quoteValue("It's interesting")); - } - - public function testQuoteTableName() - { - $connection = $this->getConnection(false); - $this->assertEquals('"table"', $connection->quoteTableName('table')); - $this->assertEquals('"table"', $connection->quoteTableName('"table"')); - $this->assertEquals('"schema"."table"', $connection->quoteTableName('schema.table')); - $this->assertEquals('"schema"."table"', $connection->quoteTableName('schema."table"')); - $this->assertEquals('"schema"."table"', $connection->quoteTableName('"schema"."table"')); - $this->assertEquals('{{table}}', $connection->quoteTableName('{{table}}')); - $this->assertEquals('(table)', $connection->quoteTableName('(table)')); - } - - public function testQuoteColumnName() - { - $connection = $this->getConnection(false); - $this->assertEquals('"column"', $connection->quoteColumnName('column')); - $this->assertEquals('"column"', $connection->quoteColumnName('"column"')); - $this->assertEquals('[[column]]', $connection->quoteColumnName('[[column]]')); - $this->assertEquals('{{column}}', $connection->quoteColumnName('{{column}}')); - $this->assertEquals('(column)', $connection->quoteColumnName('(column)')); - - $this->assertEquals('"column"', $connection->quoteSql('[[column]]')); - $this->assertEquals('"column"', $connection->quoteSql('{{column}}')); - } - - public function testQuoteFullColumnName() - { - $connection = $this->getConnection(false, false); - $this->assertEquals('"table"."column"', $connection->quoteColumnName('table.column')); - $this->assertEquals('"table"."column"', $connection->quoteColumnName('table."column"')); - $this->assertEquals('"table"."column"', $connection->quoteColumnName('"table".column')); - $this->assertEquals('"table"."column"', $connection->quoteColumnName('"table"."column"')); - - $this->assertEquals('[[table.column]]', $connection->quoteColumnName('[[table.column]]')); - $this->assertEquals('{{table}}."column"', $connection->quoteColumnName('{{table}}.column')); - $this->assertEquals('{{table}}."column"', $connection->quoteColumnName('{{table}}."column"')); - $this->assertEquals('{{table}}.[[column]]', $connection->quoteColumnName('{{table}}.[[column]]')); - $this->assertEquals('{{%table}}."column"', $connection->quoteColumnName('{{%table}}.column')); - $this->assertEquals('{{%table}}."column"', $connection->quoteColumnName('{{%table}}."column"')); - - $this->assertEquals('"table"."column"', $connection->quoteSql('[[table.column]]')); - $this->assertEquals('"table"."column"', $connection->quoteSql('{{table}}.[[column]]')); - $this->assertEquals('"table"."column"', $connection->quoteSql('{{table}}."column"')); - $this->assertEquals('"table"."column"', $connection->quoteSql('{{%table}}.[[column]]')); - $this->assertEquals('"table"."column"', $connection->quoteSql('{{%table}}."column"')); - } -} diff --git a/tests/framework/db/cubrid/ExistValidatorTest.php b/tests/framework/db/cubrid/ExistValidatorTest.php deleted file mode 100644 index daa435f..0000000 --- a/tests/framework/db/cubrid/ExistValidatorTest.php +++ /dev/null @@ -1,18 +0,0 @@ - '!%', - '\_' => '!_', - '\!' => '!!', - '\\\\' => '\\', - ]; - - /** - * This is not used as a dataprovider for testGetColumnType to speed up the test - * when used as dataprovider every single line will cause a reconnect with the database which is not needed here. - */ - public function columnTypes() - { - return array_merge(parent::columnTypes(), []); - } - - public function checksProvider() - { - $this->markTestSkipped('Adding/dropping check constraints is not supported in CUBRID.'); - } - - public function defaultValuesProvider() - { - $this->markTestSkipped('Adding/dropping default constraints is not supported in CUBRID.'); - } - - public function testResetSequence() - { - $qb = $this->getQueryBuilder(); - - $expected = 'ALTER TABLE "item" AUTO_INCREMENT=6;'; - $sql = $qb->resetSequence('item'); - $this->assertEquals($expected, $sql); - - $expected = 'ALTER TABLE "item" AUTO_INCREMENT=4;'; - $sql = $qb->resetSequence('item', 4); - $this->assertEquals($expected, $sql); - } - - public function testCommentColumn() - { - $version = $this->getQueryBuilder(false)->db->getSlavePdo()->getAttribute(\PDO::ATTR_SERVER_VERSION); - if (version_compare($version, '10.0', '<')) { - $this->markTestSkipped('Comments on columns are supported starting with CUBRID 10.0.'); - return; - } - - parent::testCommentColumn(); - } - - public function upsertProvider() - { - $concreteData = [ - 'regular values' => [ - 3 => 'MERGE INTO "T_upsert" USING (VALUES (:qp0, :qp1, :qp2, :qp3)) AS "EXCLUDED" ("email", "address", "status", "profile_id") ON ("T_upsert"."email"="EXCLUDED"."email") WHEN MATCHED THEN UPDATE SET "address"="EXCLUDED"."address", "status"="EXCLUDED"."status", "profile_id"="EXCLUDED"."profile_id" WHEN NOT MATCHED THEN INSERT ("email", "address", "status", "profile_id") VALUES ("EXCLUDED"."email", "EXCLUDED"."address", "EXCLUDED"."status", "EXCLUDED"."profile_id")', - ], - 'regular values with update part' => [ - 3 => 'MERGE INTO "T_upsert" USING (VALUES (:qp0, :qp1, :qp2, :qp3)) AS "EXCLUDED" ("email", "address", "status", "profile_id") ON ("T_upsert"."email"="EXCLUDED"."email") WHEN MATCHED THEN UPDATE SET "address"=:qp4, "status"=:qp5, "orders"=T_upsert.orders + 1 WHEN NOT MATCHED THEN INSERT ("email", "address", "status", "profile_id") VALUES ("EXCLUDED"."email", "EXCLUDED"."address", "EXCLUDED"."status", "EXCLUDED"."profile_id")', - ], - 'regular values without update part' => [ - 3 => 'MERGE INTO "T_upsert" USING (VALUES (:qp0, :qp1, :qp2, :qp3)) AS "EXCLUDED" ("email", "address", "status", "profile_id") ON ("T_upsert"."email"="EXCLUDED"."email") WHEN NOT MATCHED THEN INSERT ("email", "address", "status", "profile_id") VALUES ("EXCLUDED"."email", "EXCLUDED"."address", "EXCLUDED"."status", "EXCLUDED"."profile_id")', - ], - 'query' => [ - 3 => 'MERGE INTO "T_upsert" USING (SELECT "email", 2 AS "status" FROM "customer" WHERE "name"=:qp0 LIMIT 1) AS "EXCLUDED" ("email", "status") ON ("T_upsert"."email"="EXCLUDED"."email") WHEN MATCHED THEN UPDATE SET "status"="EXCLUDED"."status" WHEN NOT MATCHED THEN INSERT ("email", "status") VALUES ("EXCLUDED"."email", "EXCLUDED"."status")', - ], - 'query with update part' => [ - 3 => 'MERGE INTO "T_upsert" USING (SELECT "email", 2 AS "status" FROM "customer" WHERE "name"=:qp0 LIMIT 1) AS "EXCLUDED" ("email", "status") ON ("T_upsert"."email"="EXCLUDED"."email") WHEN MATCHED THEN UPDATE SET "address"=:qp1, "status"=:qp2, "orders"=T_upsert.orders + 1 WHEN NOT MATCHED THEN INSERT ("email", "status") VALUES ("EXCLUDED"."email", "EXCLUDED"."status")', - ], - 'query without update part' => [ - 3 => 'MERGE INTO "T_upsert" USING (SELECT "email", 2 AS "status" FROM "customer" WHERE "name"=:qp0 LIMIT 1) AS "EXCLUDED" ("email", "status") ON ("T_upsert"."email"="EXCLUDED"."email") WHEN NOT MATCHED THEN INSERT ("email", "status") VALUES ("EXCLUDED"."email", "EXCLUDED"."status")', - ], - 'values and expressions' => [ - 3 => 'INSERT INTO {{%T_upsert}} ({{%T_upsert}}.[[email]], [[ts]]) VALUES (:qp0, now())', - ], - 'values and expressions with update part' => [ - 3 => 'INSERT INTO {{%T_upsert}} ({{%T_upsert}}.[[email]], [[ts]]) VALUES (:qp0, now())', - ], - 'values and expressions without update part' => [ - 3 => 'INSERT INTO {{%T_upsert}} ({{%T_upsert}}.[[email]], [[ts]]) VALUES (:qp0, now())', - ], - 'query, values and expressions with update part' => [ - 3 => 'MERGE INTO {{%T_upsert}} USING (SELECT :phEmail AS "email", now() AS [[time]]) AS "EXCLUDED" ("email", [[time]]) ON ({{%T_upsert}}."email"="EXCLUDED"."email") WHEN MATCHED THEN UPDATE SET "ts"=:qp1, [[orders]]=T_upsert.orders + 1 WHEN NOT MATCHED THEN INSERT ("email", [[time]]) VALUES ("EXCLUDED"."email", "EXCLUDED".[[time]])', - ], - 'query, values and expressions without update part' => [ - 3 => 'MERGE INTO {{%T_upsert}} USING (SELECT :phEmail AS "email", now() AS [[time]]) AS "EXCLUDED" ("email", [[time]]) ON ({{%T_upsert}}."email"="EXCLUDED"."email") WHEN MATCHED THEN UPDATE SET "ts"=:qp1, [[orders]]=T_upsert.orders + 1 WHEN NOT MATCHED THEN INSERT ("email", [[time]]) VALUES ("EXCLUDED"."email", "EXCLUDED".[[time]])', - ], - ]; - $newData = parent::upsertProvider(); - foreach ($concreteData as $testName => $data) { - $newData[$testName] = array_replace($newData[$testName], $data); - } - return $newData; - } -} diff --git a/tests/framework/db/cubrid/QueryTest.php b/tests/framework/db/cubrid/QueryTest.php deleted file mode 100644 index 39b948a..0000000 --- a/tests/framework/db/cubrid/QueryTest.php +++ /dev/null @@ -1,17 +0,0 @@ -markTestSkipped('Schemas are not supported in CUBRID.'); - } - - public function testGetPDOType() - { - $values = [ - [null, \PDO::PARAM_NULL], - ['', \PDO::PARAM_STR], - ['hello', \PDO::PARAM_STR], - [0, \PDO::PARAM_INT], - [1, \PDO::PARAM_INT], - [1337, \PDO::PARAM_INT], - [true, \PDO::PARAM_INT], - [false, \PDO::PARAM_INT], - [$fp = fopen(__FILE__, 'rb'), \PDO::PARAM_LOB], - ]; - - $schema = $this->getConnection()->schema; - - foreach ($values as $value) { - $this->assertEquals($value[1], $schema->getPdoType($value[0])); - } - fclose($fp); - } - - - public function getExpectedColumns() - { - $columns = parent::getExpectedColumns(); - unset($columns['json_col']); - $columns['int_col']['dbType'] = 'integer'; - $columns['int_col']['size'] = null; - $columns['int_col']['precision'] = null; - $columns['int_col2']['dbType'] = 'integer'; - $columns['int_col2']['size'] = null; - $columns['int_col2']['precision'] = null; - $columns['tinyint_col']['smallint'] = 'short'; - $columns['tinyint_col']['dbType'] = 'short'; - $columns['tinyint_col']['size'] = null; - $columns['tinyint_col']['precision'] = null; - $columns['smallint_col']['dbType'] = 'short'; - $columns['smallint_col']['size'] = null; - $columns['smallint_col']['precision'] = null; - $columns['char_col3']['type'] = 'string'; - $columns['char_col3']['dbType'] = 'varchar(1073741823)'; - $columns['char_col3']['size'] = 1073741823; - $columns['char_col3']['precision'] = 1073741823; - $columns['enum_col']['dbType'] = "enum('a', 'B')"; - $columns['float_col']['dbType'] = 'double'; - $columns['float_col']['size'] = null; - $columns['float_col']['precision'] = null; - $columns['float_col']['scale'] = null; - $columns['numeric_col']['dbType'] = 'numeric(5,2)'; - $columns['blob_col']['phpType'] = 'resource'; - $columns['blob_col']['type'] = 'binary'; - $columns['bool_col']['dbType'] = 'short'; - $columns['bool_col']['size'] = null; - $columns['bool_col']['precision'] = null; - $columns['bool_col2']['dbType'] = 'short'; - $columns['bool_col2']['size'] = null; - $columns['bool_col2']['precision'] = null; - $columns['time']['defaultValue'] = '12:00:00 AM 01/01/2002'; - $columns['ts_default']['defaultValue'] = new Expression('SYS_TIMESTAMP'); - return $columns; - } - - public function constraintsProvider() - { - $result = parent::constraintsProvider(); - foreach ($result as $name => $constraints) { - $result[$name][2] = $this->convertPropertiesToAnycase($constraints[2]); - } - $result['1: check'][2] = false; - unset($result['1: index'][2][0]); - - $result['2: check'][2] = false; - unset($result['2: index'][2][0]); - - $result['3: foreign key'][2][0]->onDelete = 'RESTRICT'; - $result['3: foreign key'][2][0]->onUpdate = 'RESTRICT'; - $result['3: index'][2] = []; - $result['3: check'][2] = false; - - $result['4: check'][2] = false; - return $result; - } - - public function lowercaseConstraintsProvider() - { - $this->markTestSkipped('This test hangs on CUBRID.'); - } - - public function uppercaseConstraintsProvider() - { - $this->markTestSkipped('This test hangs on CUBRID.'); - } - - /** - * @param array|object|string $object - * @param bool $isProperty - * @return array|object|string - */ - private function convertPropertiesToAnycase($object, $isProperty = false) - { - if (!$isProperty && \is_array($object)) { - $result = []; - foreach ($object as $name => $value) { - $result[] = $this->convertPropertiesToAnycase($value); - } - - return $result; - } - - if (\is_object($object)) { - foreach (array_keys((array) $object) as $name) { - $object->$name = $this->convertPropertiesToAnycase($object->$name, true); - } - } elseif (\is_array($object) || \is_string($object)) { - $object = new AnyCaseValue($object); - } - - return $object; - } -} diff --git a/tests/framework/db/cubrid/UniqueValidatorTest.php b/tests/framework/db/cubrid/UniqueValidatorTest.php deleted file mode 100644 index 0685f9c..0000000 --- a/tests/framework/db/cubrid/UniqueValidatorTest.php +++ /dev/null @@ -1,18 +0,0 @@ -