empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From franci...@apache.org
Subject svn commit: r1088417 [3/4] - in /incubator/empire-db/branches/EMPIREDB-99: empire-db-codegen/src/main/java/org/apache/empire/db/codegen/ empire-db-examples/empire-db-example-advanced/src/main/java/org/apache/empire/samples/db/advanced/ empire-db-exampl...
Date Sun, 03 Apr 2011 21:12:16 GMT
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=1088417&r1=1088416&r2=1088417&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 Sun Apr  3 21:12:14 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);
+                    break;
                 case DROP:
-                    return dropObject(((DBDatabase) dbo).getSchema(), "DATABASE", script);
+                    dropObject(((DBDatabase) dbo).getSchema(), "DATABASE", script);
+                    break;
                 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);
+                    break;
                 case DROP:
-                    return dropObject(((DBTable) dbo).getName(), "TABLE", script);
+                    dropObject(((DBTable) dbo).getName(), "TABLE", script);
+                    break;
                 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);
+                    break;
                 case DROP:
-                    return dropObject(((DBView) dbo).getName(), "VIEW", script);
+                    dropObject(((DBView) dbo).getName(), "VIEW", script);
+                    break;
                 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,22 @@ public class DBDatabaseDriverDerby exten
             switch (type)
             {
                 case CREATE:
-                    return createRelation((DBRelation) dbo, script);
+                    createRelation((DBRelation) dbo, script);
+                    break;
                 case DROP:
-                    return dropObject(((DBRelation) dbo).getName(), "CONSTRAINT", script);
+                    dropObject(((DBRelation) dbo).getName(), "CONSTRAINT", script);
+                    break;
                 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);
         } 
         else
         { // an invalid argument has been supplied
-            return error(Errors.InvalidArg, dbo, "dbo");
+        	throw new EmpireException(Errors.InvalidArg, dbo, "dbo");
         }
     }
 
@@ -363,7 +372,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 +391,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 +412,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 +457,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 +485,8 @@ public class DBDatabaseDriverDerby exten
             }
             sql.append(")");
             // Create Index
-            if (script.addStmt(sql) == false)
-                return false;
+            script.addStmt(sql);
         }
