db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r532976 - /db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/sybase/SybaseBuilder.java
Date Fri, 27 Apr 2007 05:58:02 GMT
Author: tomdz
Date: Thu Apr 26 22:58:01 2007
New Revision: 532976

URL: http://svn.apache.org/viewvc?view=rev&rev=532976
Log:
Fix for DDLUTILS-173

Modified:
    db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/sybase/SybaseBuilder.java

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/sybase/SybaseBuilder.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/sybase/SybaseBuilder.java?view=diff&rev=532976&r1=532975&r2=532976
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/sybase/SybaseBuilder.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/sybase/SybaseBuilder.java Thu
Apr 26 22:58:01 2007
@@ -73,7 +73,79 @@
         super.createTable(database, table, parameters);
     }
 
-	/**
+    /**
+     * {@inheritDoc}
+     */
+	protected void writeTableCreationStmtEnding(Table table, Map parameters) throws IOException
+    {
+        if (parameters != null)
+        {
+            // We support
+            // - 'lock'
+            // - 'at'
+            // - 'external table at'
+            // - 'on'
+            // - with parameters as name value pairs
+
+            String lockValue            = (String)parameters.get("lock");
+            String atValue              = (String)parameters.get("at");
+            String externalTableAtValue = (String)parameters.get("external table at");
+            String onValue              = (String)parameters.get("on");
+
+            if (lockValue != null)
+            {
+                print(" lock ");
+                print(lockValue);
+            }
+
+            boolean writtenWithParameters = false;
+
+            for (Iterator it = parameters.entrySet().iterator(); it.hasNext();)
+            {
+                Map.Entry entry = (Map.Entry)it.next();
+                String    name  = entry.getKey().toString();
+
+                if (!"lock".equals(name) && !"at".equals(name) && !"external
table at".equals(name) && !"on".equals(name))
+                {
+                    if (!writtenWithParameters)
+                    {
+                        print(" with ");
+                        writtenWithParameters = true;
+                    }
+                    else
+                    {
+                        print(", ");
+                    }
+                    print(name);
+                    if (entry.getValue() != null)
+                    {
+                        print("=");
+                        print(entry.getValue().toString());
+                    }
+                }
+            }
+            if (onValue != null)
+            {
+                print(" on ");
+                print(onValue);
+            }
+            if (externalTableAtValue != null)
+            {
+                print(" external table at \"");
+                print(externalTableAtValue);
+                print("\"");
+            }
+            else if (atValue != null)
+            {
+                print(" at \"");
+                print(atValue);
+                print("\"");
+            }
+        }
+        super.writeTableCreationStmtEnding(table, parameters);
+    }
+
+    /**
 	 * {@inheritDoc}
 	 */
 	protected void writeColumn(Table table, Column column) throws IOException
@@ -356,7 +428,7 @@
             {
                 AddColumnChange addColumnChange = (AddColumnChange)change;
 
-                // Oracle can only add not insert columns
+                // Sybase can only add not insert columns
                 if (addColumnChange.isAtEnd())
                 {
                     processChange(currentModel, desiredModel, addColumnChange);



Mime
View raw message