incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1214707 - in /incubator/lcf/trunk: CHANGES.txt framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java
Date Thu, 15 Dec 2011 11:28:13 GMT
Author: kwright
Date: Thu Dec 15 11:28:13 2011
New Revision: 1214707

URL: http://svn.apache.org/viewvc?rev=1214707&view=rev
Log:
Fix for CONNECTORS-320.  Correct how we query information schema for tables, indexes, etc.
for HSQLDB.

Modified:
    incubator/lcf/trunk/CHANGES.txt
    incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java

Modified: incubator/lcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/CHANGES.txt?rev=1214707&r1=1214706&r2=1214707&view=diff
==============================================================================
--- incubator/lcf/trunk/CHANGES.txt (original)
+++ incubator/lcf/trunk/CHANGES.txt Thu Dec 15 11:28:13 2011
@@ -3,6 +3,10 @@ $Id$
 
 ======================= 0.4-dev =====================
 
+CONNECTORS-320: Fix issues with remote HSQLDB driver having to do
+with schema discovery.
+(Karl Wright)
+
 CONNECTORS-308: Get the alfresco connector integration tests to run
 under ant.
 (Piergiorgio Lucidi, Karl Wright)

Modified: incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java?rev=1214707&r1=1214706&r2=1214707&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java
(original)
+++ incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java
Thu Dec 15 11:28:13 2011
@@ -54,6 +54,7 @@ public class DBInterfaceHSQLDB extends D
   protected int serializableDepth = 0;
   protected boolean isRemote;
   protected String schemaName;
+  protected String schemaNameForQueries;
   
   public DBInterfaceHSQLDB(IThreadContext tc, String databaseName, String userName, String
password)
     throws ManifoldCFException
@@ -64,9 +65,15 @@ public class DBInterfaceHSQLDB extends D
     this.userName = userName;
     this.password = password;
     if (this.isRemote)
+    {
       schemaName = databaseName;
+      schemaNameForQueries = databaseName;
+    }
     else
+    {
       schemaName = null;
+      schemaNameForQueries = "PUBLIC";
+    }
   }
 
   protected void setupSchema()
@@ -612,7 +619,7 @@ public class DBInterfaceHSQLDB extends D
       
       // Now, look for schema
       params.clear();
-      params.add(databaseName);
+      params.add(databaseName.toUpperCase());
       IResultSet schemaResult = masterDatabase.executeQuery("SELECT * FROM INFORMATION_SCHEMA.SYSTEM_SCHEMAS
WHERE TABLE_SCHEM=?",params,
         null,null,null,true,-1,null,null);
       if (schemaResult.getRowCount() == 0)
@@ -781,16 +788,17 @@ public class DBInterfaceHSQLDB extends D
   {
     StringBuilder query = new StringBuilder();
     List list = new ArrayList();
+    list.add(schemaNameForQueries.toUpperCase());
     list.add(tableName.toUpperCase());
     query.append("SELECT column_name, is_nullable, data_type, character_maximum_length ")
-      .append("FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='PUBLIC' AND table_name=?");
+      .append("FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema=? AND table_name=?");
     IResultSet set = performQuery(query.toString(),list,cacheKeys,queryClass);
     if (set.getRowCount() == 0)
       return null;
 
     query = new StringBuilder();
     query.append("SELECT column_name ")
-      .append("FROM INFORMATION_SCHEMA.SYSTEM_PRIMARYKEYS WHERE table_schem='PUBLIC' AND
table_name=?");
+      .append("FROM INFORMATION_SCHEMA.SYSTEM_PRIMARYKEYS WHERE table_schem=? AND table_name=?");
     IResultSet primarySet = performQuery(query.toString(),list,cacheKeys,queryClass);
     String primaryKey = null;
     if (primarySet.getRowCount() != 0)
@@ -835,8 +843,9 @@ public class DBInterfaceHSQLDB extends D
     Map<String,IndexDescription> rval = new HashMap<String,IndexDescription>();
 
     String query = "SELECT index_name,column_name,non_unique,ordinal_position FROM INFORMATION_SCHEMA.SYSTEM_INDEXINFO
"+
-      "WHERE table_schem='PUBLIC' AND TABLE_NAME=? ORDER BY index_name,ordinal_position ASC";
+      "WHERE table_schem=? AND TABLE_NAME=? ORDER BY index_name,ordinal_position ASC";
     List list = new ArrayList();
+    list.add(schemaNameForQueries.toUpperCase());
     list.add(tableName.toUpperCase());
     IResultSet result = performQuery(query,list,cacheKeys,queryClass);
     String lastIndexName = null;
@@ -896,7 +905,9 @@ public class DBInterfaceHSQLDB extends D
   public StringSet getAllTables(StringSet cacheKeys, String queryClass)
     throws ManifoldCFException
   {
-    IResultSet set = performQuery("SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE
table_schema='PUBLIC'",null,cacheKeys,queryClass);
+    ArrayList list = new ArrayList();
+    list.add(schemaNameForQueries.toUpperCase());
+    IResultSet set = performQuery("SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE
table_schema=?",list,cacheKeys,queryClass);
     StringSetBuffer ssb = new StringSetBuffer();
     String columnName = "table_name";
 



Mime
View raw message