empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From doeb...@apache.org
Subject svn commit: r1148444 [3/4] - in /incubator/empire-db/branches/EMPIREDB-99/empire-db/src: main/java/org/apache/empire/ main/java/org/apache/empire/commons/ main/java/org/apache/empire/data/ main/java/org/apache/empire/data/bean/ main/java/org/apache/emp...
Date Tue, 19 Jul 2011 16:53:41 GMT
Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/DBView.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/DBView.java?rev=1148444&r1=1148443&r2=1148444&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/DBView.java (original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/DBView.java Tue Jul 19 16:53:34 2011
@@ -21,6 +21,7 @@ package org.apache.empire.db;
 import java.sql.Connection;
 import java.util.concurrent.atomic.AtomicInteger;
 
+import org.apache.empire.EmpireException;
 import org.apache.empire.commons.Errors;
 import org.apache.empire.commons.Options;
 import org.apache.empire.data.DataType;
@@ -117,11 +118,11 @@ public abstract class DBView extends DBR
         }    
 
         @Override
-        public boolean checkValue(Object value)
+        public void checkValue(Object value)
         {
             if (updateColumn==null)
-                return true;
-            return updateColumn.checkValue(value);
+                return;
+            updateColumn.checkValue(value);
         }
 
         @Override
@@ -283,15 +284,14 @@ public abstract class DBView extends DBR
      * @param col a view column object
      * @return true if the column was successfully added or false otherwise
      */
-    protected boolean addColumn(DBViewColumn col)
+    protected void addColumn(DBViewColumn col)
     { // find column by name
         if (col == null || col.getRowSet() != this)
-            return error(Errors.InvalidArg, col, "col");
+            throw new EmpireException(Errors.InvalidArg, col, "col");
         if (columns.contains(col) == true)
-            return error(Errors.ItemExists, col.getName());
+            throw new EmpireException(Errors.ItemExists, col.getName());
         // add now
         columns.add(col);
-        return true;
     }
 
     /**
@@ -304,7 +304,8 @@ public abstract class DBView extends DBR
     protected final DBViewColumn addColumn(String columnName, DataType dataType)
     { // find column by name
         DBViewColumn vc = new DBViewColumn(this, columnName, new DBValueExpr(db, null, dataType));
-        return (addColumn(vc) ? vc : null);
+        addColumn(vc);
+        return vc;
     }
 
     /**
@@ -317,7 +318,8 @@ public abstract class DBView extends DBR
     protected final DBViewColumn addColumn(String columnName, DBColumnExpr columnExpr)
     { // find column by name
         DBViewColumn vc = new DBViewColumn(this, columnName, columnExpr);
-        return (addColumn(vc) ? vc : null);
+        addColumn(vc);
+        return vc;
     }
 
     /**
@@ -329,14 +331,15 @@ public abstract class DBView extends DBR
     protected final DBViewColumn addColumn(DBTableColumn sourceColumn)
     { // find column by name
         DBViewColumn vc = new DBViewColumn(this, sourceColumn.getName(), sourceColumn);
-        return (addColumn(vc) ? vc : null);
+        addColumn(vc);
+        return vc;
     }
 
     /**
      * This function searchs for equal columns given by the specified DBColumnExpr object.
      * 
      * @param expr the DBColumnExpr object
-     * @return the located column (only DBViewColumn onjects)
+     * @return the located column (only DBViewColumn objects)
      */
     public DBViewColumn findViewColumn(DBColumnExpr expr)
     {
@@ -377,12 +380,12 @@ public abstract class DBView extends DBR
     }
 
     @Override
-    public boolean updateRecord(DBRecord rec, Connection conn)
+    public void updateRecord(DBRecord rec, Connection conn)
     {
         if (updateable==false)
-            return error(Errors.NotSupported, "updateRecord");
+            throw new EmpireException(Errors.NotSupported, "updateRecord");
         // Update the record
-        return super.updateRecord(rec, conn);
+        super.updateRecord(rec, conn);
     }
     
     /*
@@ -391,9 +394,9 @@ public abstract class DBView extends DBR
      * @see org.apache.empire.db.DBRowSet#addRecord(org.apache.empire.db.DBRecord, java.sql.Connection)
      */
     @Override
-    public boolean createRecord(DBRecord rec, Connection conn)
+    public void createRecord(DBRecord rec, Connection conn)
     {
-        return error(Errors.NotSupported, "addRecord");
+        throw new EmpireException(Errors.NotSupported, "addRecord");
     }
 
     /*
@@ -402,8 +405,8 @@ public abstract class DBView extends DBR
      * @see org.apache.empire.db.DBRowSet#deleteRecord(java.lang.Object[], java.sql.Connection, boolean)
      */
     @Override
-    public boolean deleteRecord(Object[] keys, Connection conn)
+    public void deleteRecord(Object[] keys, Connection conn)
     {
-        return error(Errors.NotSupported, "deleteRecord");
+        throw new EmpireException(Errors.NotSupported, "deleteRecord");
     }
 }
\ No newline at end of file

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/derby/DBDatabaseDriverDerby.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/derby/DBDatabaseDriverDerby.java?rev=1148444&r1=1148443&r2=1148444&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/derby/DBDatabaseDriverDerby.java (original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/derby/DBDatabaseDriverDerby.java Tue Jul 19 16:53:34 2011
@@ -22,6 +22,7 @@ import java.sql.Connection;
 import java.util.GregorianCalendar;
 import java.util.Iterator;
 
+import org.apache.empire.EmpireException;
 import org.apache.empire.commons.Errors;
 import org.apache.empire.commons.StringUtils;
 import org.apache.empire.data.DataType;
@@ -283,22 +284,24 @@ public class DBDatabaseDriverDerby exten
 
     /** {@inheritDoc} */
     @Override
-    public boolean getDDLScript(DBCmdType type, DBObject dbo, DBSQLScript script)
+    public void getDDLScript(DBCmdType type, DBObject dbo, DBSQLScript script)
     {
         // The Object's database must be attached to this driver
         if (dbo == null || dbo.getDatabase().getDriver() != this)
-            return error(Errors.InvalidArg, dbo, "dbo");
+            throw new EmpireException(Errors.InvalidArg, dbo, "dbo");
         // Check Type of object
         if (dbo instanceof DBDatabase)
         { // Database
             switch (type)
             {
                 case CREATE:
-                    return createDatabase((DBDatabase) dbo, script, true);
+                    createDatabase((DBDatabase) dbo, script, true);
+                    return;
                 case DROP:
-                    return dropObject(((DBDatabase) dbo).getSchema(), "DATABASE", script);
+                    dropObject(((DBDatabase) dbo).getSchema(), "DATABASE", script);
+                    return;
                 default:
-                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBTable)
@@ -306,11 +309,13 @@ public class DBDatabaseDriverDerby exten
             switch (type)
             {
                 case CREATE:
-                    return createTable((DBTable) dbo, script);
+                    createTable((DBTable) dbo, script);
+                    return;
                 case DROP:
-                    return dropObject(((DBTable) dbo).getName(), "TABLE", script);
+                    dropObject(((DBTable) dbo).getName(), "TABLE", script);
+                    return;
                 default:
-                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBView)
@@ -318,11 +323,13 @@ public class DBDatabaseDriverDerby exten
             switch (type)
             {
                 case CREATE:
-                    return createView((DBView) dbo, script);
+                    createView((DBView) dbo, script);
+                    return;
                 case DROP:
-                    return dropObject(((DBView) dbo).getName(), "VIEW", script);
+                    dropObject(((DBView) dbo).getName(), "VIEW", script);
+                    return;
                 default:
-                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBRelation)
@@ -330,20 +337,23 @@ public class DBDatabaseDriverDerby exten
             switch (type)
             {
                 case CREATE:
-                    return createRelation((DBRelation) dbo, script);
+                    createRelation((DBRelation) dbo, script);
+                    return;
                 case DROP:
-                    return dropObject(((DBRelation) dbo).getName(), "CONSTRAINT", script);
+                    dropObject(((DBRelation) dbo).getName(), "CONSTRAINT", script);
+                    return;
                 default:
-                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBTableColumn)
         { // Table Column
-            return alterTable((DBTableColumn) dbo, type, script);
+            alterTable((DBTableColumn) dbo, type, script);
+            return;
         } 
         else
         { // an invalid argument has been supplied
-            return error(Errors.InvalidArg, dbo, "dbo");
+            throw new EmpireException(Errors.InvalidArg, dbo, "dbo");
         }
     }
 
@@ -363,7 +373,7 @@ public class DBDatabaseDriverDerby exten
     /*
      * return the sql for creating a Database
      */
-    protected boolean createDatabase(DBDatabase db, DBSQLScript script, boolean createSchema)
+    protected void createDatabase(DBDatabase db, DBSQLScript script, boolean createSchema)
     {
 //        // User Master to create Database
 //        if (createSchema)
@@ -382,25 +392,20 @@ public class DBDatabaseDriverDerby exten
         Iterator<DBTable> tables = db.getTables().iterator();
         while (tables.hasNext())
         {
-            if (!createTable(tables.next(), script))
-                return false;
+            createTable(tables.next(), script);
         }
         // Create Relations
         Iterator<DBRelation> relations = db.getRelations().iterator();
         while (relations.hasNext())
         {
-            if (!createRelation(relations.next(), script))
-                return false;
+            createRelation(relations.next(), script);
         }
         // Create Views
         Iterator<DBView> views = db.getViews().iterator();
         while (views.hasNext())
         {
-            if (!createView(views.next(), script))
-                return false;
+            createView(views.next(), script);
         }
-        // Done
-        return true;
     }
     
     /**
@@ -408,7 +413,7 @@ public class DBDatabaseDriverDerby exten
      * 
      * @return true if the table has been created successfully
      */
-    protected boolean createTable(DBTable t, DBSQLScript script)
+    protected void createTable(DBTable t, DBSQLScript script)
     {
         StringBuilder sql = new StringBuilder();
         sql.append("-- creating table ");
@@ -453,8 +458,7 @@ public class DBDatabaseDriverDerby exten
             sql.append("'");
         }
         // Create the table
-        if (script.addStmt(sql) == false)
-            return false;
+        script.addStmt(sql);
         // Create other Indexes (except primary key)
         Iterator<DBIndex> indexes = t.getIndexes().iterator();
         while (indexes.hasNext())
@@ -482,11 +486,8 @@ public class DBDatabaseDriverDerby exten
             }
             sql.append(")");
             // Create Index
-            if (script.addStmt(sql) == false)
-                return false;
+            script.addStmt(sql);
         }
