db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r377020 - /db/ddlutils/trunk/src/test/org/apache/ddlutils/TestDatabaseWriterBase.java
Date Sat, 11 Feb 2006 19:23:16 GMT
Author: tomdz
Date: Sat Feb 11 11:23:16 2006
New Revision: 377020

URL: http://svn.apache.org/viewcvs?rev=377020&view=rev
Log:
Added tests for the alteration of databases

Modified:
    db/ddlutils/trunk/src/test/org/apache/ddlutils/TestDatabaseWriterBase.java

Modified: db/ddlutils/trunk/src/test/org/apache/ddlutils/TestDatabaseWriterBase.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/test/org/apache/ddlutils/TestDatabaseWriterBase.java?rev=377020&r1=377019&r2=377020&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/TestDatabaseWriterBase.java (original)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/TestDatabaseWriterBase.java Sat Feb 11
11:23:16 2006
@@ -212,18 +212,52 @@
     }
 
     /**
-     * Creates a new database model from the given XML database schema.
+     * Creates a new database from the given XML database schema.
      * 
      * @param schemaXml The XML database schema
+     * @return The parsed database model
      */
-    protected void createDatabase(String schemaXml) throws DynaSqlException
+    protected Database createDatabase(String schemaXml) throws DynaSqlException
+    {
+    	Database model = parseDatabaseFromString(schemaXml);
+
+    	createDatabase(model);
+    	return model;
+    }
+
+    /**
+     * Creates a new database from the given model.
+     * 
+     * @param model The model
+     */
+    protected void createDatabase(Database model) throws DynaSqlException
     {
         try
         {
-            _model = parseDatabaseFromString(schemaXml);
+            _model = model;
 
             getPlatform().getPlatformInfo().setCommentsSupported(false);
             getPlatform().createTables(_model, false, false);
+        }
+        catch (Exception ex)
+        {
+            throw new DynaSqlException(ex);
+        }
+    }
+
+    /**
+     * Alters the database to match the given model.
+     * 
+     * @param model The model
+     */
+    protected void alterDatabase(Database model) throws DynaSqlException
+    {
+        try
+        {
+            _model = model;
+
+            getPlatform().getPlatformInfo().setCommentsSupported(false);
+            getPlatform().alterTables(_model, true, true, false);
         }
         catch (Exception ex)
         {



Mime
View raw message