DB2/400 uses different syntax than DB2 UDB for its uppercase function.
DB2 UDB: UPPERCASE(COLUMN)
DB2/400: UCASE(COLUMN)
toUpperCase and ignoreCase where overridden in the previous implementation
to return, verbatim, what was passed in.
Now it will return the properly formatted sql syntax to create
case-insensitive where clauses.
Scott
Index: src/java/org/apache/turbine/util/db/adapter/DBDB2400.java
===================================================================
RCS file:
/home/cvspublic/jakarta-turbine-2/src/java/org/apache/turbine/util/db/adapter/DBDB2400.java,v
retrieving revision 1.1
diff -u -r1.1 DBDB2400.java
--- src/java/org/apache/turbine/util/db/adapter/DBDB2400.java 16 Oct 2001 21:05:28
-0000 1.1
+++ src/java/org/apache/turbine/util/db/adapter/DBDB2400.java 25 Jan 2002 14:01:55
+-0000
@@ -67,6 +67,11 @@
*/
public class DBDB2400 extends DBDB2App
{
+ /**
+ * UpperCase/IgnoreCase sql function in DB2/400
+ */
+ final static public String UCASE= "UCASE";
+
/**
* DBDB2400 constructor.
*/
@@ -76,26 +81,42 @@
}
/**
- * This method is used to ignore case. Had to override the
- * <code>org.apache.turbine.util.db.adapter.DBDB2App</code>
- * until I figure out the best way to accomplish this.
+ * This method is used to ignore case.
*
* @param in The string whose case to ignore.
* @return The string in a case that can be ignored.
*/
public String ignoreCase(String in)
{
- return in;
+ String s = formatCase(in);
+ Log.info("DBDB2400.ignoreCase(" + in + "), returning " + s);
+
+ return s;
}
/**
- * This method is used to ignore case. Ditto ignoreCase ;).
+ * This method is used to ignore case.
*
* @param in The string to transform to upper case.
* @return The upper case string.
*/
public String toUpperCase(String in)
{
- return in;
+ String s = formatCase(in);
+ Log.info("DBDB2400.toUpperCase(" + in + "), returning " + s);
+
+ return s;
+ }
+
+ /**
+ * Convenience method for String-formatting
+ * upper/ignore case statements.
+ *
+ * @param in The string to transform to upper case.
+ * @return The upper case string.
+ */
+ private String formatCase(String in)
+ {
+ return new StringBuffer(UCASE+"(").append(in).append(")").toString();
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>