-        // done
-        return success();
     }
     
     /**
@@ -614,7 +614,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();
@@ -649,12 +649,8 @@ public class DBDatabaseDriverDerby exten
             refs[i].getTargetColumn().addSQL(sql, DBExpr.CTX_NAME);
             addSeparator = true;
         }
-        // done
         sql.append(")");
-        if (script.addStmt(sql) == false)
-            return false;
-        // done
-        return success();
+        script.addStmt(sql);
     }
 
     /**
@@ -664,7 +660,7 @@ public class DBDatabaseDriverDerby 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 ");
@@ -685,7 +681,7 @@ public class DBDatabaseDriverDerby exten
                 break;
         }
         // done
-        return script.addStmt(sql);
+        script.addStmt(sql);
     }
 
     /**
@@ -693,17 +689,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 +720,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 +728,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=1088417&r1=1088416&r2=1088417&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 Sun Apr  3 21:12:14 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);
+                    break;
                 case DROP:
-                    return dropObject(((DBDatabase) dbo).getSchema(), "DATABASE", script);
+                    dropObject(((DBDatabase) dbo).getSchema(), "DATABASE", script);
+                    break;
                 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);
+                    break;
                 case DROP:
-                    return dropObject(((DBTable) dbo).getName(), "TABLE", script);
+                    dropObject(((DBTable) dbo).getName(), "TABLE", script);
+                    break;
                 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,11 @@ public class DBDatabaseDriverH2 extends 
             switch (type)
             {
                 case CREATE:
-                    return createView((DBView) dbo, script);
+                    createView((DBView) dbo, script);
                 case DROP:
-                    return dropObject(((DBView) dbo).getName(), "VIEW", script);
+                    dropObject(((DBView) dbo).getName(), "VIEW", script);
                 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 +340,20 @@ public class DBDatabaseDriverH2 extends 
             switch (type)
             {
                 case CREATE:
-                    return createRelation((DBRelation) dbo, script);
+                    createRelation((DBRelation) dbo, script);
                 case DROP:
-                    return dropObject(((DBRelation) dbo).getName(), "CONSTRAINT", script);
+                    dropObject(((DBRelation) dbo).getName(), "CONSTRAINT", script);
                 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);
         } 
         else
         { // an invalid argument has been supplied
-            return error(Errors.InvalidArg, dbo, "dbo");
+        	throw new EmpireException(Errors.InvalidArg, dbo, "dbo");
         }
     }
 
@@ -368,7 +373,7 @@ public class DBDatabaseDriverH2 extends 
     /*
      * 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)
@@ -387,25 +392,20 @@ 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 +413,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 +458,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 +486,8 @@ public class DBDatabaseDriverH2 extends 
             }
             sql.append(")");
             // Create Index
-            if (script.addStmt(sql) == false)
-                return false;
+            script.addStmt(sql);
         }
-        // done
-        return success();
     }
     
     /**
@@ -601,7 +597,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,10 +634,7 @@ public class DBDatabaseDriverH2 extends 
         }
         // done
         sql.append(")");
-        if (script.addStmt(sql) == false)
-            return false;
-        // done
-        return success();
+        script.addStmt(sql);
     }
 
     /**
@@ -651,7 +644,7 @@ public class DBDatabaseDriverH2 extends 
      * @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 +665,7 @@ public class DBDatabaseDriverH2 extends 
                 break;
         }
         // done
-        return script.addStmt(sql);
+        script.addStmt(sql);
     }
 
     /**
@@ -680,17 +673,15 @@ 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 +704,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 +712,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=1088417&r1=1088416&r2=1088417&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 Sun Apr  3 21:12:14 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);
+                    break;
                 case DROP:
-                    return dropObject(((DBDatabase) dbo).getSchema(), "DATABASE", script);
+                    dropObject(((DBDatabase) dbo).getSchema(), "DATABASE", script);
+                    break;
                 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);
+                    break;
                 case DROP:
-                    return dropObject(((DBTable) dbo).getName(), "TABLE", script);
+                    dropObject(((DBTable) dbo).getName(), "TABLE", script);
+                    break;
                 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);
+                    break;
                 case DROP:
-                    return dropObject(((DBView) dbo).getName(), "VIEW", script);
+                    dropObject(((DBView) dbo).getName(), "VIEW", script);
+                    break;
                 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,22 @@ public class DBDatabaseDriverHSql extend
             switch (type)
             {
                 case CREATE:
-                    return alterRelation((DBRelation) dbo, type, script);
+                    alterRelation((DBRelation) dbo, type, script);
+                    break;
                 case DROP:
-                    return alterRelation((DBRelation) dbo, type, script);
+                    alterRelation((DBRelation) dbo, type, script);
+                    break;
                 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);
         } 
         else
         { // an invalid argument has been supplied
-            return error(Errors.InvalidArg, dbo, "dbo");
+        	throw new EmpireException(Errors.InvalidArg, dbo, "dbo");
         }
     }
 
@@ -333,7 +342,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,33 +363,29 @@ 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;
     }
 
     /**
-     * Returns true if the sequence has been created successfully.
-     * 
-     * @return true if the sequence has been created successfully
+     * Creates a sequence
+     * @param db
+     * @param c
+     * @param script
      */
-    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 ");
@@ -416,8 +421,7 @@ public class DBDatabaseDriverHSql extend
         {
             DBTableColumn c = (DBTableColumn) columns.next();
             sql.append((addSeparator) ? ",\r\n   " : "\r\n   ");
-            if (appendColumnDesc(c, sql)==false)
-                continue; // Ignore and continue;
+            appendColumnDesc(c, sql);
             addSeparator = true;
         }
         // Primary Key
@@ -440,8 +444,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 +472,8 @@ public class DBDatabaseDriverHSql extend
             }
             sql.append(")");
             // Create Index
-            if (script.addStmt(sql) == false)
-                return false;
+            script.addStmt(sql);
         }
-        // done
-        return success();
     }
     
     /**
@@ -482,7 +482,7 @@ public class DBDatabaseDriverHSql extend
      * @param sql the sql builder object
      * @return true if the column was successfully appended or false otherwise
      */
-    protected boolean appendColumnDesc(DBTableColumn c, StringBuilder sql)
+    protected void appendColumnDesc(DBTableColumn c, StringBuilder sql)
     {
         // Append name
         c.addSQL(sql, DBExpr.CTX_NAME);
@@ -553,7 +553,7 @@ public class DBDatabaseDriverHSql extend
                 break;
             case UNKNOWN:
                  log.error("Cannot append column of Data-Type 'UNKNOWN'");
-                 return false;
+                 return;
         }
         // Default Value
         if (isDDLColumnDefaults() && !c.isAutoGenerated() && c.getDefaultValue()!=null)
