From a375a62070052c67ac09f7962762b92008679439 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Sun, 12 Oct 2014 03:57:14 +0200 Subject: [PATCH] bump minimum required cubrid version there is no reliable way to determine the cubrid PDO extension version used and also no reliable way to detect which combination of server and client produces wrong behavior. By requiering 9.3 or higher in both client and server we can be sure it works. fixes #852 --- docs/guide/db-active-record.md | 3 ++- docs/guide/db-dao.md | 3 ++- framework/db/cubrid/QueryBuilder.php | 2 +- framework/db/cubrid/Schema.php | 26 +------------------------- 4 files changed, 6 insertions(+), 28 deletions(-) diff --git a/docs/guide/db-active-record.md b/docs/guide/db-active-record.md index fafc332bac..d6fd439c1d 100644 --- a/docs/guide/db-active-record.md +++ b/docs/guide/db-active-record.md @@ -35,7 +35,8 @@ Below is the list of databases that are currently supported by Yii Active Record * SQLite 2 and 3: via [[yii\db\ActiveRecord]] * Microsoft SQL Server 2010 or later: via [[yii\db\ActiveRecord]] * Oracle: via [[yii\db\ActiveRecord]] -* CUBRID 9.1 or later: 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) * Sphnix: via [[yii\sphinx\ActiveRecord]], requires `yii2-sphinx` extension * ElasticSearch: via [[yii\elasticsearch\ActiveRecord]], requires `yii2-elasticsearch` extension * Redis 2.6.12 or later: via [[yii\redis\ActiveRecord]], requires `yii2-redis` extension diff --git a/docs/guide/db-dao.md b/docs/guide/db-dao.md index 05fe922a97..d9ae268040 100644 --- a/docs/guide/db-dao.md +++ b/docs/guide/db-dao.md @@ -10,7 +10,8 @@ uniform API and solves some inconsistencies between different DBMS. By default Y - [MariaDB](https://mariadb.com/) - [SQLite](http://sqlite.org/) - [PostgreSQL](http://www.postgresql.org/) -- [CUBRID](http://www.cubrid.org/): version 9.1.0 or higher. +- [CUBRID](http://www.cubrid.org/): version 9.3 or higher. (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) - [Oracle](http://www.oracle.com/us/products/database/overview/index.html) - [MSSQL](https://www.microsoft.com/en-us/sqlserver/default.aspx): version 2005 or higher. diff --git a/framework/db/cubrid/QueryBuilder.php b/framework/db/cubrid/QueryBuilder.php index 3602ebc7a1..e0c09c3943 100644 --- a/framework/db/cubrid/QueryBuilder.php +++ b/framework/db/cubrid/QueryBuilder.php @@ -10,7 +10,7 @@ namespace yii\db\cubrid; use yii\base\InvalidParamException; /** - * QueryBuilder is the query builder for CUBRID databases (version 9.1.x and higher). + * QueryBuilder is the query builder for CUBRID databases (version 9.3.x and higher). * * @author Carsten Brandt * @since 2.0 diff --git a/framework/db/cubrid/Schema.php b/framework/db/cubrid/Schema.php index 558d8dfb78..28ea970277 100644 --- a/framework/db/cubrid/Schema.php +++ b/framework/db/cubrid/Schema.php @@ -13,7 +13,7 @@ use yii\db\ColumnSchema; use yii\db\Transaction; /** - * Schema is the class for retrieving metadata from a CUBRID database (version 9.1.x and higher). + * Schema is the class for retrieving metadata from a CUBRID database (version 9.3.x and higher). * * @author Carsten Brandt * @since 2.0 @@ -103,30 +103,6 @@ class Schema extends \yii\db\Schema return strpos($name, '"') !== false || $name === '*' ? $name : '"' . $name . '"'; } - /** - * Quotes a string value for use in a query. - * Note that if the parameter is not a string, it will be returned without change. - * @param string $str string to be quoted - * @return string the properly quoted string - * @see http://www.php.net/manual/en/function.PDO-quote.php - */ - public function quoteValue($str) - { - if (!is_string($str)) { - return $str; - } - - $pdo = $this->db->getSlavePdo(); - - // workaround for broken PDO::quote() implementation in CUBRID 9.1.0 http://jira.cubrid.org/browse/APIS-658 - $version = $pdo->getAttribute(\PDO::ATTR_CLIENT_VERSION); - if (version_compare($version, '8.4.4.0002', '<') || $version[0] == '9' && version_compare($version, '9.2.0.0002', '<=')) { - return "'" . addcslashes(str_replace("'", "''", $str), "\000\n\r\\\032") . "'"; - } else { - return $pdo->quote($str); - } - } - /** * Creates a query builder for the CUBRID database. * @return QueryBuilder query builder instance