ibatis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgbut...@apache.org
Subject svn commit: r746869 - in /ibatis/trunk/java/tools/ibator/core: doc/ src/org/apache/ibatis/ibator/internal/db/ src/org/apache/ibatis/ibator/internal/util/ src/org/apache/ibatis/ibator/internal/util/messages/ src/org/apache/ibatis/ibator/plugins/
Date Mon, 23 Feb 2009 03:31:10 GMT
Author: jgbutler
Date: Mon Feb 23 03:31:07 2009
New Revision: 746869

URL: http://svn.apache.org/viewvc?rev=746869&view=rev
Log:
[Ibator] Some additional debug warnings

Modified:
    ibatis/trunk/java/tools/ibator/core/doc/todo.txt
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/db/DatabaseIntrospector.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/util/StringUtility.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/util/messages/messages.properties
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/plugins/RenameExampleClassPlugin.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/plugins/SqlMapConfigPlugin.java

Modified: ibatis/trunk/java/tools/ibator/core/doc/todo.txt
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/doc/todo.txt?rev=746869&r1=746868&r2=746869&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/doc/todo.txt (original)
+++ ibatis/trunk/java/tools/ibator/core/doc/todo.txt Mon Feb 23 03:31:07 2009
@@ -1,5 +1,10 @@
 Core:
 
+  1.2.2
+
+    1. Add a way to override default types in the JavaTypeResolver
+
+
   Future
 
     1. Write page explaining how to use the GENERIC DAOs
@@ -12,6 +17,7 @@
 
     4. Java merger with ANTLR?
 
+
 Eclipse:
 
   Future

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/db/DatabaseIntrospector.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/db/DatabaseIntrospector.java?rev=746869&r1=746868&r2=746869&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/db/DatabaseIntrospector.java
(original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/db/DatabaseIntrospector.java
Mon Feb 23 03:31:07 2009
@@ -174,14 +174,12 @@
                 // add warning that the table has no columns, remove from the list
                 String warning = Messages.getString("Warning.1", introspectedTable.getFullyQualifiedTable().toString());
 //$NON-NLS-1$
                 warnings.add(warning);
-                logger.debug(warning);
                 iter.remove();
             } else if (!introspectedTable.hasPrimaryKeyColumns()
                     && !introspectedTable.hasBaseColumns()) {
                 // add warning that the table has only BLOB columns, remove from the list
                 String warning = Messages.getString("Warning.18", introspectedTable.getFullyQualifiedTable().toString());
//$NON-NLS-1$ 
                 warnings.add(warning);
-                logger.debug(warning);
                 iter.remove();
             } else {
                 // now make sure that all columns called out in the configuration
@@ -269,7 +267,6 @@
                                 introspectedColumn.getActualColumnName());
                         
                         warnings.add(warning);
-                        logger.debug(warning);
                     }
                     
                 }
@@ -462,6 +459,29 @@
         
         closeResultSet(rs);
         
+        if (answer.size() > 1
+                && !StringUtility.stringContainsSQLWildcard(localSchema)
+                && !StringUtility.stringContainsSQLWildcard(localTableName)) {
+            // issue a warning if there is more than one table and
+            // no wildcards were used
+            ActualTableName inputAtn = new ActualTableName(tc.getCatalog(),
+                    tc.getSchema(), tc.getTableName());
+            
+            StringBuilder sb = new StringBuilder();
+            boolean comma = false;
+            for (ActualTableName atn : answer.keySet()) {
+                if (comma) {
+                    sb.append(',');
+                } else {
+                    comma = true;
+                }
+                sb.append(atn.toString());
+            }
+            
+            warnings.add(Messages.getString("Warning.25", //$NON-NLS-1$
+                    inputAtn.toString(), sb.toString()));
+        }
+        
         return answer;
     }
     

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/util/StringUtility.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/util/StringUtility.java?rev=746869&r1=746868&r2=746869&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/util/StringUtility.java
(original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/util/StringUtility.java
Mon Feb 23 03:31:07 2009
@@ -111,4 +111,12 @@
         
         return sb.toString();
     }