@@ -563,8 +563,6 @@ public class DBDatabaseDriverHSql extend
         // Nullable
         if (c.isRequired() ||  c.isAutoGenerated())
             sql.append(" NOT NULL");
-        // Done
-        return true;
     }
 
     /**
@@ -572,7 +570,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,10 +611,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,10 +627,11 @@ 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 + ")");
         }
 
     }
@@ -646,7 +643,7 @@ public class DBDatabaseDriverHSql extend
      * @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 +664,7 @@ public class DBDatabaseDriverHSql extend
                 break;
         }
         // done
-        return script.addStmt(sql.toString());
+        script.addStmt(sql.toString());
     }
 
     /**
@@ -675,17 +672,15 @@ 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 +703,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 +711,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 +722,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=1088417&r1=1088416&r2=1088417&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 Sun Apr  3 21:12:14 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;
@@ -68,17 +69,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 +88,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 +101,6 @@ public class DBDatabaseDriverMySQL exten
                     buf.append(String.valueOf(skip));
                 }    
             }
-            // done
-            return success();
         }
     }
     
@@ -208,7 +204,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 +215,11 @@ 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);
+        	throw new EmpireException(e);
         }
     }
 
@@ -378,22 +374,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);
+                    break;
                 case DROP:
-                    return dropObject(((DBDatabase) dbo).getSchema(), "DATABASE", script);
+                    dropObject(((DBDatabase) dbo).getSchema(), "DATABASE", script);
+                    break;
                 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 +399,13 @@ public class DBDatabaseDriverMySQL exten
             switch (type)
             {
                 case CREATE:
-                    return createTable((DBTable) dbo, script);
+                    createTable((DBTable) dbo, script);
+                    break;
                 case DROP:
-                    return dropObject(((DBTable) dbo).getName(), "TABLE", script);
+                    dropObject(((DBTable) dbo).getName(), "TABLE", script);
+                    break;
                 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 +413,13 @@ public class DBDatabaseDriverMySQL exten
             switch (type)
             {
                 case CREATE:
-                    return createView((DBView) dbo, script);
+                    createView((DBView) dbo, script);
+                    break;
                 case DROP:
-                    return dropObject(((DBView) dbo).getName(), "VIEW", script);
+                    dropObject(((DBView) dbo).getName(), "VIEW", script);
+                    break;
                 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 +427,22 @@ public class DBDatabaseDriverMySQL exten
             switch (type)
             {
                 case CREATE:
-                    return createRelation((DBRelation) dbo, script);
+                    createRelation((DBRelation) dbo, script);
+                    break;
                 case DROP:
-                    return dropObject(((DBRelation) dbo).getName(), "CONSTRAINT", script);
+                    dropObject(((DBRelation) dbo).getName(), "CONSTRAINT", script);
+                    break;
                 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);
         } 
         else
         { // an invalid argument has been supplied
-            return error(Errors.InvalidArg, dbo, "dbo");
+        	throw new EmpireException(Errors.InvalidArg, dbo, "dbo");
         }
     }
 
@@ -458,13 +462,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 +481,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 +502,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 ");
@@ -518,8 +517,7 @@ public class DBDatabaseDriverMySQL exten
         {
             DBTableColumn c = (DBTableColumn) columns.next();
             sql.append((addSeparator) ? ",\r\n   " : "\r\n   ");
-            if (appendColumnDesc(c, sql)==false)
-                continue; // Ignore and continue;
+            appendColumnDesc(c, sql);
             addSeparator = true;
         }
         // Primary Key
@@ -554,8 +552,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 +580,8 @@ public class DBDatabaseDriverMySQL exten
             }
             sql.append(")");
             // Create Index
-            if (script.addStmt(sql) == false)
-                return false;
+            script.addStmt(sql);
         }
-        // done
-        return success();
     }
     
     /**
@@ -596,7 +590,7 @@ public class DBDatabaseDriverMySQL exten
      * @param sql the sql builder object
      * @return true if the column was successfully appended or false otherwise
      */
-    protected boolean appendColumnDesc(DBTableColumn c, StringBuilder sql)
+    protected void appendColumnDesc(DBTableColumn c, StringBuilder sql)
     {
         // Append name
         c.addSQL(sql, DBExpr.CTX_NAME);
@@ -686,7 +680,7 @@ public class DBDatabaseDriverMySQL exten
                 break;
             case UNKNOWN:
                  log.error("Cannot append column of Data-Type 'UNKNOWN'");
-                 return false;
+                 return;
         }
         // Default Value
         if (isDDLColumnDefaults() && !c.isAutoGenerated() && c.getDefaultValue()!=null)