-        // done
-        return success();
     }
     
     /**
@@ -614,7 +615,7 @@ public class DBDatabaseDriverDerby exten
      * 
      * @return true if the relation has been created successfully
      */
-    protected boolean createRelation(DBRelation r, DBSQLScript script)
+    protected void createRelation(DBRelation r, DBSQLScript script)
     {
         DBTable sourceTable = (DBTable) r.getReferences()[0].getSourceColumn().getRowSet();
         DBTable targetTable = (DBTable) r.getReferences()[0].getTargetColumn().getRowSet();
@@ -651,20 +652,17 @@ public class DBDatabaseDriverDerby exten
         }
         // done
         sql.append(")");
-        if (script.addStmt(sql) == false)
-            return false;
-        // done
-        return success();
+        script.addStmt(sql);
     }
 
     /**
-     * Creates an alter table dll statement for adding, modifiying or droping a column.
+     * Creates an alter table dll statement for adding, modifying or dropping a column.
      * @param col the column which to add, modify or drop
      * @param type the type of operation to perform
      * @param script to which to append the sql statement to
      * @return true if the statement was successfully appended to the buffer
      */
-    protected boolean alterTable(DBTableColumn col, DBCmdType type, DBSQLScript script)
+    protected void alterTable(DBTableColumn col, DBCmdType type, DBSQLScript script)
     {
         StringBuilder sql = new StringBuilder();
         sql.append("ALTER TABLE ");
@@ -685,7 +683,7 @@ public class DBDatabaseDriverDerby exten
                 break;
         }
         // done
-        return script.addStmt(sql);
+        script.addStmt(sql);
     }
 
     /**
@@ -693,17 +691,15 @@ public class DBDatabaseDriverDerby exten
      * 
      * @return true if the view has been created successfully
      */
-    protected boolean createView(DBView v, DBSQLScript script)
+    protected void createView(DBView v, DBSQLScript script)
     {
         // Create the Command
         DBCommandExpr cmd = v.createCommand();
         if (cmd==null)
         {   // Check whether Error information is available
             log.error("No command has been supplied for view " + v.getName());
-            if (v.hasError())
-                return error(v);
             // No error information available: Use Errors.NotImplemented
-            return error(Errors.NotImplemented, v.getName() + ".createCommand");
+            throw new EmpireException(Errors.NotImplemented, v.getName() + ".createCommand");
         }
         // Make sure there is no OrderBy
         cmd.clearOrderBy();
@@ -726,7 +722,7 @@ public class DBDatabaseDriverDerby exten
         sql.append(")\r\nAS\r\n");
         cmd.addSQL( sql, DBExpr.CTX_DEFAULT);
         // done
-        return script.addStmt(sql.toString());
+        script.addStmt(sql.toString());
     }
     
     /**
@@ -734,17 +730,17 @@ public class DBDatabaseDriverDerby exten
      * 
      * @return true if the object has been dropped successfully
      */
-    protected boolean dropObject(String name, String objType, DBSQLScript script)
+    protected void dropObject(String name, String objType, DBSQLScript script)
     {
         if (name == null || name.length() == 0)
-            return error(Errors.InvalidArg, name, "name");
+            throw new EmpireException(Errors.InvalidArg, name, "name");
         // Create Drop Statement
         StringBuilder sql = new StringBuilder();
         sql.append("DROP ");
         sql.append(objType);
         sql.append(" ");
         appendElementName(sql, name);
-        return script.addStmt(sql);
+        script.addStmt(sql);
     }
 
 }

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/h2/DBDatabaseDriverH2.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/h2/DBDatabaseDriverH2.java?rev=1148444&r1=1148443&r2=1148444&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/h2/DBDatabaseDriverH2.java (original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/h2/DBDatabaseDriverH2.java Tue Jul 19 16:53:34 2011
@@ -22,6 +22,7 @@ import java.sql.Connection;
 import java.util.GregorianCalendar;
 import java.util.Iterator;
 
+import org.apache.empire.EmpireException;
 import org.apache.empire.commons.Errors;
 import org.apache.empire.commons.StringUtils;
 import org.apache.empire.data.DataType;
@@ -288,22 +289,24 @@ public class DBDatabaseDriverH2 extends 
      * @see DBDatabaseDriver#getDDLScript(DBCmdType, DBObject, DBSQLScript)  
      */
     @Override
-    public boolean getDDLScript(DBCmdType type, DBObject dbo, DBSQLScript script)
+    public void getDDLScript(DBCmdType type, DBObject dbo, DBSQLScript script)
     {
         // The Object's database must be attached to this driver
         if (dbo==null || dbo.getDatabase().getDriver()!=this)
-            return error(Errors.InvalidArg, dbo, "dbo");
+            throw new EmpireException(Errors.InvalidArg, dbo, "dbo");
         // Check Type of object
         if (dbo instanceof DBDatabase)
         { // Database
             switch (type)
             {
                 case CREATE:
-                    return createDatabase((DBDatabase) dbo, script, true);
+                    createDatabase((DBDatabase) dbo, script, true);
+                    return;
                 case DROP:
-                    return dropObject(((DBDatabase) dbo).getSchema(), "DATABASE", script);
+                    dropObject(((DBDatabase) dbo).getSchema(), "DATABASE", script);
+                    return;
                 default:
-                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBTable)
@@ -311,11 +314,13 @@ public class DBDatabaseDriverH2 extends 
             switch (type)
             {
                 case CREATE:
-                    return createTable((DBTable) dbo, script);
+                    createTable((DBTable) dbo, script);
+                    return;
                 case DROP:
-                    return dropObject(((DBTable) dbo).getName(), "TABLE", script);
+                    dropObject(((DBTable) dbo).getName(), "TABLE", script);
+                    return;
                 default:
-                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBView)
@@ -323,11 +328,13 @@ public class DBDatabaseDriverH2 extends 
             switch (type)
             {
                 case CREATE:
-                    return createView((DBView) dbo, script);
+                    createView((DBView) dbo, script);
+                    return;
                 case DROP:
-                    return dropObject(((DBView) dbo).getName(), "VIEW", script);
+                    dropObject(((DBView) dbo).getName(), "VIEW", script);
+                    return;
                 default:
-                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBRelation)
@@ -335,20 +342,23 @@ public class DBDatabaseDriverH2 extends 
             switch (type)
             {
                 case CREATE:
-                    return createRelation((DBRelation) dbo, script);
+                    createRelation((DBRelation) dbo, script);
+                    return;
                 case DROP:
-                    return dropObject(((DBRelation) dbo).getName(), "CONSTRAINT", script);
+                    dropObject(((DBRelation) dbo).getName(), "CONSTRAINT", script);
+                    return;
                 default:
-                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBTableColumn)
         { // Table Column
-            return alterTable((DBTableColumn) dbo, type, script);
+            alterTable((DBTableColumn) dbo, type, script);
+            return;
         } 
         else
         { // an invalid argument has been supplied
-            return error(Errors.InvalidArg, dbo, "dbo");
+            throw new EmpireException(Errors.InvalidArg, dbo, "dbo");
         }
     }
 
@@ -387,22 +397,19 @@ public class DBDatabaseDriverH2 extends 
         Iterator<DBTable> tables = db.getTables().iterator();
         while (tables.hasNext())
         {
-            if (!createTable(tables.next(), script))
-                return false;
+            createTable(tables.next(), script);
         }
         // Create Relations
         Iterator<DBRelation> relations = db.getRelations().iterator();
         while (relations.hasNext())
         {
-            if (!createRelation(relations.next(), script))
-                return false;
+            createRelation(relations.next(), script);
         }
         // Create Views
         Iterator<DBView> views = db.getViews().iterator();
         while (views.hasNext())
         {
-            if (!createView(views.next(), script))
-                return false;
+            createView(views.next(), script);
         }
         // Done
         return true;
@@ -413,7 +420,7 @@ public class DBDatabaseDriverH2 extends 
      * 
      * @return true if the table has been created successfully
      */
-    protected boolean createTable(DBTable t, DBSQLScript script)
+    protected void createTable(DBTable t, DBSQLScript script)
     {
         StringBuilder sql = new StringBuilder();
         sql.append("-- creating table ");
@@ -458,8 +465,7 @@ public class DBDatabaseDriverH2 extends 
             sql.append("'");
         }
         // Create the table
-        if (script.addStmt(sql) == false)
-            return false;
+        script.addStmt(sql);
         // Create other Indexes (except primary key)
         Iterator<DBIndex> indexes = t.getIndexes().iterator();
         while (indexes.hasNext())
@@ -487,11 +493,8 @@ public class DBDatabaseDriverH2 extends 
             }
             sql.append(")");
             // Create Index
-            if (script.addStmt(sql) == false)
-                return false;
+            script.addStmt(sql);
         }
