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
This commit is contained in:
Carsten Brandt
2014-10-12 03:57:14 +02:00
parent 010704d391
commit a375a62070
4 changed files with 6 additions and 28 deletions

View File

@@ -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]] * SQLite 2 and 3: via [[yii\db\ActiveRecord]]
* Microsoft SQL Server 2010 or later: via [[yii\db\ActiveRecord]] * Microsoft SQL Server 2010 or later: via [[yii\db\ActiveRecord]]
* Oracle: 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 * Sphnix: via [[yii\sphinx\ActiveRecord]], requires `yii2-sphinx` extension
* ElasticSearch: via [[yii\elasticsearch\ActiveRecord]], requires `yii2-elasticsearch` extension * ElasticSearch: via [[yii\elasticsearch\ActiveRecord]], requires `yii2-elasticsearch` extension
* Redis 2.6.12 or later: via [[yii\redis\ActiveRecord]], requires `yii2-redis` extension * Redis 2.6.12 or later: via [[yii\redis\ActiveRecord]], requires `yii2-redis` extension

View File

@@ -10,7 +10,8 @@ uniform API and solves some inconsistencies between different DBMS. By default Y
- [MariaDB](https://mariadb.com/) - [MariaDB](https://mariadb.com/)
- [SQLite](http://sqlite.org/) - [SQLite](http://sqlite.org/)
- [PostgreSQL](http://www.postgresql.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) - [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. - [MSSQL](https://www.microsoft.com/en-us/sqlserver/default.aspx): version 2005 or higher.

View File

@@ -10,7 +10,7 @@ namespace yii\db\cubrid;
use yii\base\InvalidParamException; 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 <mail@cebe.cc> * @author Carsten Brandt <mail@cebe.cc>
* @since 2.0 * @since 2.0

View File

@@ -13,7 +13,7 @@ use yii\db\ColumnSchema;
use yii\db\Transaction; 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 <mail@cebe.cc> * @author Carsten Brandt <mail@cebe.cc>
* @since 2.0 * @since 2.0
@@ -103,30 +103,6 @@ class Schema extends \yii\db\Schema
return strpos($name, '"') !== false || $name === '*' ? $name : '"' . $name . '"'; 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. * Creates a query builder for the CUBRID database.
* @return QueryBuilder query builder instance * @return QueryBuilder query builder instance