gaocr před 3 roky
rodič
revize
c5fa0151cc

+ 12 - 3
src/main/java/com/goer/common/command/kit/ConnParseKit.java

@@ -38,9 +38,18 @@ public abstract class ConnParseKit {
         String[] delimters = new String[]{" ", ",", ",", ";", "\t", "\n"};
 
         //有括号的字段,不解析其中的注释了
-        if (remarks.indexOf("(") > 0
-                && remarks.indexOf(")") < 0
-                && remarks.indexOf("(") < remarks.indexOf(")")
+        int lIndex = remarks.indexOf("(");
+        if(lIndex < 0) {
+            lIndex = remarks.indexOf("(");
+        }
+
+        int rIndex = remarks.indexOf(")");
+        if(rIndex < 0) {
+            rIndex = remarks.indexOf(")");
+        }
+        if (lIndex > 0
+                && rIndex > 0
+                && lIndex < rIndex
         ) {
             return Pair.of(remarks, "");
         }

+ 4 - 4
src/main/java/com/goer/common/dialect/impl/DBDialectMySQL.java

@@ -39,10 +39,10 @@ public class DBDialectMySQL extends DBDialect {
     public void fillColumnField(ColumnField field, Connection conn, ResultSet rs, Set<String> pkSet) throws SQLException {
         super.fillColumnField(field, conn, rs, pkSet);
         int dataType = rs.getInt("DATA_TYPE");
-        if (isInteger(dataType)) {
-            int columnSize = rs.getInt("COLUMN_SIZE")+1;
-            field.setLen(columnSize);
-        }
+//        if (isInteger(dataType)) {
+//            int columnSize = rs.getInt("COLUMN_SIZE")+1;
+//            field.setLen(columnSize);
+//        }
         String isAutoincrement = rs.getString("IS_AUTOINCREMENT");
         field.setAutoIncrement(!"NO".equalsIgnoreCase(isAutoincrement));
     }