cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ba...@locus.apache.org
Subject cvs commit: xml-cocoon/src/org/apache/cocoon/processor/xsp/library/sql XSPSQLLibrary.java
Date Tue, 16 May 2000 18:36:12 GMT
balld       00/05/16 11:36:11

  Modified:    src/org/apache/cocoon/processor/xsp/library/sql
                        XSPSQLLibrary.java
  Log:
  fixed count query bug
  Submitted by:	Giacomo Pati <Giacomo.Pati@pwr.ch>
  
  Revision  Changes    Path
  1.6       +2 -9      xml-cocoon/src/org/apache/cocoon/processor/xsp/library/sql/XSPSQLLibrary.java
  
  Index: XSPSQLLibrary.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/processor/xsp/library/sql/XSPSQLLibrary.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XSPSQLLibrary.java	2000/05/01 19:42:48	1.5
  +++ XSPSQLLibrary.java	2000/05/16 18:36:10	1.6
  @@ -60,7 +60,7 @@
    * A processor that performs SQL database queries.
    *
    * @author <a href="mailto:balld@webslingerZ.com">Donald Ball</a>
  - * @version $Revision: 1.5 $ $Date: 2000/05/01 19:42:48 $
  + * @version $Revision: 1.6 $ $Date: 2000/05/16 18:36:10 $
    */
   
   public class XSPSQLLibrary {
  @@ -243,15 +243,8 @@
   
       public static String getCountQuery(String query) {
           String lowercase_query = query.toLowerCase();
  -        int select_index = lowercase_query.indexOf("select ");
           int from_index = lowercase_query.indexOf(" from ");
  -        if (select_index < 0 || from_index < 0) return null;
  -        String columns = query.substring(select_index+7,from_index);
  -        int comma_index = columns.indexOf(',');
  -        String column;
  -        if (comma_index < 0) column = columns;
  -        else column = columns.substring(0,comma_index);
  -        return "SELECT count("+column+") FROM "+ query.substring(from_index+6);
  +		return "SELECT count(*) FROM "+query.substring(from_index+6);
       }
   
   	public static Element createElement(Document document, String namespace, String name)
{
  
  
  

Mime
View raw message