@@ -696,8 +690,6 @@ public class DBDatabaseDriverMySQL exten
         // Nullable
         if (c.isRequired() ||  c.isAutoGenerated())
             sql.append(" NOT NULL");
-        // Done
-        return true;
     }
 
     /**
@@ -705,7 +697,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 +734,7 @@ public class DBDatabaseDriverMySQL exten
         }
         // done
         sql.append(")");
-        if (script.addStmt(sql) == false)
-            return false;
-        // done
-        return success();
+       script.addStmt(sql);
     }
 
     /**
@@ -755,7 +744,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 +765,7 @@ public class DBDatabaseDriverMySQL exten
                 break;
         }
         // done
-        return script.addStmt(sql);
+        script.addStmt(sql);
     }
 
     /**
@@ -784,17 +773,15 @@ 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 +804,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 +812,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=1088417&r1=1088416&r2=1088417&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 Sun Apr  3 21:12:14 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
@@ -120,11 +120,11 @@ public class DBCommandOracle extends DBC
      * @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=1088417&r1=1088416&r2=1088417&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 Sun Apr  3 21:12:14 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;
@@ -315,22 +316,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);
+                    break;
                 case DROP:
-                    return dropObject(((DBDatabase) dbo).getSchema(), "USER", script);
+                    dropObject(((DBDatabase) dbo).getSchema(), "USER", script);
+                    break;
                 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 +341,13 @@ public class DBDatabaseDriverOracle exte
             switch (type)
             {
                 case CREATE:
-                    return createTable((DBTable) dbo, script);
+                    createTable((DBTable) dbo, script);
+                    break;
                 case DROP:
-                    return dropObject(((DBTable) dbo).getName(), "TABLE", script);
+                    dropObject(((DBTable) dbo).getName(), "TABLE", script);
+                    break;
                 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 +355,13 @@ public class DBDatabaseDriverOracle exte
             switch (type)
             {
                 case CREATE:
-                    return createView((DBView) dbo, script);
+                    createView((DBView) dbo, script);
+                    break;
                 case DROP:
-                    return dropObject(((DBView) dbo).getName(), "VIEW", script);
+                    dropObject(((DBView) dbo).getName(), "VIEW", script);
+                    break;
                 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 +369,22 @@ public class DBDatabaseDriverOracle exte
             switch (type)
             {
                 case CREATE:
-                    return createRelation((DBRelation) dbo, script);
+                    createRelation((DBRelation) dbo, script);
+                    break;
                 case DROP:
-                    return dropObject(((DBRelation) dbo).getName(), "CONSTRAINT", script);
+                    dropObject(((DBRelation) dbo).getName(), "CONSTRAINT", script);
+                    break;
                 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);
         } 
         else
         { // an invalid argument has been supplied
-            return error(Errors.InvalidArg, dbo, "dbo");
+        	throw new EmpireException(Errors.InvalidArg, dbo, "dbo");
         }
     }
 
@@ -396,8 +405,7 @@ public class DBDatabaseDriverOracle exte
         } catch (Exception e)
         {
             log.error("getUpdateTimestamp exception: " + e);
-            error(e);
-            return null;
+            throw new EmpireException(e);
         } finally
         { // Cleanup
             try
@@ -419,7 +427,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 +448,20 @@ 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;
+        	createView(views.next(), script);
         }
-        // Done
-        return true;
     }
 
     /**
@@ -467,7 +469,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 +482,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 ");
@@ -502,8 +504,7 @@ public class DBDatabaseDriverOracle exte
         {
             DBTableColumn c = (DBTableColumn) columns.next();
             sql.append((addSeparator) ? ",\r\n   " : "\r\n   ");
-            if (appendColumnDesc(c, sql)==false)
-                continue; // Ignore and continue;
+            appendColumnDesc(c, sql);
             addSeparator = true;
         }
         // Primary Key
@@ -527,8 +528,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 +557,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,17 +569,14 @@ public class DBDatabaseDriverOracle exte
             if (com != null)
                 createComment(db, "COLUMN", c, com, script);
         }
-        // done
-        return success();
     }
     
     /**
      * Appends a table column definition to a ddl statement
      * @param c the column which description to append
      * @param sql the sql builder object
-     * @return true if the column was successfully appended or false otherwise
      */