-        // done
-        return success();
     }
     
     /**
@@ -581,8 +584,8 @@ public class DBDatabaseDriverH2 extends 
                 sql.append("CHAR(36)");
                 break;
             case UNKNOWN:
-                 log.error("Cannot append column of Data-Type 'UNKNOWN'");
-                 return false;
+                log.warn("Cannot append column of Data-Type 'UNKNOWN'");
+                return false;
         }
         // Default Value
         if (isDDLColumnDefaults() && !c.isAutoGenerated() && c.getDefaultValue()!=null)
@@ -601,7 +604,7 @@ public class DBDatabaseDriverH2 extends 
      * 
      * @return true if the relation has been created successfully
      */
-    protected boolean createRelation(DBRelation r, DBSQLScript script)
+    protected void createRelation(DBRelation r, DBSQLScript script)
     {
         DBTable sourceTable = (DBTable) r.getReferences()[0].getSourceColumn().getRowSet();
         DBTable targetTable = (DBTable) r.getReferences()[0].getTargetColumn().getRowSet();
@@ -638,20 +641,17 @@ public class DBDatabaseDriverH2 extends 
         }
         // done
         sql.append(")");
-        if (script.addStmt(sql) == false)
-            return false;
-        // done
-        return success();
+        script.addStmt(sql);
     }
 
     /**
-     * Creates an alter table dll statement for adding, modifiying or droping a column.
+     * Creates an alter table dll statement for adding, modifying or dropping a column.
      * @param col the column which to add, modify or drop
      * @param type the type of operation to perform
      * @param script to which to append the sql statement to
      * @return true if the statement was successfully appended to the buffer
      */
-    protected boolean alterTable(DBTableColumn col, DBCmdType type, DBSQLScript script)
+    protected void alterTable(DBTableColumn col, DBCmdType type, DBSQLScript script)
     {
         StringBuilder sql = new StringBuilder();
         sql.append("ALTER TABLE ");
@@ -672,7 +672,7 @@ public class DBDatabaseDriverH2 extends 
                 break;
         }
         // done
-        return script.addStmt(sql);
+        script.addStmt(sql);
     }
 
     /**
@@ -680,17 +680,14 @@ public class DBDatabaseDriverH2 extends 
      * 
      * @return true if the view has been created successfully
      */
-    protected boolean createView(DBView v, DBSQLScript script)
+    protected void createView(DBView v, DBSQLScript script)
     {
         // Create the Command
         DBCommandExpr cmd = v.createCommand();
         if (cmd==null)
         {   // Check whether Error information is available
             log.error("No command has been supplied for view " + v.getName());
-            if (v.hasError())
-                return error(v);
-            // No error information available: Use Errors.NotImplemented
-            return error(Errors.NotImplemented, v.getName() + ".createCommand");
+            throw new EmpireException(Errors.NotImplemented, v.getName() + ".createCommand");
         }
         // Make sure there is no OrderBy
         cmd.clearOrderBy();
@@ -713,7 +710,7 @@ public class DBDatabaseDriverH2 extends 
         sql.append(")\r\nAS\r\n");
         cmd.addSQL( sql, DBExpr.CTX_DEFAULT);
         // done
-        return script.addStmt(sql.toString());
+        script.addStmt(sql.toString());
     }
     
     /**
@@ -721,17 +718,17 @@ public class DBDatabaseDriverH2 extends 
      * 
      * @return true if the object has been dropped successfully
      */
