]> source.dussan.org Git - jackcess.git/commitdiff
better import/copy column setup; added ability for users to further customize import...
authorJames Ahlborn <jtahlborn@yahoo.com>
Sun, 12 Nov 2006 19:43:42 +0000 (19:43 +0000)
committerJames Ahlborn <jtahlborn@yahoo.com>
Sun, 12 Nov 2006 19:43:42 +0000 (19:43 +0000)
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@135 f203690c-595d-4dc9-a70b-905162fa7fd2

src/java/com/healthmarketscience/jackcess/DataType.java

index 5cc9a2faa48894c00014781c49dce662f219b2fc..dcc18d7d5c26bb9229bc81baf6e29a608153b013 100644 (file)
@@ -290,17 +290,14 @@ public enum DataType {
       throw new SQLException("Unsupported SQL type: " + sqlType);
     }
 
-    if(rtn.isVariableLength()) {
-      // make sure size is reasonable
-      if((lengthInUnits * rtn.getUnitSize()) > rtn.getMaxSize()) {
-        // try alternate types
-        DataType altRtn = ALT_SQL_TYPES.get(sqlType);
-        if(altRtn != null) {
-          if((lengthInUnits * altRtn.getUnitSize()) <= altRtn.getMaxSize()) {
-            // use alternate type
-            rtn = altRtn;
-          }
-        }
+    // make sure size is reasonable
+    int size = lengthInUnits * rtn.getUnitSize();
+    if(rtn.isVariableLength() && !rtn.isValidSize(size)) {
+      // try alternate type
+      DataType altRtn = ALT_SQL_TYPES.get(sqlType);
+      if((altRtn != null) && altRtn.isValidSize(size)) {
+        // use alternate type
+        rtn = altRtn;
       }
     }