db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r373389 - in /db/ddlutils/trunk: lib/ src/java/org/apache/ddlutils/platform/oracle/ src/test/
Date Sun, 29 Jan 2006 23:14:41 GMT
Author: tomdz
Date: Sun Jan 29 15:14:27 2006
New Revision: 373389

URL: http://svn.apache.org/viewcvs?rev=373389&view=rev
Log:
Added Oracle 10 platform
Enhanced/fixed Oracle platforms

Added:
    db/ddlutils/trunk/lib/jakarta-oro-2.0.8.jar   (with props)
    db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/oracle/Oracle10Builder.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/oracle/Oracle10ModelReader.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/oracle/Oracle10Platform.java
    db/ddlutils/trunk/src/test/jdbc.properties.oracle10

Added: db/ddlutils/trunk/lib/jakarta-oro-2.0.8.jar
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/lib/jakarta-oro-2.0.8.jar?rev=373389&view=auto
==============================================================================
Binary file - no diff available.

Propchange: db/ddlutils/trunk/lib/jakarta-oro-2.0.8.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/oracle/Oracle10Builder.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/oracle/Oracle10Builder.java?rev=373389&view=auto
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/oracle/Oracle10Builder.java (added)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/oracle/Oracle10Builder.java Sun
Jan 29 15:14:27 2006
@@ -0,0 +1,64 @@
+package org.apache.ddlutils.platform.oracle;
+
+import java.io.IOException;
+
+import org.apache.ddlutils.PlatformInfo;
+import org.apache.ddlutils.model.Column;
+import org.apache.ddlutils.model.Table;
+
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * The SQL builder for Oracle 10.
+ */
+public class Oracle10Builder extends Oracle8Builder
+{
+    /**
+     * Creates a new builder instance.
+     * 
+     * @param info The platform info
+     */
+    public Oracle10Builder(PlatformInfo info)
+    {
+        super(info);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void dropTable(Table table) throws IOException
+    {
+    	// The only difference to the Oracle 8/9 variant is the purge which prevents the
+    	// table from being moved to the recycle bin (which is new in Oracle 10)
+        print("DROP TABLE ");
+        printIdentifier(getTableName(table));
+        print(" CASCADE CONSTRAINTS PURGE");
+        printEndOfStatement();
+
+        Column[] columns = table.getAutoIncrementColumns();
+
+        for (int idx = 0; idx < columns.length; idx++)
+        {
+            print("DROP TRIGGER ");
+            printIdentifier(getConstraintName("trg", table, columns[idx].getName(), null));
+            printEndOfStatement();
+            print("DROP SEQUENCE ");
+            printIdentifier(getConstraintName("seq", table, columns[idx].getName(), null));
+            printEndOfStatement();
+        }
+    }
+}

Added: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/oracle/Oracle10ModelReader.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/oracle/Oracle10ModelReader.java?rev=373389&view=auto
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/oracle/Oracle10ModelReader.java
(added)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/oracle/Oracle10ModelReader.java
Sun Jan 29 15:14:27 2006
@@ -0,0 +1,75 @@
+package org.apache.ddlutils.platform.oracle;
+
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Map;
+
+import org.apache.ddlutils.PlatformInfo;
+import org.apache.ddlutils.model.Table;
+import org.apache.ddlutils.platform.DatabaseMetaDataWrapper;
+
+public class Oracle10ModelReader extends Oracle8ModelReader
+{
+    /**
+     * Creates a new model reader for Oracle 10 databases.
+     * 
+     * @param platformInfo The platform specific settings
+     */
+    public Oracle10ModelReader(PlatformInfo platformInfo)
+    {
+        super(platformInfo);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+	protected Table readTable(DatabaseMetaDataWrapper metaData, Map values) throws SQLException
+	{
+		// Oracle 10 added the recycle bin which contains dropped database objects not yet purged
+		// Since we don't want entries from the recycle bin, we filter them out
+        PreparedStatement stmt       = null;
+        boolean           deletedObj = false;
+
+        try
+        {
+        	stmt = getConnection().prepareStatement("SELECT * FROM RECYCLEBIN WHERE OBJECT_NAME=?");
+        	stmt.setString(1, (String)values.get("TABLE_NAME"));
+        	
+        	ResultSet rs = stmt.executeQuery();
+
+        	if (rs.next())
+        	{
+        		// we found the table in the recycle bin, so its a deleted one which we ignore
+        		deletedObj = true;
+        	}
+        	rs.close();
+        }
+        finally
+        {
+        	if (stmt != null)
+        	{
+        		stmt.close();
+        	}
+        }
+
+        return deletedObj ? null : super.readTable(metaData, values);
+	}
+
+}

Added: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/oracle/Oracle10Platform.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/oracle/Oracle10Platform.java?rev=373389&view=auto
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/oracle/Oracle10Platform.java (added)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/oracle/Oracle10Platform.java Sun
Jan 29 15:14:27 2006
@@ -0,0 +1,48 @@
+package org.apache.ddlutils.platform.oracle;
+
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+/**
+ * The platform for Oracle 10.
+ *
+ * @author Thomas Dudziak
+ * @version $Revision: 231306 $
+ */
+public class Oracle10Platform extends Oracle9Platform
+{
+    /** Database name of this platform. */
+    public static final String DATABASENAME = "Oracle10";
+
+    /**
+     * Creates a new platform instance.
+     */
+    public Oracle10Platform()
+    {
+        super();
+        setSqlBuilder(new Oracle10Builder(getPlatformInfo()));
+        setModelReader(new Oracle10ModelReader(getPlatformInfo()));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getName()
+    {
+        return DATABASENAME;
+    }
+}

Added: db/ddlutils/trunk/src/test/jdbc.properties.oracle10
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/test/jdbc.properties.oracle10?rev=373389&view=auto
==============================================================================
--- db/ddlutils/trunk/src/test/jdbc.properties.oracle10 (added)
+++ db/ddlutils/trunk/src/test/jdbc.properties.oracle10 Sun Jan 29 15:14:27 2006
@@ -0,0 +1,31 @@
+# JDBC properties for Oracle10
+# Note: Properties starting with "datasource." will be fed into the datasource instance of
the
+# class configured via the datasource.class property
+
+# Use this property to choose the Oracle10 platform (instead of the Oracle8 default one)
+ddlutils.platform=Oracle10
+
+#
+# Using the plain DBCP datasource
+#
+
+#datasource.class=org.apache.commons.dbcp.BasicDataSource
+#datasource.driverClassName=oracle.jdbc.driver.OracleDriver
+#datasource.url=jdbc:oracle:thin:@localhost:1521:test
+#datasource.username=ddlutils
+#datasource.password=ddlutils
+
+#
+# Or the Oracle datasource
+#
+
+datasource.class=oracle.jdbc.pool.OracleDataSource
+datasource.URL=jdbc:oracle:thin:@localhost:1521:test
+datasource.user=ddlutils
+datasource.password=ddlutils
+datasource.connectionCachingEnabled=true
+
+
+# For oracle, we should limit the schema to the one of the user
+# Note that Oracle requires this to be uppercase, even when using delimited identifiers
+ddlutils.schema=DDLUTILS



Mime
View raw message