Re: Fix for Operator recognition problems with Turkish locale

Stefaan A Eeckels <[email protected]> Wed, 11 Oct 2006 01:14:16 +0200
Newsgroups gmane.comp.db.mckoi
Organization E.C.C. sa - Computer Consultants
Message-ID <[email protected]>
--Multipart=_Wed__11_Oct_2006_01_14_16_+0200_bFK_+vwKCmM0S4+N
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

On Thu, 5 Oct 2006 23:19:02 +0200
Stefaan A Eeckels <[email protected]> wrote:

> When using McKoi with a Turkish locale, the internal queries that
> create the views don't work, and the database doesn't start. 

I've researched this a bit better, and I've now a better analysis plus
a patch to fix this. 

The problem with Turkish is that there are two types of "I", with and
without dot. The two lowercase letters are \u0069 "i" and \u0131
(dotless lowercase "i") and they are totally unrelated. Their uppercase
versions are \u0130 (dotted capital "I") and \u0049, the dotless
uppercase "I". When using towLowerCase(), the dotless "I" becomes a
dotless "i", which is not the same as in English; as a result,
uppercase keywords - and anything that gets lowercased for to get rid
of case sensitivity - becomes unrecognisable.

Unfortunately, using upper case doesn't solve the problem, because the
lowercase dotted "i" becomes the uppercase dotted "I", which again
causes comparisons to fail. 