-    protected boolean appendColumnDesc(DBTableColumn c, StringBuilder sql)
+    protected void appendColumnDesc(DBTableColumn c, StringBuilder sql)
     {
         // Append name
         c.addSQL(sql, DBExpr.CTX_NAME);
@@ -653,7 +649,7 @@ public class DBDatabaseDriverOracle exte
                 break;
             case UNKNOWN:
                 log.error("Cannot append column of Data-Type 'UNKNOWN'");
-                return false;
+                return;
         }
         // Default Value
         if (isDDLColumnDefaults() && !c.isAutoGenerated() && c.getDefaultValue()!=null)
@@ -663,15 +659,13 @@ public class DBDatabaseDriverOracle exte
         // Nullable
         if (c.isRequired() ||  c.isAutoGenerated())
             sql.append(" NOT NULL");
-        // Done
-        return true;
     }
 
     /**
      * 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 +703,7 @@ public class DBDatabaseDriverOracle exte
         // done
         sql.append(")");
         // done
-        return script.addStmt(sql);
+        script.addStmt(sql);
     }
 
     /**
@@ -719,7 +713,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 +734,7 @@ public class DBDatabaseDriverOracle exte
                 break;
         }
         // done
-        return script.addStmt(sql);
+        script.addStmt(sql);
     }
     
     /**
@@ -748,17 +742,15 @@ 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 +773,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 +781,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;
         StringBuilder sql = new StringBuilder();
         sql.append("COMMENT ON ");
         sql.append(type);
@@ -808,7 +800,7 @@ public class DBDatabaseDriverOracle exte
         sql.append(comment);
         sql.append("'");
         // Create Index
-        return script.addStmt(sql);
+        script.addStmt(sql);
     }
     
     /**
@@ -816,17 +808,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);
     }
 
     
@@ -840,7 +832,7 @@ public class DBDatabaseDriverOracle exte
     {
         // Check Params
         if (owner==null || owner.length()==0)
-            return error(Errors.InvalidArg, owner, "owner");
+        	throw new EmpireException(Errors.InvalidArg, owner, "owner");
         // Datebase definition
         OracleSYSDatabase sysDB = new OracleSYSDatabase(this);
         // Check Columns
@@ -852,8 +844,8 @@ public class DBDatabaseDriverOracle exte
         DBReader rd = new DBReader();
         try
         {
-            if (rd.open(sysDBCommand, conn))
-            {
+        	rd.open(sysDBCommand, conn);
+
                 log.info("---------------------------------------------------------------------------------");
                 log.info("checkDatabase start: " + db.getClass().getName());
                 String skipTable = "";
@@ -915,17 +907,14 @@ public class DBDatabaseDriverOracle exte
                 dataDictionnary.checkDBTableDefinition(db.getTables());
                 // check Views
                 dataDictionnary.checkDBViewDefinition (db.getViews()); 
-            }
-            else {
-                return error(Errors.NotAuthorized);
-            }
+
             log.info("checkDatabase end: " + db.getClass().getName());
             log.info("---------------------------------------------------------------------------------");
-            return success();
         } finally
         {
             rd.close();
         }
+        return true;
     }
 
 }

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/postgresql/DBDatabaseDriverPostgreSQL.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/postgresql/DBDatabaseDriverPostgreSQL.java?rev=1088417&r1=1088416&r2=1088417&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/postgresql/DBDatabaseDriverPostgreSQL.java (original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/postgresql/DBDatabaseDriverPostgreSQL.java Sun Apr  3 21:12:14 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;
@@ -242,7 +243,7 @@ public class DBDatabaseDriverPostgreSQL 
             return (executeSQL(CREATE_REVERSE_FUNCTION, null, conn, null)>=0);
         } catch(SQLException e) {
             log.error("Unable to create reverse function!", e);
-            return error(e);
+            throw new EmpireException(e);
         }
     }
     
@@ -397,22 +398,24 @@ public class DBDatabaseDriverPostgreSQL 
      * @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);
+                    break;
                 case DROP:
-                    return dropObject(((DBDatabase) dbo).getSchema(), "DATABASE", script);
+                    dropObject(((DBDatabase) dbo).getSchema(), "DATABASE", script);
+                    break;
                 default:
-                    return error(Errors.NotImplemented, "getDDLScript."+dbo.getClass().getName()+"."+String.valueOf(type));
+                	throw new EmpireException(Errors.NotImplemented, "getDDLScript."+dbo.getClass().getName()+"."+String.valueOf(type));
             }
         } 
         else if (dbo instanceof DBTable)
@@ -420,11 +423,13 @@ public class DBDatabaseDriverPostgreSQL 
             switch (type)
             {
                 case CREATE:
-                    return createTable((DBTable) dbo, script);
+                    createTable((DBTable) dbo, script);
+                    break;
                 case DROP:
-                    return dropObject(((DBTable) dbo).getName(), "TABLE", script);
+                    dropObject(((DBTable) dbo).getName(), "TABLE", script);
+                    break;
                 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)
@@ -432,11 +437,13 @@ public class DBDatabaseDriverPostgreSQL 
             switch (type)
             {
                 case CREATE:
-                    return createView((DBView) dbo, script);
+                    createView((DBView) dbo, script);
+                    break;
                 case DROP:
-                    return dropObject(((DBView) dbo).getName(), "VIEW", script);
+                    dropObject(((DBView) dbo).getName(), "VIEW", script);
+                    break;
                 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)
@@ -444,20 +451,22 @@ public class DBDatabaseDriverPostgreSQL 
             switch (type)
             {
                 case CREATE:
-                    return createRelation((DBRelation) dbo, script);
+                    createRelation((DBRelation) dbo, script);
+                    break;
                 case DROP:
-                    return dropObject(((DBRelation) dbo).getName(), "CONSTRAINT", script);
+                    dropObject(((DBRelation) dbo).getName(), "CONSTRAINT", script);
+                    break;
                 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);
         } 
         else
         { // an invalid argument has been supplied
-            return error(Errors.InvalidArg, dbo, "dbo");
+        	throw new EmpireException(Errors.InvalidArg, dbo, "dbo");
         }
     }
 
@@ -477,7 +486,7 @@ public class DBDatabaseDriverPostgreSQL 
     /*
      * 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();
@@ -499,25 +508,20 @@ public class DBDatabaseDriverPostgreSQL 
         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;
     }
     
     protected String createSequenceName(DBTableColumn c){
@@ -530,7 +534,7 @@ public class DBDatabaseDriverPostgreSQL 
      * 
      * @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)
     {
     	String seqName = createSequenceName(c);
         // createSQL
@@ -547,7 +551,7 @@ public class DBDatabaseDriverPostgreSQL 
         
         sql.append(" INCREMENT BY 1 START WITH 1 MINVALUE 0");
         // executeDLL
-        return script.addStmt(sql);
+        script.addStmt(sql);
     }
     
     /**
@@ -555,7 +559,7 @@ public class DBDatabaseDriverPostgreSQL 
      * 
      * @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 ");
@@ -600,8 +604,7 @@ public class DBDatabaseDriverPostgreSQL 
             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())
@@ -629,11 +632,8 @@ public class DBDatabaseDriverPostgreSQL 
             }
             sql.append(")");
             // Create Index
-            if (script.addStmt(sql) == false)
-                return false;
+            script.addStmt(sql);
         }
-        // done
-        return success();
     }
     
     /**
@@ -763,7 +763,7 @@ public class DBDatabaseDriverPostgreSQL 
      * 
      * @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();
@@ -800,10 +800,8 @@ public class DBDatabaseDriverPostgreSQL 
         }
         // done
         sql.append(")");
-        if (script.addStmt(sql) == false)
-            return false;
-        // done
-        return success();
+        script.addStmt(sql);
+
     }
     
     /**
@@ -813,7 +811,7 @@ public class DBDatabaseDriverPostgreSQL 
      * @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 ");
@@ -834,7 +832,7 @@ public class DBDatabaseDriverPostgreSQL 
                 break;
         }
         // done
-        return script.addStmt(sql);
+        script.addStmt(sql);
     }
     
     
@@ -844,17 +842,15 @@ public class DBDatabaseDriverPostgreSQL 
      * 
      * @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();
@@ -877,7 +873,7 @@ public class DBDatabaseDriverPostgreSQL 
         sql.append(")\r\nAS\r\n");
         cmd.addSQL( sql, DBExpr.CTX_DEFAULT);
         // done
-        return script.addStmt(sql.toString());
+        script.addStmt(sql.toString());
     }
     
     /**
@@ -885,17 +881,17 @@ public class DBDatabaseDriverPostgreSQL 
      * 
      * @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);
     }
     
 }



Mime
View raw message