Explorar o código

Update: 表名规则更改匹配`xxx`

朱金辉 %!s(int64=2) %!d(string=hai) anos
pai
achega
e21c50f526
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  1. 4 1
      src/Driver/Base.php

+ 4 - 1
src/Driver/Base.php

@@ -841,7 +841,10 @@ class Base
      */
     protected function getTableAlias($name)
     {
-        if (!is_string($name) || !preg_match("/^[a-zA-Z_]+[a-zA-Z0-9_]{0,}$/", $name)) {
+        if (!is_string($name) || (
+            !preg_match("/^[a-zA-Z_]+[a-zA-Z0-9_]{0,}$/", $name) &&
+            !preg_match("/^`[a-zA-Z_]+[a-zA-Z0-9_]{0,}`$/", $name))
+        ) {
             if (gettype($name) == 'string') {
                 throw new TableException("表名不能包含怪字符且不能以数字开头");
             }