The fix I applied to Mckoi is to make sure that the conversions to
lower case (with the exception of the one instance used to implement
the "LOWER()" function are called with the java.util.Locale.ENGLISH
parameter. All conversions to upper case with the exception of the one
instance used to implement the "UPPER()" function should also be
changed to use the java.util.Locale.ENGLISH parameter.

Obviously, if you want your application to run properly in the Turkish
locale, you could use the same approach for "utility" case conversions.

A patch against 1.0.3 is attached. Please note that it also includes my
previous patches to compile in Java 5 and SQL wildcard heap overflow
(see my article in the "Java heap space" thread).

I don't think it is necessary to apply this fix to the GNU regular
expression library included with Mckoi. Please let me know if I'm
mistaken. 

Take care,

-- 
Stefaan
-- 
As complexity rises, precise statements lose meaning,
and meaningful statements lose precision. -- Lotfi Zadeh 


--Multipart=_Wed__11_Oct_2006_01_14_16_+0200_bFK_+vwKCmM0S4+N
Content-Type: text/plain;
 name="turkish_wildcard_java5.patch"
Content-Disposition: attachment;
 filename="turkish_wildcard_java5.patch"
Content-Transfer-Encoding: quoted-printable

diff -r -u mckoi1.0.3/src/com/mckoi/database/DatabaseConnection.java mckoi1=
.0.3.sae/src/com/mckoi/database/DatabaseConnection.java
--- mckoi1.0.3/src/com/mckoi/database/DatabaseConnection.java	Wed Jul 14 20=
:04:18 2004
+++ mckoi1.0.3.sae/src/com/mckoi/database/DatabaseConnection.java	Wed Oct 1=
1 00:47:37 2006
@@ -458,10 +458,10 @@
    *   case insensitive for identifiers resolved by the grammar.
    */
   public void setVar(String name, Expression exp) {
-    if (name.toUpperCase().equals("ERROR_ON_DIRTY_SELECT")) {
+    if (name.toUpperCase(java.util.Locale.ENGLISH).equals("ERROR_ON_DIRTY_=
SELECT")) {
       error_on_dirty_select =3D toBooleanValue(exp);
     }
-    else if (name.toUpperCase().equals("CASE_INSENSITIVE_IDENTIFIERS")) {
+    else if (name.toUpperCase(java.util.Locale.ENGLISH).equals("CASE_INSEN=
SITIVE_IDENTIFIERS")) {
       case_insensitive_identifiers =3D toBooleanValue(exp);
     }
   }
diff -r -u mckoi1.0.3/src/com/mckoi/database/FunctionFactory.java mckoi1.0.=
3.sae/src/com/mckoi/database/FunctionFactory.java
--- mckoi1.0.3/src/com/mckoi/database/FunctionFactory.java	Sun Aug 25 17:50=
:08 2002
+++ mckoi1.0.3.sae/src/com/mckoi/database/FunctionFactory.java	Wed Oct 11 0=
0:23:07 2006
@@ -95,7 +95,7 @@
    */
   protected void addFunction(String fun_name, Class fun_class, int fun_typ=
e) {
     try {
-      String lf_name =3D fun_name.toLowerCase();
+      String lf_name =3D fun_name.toLowerCase(java.util.Locale.ENGLISH);
       if (fun_class_mapping.get(lf_name) =3D=3D null) {
         FF_FunctionInfo ff_info =3D new FF_FunctionInfo(fun_name, fun_type,
                                    fun_class.getConstructor(construct_prot=
o));
@@ -122,9 +122,9 @@
    * Removes a static function from this factory.
    */
   protected void removeFunction(String fun_name) {
-    String lf_name =3D fun_name.toLowerCase();
+    String lf_name =3D fun_name.toLowerCase(java.util.Locale.ENGLISH);
     if (fun_class_mapping.get(lf_name) !=3D null) {
-      fun_class_mapping.remove(fun_name.toLowerCase());
+      fun_class_mapping.remove(fun_name.toLowerCase(java.util.Locale.ENGLI=
SH));
     }
     else {
       throw new Error("Function '" + lf_name +
@@ -136,7 +136,7 @@
    * Returns true if the function name is defined in this factory.
    */
   protected boolean functionDefined(String fun_name) {
-    String lf_name =3D fun_name.toLowerCase();
+    String lf_name =3D fun_name.toLowerCase(java.util.Locale.ENGLISH);
     return fun_class_mapping.get(lf_name) !=3D null;
   }
=20
@@ -162,7 +162,7 @@
     // function class was registered, instantiates and returns it.
=20
     FF_FunctionInfo ff_info =3D (FF_FunctionInfo)
-                              fun_class_mapping.get(func_name.toLowerCase(=
));
+                              fun_class_mapping.get(func_name.toLowerCase(=
java.util.Locale.ENGLISH));
     if (ff_info =3D=3D null) {
       // Function not handled by this factory so return null.
       return null;
@@ -204,7 +204,7 @@
    */
   public FunctionInfo getFunctionInfo(String fun_name) {
     FF_FunctionInfo ff_info =3D (FF_FunctionInfo)
-                              fun_class_mapping.get(fun_name.toLowerCase()=
);
+                              fun_class_mapping.get(fun_name.toLowerCase(j=
ava.util.Locale.ENGLISH));
     return ff_info;
   }
=20
diff -r -u mckoi1.0.3/src/com/mckoi/database/FunctionTable.java mckoi1.0.3.=
sae/src/com/mckoi/database/FunctionTable.java
--- mckoi1.0.3/src/com/mckoi/database/FunctionTable.java	Tue Apr  8 01:55:0=
2 2003
+++ mckoi1.0.3.sae/src/com/mckoi/database/FunctionTable.java	Tue Oct 10 23:=
24:17 2006
@@ -239,12 +239,12 @@
=20
     // Set up 'whole_table_group' to the list of all rows in the reference
     // table.
-    RowEnumeration enum =3D getReferenceTable().rowEnumeration();
-    whole_table_is_simple_enum =3D enum instanceof SimpleRowEnumeration;
+    RowEnumeration theEnum =3D getReferenceTable().rowEnumeration();
+    whole_table_is_simple_enum =3D theEnum instanceof SimpleRowEnumeration;
     if (!whole_table_is_simple_enum) {
       whole_table_group =3D new IntegerVector(getReferenceTable().getRowCo=
unt());
-      while (enum.hasMoreRows()) {
-        whole_table_group.addInt(enum.nextRowIndex());
+      while (theEnum.hasMoreRows()) {
+        whole_table_group.addInt(theEnum.nextRowIndex());
       }
     }
=20
@@ -425,9 +425,9 @@
       // This means there is no grouping, so merge with entire table,
       int r_count =3D table.getRowCount();
       row_list =3D new IntegerVector(r_count);
-      RowEnumeration enum =3D table.rowEnumeration();
-      while (enum.hasMoreRows()) {
-        row_list.addInt(enum.nextRowIndex());
+      RowEnumeration theEnum =3D table.rowEnumeration();
+      while (theEnum.hasMoreRows()) {
+        row_list.addInt(theEnum.nextRowIndex());
       }
     }
=20
diff -r -u mckoi1.0.3/src/com/mckoi/database/InternalFunctionFactory.java m=
ckoi1.0.3.sae/src/com/mckoi/database/InternalFunctionFactory.java
--- mckoi1.0.3/src/com/mckoi/database/InternalFunctionFactory.java	Fri May =
16 16:07:38 2003
+++ mckoi1.0.3.sae/src/com/mckoi/database/InternalFunctionFactory.java	Wed =
Oct 11 00:23:43 2006
@@ -2135,7 +2135,7 @@
=20
       if (parameterCount() !=3D 2) {
         throw new RuntimeException(
-                             "i_sql_type function must have two arguments.=
");
+                             "i_view_data function must have two arguments=
.");
       }
     }
=20
diff -r -u mckoi1.0.3/src/com/mckoi/database/NaturallyJoinedTable.java mcko=
i1.0.3.sae/src/com/mckoi/database/NaturallyJoinedTable.java
--- mckoi1.0.3/src/com/mckoi/database/NaturallyJoinedTable.java	Sat Sep 21 =
21:37:06 2002
+++ mckoi1.0.3.sae/src/com/mckoi/database/NaturallyJoinedTable.java	Tue Oct=
 10 23:24:17 2006
@@ -86,9 +86,9 @@
    */
   private static IntegerVector createLookupRowList(Table t) {
     IntegerVector ivec =3D new IntegerVector();
-    RowEnumeration enum =3D t.rowEnumeration();
-    while (enum.hasMoreRows()) {
-      int row_index =3D enum.nextRowIndex();
+    RowEnumeration theEnum =3D t.rowEnumeration();
+    while (theEnum.hasMoreRows()) {
+      int row_index =3D theEnum.nextRowIndex();
       ivec.addInt(row_index);
     }
     return ivec;
diff -r -u mckoi1.0.3/src/com/mckoi/database/Operator.java mckoi1.0.3.sae/s=
rc/com/mckoi/database/Operator.java
--- mckoi1.0.3/src/com/mckoi/database/Operator.java	Tue Jul  6 20:24:26 2004
+++ mckoi1.0.3.sae/src/com/mckoi/database/Operator.java	Wed Oct 11 00:49:21=
 2006
@@ -273,7 +273,7 @@
    * Same as above only it handles the type as a string.
    */
   public Operator getSubQueryForm(String type_str) {
-    String s =3D type_str.toUpperCase();
+    String s =3D type_str.toUpperCase(java.util.Locale.ENGLISH);
     if (s.equals("SINGLE") || s.equals("ANY") || s.equals("SOME")) {
       return getSubQueryForm(ANY);
     }
@@ -346,7 +346,7 @@
     else if (op.equals(")")) { return par2_op; }
=20
     // Operators that are words, convert to lower case...
-    op =3D op.toLowerCase();
+    op =3D op.toLowerCase(java.util.Locale.ENGLISH);
     if (op.equals("is")) { return is_op; }
     else if (op.equals("is not")) { return isn_op; }
     else if (op.equals("like")) { return like_op; }
diff -r -u mckoi1.0.3/src/com/mckoi/database/PatternSearch.java mckoi1.0.3.=
sae/src/com/mckoi/database/PatternSearch.java
--- mckoi1.0.3/src/com/mckoi/database/PatternSearch.java	Mon Feb  3 13:42:5=
8 2003
+++ mckoi1.0.3.sae/src/com/mckoi/database/PatternSearch.java	Tue Oct 10 23:=
24:17 2006
@@ -204,7 +204,6 @@
=20
     // Look at first character in pattern, if it's a ONE_CHAR wildcard then
     // check expression and pattern match until next wild card.
-
     if (pattern.charAt(0) =3D=3D ONE_CHAR) {
=20
       // Else step through each character in pattern and see if it matches=
 up
@@ -382,6 +381,7 @@
=20
     StringBuffer pre_pattern =3D new StringBuffer();
     int i =3D 0;
+    int j =3D 0;
     boolean finished =3D i >=3D pattern.length();
     boolean last_is_escape =3D false;
=20
@@ -388,14 +388,24 @@
     while (!finished) {
       char c =3D pattern.charAt(i);
       if (last_is_escape) {
-        last_is_escape =3D true;
+        last_is_escape =3D false;
         pre_pattern.append(c);
+        j++;
+        ++i;
+        if (i >=3D pattern.length()) {
+          finished =3D true;
       }
+      }
       else if (c =3D=3D escape_char) {
         last_is_escape =3D true;
+        ++i;
+        if (i >=3D pattern.length()) {
+          finished =3D true;
       }
+      }
       else if (!isWildCard(c)) {
         pre_pattern.append(c);
+        j++;
=20
         ++i;
         if (i >=3D pattern.length()) {
@@ -446,8 +456,8 @@
       // 'Geoff\33'
=20
       String lower_bounds =3D new String(pre_pattern);
-      int next_char =3D pre_pattern.charAt(i - 1) + 1;
-      pre_pattern.setCharAt(i - 1, (char) next_char);
+      int next_char =3D pre_pattern.charAt(j - 1) + 1;
+      pre_pattern.setCharAt(j - 1, (char) next_char);
       String upper_bounds =3D new String(pre_pattern);
=20
       post_pattern =3D pattern.substring(i);
diff -r -u mckoi1.0.3/src/com/mckoi/database/Table.java mckoi1.0.3.sae/src/=
com/mckoi/database/Table.java
--- mckoi1.0.3/src/com/mckoi/database/Table.java	Tue Mar  4 16:11:40 2003
+++ mckoi1.0.3.sae/src/com/mckoi/database/Table.java	Tue Oct 10 23:24:17 20=
06
@@ -1597,9 +1597,9 @@
    */
   public final IntegerVector selectAll() {
     IntegerVector list =3D new IntegerVector(getRowCount());
-    RowEnumeration enum =3D rowEnumeration();
-    while (enum.hasMoreRows()) {
-      list.addInt(enum.nextRowIndex());
+    RowEnumeration theEnum =3D rowEnumeration();
+    while (theEnum.hasMoreRows()) {
+      list.addInt(theEnum.nextRowIndex());
     }
     return list;
   }
@@ -1751,9 +1751,9 @@
   public Map toMap() {
     if (getColumnCount() =3D=3D 2) {
       HashMap map =3D new HashMap();
-      RowEnumeration enum =3D rowEnumeration();
-      while (enum.hasMoreRows()) {
-        int row_index =3D enum.nextRowIndex();
+      RowEnumeration theEnum =3D rowEnumeration();
+      while (theEnum.hasMoreRows()) {
+        int row_index =3D theEnum.nextRowIndex();
         TObject key =3D getCellContents(0, row_index);
         TObject value =3D getCellContents(1, row_index);
         map.put(key.getObject().toString(), value.getObject());
diff -r -u mckoi1.0.3/src/com/mckoi/database/control/DefaultDBConfig.java m=
ckoi1.0.3.sae/src/com/mckoi/database/control/DefaultDBConfig.java
--- mckoi1.0.3/src/com/mckoi/database/control/DefaultDBConfig.java	Tue Jul =
23 00:31:36 2002
+++ mckoi1.0.3.sae/src/com/mckoi/database/control/DefaultDBConfig.java	Tue =
Oct 10 23:24:17 2006
@@ -93,10 +93,10 @@
     Properties config =3D new Properties();
     config.load(new BufferedInputStream(input));
     // For each property in the file
-    Enumeration enum =3D config.propertyNames();
-    while (enum.hasMoreElements()) {
+    Enumeration theEnum =3D config.propertyNames();
+    while (theEnum.hasMoreElements()) {
       // Set the property value in this configuration.
-      String property_key =3D (String) enum.nextElement();
+      String property_key =3D (String) theEnum.nextElement();
       setValue(property_key, config.getProperty(property_key));
     }
   }
diff -r -u mckoi1.0.3/src/com/mckoi/database/interpret/CreateTable.java mck=
oi1.0.3.sae/src/com/mckoi/database/interpret/CreateTable.java
--- mckoi1.0.3/src/com/mckoi/database/interpret/CreateTable.java	Tue Jul 22=
 01:53:06 2003
+++ mckoi1.0.3.sae/src/com/mckoi/database/interpret/CreateTable.java	Wed Oc=
t 11 00:48:16 2006
@@ -137,8 +137,8 @@
       // Currently we forbid referencing a table in another schema
       TableName ref_table =3D
                           TableName.resolve(constraint.reference_table_nam=
e);
-      String update_rule =3D constraint.getUpdateRule().toUpperCase();
-      String delete_rule =3D constraint.getDeleteRule().toUpperCase();
+      String update_rule =3D constraint.getUpdateRule().toUpperCase(java.u=
til.Locale.ENGLISH);
+      String delete_rule =3D constraint.getDeleteRule().toUpperCase(java.u=
til.Locale.ENGLISH);
       if (table.getSchema().equals(ref_table.getSchema())) {
         manager.addForeignKeyConstraint(
              table, constraint.getColumnList(),
diff -r -u mckoi1.0.3/src/com/mckoi/database/interpret/CreateTrigger.java m=
ckoi1.0.3.sae/src/com/mckoi/database/interpret/CreateTrigger.java
--- mckoi1.0.3/src/com/mckoi/database/interpret/CreateTrigger.java	Tue Apr =
 8 02:31:06 2003
+++ mckoi1.0.3.sae/src/com/mckoi/database/interpret/CreateTrigger.java	Wed =
Oct 11 00:48:27 2006
@@ -62,7 +62,7 @@
               "Multiple triggered types not allowed for callback triggers.=
");
       }
      =20
-      String trig_type =3D ((String) types.get(0)).toUpperCase();
+      String trig_type =3D ((String) types.get(0)).toUpperCase(java.util.L=
ocale.ENGLISH);
       int int_type;
       if (trig_type.equals("INSERT")) {
         int_type =3D TriggerEvent.INSERT;
diff -r -u mckoi1.0.3/src/com/mckoi/database/interpret/Insert.java mckoi1.0=
.3.sae/src/com/mckoi/database/interpret/Insert.java
--- mckoi1.0.3/src/com/mckoi/database/interpret/Insert.java	Tue Jul 22 01:5=
4:32 2003
+++ mckoi1.0.3.sae/src/com/mckoi/database/interpret/Insert.java	Tue Oct 10 =
23:24:17 2006
@@ -274,9 +274,9 @@
       // Copy row list into an intermediate IntegerVector list.
       // (A RowEnumeration for a table being modified is undefined).
       IntegerVector row_list =3D new IntegerVector();
-      RowEnumeration enum =3D result.rowEnumeration();
-      while (enum.hasMoreRows()) {
-        row_list.addInt(enum.nextRowIndex());
+      RowEnumeration theEnum =3D result.rowEnumeration();
+      while (theEnum.hasMoreRows()) {
+        row_list.addInt(theEnum.nextRowIndex());
       }
=20
       // For each row of the select table.
diff -r -u mckoi1.0.3/src/com/mckoi/database/interpret/PrivManager.java mck=
oi1.0.3.sae/src/com/mckoi/database/interpret/PrivManager.java
--- mckoi1.0.3/src/com/mckoi/database/interpret/PrivManager.java	Tue Apr  8=
 02:26:20 2003
+++ mckoi1.0.3.sae/src/com/mckoi/database/interpret/PrivManager.java	Wed Oc=
t 11 00:48:42 2006
@@ -102,7 +102,7 @@
       // Is the user permitted to give out these privs?
       Privileges grant_privs =3D Privileges.EMPTY_PRIVS;
       for (int i =3D 0; i < priv_list.size(); ++i) {
-        String priv =3D ((String) priv_list.get(i)).toUpperCase();
+        String priv =3D ((String) priv_list.get(i)).toUpperCase(java.util.=
Locale.ENGLISH);
         int priv_bit;
         if (priv.equals("ALL")) {
           if (grant_object =3D=3D GrantManager.TABLE) {
@@ -164,7 +164,7 @@
       // Is the user permitted to give out these privs?
       Privileges revoke_privs =3D Privileges.EMPTY_PRIVS;
       for (int i =3D 0; i < priv_list.size(); ++i) {
-        String priv =3D ((String) priv_list.get(i)).toUpperCase();
+        String priv =3D ((String) priv_list.get(i)).toUpperCase(java.util.=
Locale.ENGLISH);
         int priv_bit;
         if (priv.equals("ALL")) {
           if (grant_object =3D=3D GrantManager.TABLE) {
diff -r -u mckoi1.0.3/src/com/mckoi/database/interpret/Schema.java mckoi1.0=
.3.sae/src/com/mckoi/database/interpret/Schema.java
--- mckoi1.0.3/src/com/mckoi/database/interpret/Schema.java	Tue Apr  8 02:2=
6:20 2003
+++ mckoi1.0.3.sae/src/com/mckoi/database/interpret/Schema.java	Wed Oct 11 =
00:23:58 2006
@@ -58,7 +58,7 @@
=20
     DatabaseQueryContext context =3D new DatabaseQueryContext(database);
=20
-    String com =3D type.toLowerCase();
+    String com =3D type.toLowerCase(java.util.Locale.ENGLISH);
=20
     if (!database.getDatabase().canUserCreateAndDropSchema(
                                                 context, user, schema_name=
)) {
diff -r -u mckoi1.0.3/src/com/mckoi/database/interpret/Set.java mckoi1.0.3.=
sae/src/com/mckoi/database/interpret/Set.java
--- mckoi1.0.3/src/com/mckoi/database/interpret/Set.java	Tue Apr  8 02:26:5=
4 2003
+++ mckoi1.0.3.sae/src/com/mckoi/database/interpret/Set.java	Wed Oct 11 00:=
24:12 2006
@@ -74,17 +74,17 @@
=20
     DatabaseQueryContext context =3D new DatabaseQueryContext(database);
=20
-    String com =3D type.toLowerCase();
+    String com =3D type.toLowerCase(java.util.Locale.ENGLISH);
=20
     if (com.equals("varset")) {
       database.setVar(var_name, exp);
     }
     else if (com.equals("isolationset")) {
-      value =3D value.toLowerCase();
+      value =3D value.toLowerCase(java.util.Locale.ENGLISH);
       database.setTransactionIsolation(value);
     }
     else if (com.equals("autocommit")) {
-      value =3D value.toLowerCase();
+      value =3D value.toLowerCase(java.util.Locale.ENGLISH);
       if (value.equals("on") ||
           value.equals("1")) {
         database.setAutoCommit(true);
diff -r -u mckoi1.0.3/src/com/mckoi/database/interpret/Show.java mckoi1.0.3=
.sae/src/com/mckoi/database/interpret/Show.java
--- mckoi1.0.3/src/com/mckoi/database/interpret/Show.java	Wed Apr  9 19:16:=
28 2003
+++ mckoi1.0.3.sae/src/com/mckoi/database/interpret/Show.java	Wed Oct 11 00=
:24:19 2006
@@ -96,7 +96,7 @@
   public void prepare() throws DatabaseException {
     // Get the show variables from the query model
     show_type =3D (String) cmd.getObject("show");
-    show_type =3D show_type.toLowerCase();
+    show_type =3D show_type.toLowerCase(java.util.Locale.ENGLISH);
     table_name =3D (String) cmd.getObject("table_name");
     args =3D (Expression[]) cmd.getObject("args");
     where_clause =3D (SearchExpression) cmd.getObject("where_clause");
diff -r -u mckoi1.0.3/src/com/mckoi/database/interpret/TableSelectExpressio=
n.java mckoi1.0.3.sae/src/com/mckoi/database/interpret/TableSelectExpressio=
n.java
--- mckoi1.0.3/src/com/mckoi/database/interpret/TableSelectExpression.java	=
Tue Aug  6 18:23:24 2002
+++ mckoi1.0.3.sae/src/com/mckoi/database/interpret/TableSelectExpression.j=
ava	Wed Oct 11 00:24:26 2006
@@ -118,7 +118,7 @@
   public void chainComposite(TableSelectExpression expression,
                              String composite, boolean is_all) {
     this.next_composite =3D expression;
-    composite =3D composite.toLowerCase();
+    composite =3D composite.toLowerCase(java.util.Locale.ENGLISH);
     if (composite.equals("union")) {
       composite_function =3D CompositeTable.UNION;
     }
diff -r -u mckoi1.0.3/src/com/mckoi/database/jdbc/MDatabaseMetaData.java mc=
koi1.0.3.sae/src/com/mckoi/database/jdbc/MDatabaseMetaData.java
--- mckoi1.0.3/src/com/mckoi/database/jdbc/MDatabaseMetaData.java	Fri Apr 2=
5 02:43:06 2003
+++ mckoi1.0.3.sae/src/com/mckoi/database/jdbc/MDatabaseMetaData.java	Wed O=
ct 11 00:24:34 2006
@@ -153,7 +153,7 @@
     // Depends if we are embedded or not,
     // ISSUE: We need to keep an eye on this for future enhancements to the
     //   Mckoi URL spec.
-    if (getURL().toLowerCase().startsWith(":jdbc:mckoi:local://")) {
+    if (getURL().toLowerCase(java.util.Locale.ENGLISH).startsWith(":jdbc:m=
ckoi:local://")) {
       return true;
     }
     else {
diff -r -u mckoi1.0.3/src/com/mckoi/database/jdbc/MDriver.java mckoi1.0.3.s=
ae/src/com/mckoi/database/jdbc/MDriver.java
--- mckoi1.0.3/src/com/mckoi/database/jdbc/MDriver.java	Tue Apr  8 02:36:40=
 2003
+++ mckoi1.0.3.sae/src/com/mckoi/database/jdbc/MDriver.java	Wed Oct 11 00:2=
6:47 2006
@@ -155,7 +155,7 @@
       String token =3D tok.nextToken().trim();
       int split_point =3D token.indexOf("=3D");
       if (split_point > 0) {
-        String key =3D token.substring(0, split_point).toLowerCase();
+        String key =3D token.substring(0, split_point).toLowerCase(java.ut=
il.Locale.ENGLISH);
         String value =3D token.substring(split_point + 1);
         // Put the key/value pair in the 'info' object.
         info.put(key, value);
@@ -289,7 +289,7 @@
     // 'jdbc:mckoi:local:///my_db/db.conf/TOBY' will start the database in=
 the
     // TOBY schema of the database denoted by the configuration path
     // '/my_db/db.conf'
-    int schema_del_i =3D config_path.toLowerCase().indexOf(".conf/");
+    int schema_del_i =3D config_path.toLowerCase(java.util.Locale.ENGLISH)=
.indexOf(".conf/");
     if (schema_del_i > 0 &&
         schema_del_i + 6 < config_path.length()) {
       schema_name =3D config_path.substring(schema_del_i + 6);
@@ -303,7 +303,7 @@
     }
=20
     // Is there already a local connection to this database?
-    String session_key =3D config_path.toLowerCase();
+    String session_key =3D config_path.toLowerCase(java.util.Locale.ENGLIS=
H);
     LocalBootable local_bootable =3D
                            (LocalBootable) local_session_map.get(session_k=
ey);
     // No so create one and put it in the connection mapping
diff -r -u mckoi1.0.3/src/com/mckoi/database/jdbc/MResultSet.java mckoi1.0.=
3.sae/src/com/mckoi/database/jdbc/MResultSet.java
--- mckoi1.0.3/src/com/mckoi/database/jdbc/MResultSet.java	Tue Jul  6 12:45=
:02 2004
+++ mckoi1.0.3.sae/src/com/mckoi/database/jdbc/MResultSet.java	Wed Oct 11 0=
0:49:01 2006
@@ -515,7 +515,7 @@
=20
     boolean case_insensitive =3D connection.isCaseInsensitiveIdentifiers();
     if (case_insensitive) {
-      name =3D name.toUpperCase();
+      name =3D name.toUpperCase(java.util.Locale.ENGLISH);
     }
=20
     Integer index =3D (Integer) column_hash.get(name);
@@ -533,7 +533,7 @@
           col_name =3D col_name.substring(2);
         }
         if (case_insensitive) {
-          col_name =3D col_name.toUpperCase();
+          col_name =3D col_name.toUpperCase(java.util.Locale.ENGLISH);
         }
         cols[i] =3D col_name;
       }
diff -r -u mckoi1.0.3/src/com/mckoi/database/jdbcserver/AbstractJDBCDatabas=
eInterface.java mckoi1.0.3.sae/src/com/mckoi/database/jdbcserver/AbstractJD=
BCDatabaseInterface.java
--- mckoi1.0.3/src/com/mckoi/database/jdbcserver/AbstractJDBCDatabaseInterf=
ace.java	Tue Apr  8 02:36:06 2003
+++ mckoi1.0.3.sae/src/com/mckoi/database/jdbcserver/AbstractJDBCDatabaseIn=
terface.java	Tue Oct 10 23:24:17 2006
@@ -770,9 +770,9 @@
       // Build 'row_index_map' if not a simple enum
       if (!result_is_simple_enum) {
         row_index_map =3D new IntegerVector(table.getRowCount());
-        RowEnumeration enum =3D table.rowEnumeration();
-        while (enum.hasMoreRows()) {
-          row_index_map.addInt(enum.nextRowIndex());
+        RowEnumeration theEnum =3D table.rowEnumeration();
+        while (theEnum.hasMoreRows()) {
+          row_index_map.addInt(theEnum.nextRowIndex());
         }
       }
=20
diff -r -u mckoi1.0.3/src/com/mckoi/database/sql/SQL.java mckoi1.0.3.sae/sr=
c/com/mckoi/database/sql/SQL.java
--- mckoi1.0.3/src/com/mckoi/database/sql/SQL.java	Tue Jul  6 17:14:22 2004
+++ mckoi1.0.3.sae/src/com/mckoi/database/sql/SQL.java	Wed Oct 11 00:22:25 =
2006
@@ -3920,7 +3920,7 @@
       exp1 =3D DoExpression();
       jj_consume_token(209);
                           exp_list =3D new Expression[3];
-                          String ttype =3D t2 =3D=3D null ? "both" : t2.im=
age.toLowerCase();
+                          String ttype =3D t2 =3D=3D null ? "both" : t2.im=
age.toLowerCase(java.util.Locale.ENGLISH);
                           Object str_char =3D t3 =3D=3D null ? TObject.str=
ingVal(" ") :
                                                          Util.toParamObjec=
t(t3, case_insensitive_identifiers);
                           exp_list[0] =3D new Expression(TObject.stringVal=
(ttype));
@@ -5998,8 +5998,8 @@
         jj_expentry[i] =3D jj_lasttokens[i];
       }
       boolean exists =3D false;
-      for (java.util.Enumeration enum =3D jj_expentries.elements(); enum.h=
asMoreElements();) {
-        int[] oldentry =3D (int[])(enum.nextElement());
+      for (java.util.Enumeration theEnum =3D jj_expentries.elements(); the=
Enum.hasMoreElements();) {
+        int[] oldentry =3D (int[])(theEnum.nextElement());
         if (oldentry.length =3D=3D jj_expentry.length) {
           exists =3D true;
           for (int i =3D 0; i < jj_expentry.length; i++) {
diff -r -u mckoi1.0.3/src/com/mckoi/database/sql/Util.java mckoi1.0.3.sae/s=
rc/com/mckoi/database/sql/Util.java
--- mckoi1.0.3/src/com/mckoi/database/sql/Util.java	Mon May  5 03:18:14 2003
+++ mckoi1.0.3.sae/src/com/mckoi/database/sql/Util.java	Wed Oct 11 00:47:14=
 2006
@@ -114,7 +114,7 @@
 //        name =3D token.image;
 //      }
       if (upper_identifiers) {
-        name =3D name.toUpperCase();
+        name =3D name.toUpperCase(java.util.Locale.ENGLISH);
       }
       Variable v;
       int div =3D name.lastIndexOf(".");
@@ -138,7 +138,7 @@
             // as a variable.
       String name =3D token.image;
       if (upper_identifiers) {
-        name =3D name.toUpperCase();
+        name =3D name.toUpperCase(java.util.Locale.ENGLISH);
       }
       return new Variable(token.image);
     }
diff -r -u mckoi1.0.3/src/com/mckoi/tools/JDBCScriptTool.java mckoi1.0.3.sa=
e/src/com/mckoi/tools/JDBCScriptTool.java
--- mckoi1.0.3/src/com/mckoi/tools/JDBCScriptTool.java	Mon May 19 21:46:36 =
2003
+++ mckoi1.0.3.sae/src/com/mckoi/tools/JDBCScriptTool.java	Wed Oct 11 00:24=
:59 2006
@@ -119,7 +119,7 @@
       try {
         // Check it's not an internal command.
         String command =3D
-                 query.substring(0, query.length() - 1).trim().toLowerCase=
();
+                 query.substring(0, query.length() - 1).trim().toLowerCase=
(java.util.Locale.ENGLISH);
         if (command.startsWith("switch to connection ")) {
           String connection_name =3D command.substring(21);
           Connection c =3D (Connection) connections.get(connection_name);
diff -r -u mckoi1.0.3/src/com/mckoi/util/GeneralParser.java mckoi1.0.3.sae/=
src/com/mckoi/util/GeneralParser.java
--- mckoi1.0.3/src/com/mckoi/util/GeneralParser.java	Tue Jul 23 00:31:36 20=
02
+++ mckoi1.0.3.sae/src/com/mckoi/util/GeneralParser.java	Wed Oct 11 00:25:0=
7 2006
@@ -191,7 +191,7 @@
       word_buffer.setLength(0);
       parseWordString(i, word_buffer);
=20
-      String str =3D new String(word_buffer).toLowerCase();
+      String str =3D new String(word_buffer).toLowerCase(java.util.Locale.=
ENGLISH);
       if ((str.startsWith("week") ||
            str.equals("w")) &&
           !time_parsed[0]) {


--Multipart=_Wed__11_Oct_2006_01_14_16_+0200_bFK_+vwKCmM0S4+N
Content-Type: text/plain; charset=us-ascii


---------------------------------------------------------------
Mckoi SQL Database mailing list  http://www.mckoi.com/database/
To unsubscribe, send a message to [email protected]
--Multipart=_Wed__11_Oct_2006_01_14_16_+0200_bFK_+vwKCmM0S4+N--