jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marti...@apache.org
Subject svn commit: r686688 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/OracleDatabaseJournal.java
Date Mon, 18 Aug 2008 07:40:55 GMT
Author: martijnh
Date: Mon Aug 18 00:40:55 2008
New Revision: 686688

URL: http://svn.apache.org/viewvc?rev=686688&view=rev
Log:
JCR-1362: DatabaseJournal improperly finds tables in external schemas when used on Oracle

Applied proposed patch.

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/OracleDatabaseJournal.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/OracleDatabaseJournal.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/OracleDatabaseJournal.java?rev=686688&r1=686687&r2=686688&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/OracleDatabaseJournal.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/OracleDatabaseJournal.java
Mon Aug 18 00:40:55 2008
@@ -16,6 +16,10 @@
  */
 package org.apache.jackrabbit.core.journal;
 
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
 import org.apache.jackrabbit.util.Text;
 
 /**
@@ -68,4 +72,24 @@
         }
         return Text.replace(sql, TABLE_SPACE_VARIABLE, tspace).trim();
     }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected boolean tableExists(DatabaseMetaData metaData, String tableName) throws SQLException
{
+        if (metaData.storesLowerCaseIdentifiers()) {
+            tableName = tableName.toLowerCase();
+        } else if (metaData.storesUpperCaseIdentifiers()) {
+            tableName = tableName.toUpperCase();
+        }
+
+        String userName = metaData.getUserName();
+        ResultSet rs = metaData.getTables(null, userName, tableName, null);
+
+        try {
+            return rs.next();
+        } finally {
+            rs.close();
+        }
+    }
 }



Mime
View raw message