db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/util SqlHelper.java
Date Tue, 06 May 2003 19:33:39 GMT
brj         2003/05/06 12:33:39

  Modified:    src/java/org/apache/ojb/broker/util SqlHelper.java
  Log:
  fixed problem with spaces after colName
  
  Revision  Changes    Path
  1.11      +14 -7     db-ojb/src/java/org/apache/ojb/broker/util/SqlHelper.java
  
  Index: SqlHelper.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/util/SqlHelper.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- SqlHelper.java	28 Apr 2003 18:59:26 -0000	1.10
  +++ SqlHelper.java	6 May 2003 19:33:39 -0000	1.11
  @@ -111,7 +111,7 @@
    	 * up to the column<br>
        * ie: avg(amount) -> amount , avg( , ) <br>
        * ie: sum (accounts.amount) as theSum -> accounts.amount , sum( , ) as theSum <br>
  -     * ie: count(distinct id) -> id , count(distinct , ) <br>
  +     * ie: count( distinct id ) as bla -> id , count(distinct , ) as bla<br>
    	 * @param aPath
    	 * @return PathInfo
    	 */
  @@ -120,6 +120,7 @@
           int braceBegin;
           int braceEnd;
           int colBegin;
  +        String betweenBraces;
           String prefix = null;
           String suffix = null;
           String colName;
  @@ -133,13 +134,19 @@
           braceEnd = aPath.lastIndexOf(")");
           if (braceBegin >= 0 && braceEnd >= 0)
           {
  -            colBegin = aPath.lastIndexOf(" ", braceEnd);
  -            if (colBegin < braceBegin)
  +            betweenBraces = aPath.substring(braceBegin + 1, braceEnd).trim();
  +            // look for ie 'distinct name' 
  +            colBegin = betweenBraces.lastIndexOf(" ");
  +            if (colBegin >= 0)
               {
  -                colBegin = braceBegin;
  +                prefix = aPath.substring(0, braceBegin + colBegin + 3);
  +                colName = betweenBraces.substring(colBegin + 1).trim();
  +            }
  +            else
  +            {
  +                prefix = aPath.substring(0, braceBegin + 1);
  +                colName = betweenBraces;
               }
  -            prefix = aPath.substring(0, colBegin + 1);
  -            colName = aPath.substring(colBegin + 1, braceEnd).trim();
               suffix = aPath.substring(braceEnd);
           }
           else
  
  
  

Mime
View raw message