-    protected boolean dropObject(String name, String objType, DBSQLScript script)
+    protected void dropObject(String name, String objType, DBSQLScript script)
     {
         if (name == null || name.length() == 0)
-            return error(Errors.InvalidArg, name, "name");
+            throw new EmpireException(Errors.InvalidArg, name, "name");
         // Create Drop Statement
         StringBuilder sql = new StringBuilder();
         sql.append("DROP ");
         sql.append(objType);
         sql.append(" ");
         appendElementName(sql, name);
-        return script.addStmt(sql);
+        script.addStmt(sql);
     }
 
 }

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/hsql/DBDatabaseDriverHSql.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/hsql/DBDatabaseDriverHSql.java?rev=1148444&r1=1148443&r2=1148444&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/hsql/DBDatabaseDriverHSql.java (original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/hsql/DBDatabaseDriverHSql.java Tue Jul 19 16:53:34 2011
@@ -22,6 +22,7 @@ import java.sql.Connection;
 import java.util.GregorianCalendar;
 import java.util.Iterator;
 
+import org.apache.empire.EmpireException;
 import org.apache.empire.commons.Errors;
 import org.apache.empire.data.DataType;
 import org.apache.empire.db.DBCmdType;
@@ -253,22 +254,24 @@ public class DBDatabaseDriverHSql extend
      * @see DBDatabaseDriver#getDDLScript(DBCmdType, DBObject, DBSQLScript)  
      */
     @Override
-    public boolean getDDLScript(DBCmdType type, DBObject dbo, DBSQLScript script)
+    public void getDDLScript(DBCmdType type, DBObject dbo, DBSQLScript script)
     {
         // The Object's database must be attached to this driver
         if (dbo==null || dbo.getDatabase().getDriver()!=this)
-            return error(Errors.InvalidArg, dbo, "dbo");
+            throw new EmpireException(Errors.InvalidArg, dbo, "dbo");
         // Check Type of object
         if (dbo instanceof DBDatabase)
         { // Database
             switch (type)
             {
                 case CREATE:
-                    return createDatabase((DBDatabase) dbo, script);
+                    createDatabase((DBDatabase) dbo, script);
+                    return;
                 case DROP:
-                    return dropObject(((DBDatabase) dbo).getSchema(), "DATABASE", script);
+                    dropObject(((DBDatabase) dbo).getSchema(), "DATABASE", script);
+                    return;
                 default:
-                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBTable)
@@ -276,11 +279,13 @@ public class DBDatabaseDriverHSql extend
             switch (type)
             {
                 case CREATE:
-                    return createTable((DBTable) dbo, script);
+                    createTable((DBTable) dbo, script);
+                    return;
                 case DROP:
-                    return dropObject(((DBTable) dbo).getName(), "TABLE", script);
+                    dropObject(((DBTable) dbo).getName(), "TABLE", script);
+                    return;
                 default:
-                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBView)
@@ -288,11 +293,13 @@ public class DBDatabaseDriverHSql extend
             switch (type)
             {
                 case CREATE:
-                    return createView((DBView) dbo, script);
+                    createView((DBView) dbo, script);
+                    return;
                 case DROP:
-                    return dropObject(((DBView) dbo).getName(), "VIEW", script);
+                    dropObject(((DBView) dbo).getName(), "VIEW", script);
+                    return;
                 default:
-                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBRelation)
@@ -300,20 +307,23 @@ public class DBDatabaseDriverHSql extend
             switch (type)
             {
                 case CREATE:
-                    return alterRelation((DBRelation) dbo, type, script);
+                    alterRelation((DBRelation) dbo, type, script);
+                    return;
                 case DROP:
-                    return alterRelation((DBRelation) dbo, type, script);
+                    alterRelation((DBRelation) dbo, type, script);
+                    return;
                 default:
-                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBTableColumn)
         { // Table Column
-            return alterTable((DBTableColumn) dbo, type, script);
+            alterTable((DBTableColumn) dbo, type, script);
+            return;
         } 
         else
         { // an invalid argument has been supplied
-            return error(Errors.InvalidArg, dbo, "dbo");
+            throw new EmpireException(Errors.InvalidArg, dbo, "dbo");
         }
     }
 
@@ -333,7 +343,7 @@ public class DBDatabaseDriverHSql extend
     /*
      * return the sql for creating a Database
      */
-    protected boolean createDatabase(DBDatabase db, DBSQLScript script)
+    protected void createDatabase(DBDatabase db, DBSQLScript script)
     {
         // Create all Sequences
         Iterator<DBTable> seqtabs = db.getTables().iterator();
@@ -354,25 +364,20 @@ public class DBDatabaseDriverHSql extend
         Iterator<DBTable> tables = db.getTables().iterator();
         while (tables.hasNext())
         {
-            if (!createTable(tables.next(), script))
-                return false;
+            createTable(tables.next(), script);
         }
         // Create Relations
         Iterator<DBRelation> relations = db.getRelations().iterator();
         while (relations.hasNext())
         {
-            if (!alterRelation(relations.next(), DBCmdType.CREATE, script))
-                return false;
+            alterRelation(relations.next(), DBCmdType.CREATE, script);
         }
         // Create Views
         Iterator<DBView> views = db.getViews().iterator();
         while (views.hasNext())
         {
-            if (!createView(views.next(), script))
-                return false;
+            createView(views.next(), script);
         }
-        // Done
-        return true;
     }
 
     /**
@@ -380,7 +385,7 @@ public class DBDatabaseDriverHSql extend
      * 
      * @return true if the sequence has been created successfully
      */
-    protected boolean createSequence(DBDatabase db, DBTableColumn c, DBSQLScript script)
+    protected void createSequence(DBDatabase db, DBTableColumn c, DBSQLScript script)
     {
         Object defValue = c.getDefaultValue();
         String seqName = (defValue != null) ? defValue.toString() : c.toString();
@@ -393,7 +398,7 @@ public class DBDatabaseDriverHSql extend
         db.appendQualifiedName(sql, seqName, detectQuoteName(seqName));
         sql.append(" START WITH 1");
         // executeDLL
-        return script.addStmt(sql);
+        script.addStmt(sql);
     }
     
     /**
@@ -401,7 +406,7 @@ public class DBDatabaseDriverHSql extend
      * 
      * @return true if the table has been created successfully
      */
-    protected boolean createTable(DBTable t, DBSQLScript script)
+    protected void createTable(DBTable t, DBSQLScript script)
     {
         StringBuilder sql = new StringBuilder();
         sql.append("-- creating table ");
@@ -440,8 +445,7 @@ public class DBDatabaseDriverHSql extend
         }
         sql.append(")");
         // Create the table
-        if (script.addStmt(sql) == false)
-            return false;
+        script.addStmt(sql);
         // Create other Indexes (except primary key)
         Iterator<DBIndex> indexes = t.getIndexes().iterator();
         while (indexes.hasNext())
@@ -469,11 +473,8 @@ public class DBDatabaseDriverHSql extend
             }
             sql.append(")");
             // Create Index
-            if (script.addStmt(sql) == false)
-                return false;
+            script.addStmt(sql);
         }
-        // done
-        return success();
     }
     
     /**
@@ -552,8 +553,8 @@ public class DBDatabaseDriverHSql extend
                 sql.append("CHAR(36)");
                 break;
             case UNKNOWN:
-                 log.error("Cannot append column of Data-Type 'UNKNOWN'");
-                 return false;
+                log.warn("Cannot append column of Data-Type 'UNKNOWN'");
+                return false;
         }
         // Default Value
         if (isDDLColumnDefaults() && !c.isAutoGenerated() && c.getDefaultValue()!=null)
@@ -572,7 +573,7 @@ public class DBDatabaseDriverHSql extend
      * 
      * @return true if the relation has been altered successfully
      */
-    protected boolean alterRelation(DBRelation r, DBCmdType type, DBSQLScript script)
+    protected void alterRelation(DBRelation r, DBCmdType type, DBSQLScript script)
     {
         switch(type)
         {
@@ -613,11 +614,8 @@ public class DBDatabaseDriverHSql extend
                 }
                 // done
                 sql.append(")");
-                if (script.addStmt(sql.toString()) == false)
-                    return false;
-                // done
-                return success();
-                
+                script.addStmt(sql.toString());
+                break;
             }
             case DROP:
             {
@@ -631,22 +629,23 @@ public class DBDatabaseDriverHSql extend
                 sql.append(" DROP CONSTRAINT ");
                 appendElementName(sql, r.getName());
                 // done
-                return script.addStmt(sql.toString());
+                script.addStmt(sql.toString());
+                break;
             }
             default:
-                return error(Errors.NotImplemented, "Type not supported (" + type + ")");
+                throw new EmpireException(Errors.NotImplemented, "Type not supported (" + type + ")");
         }
 
     }
 
     /**
-     * Creates an alter table dll statement for adding, modifiying or droping a column.
+     * Creates an alter table dll statement for adding, modifying or dropping a column.
      * @param col the column which to add, modify or drop
      * @param type the type of operation to perform
      * @param script to which to append the sql statement to
      * @return true if the statement was successfully appended to the buffer
      */
-    protected boolean alterTable(DBTableColumn col, DBCmdType type, DBSQLScript script)
+    protected void alterTable(DBTableColumn col, DBCmdType type, DBSQLScript script)
     {
         StringBuilder sql = new StringBuilder();
         sql.append("ALTER TABLE ");
@@ -667,7 +666,7 @@ public class DBDatabaseDriverHSql extend
                 break;
         }
         // done
-        return script.addStmt(sql.toString());
+        script.addStmt(sql.toString());
     }
 
     /**
@@ -675,17 +674,14 @@ public class DBDatabaseDriverHSql extend
      * 
      * @return true if the view has been created successfully
      */
-    protected boolean createView(DBView v, DBSQLScript script)
+    protected void createView(DBView v, DBSQLScript script)
     {
         // Create the Command
         DBCommandExpr cmd = v.createCommand();
         if (cmd==null)
         {   // Check whether Error information is available
             log.error("No command has been supplied for view " + v.getName());
-            if (v.hasError())
-                return error(v);
-            // No error information available: Use Errors.NotImplemented
-            return error(Errors.NotImplemented, v.getName() + ".createCommand");
+            throw new EmpireException(Errors.NotImplemented, v.getName() + ".createCommand");
         }
         // Make sure there is no OrderBy
         cmd.clearOrderBy();
@@ -708,7 +704,7 @@ public class DBDatabaseDriverHSql extend
         sql.append(")\r\nAS\r\n");
         cmd.addSQL( sql, DBExpr.CTX_DEFAULT);
         // done
-        return script.addStmt(sql.toString());
+        script.addStmt(sql.toString());
     }
 
     /**
@@ -716,10 +712,10 @@ public class DBDatabaseDriverHSql extend
      * 
      * @return true if the object has been dropped successfully
      */
