You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by lu...@apache.org on 2004/09/28 13:35:42 UTC

cvs commit: jakarta-slide/src/stores/org/apache/slide/store/impl/rdbms/expression RDBMSExpressionFactory.java

luetzkendorf    2004/09/28 04:35:42

  Modified:    src/stores/org/apache/slide/store/impl/rdbms/expression Tag:
                        SLIDE_2_1_RELEASE_BRANCH
                        RDBMSExpressionFactory.java
  Log:
  fix to make the it JDK1.3 compatible
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.9.2.2   +15 -5     jakarta-slide/src/stores/org/apache/slide/store/impl/rdbms/expression/RDBMSExpressionFactory.java
  
  Index: RDBMSExpressionFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/stores/org/apache/slide/store/impl/rdbms/expression/RDBMSExpressionFactory.java,v
  retrieving revision 1.9.2.1
  retrieving revision 1.9.2.2
  diff -u -r1.9.2.1 -r1.9.2.2
  --- RDBMSExpressionFactory.java	10 Aug 2004 14:40:44 -0000	1.9.2.1
  +++ RDBMSExpressionFactory.java	28 Sep 2004 11:35:42 -0000	1.9.2.2
  @@ -170,7 +170,7 @@
       }
   
       public static boolean isSQLCompilableProperty(Element element) {
  -        Element davProp = (Element) element.getChild(Literals.PROP, NamespaceCache.DEFAULT_NAMESPACE);
  +        Element davProp = element.getChild(Literals.PROP, NamespaceCache.DEFAULT_NAMESPACE);
           if (davProp != null) {
               Element property = (Element) davProp.getChildren().get(0);
               return isSQLCompilableProperty(property.getNamespaceURI(), property.getName());
  @@ -186,7 +186,17 @@
        * converts a property name to a legal SQL alias.
        */
       public static String propertyToAlias(String propertyName) {
  -        return "prop_" + propertyName.replaceAll("-", "_");
  +        // replaceAll occurs in JDK1.4
  +        //return "prop_" + propertyName.replaceAll("-", "_");
  +        
  +        StringBuffer buffer = new StringBuffer(propertyName.length() + 5);
  +        buffer.append("prop_");
  +        for (int i = 0, l = propertyName.length(); i < l; i++) {
  +            char c = propertyName.charAt(i);
  +            if (c == '-') c = '_';
  +            buffer.append(c);
  +        }
  +        return buffer.toString();
       }
   
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org