incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1222195 - in /incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database: DBInterfaceDerby.java DBInterfaceHSQLDB.java DBInterfaceMySQL.java Database.java
Date Thu, 22 Dec 2011 12:12:07 GMT
Author: kwright
Date: Thu Dec 22 12:12:06 2011
New Revision: 1222195

URL: http://svn.apache.org/viewvc?rev=1222195&view=rev
Log:
MySQL looks up columns using the label, not the column, so create an abstraction for that.
 Part of CONNECTORS-334.

Modified:
    incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceDerby.java
    incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java
    incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java
    incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/Database.java

Modified: incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceDerby.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceDerby.java?rev=1222195&r1=1222194&r2=1222195&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceDerby.java
(original)
+++ incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceDerby.java
Thu Dec 22 12:12:06 2011
@@ -1532,12 +1532,12 @@ public class DBInterfaceDerby extends Da
   }
 
   /** Abstract method for mapping a column name from resultset */
-  protected String mapColumnName(String rawColumnName)
+  @Override
+  protected String mapLabelName(String rawLabelName)
   {
-    return rawColumnName.toLowerCase();
+    return rawLabelName.toLowerCase();
   }
 
-
   // Functions that correspond to user-defined functions in Derby
   
   /** Method to compare a value using a case-insensitive regular expression.

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=1222195&r1=1222194&r2=1222195&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 22 12:12:06 2011
@@ -1449,9 +1449,10 @@ public class DBInterfaceHSQLDB extends D
   }
 
   /** Abstract method for mapping a column name from resultset */
-  protected String mapColumnName(String rawColumnName)
+  @Override
+  protected String mapLabelName(String rawLabelName)
   {
-    return rawColumnName.toLowerCase();
+    return rawLabelName.toLowerCase();
   }
 
 }

Modified: incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java?rev=1222195&r1=1222194&r2=1222195&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java
(original)
+++ incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java
Thu Dec 22 12:12:06 2011
@@ -99,6 +99,13 @@ public class DBInterfaceMySQL extends Da
     return theException;
   }
 
+  /** Abstract method for mapping a column lookup name from resultset */
+  @Override
+  protected String mapLookupName(String rawColumnName, String rawLabelName)
+  {
+    return rawLabelName;
+  }
+
   /** Initialize.  This method is called once per JVM instance, in order to set up
   * database communication.
   */

Modified: incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/Database.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/Database.java?rev=1222195&r1=1222194&r2=1222195&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/Database.java
(original)
+++ incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/Database.java
Thu Dec 22 12:12:06 2011
@@ -112,13 +112,19 @@ public abstract class Database
     throws ManifoldCFException
   {
   }
-  
-  /** Abstract method for mapping a column name from resultset */
-  protected String mapColumnName(String rawColumnName)
+
+  /** Abstract method for mapping a column lookup name from resultset */
+  protected String mapLookupName(String rawColumnName, String rawLabelName)
   {
     return rawColumnName;
   }
   
+  /** Abstract method for mapping a label name from resultset */
+  protected String mapLabelName(String rawLabelName)
+  {
+    return rawLabelName;
+  }
+  
   /** Execute arbitrary database query, and optionally cache the result.  Cached results
are
   * returned for this operation if they are valid and appropriate.  Note that any cached
results
   * returned were only guaranteed to be pertinent at the time the cached result was obtained;
the
@@ -887,8 +893,9 @@ public abstract class Database
             resultLabels = new String[colcount];
             for (int i = 0; i < colcount; i++)
             {
-              resultCols[i] = rsmd.getColumnName(i+1);
-              resultLabels[i] = mapColumnName(rsmd.getColumnLabel(i+1));
+              String labelName = rsmd.getColumnLabel(i+1);
+              resultCols[i] = mapLookupName(rsmd.getColumnName(i+1),labelName);
+              resultLabels[i] = mapLabelName(labelName);
             }
           }
 



Mime
View raw message