-    protected boolean dropObject(String name, String objType, DBSQLScript script)
+    protected void dropObject(String name, String objType, DBSQLScript script)
     {
         if (name == null || name.length() == 0)
-            return error(Errors.InvalidArg, name, "name");
+            throw new EmpireException(Errors.InvalidArg, name, "name");
         // Create Drop Statement
         StringBuilder sql = new StringBuilder();
         sql.append("DROP ");
@@ -727,7 +723,7 @@ public class DBDatabaseDriverHSql extend
         sql.append(" ");
         appendElementName(sql, name);
         // Done
-        return script.addStmt(sql);
+        script.addStmt(sql);
     }    
 }
 

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/mysql/DBDatabaseDriverMySQL.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/mysql/DBDatabaseDriverMySQL.java?rev=1148444&r1=1148443&r2=1148444&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/mysql/DBDatabaseDriverMySQL.java (original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/mysql/DBDatabaseDriverMySQL.java Tue Jul 19 16:53:34 2011
@@ -23,6 +23,7 @@ import java.sql.SQLException;
 import java.util.GregorianCalendar;
 import java.util.Iterator;
 
+import org.apache.empire.EmpireException;
 import org.apache.empire.commons.Errors;
 import org.apache.empire.commons.StringUtils;
 import org.apache.empire.data.DataType;
@@ -33,6 +34,7 @@ import org.apache.empire.db.DBCommandExp
 import org.apache.empire.db.DBDatabase;
 import org.apache.empire.db.DBDatabaseDriver;
 import org.apache.empire.db.DBDriverFeature;
+import org.apache.empire.db.DBErrors;
 import org.apache.empire.db.DBExpr;
 import org.apache.empire.db.DBIndex;
 import org.apache.empire.db.DBObject;
@@ -68,17 +70,15 @@ public class DBDatabaseDriverMySQL exten
         }
         
         @Override
-        public boolean limitRows(int numRows)
+        public void limitRows(int numRows)
         {
             limit = numRows;
-            return success();
         }
 
         @Override
-        public boolean skipRows(int numRows)
+        public void skipRows(int numRows)
         {
             skip = numRows;
-            return success();
         }
          
         @Override
@@ -89,10 +89,9 @@ public class DBDatabaseDriverMySQL exten
         }
         
         @Override
-        public boolean getSelect(StringBuilder buf)
+        public void getSelect(StringBuilder buf)
         {   // call base class
-            if (super.getSelect(buf)==false)
-                return false;
+            super.getSelect(buf);
             // add limit and offset
             if (limit>=0)
             {   buf.append("\r\nLIMIT ");
@@ -103,8 +102,6 @@ public class DBDatabaseDriverMySQL exten
                     buf.append(String.valueOf(skip));
                 }    
             }
-            // done
-            return success();
         }
     }
     
@@ -208,7 +205,7 @@ public class DBDatabaseDriverMySQL exten
      * @see org.apache.empire.db.DBDatabaseDriver#openDatabase(org.apache.empire.db.DBDatabase, java.sql.Connection)
      */
     @Override
-    public boolean attachDatabase(DBDatabase db, Connection conn)
+    public void attachDatabase(DBDatabase db, Connection conn)
     {
         // Prepare
         try
@@ -219,11 +216,12 @@ public class DBDatabaseDriverMySQL exten
             if (useSequenceTable && db.getTable(sequenceTableName)==null)
                 new DBSeqTable(sequenceTableName, db);
             // call Base implementation
-            return super.attachDatabase(db, conn);
+            super.attachDatabase(db, conn);
             
-        } catch (SQLException e)
-        {
-            return error(e);
+        } catch (SQLException e) {
+            // throw exception
+            String msg = extractErrorMessage(e);
+            throw new EmpireException(DBErrors.SQLException, new Object[] { msg }, e);
         }
     }
 
@@ -243,7 +241,7 @@ public class DBDatabaseDriverMySQL exten
 
     /**
      * Returns whether or not a particular feature is supported by this driver
-     * @param type type of requrested feature. @see DBDriverFeature
+     * @param type type of requested feature. @see DBDriverFeature
      * @return true if the features is supported or false otherwise
      */
     @Override
@@ -378,22 +376,24 @@ public class DBDatabaseDriverMySQL exten
      * @see DBDatabaseDriver#getDDLScript(DBCmdType, DBObject, DBSQLScript)  
      */
     @Override
-    public boolean getDDLScript(DBCmdType type, DBObject dbo, DBSQLScript script)
+    public void getDDLScript(DBCmdType type, DBObject dbo, DBSQLScript script)
     {
         // The Object's database must be attached to this driver
         if (dbo==null || dbo.getDatabase().getDriver()!=this)
-            return error(Errors.InvalidArg, dbo, "dbo");
+            throw new EmpireException(Errors.InvalidArg, dbo, "dbo");
         // Check Type of object
         if (dbo instanceof DBDatabase)
         { // Database
             switch (type)
             {
                 case CREATE:
-                    return createDatabase((DBDatabase) dbo, script, true);
+                    createDatabase((DBDatabase) dbo, script, true);
+                    return;
                 case DROP:
-                    return dropObject(((DBDatabase) dbo).getSchema(), "DATABASE", script);
+                    dropObject(((DBDatabase) dbo).getSchema(), "DATABASE", script);
+                    return;
                 default:
-                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBTable)
@@ -401,11 +401,13 @@ public class DBDatabaseDriverMySQL exten
             switch (type)
             {
                 case CREATE:
-                    return createTable((DBTable) dbo, script);
+                    createTable((DBTable) dbo, script);
+                    return;
                 case DROP:
-                    return dropObject(((DBTable) dbo).getName(), "TABLE", script);
+                    dropObject(((DBTable) dbo).getName(), "TABLE", script);
+                    return;
                 default:
-                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBView)
@@ -413,11 +415,13 @@ public class DBDatabaseDriverMySQL exten
             switch (type)
             {
                 case CREATE:
-                    return createView((DBView) dbo, script);
+                    createView((DBView) dbo, script);
+                    return;
                 case DROP:
-                    return dropObject(((DBView) dbo).getName(), "VIEW", script);
+                    dropObject(((DBView) dbo).getName(), "VIEW", script);
+                    return;
                 default:
-                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBRelation)
@@ -425,20 +429,23 @@ public class DBDatabaseDriverMySQL exten
             switch (type)
             {
                 case CREATE:
-                    return createRelation((DBRelation) dbo, script);
+                    createRelation((DBRelation) dbo, script);
+                    return;
                 case DROP:
-                    return dropObject(((DBRelation) dbo).getName(), "CONSTRAINT", script);
+                    dropObject(((DBRelation) dbo).getName(), "CONSTRAINT", script);
+                    return;
                 default:
-                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBTableColumn)
         { // Table Column
-            return alterTable((DBTableColumn) dbo, type, script);
+            alterTable((DBTableColumn) dbo, type, script);
+            return;
         } 
         else
         { // an invalid argument has been supplied
-            return error(Errors.InvalidArg, dbo, "dbo");
+            throw new EmpireException(Errors.InvalidArg, dbo, "dbo");
         }
     }
 
@@ -458,13 +465,13 @@ public class DBDatabaseDriverMySQL exten
     /*
      * return the sql for creating a Database
      */
-    protected boolean createDatabase(DBDatabase db, DBSQLScript script, boolean createSchema)
+    protected void createDatabase(DBDatabase db, DBSQLScript script, boolean createSchema)
     {
         // User Master to create Database
         if (createSchema)
         {   // check database Name
             if (StringUtils.isEmpty(databaseName))
-                return error(Errors.InvalidProperty, "databaseName");
+                throw new EmpireException(Errors.InvalidProperty, "databaseName");
             // Create Database
             script.addStmt("CREATE DATABASE IF NOT EXISTS " + databaseName + " CHARACTER SET " + characterSet);
             script.addStmt("USE " + databaseName);
@@ -477,25 +484,20 @@ public class DBDatabaseDriverMySQL exten
         Iterator<DBTable> tables = db.getTables().iterator();
         while (tables.hasNext())
         {
-            if (!createTable(tables.next(), script))
-                return false;
+            createTable(tables.next(), script);
         }
         // Create Relations
         Iterator<DBRelation> relations = db.getRelations().iterator();
         while (relations.hasNext())
         {
-            if (!createRelation(relations.next(), script))
-                return false;
+            createRelation(relations.next(), script);
         }
         // Create Views
         Iterator<DBView> views = db.getViews().iterator();
         while (views.hasNext())
         {
-            if (!createView(views.next(), script))
-                return false;
+            createView(views.next(), script);
         }
-        // Done
-        return true;
     }
     
     /**
@@ -503,7 +505,7 @@ public class DBDatabaseDriverMySQL exten
      * 
      * @return true if the table has been created successfully
      */
-    protected boolean createTable(DBTable t, DBSQLScript script)
+    protected void createTable(DBTable t, DBSQLScript script)
     {
         StringBuilder sql = new StringBuilder();
         sql.append("-- creating table ");
@@ -554,8 +556,7 @@ public class DBDatabaseDriverMySQL exten
             sql.append("'");
         }
         // Create the table
-        if (script.addStmt(sql) == false)
-            return false;
+        script.addStmt(sql);
         // Create other Indexes (except primary key)
         Iterator<DBIndex> indexes = t.getIndexes().iterator();
         while (indexes.hasNext())
@@ -583,11 +584,8 @@ public class DBDatabaseDriverMySQL exten
             }
             sql.append(")");
             // Create Index
-            if (script.addStmt(sql) == false)
-                return false;
+            script.addStmt(sql);
         }