+    
+    public static boolean stringContainsSQLWildcard(String s) {
+        if (s == null) {
+            return false;
+        }
+        
+        return s.indexOf('%') != -1 || s.indexOf('_') != -1;
+    }
 }

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/util/messages/messages.properties
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/util/messages/messages.properties?rev=746869&r1=746868&r2=746869&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/util/messages/messages.properties
(original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/util/messages/messages.properties
Mon Feb 23 03:31:07 2009
@@ -16,6 +16,7 @@
 ValidationError.15=Generated key type must be either "pre" or "post" if the type is specified
for a generated key for table {0}
 ValidationError.16="id" is required in an IbatorContext
 ValidationError.17="type" is required in an IbatorPlugin in context {0}
+ValidationError.18={0} requires the {1} property
 
 RuntimeError.0=configfile is a required parameter
 RuntimeError.1=configfile {0} does not exist
@@ -65,10 +66,7 @@
 Warning.22=Property {0} exists in root class {1}, but does not have a getter.  Ibator will
generate the property. 
 Warning.23=Property {0} exists in root class {1}, but does not have a setter.  Ibator will
generate the property.
 Warning.24=Plugin {0} in context {1} is invalid and will be ignored.
-Warning.25=SqlMapConfigPlugin requires the targetProject property 
-Warning.26=SqlMapConfigPlugin requires the targetPackage property 
-Warning.27=RenameExampleClassPlugin requires the searchString property 
-Warning.28=RenameExampleClassPlugin requires the replaceString property 
+Warning.25=Table Configuration {0} matched more than one table ({1})
 
 Progress.0=Connecting to the Database
 Progress.1=Introspecting table {0}

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/plugins/RenameExampleClassPlugin.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/plugins/RenameExampleClassPlugin.java?rev=746869&r1=746868&r2=746869&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/plugins/RenameExampleClassPlugin.java
(original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/plugins/RenameExampleClassPlugin.java
Mon Feb 23 03:31:07 2009
@@ -77,10 +77,14 @@
             pattern = Pattern.compile(searchString);
         } else {
             if (!StringUtility.stringHasValue(searchString)) {
-                warnings.add(Messages.getString("Warning.27")); //$NON-NLS-1$
+                warnings.add(Messages.getString("ValidationError.18", //$NON-NLS-1$
+                        "RenameExampleClassPlugin", //$NON-NLS-1$
+                        "searchString")); //$NON-NLS-1$
             }
             if (!StringUtility.stringHasValue(replaceString)) {
-                warnings.add(Messages.getString("Warning.28")); //$NON-NLS-1$
+                warnings.add(Messages.getString("ValidationError.18", //$NON-NLS-1$
+                        "RenameExampleClassPlugin", //$NON-NLS-1$
+                        "replaceString")); //$NON-NLS-1$
             }
         }
         

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/plugins/SqlMapConfigPlugin.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/plugins/SqlMapConfigPlugin.java?rev=746869&r1=746868&r2=746869&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/plugins/SqlMapConfigPlugin.java
(original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/plugins/SqlMapConfigPlugin.java
Mon Feb 23 03:31:07 2009
@@ -64,12 +64,16 @@
         boolean valid = true;
         
         if (!StringUtility.stringHasValue(properties.getProperty("targetProject"))) { //$NON-NLS-1$
-            warnings.add(Messages.getString("Warning.25")); //$NON-NLS-1$
+            warnings.add(Messages.getString("ValidationError.18", //$NON-NLS-1$
+                    "SqlMapConfigPlugin", //$NON-NLS-1$
+                    "targetProject")); //$NON-NLS-1$
             valid = false;
         }
         
         if (!StringUtility.stringHasValue(properties.getProperty("targetPackage"))) { //$NON-NLS-1$
-            warnings.add(Messages.getString("Warning.26")); //$NON-NLS-1$
+            warnings.add(Messages.getString("ValidationError.18", //$NON-NLS-1$
+                    "SqlMapConfigPlugin", //$NON-NLS-1$
+                    "targetPackage")); //$NON-NLS-1$
             valid = false;
         }
         



Mime
View raw message