mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 06:15:19 +08:00
WIP
This commit is contained in:
@ -369,11 +369,12 @@ abstract class Schema extends Object
|
||||
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)
|
||||
$pdo = $this->db->getReadPdo();
|
||||
|
||||
if (($value = $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") . "'";
|
||||
}
|
||||
}
|
||||
@ -520,4 +521,10 @@ abstract class Schema extends Object
|
||||
throw new $exceptionClass($message, $errorInfo, (int) $e->getCode(), $e);
|
||||
}
|
||||
}
|
||||
|
||||
public function isReadQuery($sql)
|
||||
{
|
||||
$pattern = '/^\s*(SELECT|SHOW|DESCRIBE)\b/i';
|
||||
return preg_match($pattern, $sql);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user