-        // done
-        return success();
     }
     
     /**
@@ -685,8 +683,8 @@ public class DBDatabaseDriverMySQL exten
                 sql.append("CHAR(36)");
                 break;
             case UNKNOWN:
-                 log.error("Cannot append column of Data-Type 'UNKNOWN'");
-                 return false;
+                log.warn("Cannot append column of Data-Type 'UNKNOWN'");
+                return false;
         }
         // Default Value
         if (isDDLColumnDefaults() && !c.isAutoGenerated() && c.getDefaultValue()!=null)
@@ -705,7 +703,7 @@ public class DBDatabaseDriverMySQL exten
      * 
      * @return true if the relation has been created successfully
      */
-    protected boolean createRelation(DBRelation r, DBSQLScript script)
+    protected void createRelation(DBRelation r, DBSQLScript script)
     {
         DBTable sourceTable = (DBTable) r.getReferences()[0].getSourceColumn().getRowSet();
         DBTable targetTable = (DBTable) r.getReferences()[0].getTargetColumn().getRowSet();
@@ -742,10 +740,7 @@ public class DBDatabaseDriverMySQL exten
         }
         // done
         sql.append(")");
-        if (script.addStmt(sql) == false)
-            return false;
-        // done
-        return success();
+        script.addStmt(sql);
     }
 
     /**
@@ -755,7 +750,7 @@ public class DBDatabaseDriverMySQL exten
      * @param script to which to append the sql statement to
      * @return true if the statement was successfully appended to the buffer
      */
-    protected boolean alterTable(DBTableColumn col, DBCmdType type, DBSQLScript script)
+    protected void alterTable(DBTableColumn col, DBCmdType type, DBSQLScript script)
     {
         StringBuilder sql = new StringBuilder();
         sql.append("ALTER TABLE ");
@@ -776,7 +771,7 @@ public class DBDatabaseDriverMySQL exten
                 break;
         }
         // done
-        return script.addStmt(sql);
+        script.addStmt(sql);
     }
 
     /**
@@ -784,17 +779,14 @@ public class DBDatabaseDriverMySQL exten
      * 
      * @return true if the view has been created successfully
      */
-    protected boolean createView(DBView v, DBSQLScript script)
+    protected void createView(DBView v, DBSQLScript script)
     {
         // Create the Command
         DBCommandExpr cmd = v.createCommand();
         if (cmd==null)
         {   // Check whether Error information is available
             log.error("No command has been supplied for view " + v.getName());
-            if (v.hasError())
-                return error(v);
-            // No error information available: Use Errors.NotImplemented
-            return error(Errors.NotImplemented, v.getName() + ".createCommand");
+            throw new EmpireException(Errors.NotImplemented, v.getName() + ".createCommand");
         }
         // Make sure there is no OrderBy
         cmd.clearOrderBy();
@@ -817,7 +809,7 @@ public class DBDatabaseDriverMySQL exten
         sql.append(")\r\nAS\r\n");
         cmd.addSQL( sql, DBExpr.CTX_DEFAULT);
         // done
-        return script.addStmt(sql.toString());
+        script.addStmt(sql.toString());
     }
     
     /**
@@ -825,17 +817,17 @@ public class DBDatabaseDriverMySQL exten
      * 
      * @return true if the object has been dropped successfully
      */
-    protected boolean dropObject(String name, String objType, DBSQLScript script)
+    protected void dropObject(String name, String objType, DBSQLScript script)
     {
         if (name == null || name.length() == 0)
-            return error(Errors.InvalidArg, name, "name");
+            throw new EmpireException(Errors.InvalidArg, name, "name");
         // Create Drop Statement
         StringBuilder sql = new StringBuilder();
         sql.append("DROP ");
         sql.append(objType);
         sql.append(" ");
         appendElementName(sql, name);
-        return script.addStmt(sql);
+        script.addStmt(sql);
     }
 
 }

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/oracle/DBCommandOracle.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/oracle/DBCommandOracle.java?rev=1148444&r1=1148443&r2=1148444&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/oracle/DBCommandOracle.java (original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/oracle/DBCommandOracle.java Tue Jul 19 16:53:34 2011
@@ -19,6 +19,7 @@
 package org.apache.empire.db.oracle;
 
 // Imports
+import org.apache.empire.EmpireException;
 import org.apache.empire.commons.Errors;
 import org.apache.empire.db.DBCommand;
 import org.apache.empire.db.DBDatabase;
@@ -94,13 +95,12 @@ public class DBCommandOracle extends DBC
     }
     
     @Override
-    public boolean limitRows(int numRows)
+    public void limitRows(int numRows)
     {
     	if (rowNumExpr==null)
     		rowNumExpr = new OracleRowNumExpr(getDatabase());
     	// Add the constraint
     	where(rowNumExpr.isLessOrEqual(numRows));
-        return success();
     }
      
     @Override
@@ -116,15 +116,15 @@ public class DBCommandOracle extends DBC
      * Creates the SQL statement the special characteristics of
      * the Oracle database are supported.
      * 
-     * @param buf the SQL statment
+     * @param buf the SQL statement
      * @return true if the creation was successful
      */
     @Override
-    public synchronized boolean getSelect(StringBuilder buf)
+    public synchronized void getSelect(StringBuilder buf)
     {
         resetParamUsage();
         if (select == null)
-            return error(Errors.ObjectNotValid, getClass().getName()); // invalid!
+            throw new EmpireException(Errors.ObjectNotValid, getClass().getName()); // invalid!
         // Prepares statement
         buf.append("SELECT ");
         if (optimizerHint != null)
@@ -164,8 +164,6 @@ public class DBCommandOracle extends DBC
             // Add List of Order By Expressions
             addListExpr(buf, orderBy, CTX_DEFAULT, ", ");
         }
-        // Done
-        return success();
     }
     
     /**

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/oracle/DBDatabaseDriverOracle.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/oracle/DBDatabaseDriverOracle.java?rev=1148444&r1=1148443&r2=1148444&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/oracle/DBDatabaseDriverOracle.java (original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/oracle/DBDatabaseDriverOracle.java Tue Jul 19 16:53:34 2011
@@ -24,6 +24,7 @@ import java.sql.SQLException;
 import java.sql.Statement;
 import java.util.Iterator;
 
+import org.apache.empire.EmpireException;
 import org.apache.empire.commons.Errors;
 import org.apache.empire.data.DataType;
 import org.apache.empire.db.DBCmdType;
@@ -33,6 +34,7 @@ import org.apache.empire.db.DBCommandExp
 import org.apache.empire.db.DBDatabase;
 import org.apache.empire.db.DBDatabaseDriver;
 import org.apache.empire.db.DBDriverFeature;
+import org.apache.empire.db.DBErrors;
 import org.apache.empire.db.DBExpr;
 import org.apache.empire.db.DBIndex;
 import org.apache.empire.db.DBObject;
@@ -97,7 +99,7 @@ public class DBDatabaseDriverOracle exte
 
     /**
      * Returns whether or not a particular feature is supported by this driver
-     * @param type type of requrested feature. @see DBDriverFeature
+     * @param type type of requested feature. @see DBDriverFeature
      * @return true if the features is supported or false otherwise
      */
     @Override
@@ -315,22 +317,24 @@ public class DBDatabaseDriverOracle exte
      * @see DBDatabaseDriver#getDDLScript(DBCmdType, DBObject, DBSQLScript)  
      */
     @Override
