mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 20:52:48 +08:00
改进驱动的parseKey方法
This commit is contained in:
@@ -82,15 +82,18 @@ class Mysql extends Builder
|
||||
/**
|
||||
* 字段和表名处理
|
||||
* @access protected
|
||||
* @param string $key
|
||||
* @param mixed $key
|
||||
* @param array $options
|
||||
* @return string
|
||||
*/
|
||||
protected function parseKey($key, $options = [], $strict = false)
|
||||
{
|
||||
if (is_int($key)) {
|
||||
if (is_numeric($key)) {
|
||||
return $key;
|
||||
} elseif ($key instanceof Expression) {
|
||||
return $key->getValue();
|
||||
}
|
||||
|
||||
$key = trim($key);
|
||||
if (strpos($key, '$.') && false === strpos($key, '(')) {
|
||||
// JSON字段支持
|
||||
|
||||
@@ -44,12 +44,18 @@ class Pgsql extends Builder
|
||||
/**
|
||||
* 字段和表名处理
|
||||
* @access protected
|
||||
* @param string $key
|
||||
* @param mixed $key
|
||||
* @param array $options
|
||||
* @return string
|
||||
*/
|
||||
protected function parseKey($key, $options = [], $strict = false)
|
||||
{
|
||||
if (is_numeric($key)) {
|
||||
return $key;
|
||||
} elseif ($key instanceof Expression) {
|
||||
return $key->getValue();
|
||||
}
|
||||
|
||||
$key = trim($key);
|
||||
if (strpos($key, '$.') && false === strpos($key, '(')) {
|
||||
// JSON字段支持
|
||||
|
||||
@@ -52,12 +52,18 @@ class Sqlite extends Builder
|
||||
/**
|
||||
* 字段和表名处理
|
||||
* @access protected
|
||||
* @param string $key
|
||||
* @param mixed $key
|
||||
* @param array $options
|
||||
* @return string
|
||||
*/
|
||||
protected function parseKey($key, $options = [], $strict = false)
|
||||
{
|
||||
if (is_numeric($key)) {
|
||||
return $key;
|
||||
} elseif ($key instanceof Expression) {
|
||||
return $key->getValue();
|
||||
}
|
||||
|
||||
$key = trim($key);
|
||||
if (strpos($key, '.')) {
|
||||
list($table, $key) = explode('.', $key, 2);
|
||||
|
||||
@@ -73,14 +73,16 @@ class Sqlsrv extends Builder
|
||||
/**
|
||||
* 字段和表名处理
|
||||
* @access protected
|
||||
* @param string $key
|
||||
* @param mixed $key
|
||||
* @param array $options
|
||||
* @return string
|
||||
*/
|
||||
protected function parseKey($key, $options = [], $strict = false)
|
||||
{
|
||||
if (is_int($key)) {
|
||||
if (is_numeric($key)) {
|
||||
return $key;
|
||||
} elseif ($key instanceof Expression) {
|
||||
return $key->getValue();
|
||||
}
|
||||
$key = trim($key);
|
||||
if (strpos($key, '.') && !preg_match('/[,\'\"\(\)\[\s]/', $key)) {
|
||||
|
||||
Reference in New Issue
Block a user