mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-09 01:27:20 +08:00
CUBRID added exception about wrong implementation of quoteValue
This commit is contained in:
@ -21,7 +21,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
|
|||||||
* @var array mapping from abstract column types (keys) to physical column types (values).
|
* @var array mapping from abstract column types (keys) to physical column types (values).
|
||||||
*/
|
*/
|
||||||
public $typeMap = array(
|
public $typeMap = array(
|
||||||
Schema::TYPE_PK => 'int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY',
|
Schema::TYPE_PK => 'int NOT NULL AUTO_INCREMENT PRIMARY KEY',
|
||||||
Schema::TYPE_STRING => 'varchar(255)',
|
Schema::TYPE_STRING => 'varchar(255)',
|
||||||
Schema::TYPE_TEXT => 'varchar',
|
Schema::TYPE_TEXT => 'varchar',
|
||||||
Schema::TYPE_SMALLINT => 'smallint',
|
Schema::TYPE_SMALLINT => 'smallint',
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
namespace yii\db\cubrid;
|
namespace yii\db\cubrid;
|
||||||
|
|
||||||
|
use yii\base\NotSupportedException;
|
||||||
use yii\db\Expression;
|
use yii\db\Expression;
|
||||||
use yii\db\TableSchema;
|
use yii\db\TableSchema;
|
||||||
use yii\db\ColumnSchema;
|
use yii\db\ColumnSchema;
|
||||||
@ -86,6 +87,29 @@ 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)
|
||||||
|
{
|
||||||
|
throw new NotSupportedException('quoteValue is currently broken in cubrid PDO');
|
||||||
|
// TODO implement workaround
|
||||||
|
/* if (!is_string($str)) {
|
||||||
|
return $str;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->open();
|
||||||
|
if (($value = $this->db->pdo->quote($str)) !== false) {
|
||||||
|
return $value;
|
||||||
|
} else { // the driver doesn't support quote (e.g. oci)
|
||||||
|
return "'" . addcslashes(str_replace("'", "''", $str), "\000\n\r\\\032") . "'";
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
|
|||||||
Reference in New Issue
Block a user