-    public boolean getDDLScript(DBCmdType type, DBObject dbo, DBSQLScript script)
+    public void getDDLScript(DBCmdType type, DBObject dbo, DBSQLScript script)
     {
         // The Object's database must be attached to this driver
         if (dbo==null || dbo.getDatabase().getDriver()!=this)
-            return error(Errors.InvalidArg, dbo, "dbo");
+            throw new EmpireException(Errors.InvalidArg, dbo, "dbo");
         // Check Type of object
         if (dbo instanceof DBDatabase)
         { // Database
             switch (type)
             {
                 case CREATE:
-                    return createDatabase((DBDatabase) dbo, script);
+                    createDatabase((DBDatabase) dbo, script);
+                    return;
                 case DROP:
-                    return dropObject(((DBDatabase) dbo).getSchema(), "USER", script);
+                    dropObject(((DBDatabase) dbo).getSchema(), "USER", script);
+                    return;
                 default:
-                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBTable)
@@ -338,11 +342,13 @@ public class DBDatabaseDriverOracle exte
             switch (type)
             {
                 case CREATE:
-                    return createTable((DBTable) dbo, script);
+                    createTable((DBTable) dbo, script);
+                    return;
                 case DROP:
-                    return dropObject(((DBTable) dbo).getName(), "TABLE", script);
+                    dropObject(((DBTable) dbo).getName(), "TABLE", script);
+                    return;
                 default:
-                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBView)
@@ -350,11 +356,13 @@ public class DBDatabaseDriverOracle exte
             switch (type)
             {
                 case CREATE:
-                    return createView((DBView) dbo, script);
+                    createView((DBView) dbo, script);
+                    return;
                 case DROP:
-                    return dropObject(((DBView) dbo).getName(), "VIEW", script);
+                    dropObject(((DBView) dbo).getName(), "VIEW", script);
+                    return;
                 default:
-                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBRelation)
@@ -362,20 +370,23 @@ public class DBDatabaseDriverOracle exte
             switch (type)
             {
                 case CREATE:
-                    return createRelation((DBRelation) dbo, script);
+                    createRelation((DBRelation) dbo, script);
+                    return;
                 case DROP:
-                    return dropObject(((DBRelation) dbo).getName(), "CONSTRAINT", script);
+                    dropObject(((DBRelation) dbo).getName(), "CONSTRAINT", script);
+                    return;
                 default:
-                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBTableColumn)
         { // Table Column
-            return alterTable((DBTableColumn) dbo, type, script);
+            alterTable((DBTableColumn) dbo, type, script);
+            return;
         } 
         else
         { // an invalid argument has been supplied
-            return error(Errors.InvalidArg, dbo, "dbo");
+            throw new EmpireException(Errors.InvalidArg, dbo, "dbo");
         }
     }
 
@@ -393,11 +404,10 @@ public class DBDatabaseDriverOracle exte
         {   // Oracle Timestamp query
             rs = executeQuery("select sysdate from dual", null, false, conn);
             return (rs.next() ? rs.getTimestamp(1) : null);
-        } catch (Exception e)
-        {
-            log.error("getUpdateTimestamp exception: " + e);
-            error(e);
-            return null;
+        } catch (SQLException e) {
+            // throw exception
+            String msg = extractErrorMessage(e);
+            throw new EmpireException(DBErrors.SQLException, new Object[] { msg }, e);
         } finally
         { // Cleanup
             try
@@ -407,9 +417,10 @@ public class DBDatabaseDriverOracle exte
                     rs.close();
                 if (stmt != null)
                     stmt.close();
-            } catch (SQLException sqle)
-            {
-                log.error("getUpdateTimestamp close exception: " + sqle);
+            } catch (SQLException e) {
+                // throw exception
+                String msg = extractErrorMessage(e);
+                throw new EmpireException(DBErrors.SQLException, new Object[] { msg }, e);
             }
         }
     }
@@ -419,7 +430,7 @@ public class DBDatabaseDriverOracle exte
      * 
      * @return true if the database has been created successfully
      */
-    protected boolean createDatabase(DBDatabase db, DBSQLScript script)
+    protected void createDatabase(DBDatabase db, DBSQLScript script)
     {
         // Create all Sequences
         Iterator<DBTable> seqtabs = db.getTables().iterator();
@@ -440,26 +451,30 @@ public class DBDatabaseDriverOracle exte
         Iterator<DBTable> tables = db.getTables().iterator();
         while (tables.hasNext())
         {
-            if (!createTable(tables.next(), script))
-                return false;
+            createTable(tables.next(), script);
         }
         // Create Relations
         Iterator<DBRelation> relations = db.getRelations().iterator();
         while (relations.hasNext())
         {
-            if (!createRelation(relations.next(), script))
-                return false;
+            createRelation(relations.next(), script);
         }
         // Create Views
         Iterator<DBView> views = db.getViews().iterator();
         while (views.hasNext())
         {
-            if (!createView(views.next(), script))
-                if (getErrorType()!=Errors.NotImplemented)
-                    return false;
+            try {
+                createView(views.next(), script);
+            } catch(EmpireException e) {
+                // Error
+                if (e.getErrorType()!=Errors.NotImplemented)
+                {   // View command not implemented
+                    log.warn("Error creating the view {0}. This view will be ignored.");
+                    continue;
+                }    
+                else throw e; 
+            }
         }
-        // Done
-        return true;
     }
 
     /**
@@ -467,7 +482,7 @@ public class DBDatabaseDriverOracle exte
      * 
      * @return true if the sequence has been created successfully
      */
-    protected boolean createSequence(DBDatabase db, DBTableColumn c, DBSQLScript script)
+    protected void createSequence(DBDatabase db, DBTableColumn c, DBSQLScript script)
     {
         Object defValue = c.getDefaultValue();
         String seqName = (defValue != null) ? defValue.toString() : c.toString();
@@ -480,14 +495,14 @@ public class DBDatabaseDriverOracle exte
         db.appendQualifiedName(sql, seqName, detectQuoteName(seqName));
         sql.append(" INCREMENT BY 1 START WITH 1 MINVALUE 0 NOCYCLE NOCACHE NOORDER");
         // executeDLL
-        return script.addStmt(sql);
+        script.addStmt(sql);
     }
     
     /**
      * Returns true if the table has been created successfully.
      * @return true if the table has been created successfully
      */
-    protected boolean createTable(DBTable t, DBSQLScript script)
+    protected void createTable(DBTable t, DBSQLScript script)
     {
         StringBuilder sql = new StringBuilder();
         sql.append("-- creating table ");
@@ -527,8 +542,7 @@ public class DBDatabaseDriverOracle exte
         sql.append(")");
         // Create the table
         DBDatabase db = t.getDatabase();
-        if (script.addStmt(sql) == false)
-            return false;
+        script.addStmt(sql);
         // Create other Indexes (except primary key)
         Iterator<DBIndex> indexes = t.getIndexes().iterator();
         while (indexes.hasNext())
@@ -557,8 +571,7 @@ public class DBDatabaseDriverOracle exte
             }
             sql.append(")");
             // Create Index
-            if (script.addStmt(sql) == false)
-                return false;
+            script.addStmt(sql);
         }
         // add Comments
         createComment(db, "TABLE", t, t.getComment(), script);
@@ -570,8 +583,6 @@ public class DBDatabaseDriverOracle exte
             if (com != null)
                 createComment(db, "COLUMN", c, com, script);
         }
-        // done
-        return success();
     }
     
     /**
@@ -652,7 +663,7 @@ public class DBDatabaseDriverOracle exte
                 sql.append("CHAR(36)");
                 break;
             case UNKNOWN:
-                log.error("Cannot append column of Data-Type 'UNKNOWN'");
+                log.warn("Cannot append column of Data-Type 'UNKNOWN'");
                 return false;
         }
         // Default Value
@@ -671,7 +682,7 @@ public class DBDatabaseDriverOracle exte
      * Create a sql string for creating a relation and appends it to the supplied buffer
      * @return true if the relation has been created successfully
      */
-    protected boolean createRelation(DBRelation r, DBSQLScript script)
+    protected void createRelation(DBRelation r, DBSQLScript script)
     {
         DBTable sourceTable = (DBTable) r.getReferences()[0].getSourceColumn().getRowSet();
         DBTable targetTable = (DBTable) r.getReferences()[0].getTargetColumn().getRowSet();
@@ -709,7 +720,7 @@ public class DBDatabaseDriverOracle exte
         // done
         sql.append(")");
         // done
-        return script.addStmt(sql);
+        script.addStmt(sql);
     }
 
     /**
@@ -719,7 +730,7 @@ public class DBDatabaseDriverOracle exte
      * @param script to which to append the sql statement to
      * @return true if the statement was successfully appended to the buffer
      */
-    protected boolean alterTable(DBTableColumn col, DBCmdType type, DBSQLScript script)
+    protected void alterTable(DBTableColumn col, DBCmdType type, DBSQLScript script)
     {
         StringBuilder sql = new StringBuilder();
         sql.append("ALTER TABLE ");
@@ -740,7 +751,7 @@ public class DBDatabaseDriverOracle exte
                 break;
         }
         // done
-        return script.addStmt(sql);
+        script.addStmt(sql);
     }
     
     /**
@@ -748,17 +759,14 @@ public class DBDatabaseDriverOracle exte
      * 
      * @return true if the view has been created successfully
      */
