single quote qeustionmark bug
authoridfx <idfx>
Sun, 21 Apr 2002 14:18:29 +0000 (14:18 +0000)
committeridfx <idfx>
Sun, 21 Apr 2002 14:18:29 +0000 (14:18 +0000)
source/mir/misc/StringUtil.java

index 09f2a31..1802ed8 100755 (executable)
@@ -86,7 +86,7 @@ public final class StringUtil {
                webdbDate.append(pad2(theDate.get(Calendar.MINUTE)));
                webdbDate.append(":");
                webdbDate.append(pad2(theDate.get(Calendar.SECOND)));
-               //assumes you are an hour-multiple away from UTC.... 
+               //assumes you are an hour-multiple away from UTC....
                int offset=(theDate.get(Calendar.ZONE_OFFSET)/(60*60*1000));
                if (offset < 0){
                webdbDate.append("-");
@@ -183,7 +183,7 @@ public final class StringUtil {
                            returnDate.append("Z");
                        }
                        else{
-                           //need to see what a newfoundland postgres 
+                           //need to see what a newfoundland postgres
                            //timestamp looks like before making this robust
                            returnDate.append(tzInfo);
                            returnDate.append(":00");
@@ -246,7 +246,7 @@ public final class StringUtil {
        }
 
     /**
-     * Splits the provided CSV text into a list. stolen wholesale from 
+     * Splits the provided CSV text into a list. stolen wholesale from
      * from Jakarta Turbine StrinUtils.java -mh
      *
      * @param text      The CSV list of values to split apart.
@@ -310,7 +310,20 @@ public final class StringUtil {
         */
        public static String quote(String s)
        {
-               String s2 = quote(s, '\'');
+               //String s2 = quote(s, '\'');
+               //Quickhack     ÊÊ Ê Ê Ê Ê Ê Ê
+               //Because of '?-Bug in Postgresql-JDBC-Driver
+               StringBuffer temp = new StringBuffer();
+               for(int i=0;i<s.length();i++){
+                       if(s.charAt(i)=='\''){
+                               temp.append("&#39;");
+                       } else {
+                               temp.append(s.charAt(i));
+                       }
+               }
+               String s2 = temp.toString();
+               //end Quickhack
+               
                s2 = quote(s2, '\"');
                return s2;
        }