-    protected boolean createView(DBView v, DBSQLScript script)
+    protected void createView(DBView v, DBSQLScript script)
     {
         // Create the Command
         DBCommandExpr cmd = v.createCommand();
         if (cmd==null)
         {   // Check whether Error information is available
             log.error("No command has been supplied for view " + v.getName());
-            if (v.hasError())
-                return error(v);
-            // No error information available: Use Errors.NotImplemented
-            return error(Errors.NotImplemented, v.getName() + ".createCommand");
+            throw new EmpireException(Errors.NotImplemented, v.getName() + ".createCommand");
         }
         // Make sure there is no OrderBy
         cmd.clearOrderBy();
@@ -781,7 +789,7 @@ public class DBDatabaseDriverOracle exte
         sql.append(")\r\nAS\r\n");
         cmd.addSQL( sql, DBExpr.CTX_DEFAULT);
         // done
-        return script.addStmt(sql.toString());
+        script.addStmt(sql.toString());
     }
 
     /**
@@ -789,10 +797,10 @@ public class DBDatabaseDriverOracle exte
      * 
      * @return true if the comment has been created successfully
      */
-    protected boolean createComment(DBDatabase db, String type, DBExpr expr, String comment, DBSQLScript script)
+    protected void createComment(DBDatabase db, String type, DBExpr expr, String comment, DBSQLScript script)
     {
         if (comment==null || comment.length()==0)
-            return true;
+            return; // Nothing to do
         StringBuilder sql = new StringBuilder();
         sql.append("COMMENT ON ");
         sql.append(type);
@@ -808,7 +816,7 @@ public class DBDatabaseDriverOracle exte
         sql.append(comment);
         sql.append("'");
         // Create Index
-        return script.addStmt(sql);
+        script.addStmt(sql);
     }
     
     /**
@@ -816,17 +824,17 @@ public class DBDatabaseDriverOracle exte
      * 
      * @return true if the object has been dropped successfully
      */
-    protected boolean dropObject(String name, String objType, DBSQLScript script)
+    protected void dropObject(String name, String objType, DBSQLScript script)
     {
         if (name == null || name.length() == 0)
-            return error(Errors.InvalidArg, name, "name");
+            throw new EmpireException(Errors.InvalidArg, name, "name");
         // Create Drop Statement
         StringBuilder sql = new StringBuilder();
         sql.append("DROP ");
         sql.append(objType);
         sql.append(" ");
         appendElementName(sql, name);
-        return script.addStmt(sql);
+        script.addStmt(sql);
     }
 
     
@@ -836,12 +844,12 @@ public class DBDatabaseDriverOracle exte
      * @return true if the database definition matches the real database structure.
      */
     @Override
-    public boolean checkDatabase(DBDatabase db, String owner, Connection conn)
+    public void checkDatabase(DBDatabase db, String owner, Connection conn)
     {
         // Check Params
         if (owner==null || owner.length()==0)
-            return error(Errors.InvalidArg, owner, "owner");
-        // Datebase definition
+            throw new EmpireException(Errors.InvalidArg, owner, "owner");
+        // Database definition
         OracleSYSDatabase sysDB = new OracleSYSDatabase(this);
         // Check Columns
         DBCommand sysDBCommand = sysDB.createCommand();
@@ -852,78 +860,74 @@ public class DBDatabaseDriverOracle exte
         DBReader rd = new DBReader();
         try
         {
-            if (rd.open(sysDBCommand, conn))
+            rd.open(sysDBCommand, conn);
+            // read all
+            log.info("---------------------------------------------------------------------------------");
+            log.info("checkDatabase start: " + db.getClass().getName());
+            String skipTable = "";
+            while (rd.moveNext())
             {
-                log.info("---------------------------------------------------------------------------------");
-                log.info("checkDatabase start: " + db.getClass().getName());
-                String skipTable = "";
-                while (rd.moveNext())
-                {
-                    String tableName = rd.getString(sysDB.CI.C_TABLE_NAME);
-
-                    // if a table wasn't found before, skip it
-                    if (tableName.equals(skipTable))
-                        continue;
+                String tableName = rd.getString(sysDB.CI.C_TABLE_NAME);
 
-                    // check if the found table exists in the DBDatabase object
-                    String columnName = rd.getString(sysDB.CI.C_COLUMN_NAME);
-                    DBTable dbTable = db.getTable(tableName);
-                    DBView  dbView  = db.getView(tableName);
-                    
-                    String dataType = rd.getString(sysDB.CI.C_DATA_TYPE);
-                    int charLength = rd.getInt(sysDB.CI.C_CHAR_LENGTH);
-                    int dataLength = rd.getInt(sysDB.CI.C_DATA_LENGTH);
-                    int dataPrecision = rd.getInt(sysDB.CI.C_DATA_PRECISION);
-                    int dataScale = rd.getInt(sysDB.CI.C_DATA_SCALE);
-                    String nullable = rd.getString(sysDB.CI.C_NULLABLE);
-                    
-                    dataDictionnary.fillDataDictionnary(tableName, columnName, dataType, 
-                                                        charLength, dataLength, dataPrecision, dataScale, nullable);
+                // if a table wasn't found before, skip it
+                if (tableName.equals(skipTable))
+                    continue;
+
+                // check if the found table exists in the DBDatabase object
+                String columnName = rd.getString(sysDB.CI.C_COLUMN_NAME);
+                DBTable dbTable = db.getTable(tableName);
+                DBView  dbView  = db.getView(tableName);
+                
+                String dataType = rd.getString(sysDB.CI.C_DATA_TYPE);
+                int charLength = rd.getInt(sysDB.CI.C_CHAR_LENGTH);
+                int dataLength = rd.getInt(sysDB.CI.C_DATA_LENGTH);
+                int dataPrecision = rd.getInt(sysDB.CI.C_DATA_PRECISION);
+                int dataScale = rd.getInt(sysDB.CI.C_DATA_SCALE);
+                String nullable = rd.getString(sysDB.CI.C_NULLABLE);
+                
+                dataDictionnary.fillDataDictionnary(tableName, columnName, dataType, 
+                                                    charLength, dataLength, dataPrecision, dataScale, nullable);
+                
+                if (dbTable != null)
+                {
                     
-                    if (dbTable != null)
-                    {
-                        
-                        // check if the found column exists in the found DBTable
-                        DBColumn col = dbTable.getColumn(columnName);
-                        if (col == null)
-                        {
-                            log.warn("COLUMN NOT FOUND IN " + db.getClass().getName() + "\t: [" + tableName + "]["
-                                           + columnName + "][" + dataType + "][" + dataLength + "]");
-                            continue;
-                        }
-                        /*
-                        else
-                        {   // check the DBTableColumn definition
-                            int length = (charLength>0) ? charLength : dataLength;
-                            dataDictionnary.checkColumnDefinition(col, dataType, length, dataPrecision, dataScale, nullable.equals("N"));
-                        }
-                        */
-                    } 
-                    else if (dbView!=null)
+                    // check if the found column exists in the found DBTable
+                    DBColumn col = dbTable.getColumn(columnName);
+                    if (col == null)
                     {
-                        log.debug("Column check for view " + tableName + " not yet implemented.");
-                    } 
-                    else
-                    {
-                        log.debug("TABLE OR VIEW NOT FOUND IN " + db.getClass().getName() + "\t: [" + tableName + "]");
-                        // skip this table
-                        skipTable = tableName;
+                        log.warn("COLUMN NOT FOUND IN " + db.getClass().getName() + "\t: [" + tableName + "]["
+                                       + columnName + "][" + dataType + "][" + dataLength + "]");
                         continue;
                     }
+                    /*
+                    else
+                    {   // check the DBTableColumn definition
+                        int length = (charLength>0) ? charLength : dataLength;
+                        dataDictionnary.checkColumnDefinition(col, dataType, length, dataPrecision, dataScale, nullable.equals("N"));
+                    }
+                    */
+                } 
+                else if (dbView!=null)
+                {
+                    log.debug("Column check for view " + tableName + " not yet implemented.");
+                } 
+                else
+                {
+                    log.debug("TABLE OR VIEW NOT FOUND IN " + db.getClass().getName() + "\t: [" + tableName + "]");
+                    // skip this table
+                    skipTable = tableName;
+                    continue;
                 }
-                // check Tables
-                dataDictionnary.checkDBTableDefinition(db.getTables());
-                // check Views
-                dataDictionnary.checkDBViewDefinition (db.getViews()); 
-            }
-            else {
-                return error(Errors.NotAuthorized);
             }
+            // check Tables
+            dataDictionnary.checkDBTableDefinition(db.getTables());
+            // check Views
+            dataDictionnary.checkDBViewDefinition (db.getViews());
+            // done
             log.info("checkDatabase end: " + db.getClass().getName());
             log.info("---------------------------------------------------------------------------------");
-            return success();
-        } finally
-        {
+        } finally {
+            // close
             rd.close();
         }
     }



Mime
View raw message