You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by ha...@apache.org on 2001/10/17 16:12:14 UTC

cvs commit: xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/java esql.xsl

haul        01/10/17 07:12:14

  Modified:    src/org/apache/cocoon/components/language/markup/xsp/java
                        esql.xsl
  Added:       src/org/apache/cocoon/components/language/markup/xsp
                        EsqlConnection.java EsqlConnectionCocoon2.java
                        EsqlHelper.java EsqlQuery.java
  Log:
  Patch from Thorsten
    - removed the inner classes (created real ones)
    - moved redundant code into a helper class
    - added support for jdbc ResultSet positioning
      (now we can do paging not only for MySQL and PostgreSQL
       and it's quite easy to add more)
    - added a <esql:previous-results> as counterpart of <esql:more-results>
  
  Revision  Changes    Path
  1.1                  xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/EsqlConnection.java
  
  Index: EsqlConnection.java
  ===================================================================
  /*****************************************************************************
   * Copyright (C) The Apache Software Foundation. All rights reserved.        *
   * ------------------------------------------------------------------------- *
   * This software is published under the terms of the Apache Software License *
   * version 1.1, a copy of which has been included  with this distribution in *
   * the LICENSE file.                                                         *
   *****************************************************************************/
  package org.apache.cocoon.components.language.markup.xsp;
   
  import java.sql.Connection;
  import java.util.Properties;
  import java.sql.SQLException;
  
  /**
   * This is wrapper to extend a java.sql.Conncetion implementation
   * for easier paging / limit facilities
   *
   * @author <A HREF="mailto:tcurdt@dff.st">Torsten Curdt</A>
   * based on the orginal esql.xsl
   */ 
  
  public class EsqlConnection implements Connection {
    public static final int LIMIT_METHOD_NOLIMIT = 0;
    public static final int LIMIT_METHOD_POSTGRESQL = 1;
    public static final int LIMIT_METHOD_MYSQL = 2;
    public static final int LIMIT_METHOD_JDBC = 3;
  
    public Connection connection = null;
  
    private String url = null;
    private Properties info = new Properties();
    private int limitMethod = LIMIT_METHOD_NOLIMIT;
  
    public Properties getInfo() {
      return(info);
    }
  
    public String getUrl() {
      return(url);
    }
  
    public void setUrl( String url ) {
      this.url = url;
    }
  
    public void setProperty( String name, Object value ) {
      info.put(name,value);
    }
  
    public void setUser(String user) {
      setProperty("user",user);
    }
  
    public void setPassword(String password) {
      setProperty("password",password);
    }
  
    public int getLimitMethod() {
      return(limitMethod);
    }
  
    public void setLimitMethod( String method ) {
      if ("".equals(method) || "auto".equals(method) ) {
        String jdbcSource;
        try {
          jdbcSource = connection.getMetaData().getURL();
        } catch (Exception e) {
          throw new RuntimeException("Error accessing connection metadata: "+e);
        }
        if (jdbcSource.startsWith("jdbc:postgresql:")) {
          limitMethod = LIMIT_METHOD_POSTGRESQL;
        } else if (jdbcSource.startsWith("jdbc:mysql:")) {
          limitMethod = LIMIT_METHOD_MYSQL;
        } else if (jdbcSource.startsWith("jdbc:sybase:")) {
          limitMethod = LIMIT_METHOD_JDBC;
        }
        else {
          throw new RuntimeException("Cannot guess limit method from jdbc url: " + method);
        }
      }
      else if ("postgresql".equals(method)) {
        limitMethod = LIMIT_METHOD_POSTGRESQL;
      } else if ("mysql".equals(method)) {
        limitMethod = LIMIT_METHOD_MYSQL;
      } else if ("jdbc".equals(method)) {
        limitMethod = LIMIT_METHOD_JDBC;
      } else {
        throw new RuntimeException("Unknown limit method: " + method);
      }
    }
  
  
    /* */ 
  
    public java.sql.Statement createStatement() throws SQLException {
      return(connection.createStatement());
    }
  
    public java.sql.Statement createStatement(int i1, int i2) throws SQLException {
      return(connection.createStatement(i1, i2));
    }
  
    public java.sql.PreparedStatement prepareStatement(String s) throws SQLException {
      return(connection.prepareStatement(s));
    }
  
    public java.sql.PreparedStatement prepareStatement(String s, int i1, int i2) throws SQLException {
      return(connection.prepareStatement(s, i1, i2));
    }
  
  
    public void close() throws SQLException {
      connection.close();
    }
  
    public void commit() throws SQLException {
      connection.commit();
    }
  
    public void rollback() throws SQLException {
      connection.rollback();
    }
  
    public boolean getAutoCommit() throws SQLException {
      return(connection.getAutoCommit());
    }
  
    public void setAutoCommit(boolean autocommit) throws SQLException {
      connection.setAutoCommit(autocommit);
    }
  
    public void setTransactionIsolation(int i)  throws SQLException {
      connection.setTransactionIsolation(i);
    }
  
    public int getTransactionIsolation()  throws SQLException {
      return(connection.getTransactionIsolation());
    }
  
    public String getCatalog()  throws SQLException {
      return(connection.getCatalog());
    }
  
    public java.sql.SQLWarning getWarnings()  throws SQLException {
      return(connection.getWarnings());
    }
  
    public java.util.Map getTypeMap() throws SQLException {
      return(connection.getTypeMap());
    }
  
    public boolean isClosed() throws SQLException {
      return(isClosed());
    }
  
    public java.sql.DatabaseMetaData getMetaData() throws SQLException {
      return(connection.getMetaData());
    }
  
    public void setCatalog(String s) throws SQLException {
      connection.setCatalog(s);
    }
  
    public void setTypeMap(java.util.Map m) throws SQLException {
      connection.setTypeMap(m);
    }
  
    public void setReadOnly(boolean b) throws SQLException {
      connection.setReadOnly(b);
    }
  
    public void clearWarnings() throws SQLException {
      connection.clearWarnings();
    }
  
    public boolean isReadOnly() throws SQLException {
      return(connection.isReadOnly());
    }
  
    public String nativeSQL(String s) throws SQLException {
      return(connection.nativeSQL(s));
    }
  
    public java.sql.CallableStatement prepareCall(String s) throws SQLException {
      return(connection.prepareCall(s));
    }
  
    public java.sql.CallableStatement prepareCall(String s, int i1, int i2) throws SQLException {
      return(connection.prepareCall(s,i1,i2));
    }
  
  }                                                                                                                      
  
  
  
  
  1.1                  xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/EsqlConnectionCocoon2.java
  
  Index: EsqlConnectionCocoon2.java
  ===================================================================
  /*****************************************************************************
   * Copyright (C) The Apache Software Foundation. All rights reserved.        *
   * ------------------------------------------------------------------------- *
   * This software is published under the terms of the Apache Software License *
   * version 1.1, a copy of which has been included  with this distribution in *
   * the LICENSE file.                                                         *
   *****************************************************************************/
  package org.apache.cocoon.components.language.markup.xsp;
   
  import org.apache.avalon.excalibur.datasource.DataSourceComponent;
  
  /**
   * This is the Cocoon2 specific part of an EsqlConnection.
   * This should only be in the C2 codebase
   *
   * @author <A HREF="mailto:tcurdt@dff.st">Torsten Curdt</A>
   * based on the orginal esql.xsl
   */
   
  public class EsqlConnectionCocoon2 extends EsqlConnection {
    public DataSourceComponent datasource = null;
  }
  
  
  
  1.1                  xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/EsqlHelper.java
  
  Index: EsqlHelper.java
  ===================================================================
  /*****************************************************************************
   * Copyright (C) The Apache Software Foundation. All rights reserved.        *
   * ------------------------------------------------------------------------- *
   * This software is published under the terms of the Apache Software License *
   * version 1.1, a copy of which has been included  with this distribution in *
   * the LICENSE file.                                                         *
   *****************************************************************************/
  package org.apache.cocoon.components.language.markup.xsp;
   
  import java.io.BufferedInputStream;
  import java.sql.ResultSet;
  import java.io.InputStream;
  import java.sql.Clob;
  
  /**
   * This is a helper class to remove redundant code in
   * esql pages
   *
   * @author <A HREF="mailto:tcurdt@dff.st">Torsten Curdt</A>
   * based on the orginal esql.xsl
   */
   
  public class EsqlHelper {
  
        private final static String getAscii(ResultSet set, String column) {
          InputStream asciiStream = null;
          byte[] buffer = null;
   
          try {
              Clob dbClob = set.getClob(column);
              int length = (int) dbClob.length();
              asciiStream = new BufferedInputStream(dbClob.getAsciiStream());
              buffer = new byte[length];
              asciiStream.read(buffer);
              asciiStream.close();
          } catch (Exception e) {
              throw new RuntimeException("Error getting clob data: " + e.getMessage());
          } finally {
              if (asciiStream != null) try {asciiStream.close();} catch (Exception ase) {
                  throw new RuntimeException("Error closing clob stream: " + ase.getMessage());
              }
          }
   
          if (buffer == null) return "";
   
          return new String(buffer);
        }                                                                                                                      
  
        private final static String getStringFromByteArray(byte[] bytes, String encoding) {
          try {
              return new String(bytes,encoding);
          } catch (java.io.UnsupportedEncodingException uee) {
              throw new RuntimeException("Unsupported Encoding Exception: " + uee.getMessage());
          }
        }
  
  }
  
  
  
  1.1                  xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/EsqlQuery.java
  
  Index: EsqlQuery.java
  ===================================================================
  /*****************************************************************************
   * Copyright (C) The Apache Software Foundation. All rights reserved.        *
   * ------------------------------------------------------------------------- *
   * This software is published under the terms of the Apache Software License *
   * version 1.1, a copy of which has been included  with this distribution in *
   * the LICENSE file.                                                         *
   *****************************************************************************/
  package org.apache.cocoon.components.language.markup.xsp;
   
  import java.sql.Connection;
  import java.sql.Statement;
  import java.sql.PreparedStatement;
  import java.sql.ResultSet;
  import java.sql.ResultSetMetaData;
  import java.sql.SQLException;
  
  /**
   * This helper class takes care of contstructing queries
   * and cursor positioning (paging) for all different kinds
   * of databases
   *
   * @author <A HREF="mailto:tcurdt@dff.st">Torsten Curdt</A>
   * based on the orginal esql.xsl
   */
   
  public class EsqlQuery {
    private Connection connection = null;
    private Statement statement = null;
    private PreparedStatement preparedStatement = null;
    private ResultSet resultSet = null;
    private ResultSetMetaData resultSetMetaData = null;
    private boolean hasResultSet = false;
    private int position = -1;
    private int maxRows = -1;
    private int skipRows = 0;
  
    private String query;
    private int limitMethod;
  
    public EsqlQuery( EsqlConnection connection, String query ) {
      this.connection = connection;
      this.limitMethod = connection.getLimitMethod();
      this.query = query;
    }
  
    public int getSkipRows() {
      return(skipRows);
    }
  
    public void setSkipRows( int i ) {
      this.skipRows = i;
    }
  
    public int getMaxRows() {
      return(maxRows);
    }
  
    public void setMaxRows( int i ) {
      this.maxRows = i;
    }
  
    public int getCurrentRow() {
      return(position);
    }
  
    public String getQueryString() {
      switch(limitMethod) {
        case EsqlConnection.LIMIT_METHOD_POSTGRESQL:
          if (skipRows > 0) {
            if (maxRows > -1) {
              return(query + " LIMIT " + maxRows + "," + skipRows);
            }
            else {
              return(query + " OFFSET " + skipRows);
            }
          }
          else {
            if (maxRows > -1) {
              return(query + " LIMIT " + maxRows);
            }
            else {
              return(query);
            }
          }
        case EsqlConnection.LIMIT_METHOD_MYSQL:
          if (skipRows > 0) {
            if (maxRows > -1) {
              return(query + " LIMIT " + skipRows + "," + maxRows);
            }
            else {
              throw new RuntimeException("MySQL does not support a skip of rows only");
            }
          }
          else {
            if (maxRows > -1) {
              return(query + " LIMIT " + maxRows);
            }
            else {
              return(query);
            }
          }
        default:
          return(query);
      };
    }
  
    public PreparedStatement prepareStatement() throws SQLException {
      switch(limitMethod) {
        case EsqlConnection.LIMIT_METHOD_JDBC:
          preparedStatement = connection.prepareStatement( getQueryString(), ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
          break;
        default:
          preparedStatement = connection.prepareStatement( getQueryString() );
      };
      statement = preparedStatement; 
      return(preparedStatement);
    }
  
    public PreparedStatement getPreparedStatement() {
      return(preparedStatement);
    }
  
    public ResultSet getResultSet() {
      return(resultSet);
    }
  
    public boolean nextRow() throws SQLException {
      position++;
      return(resultSet.next());
    }
  
    public ResultSetMetaData getResultSetMetaData() {
      return(resultSetMetaData);
    }
  
    public Statement createStatement() throws SQLException {
      switch(limitMethod) {
        case EsqlConnection.LIMIT_METHOD_JDBC:
          statement = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
          break;
        default:
          statement = connection.createStatement();
      };
      return(statement);
    }
  
    public Statement getStatement() {
      return(statement);
    }
  
    public boolean getMoreResults() throws SQLException {
      return(statement.getMoreResults());
    }
  
    public boolean execute() throws SQLException {
      if (preparedStatement != null) {
        hasResultSet = preparedStatement.execute();
      }
      else {
        hasResultSet = statement.execute( getQueryString() );
      }
      return(hasResultSet);
    }
  
    public boolean hasResultSet() {
      return(this.hasResultSet);
    }
  
    public void getResultRows() throws SQLException {
      resultSet = statement.getResultSet();
      resultSetMetaData = resultSet.getMetaData();
     
      if (skipRows > 0) {
        switch(limitMethod) {
          case EsqlConnection.LIMIT_METHOD_POSTGRESQL:
            // in clause
            position = skipRows;
            break;
          case EsqlConnection.LIMIT_METHOD_MYSQL:
            // in clause
            position = skipRows;
            break;
          case EsqlConnection.LIMIT_METHOD_JDBC:
            resultSet.absolute(skipRows);
            position = skipRows;
            break;
          default:
            while (resultSet.next()) {
              position++;
              if (position == skipRows) {
                 break;
              }
            }
        };
      }
    }
  }
  
  
  
  1.22      +122 -225  xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/java/esql.xsl
  
  Index: esql.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/java/esql.xsl,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- esql.xsl	2001/09/06 20:03:36	1.21
  +++ esql.xsl	2001/10/17 14:12:14	1.22
  @@ -1,5 +1,5 @@
   <?xml version="1.0"?>
  -<!-- $Id: esql.xsl,v 1.21 2001/09/06 20:03:36 bloritsch Exp $-->
  +<!-- $Id: esql.xsl,v 1.22 2001/10/17 14:12:14 haul Exp $-->
   <!--
   
    ============================================================================
  @@ -57,8 +57,6 @@
     xmlns:esql="http://apache.org/cocoon/SQL/v2"
     xmlns:xspdoc="http://apache.org/cocoon/XSPDoc/v1"
   >
  -<!--
  --->
   
   <xsl:param name="XSP-ENVIRONMENT"/>
   <xsl:param name="XSP-VERSION"/>
  @@ -76,23 +74,23 @@
   <xsl:variable name="environment">
     <xsl:choose>
       <xsl:when test="starts-with($XSP-ENVIRONMENT,$cocoon1-environment)">
  -      <xsl:text>cocoon1</xsl:text>
  +      <xsl:text>Cocoon1</xsl:text>
       </xsl:when>
       <xsl:when test="starts-with($XSP-ENVIRONMENT,$cocoon2-environment)">
  -      <xsl:text>cocoon2</xsl:text>
  +      <xsl:text>Cocoon2</xsl:text>
       </xsl:when>
       <xsl:otherwise>
  -      <xsl:text>cocoon2</xsl:text>
  +      <xsl:text>Cocoon2</xsl:text>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:variable>
   
   <xsl:variable name="xsp-namespace-uri">
     <xsl:choose>
  -    <xsl:when test="$environment = 'cocoon1'">
  +    <xsl:when test="$environment = 'Cocoon1'">
         <xsl:value-of select="$cocoon1-xsp-namespace-uri"/>
       </xsl:when>
  -    <xsl:when test="$environment = 'cocoon2'">
  +    <xsl:when test="$environment = 'Cocoon2'">
         <xsl:value-of select="$cocoon2-xsp-namespace-uri"/>
       </xsl:when>
     </xsl:choose>
  @@ -113,7 +111,7 @@
   <xsl:template name="get-nested-string">
     <xsl:param name="content"/>
     <xsl:choose>
  -    <xsl:when test="$environment = 'cocoon1'">
  +    <xsl:when test="$environment = 'Cocoon1'">
         <xsl:choose>
           <xsl:when test="$content/*">
             ""
  @@ -133,7 +131,7 @@
           </xsl:otherwise>
         </xsl:choose>
       </xsl:when>
  -    <xsl:when test="$environment = 'cocoon2'">
  +    <xsl:when test="$environment = 'Cocoon2'">
         <xsl:choose>
           <xsl:when test="$content/*">
             ""
  @@ -223,16 +221,27 @@
         <xsp:include>java.util.ListIterator</xsp:include>
         <xsp:include>java.sql.Struct</xsp:include>
         <xsp:include>java.sql.Types</xsp:include>
  -      <xsl:if test="$environment = 'cocoon2'">
  -          <xsp:include>org.apache.cocoon.components.language.markup.xsp.XSPUtil</xsp:include>
  -      </xsl:if>
  +      <xsl:choose>
  +         <xsl:when test="$environment = 'Cocoon1'">
  +             <xsp:include>org.apache.cocoon.processor.xsp.library.sql.EsqlHelper</xsp:include>
  +             <xsp:include>org.apache.cocoon.processor.xsp.library.sql.EsqlQuery</xsp:include>
  +             <xsp:include>org.apache.cocoon.processor.xsp.library.sql.EsqlConnection</xsp:include>
  +         </xsl:when>
  +         <xsl:when test="$environment = 'Cocoon2'">
  +             <xsp:include>org.apache.cocoon.components.language.markup.xsp.EsqlHelper</xsp:include>
  +             <xsp:include>org.apache.cocoon.components.language.markup.xsp.EsqlQuery</xsp:include>
  +             <xsp:include>org.apache.cocoon.components.language.markup.xsp.EsqlConnection</xsp:include>
  +             <xsp:include>org.apache.cocoon.components.language.markup.xsp.EsqlConnectionCocoon2</xsp:include>
  +             <xsp:include>org.apache.cocoon.components.language.markup.xsp.XSPUtil</xsp:include>
  +         </xsl:when>
  +      </xsl:choose>
         <xsl:if test=".//esql:connection/esql:pool">
           <xsl:choose>
  -          <xsl:when test="$environment = 'cocoon1'">
  +          <xsl:when test="$environment = 'Cocoon1'">
               <xsp:include>org.apache.turbine.services.db.PoolBrokerService</xsp:include>
               <xsp:include>org.apache.turbine.util.db.pool.DBConnection</xsp:include>
             </xsl:when>
  -          <xsl:when test="$environment = 'cocoon2'">
  +          <xsl:when test="$environment = 'Cocoon2'">
               <xsp:include>org.apache.avalon.excalibur.datasource.DataSourceComponent</xsp:include>
             </xsl:when>
           </xsl:choose>
  @@ -240,7 +249,7 @@
       </xsp:structure>
       <xsp:logic>
         private Stack _esql_connections = new Stack();
  -      private EsqlConnection _esql_connection = null;
  +      private EsqlConnection<xsl:value-of select="$environment"/> _esql_connection = null;
         private Stack _esql_queries = new Stack();
         private EsqlQuery _esql_query = null;
         private SQLException _esql_exception = null;
  @@ -248,10 +257,10 @@
   
         <xsl:if test=".//esql:connection/esql:pool">
           <xsl:choose>
  -          <xsl:when test="$environment = 'cocoon1'">
  +          <xsl:when test="$environment = 'Cocoon1'">
               static PoolBrokerService _esql_pool = PoolBrokerService.getInstance();
             </xsl:when>
  -          <xsl:when test="$environment = 'cocoon2'">
  +          <xsl:when test="$environment = 'Cocoon2'">
               private static ComponentSelector _esql_selector = null;
   
               public void compose(ComponentManager manager) throws org.apache.avalon.framework.component.ComponentException {
  @@ -267,73 +276,11 @@
             </xsl:when>
           </xsl:choose>
         </xsl:if>
  -      class EsqlConnection {
  -        <xsl:if test=".//esql:connection/esql:pool">
  -          <xsl:choose>
  -            <xsl:when test="$environment = 'cocoon1'">
  -              DBConnection db_connection = null;
  -            </xsl:when>
  -            <xsl:when test="$environment = 'cocoon2'">
  -              DataSourceComponent datasource = null;
  -            </xsl:when>
  -          </xsl:choose>
  -        </xsl:if>
  -        Connection connection = null;
  -        String dburl = null;
  -        java.util.Properties info = new java.util.Properties();
  -        int use_limit_clause = 0;
  -        static final int LIMIT_CLAUSE_POSTGRESQL = 1;
  -        static final int LIMIT_CLAUSE_MYSQL = 2;
  -      }
  -      class EsqlQuery {
  -        String query;
  -        Statement statement;
  -        PreparedStatement prepared_statement;
  -        ResultSet resultset;
  -        ResultSetMetaData resultset_metadata;
  -        /** the position of the current row in the resultset **/
  -        int position = -1;
  -        int max_rows = -1;
  -        int skip_rows = 0;
  -        boolean results;
  -      }
  -
  -      private final String getAscii(ResultSet set, String column) {
  -        InputStream asciiStream = null;
  -        byte[] buffer = null;
  -
  -        try {
  -            Clob dbClob = set.getClob(column);
  -            int length = (int) dbClob.length();
  -            asciiStream = new BufferedInputStream(dbClob.getAsciiStream());
  -            buffer = new byte[length];
  -            asciiStream.read(buffer);
  -            asciiStream.close();
  -        } catch (Exception e) {
  -            throw new RuntimeException("Error getting clob data: " + e.getMessage());
  -        } finally {
  -            if (asciiStream != null) try {asciiStream.close();} catch (Exception ase) {
  -                throw new RuntimeException("Error closing clob stream: " + ase.getMessage());
  -            }
  -        }
  -
  -        if (buffer == null) return "";
  -
  -        return new String(buffer);
  -      }
  -
  -      private final String getStringFromByteArray(byte[] bytes, String encoding) {
  -        try {
  -            return new String(bytes,encoding);
  -        } catch (java.io.UnsupportedEncodingException uee) {
  -            throw new RuntimeException("Unsupported Encoding Exception: " + uee.getMessage());
  -        }
  -      }
   
         <xsl:choose>
  -        <xsl:when test="$environment = 'cocoon1'">
  +        <xsl:when test="$environment = 'Cocoon1'">
           </xsl:when>
  -        <xsl:when test="$environment = 'cocoon2'">
  +        <xsl:when test="$environment = 'Cocoon2'">
               protected void _esql_printObject ( Object obj, AttributesImpl xspAttr) throws SAXException
               {
                  if ( obj instanceof List) {
  @@ -391,10 +338,10 @@
       if (_esql_connection != null) {
         _esql_connections.push(_esql_connection);
       }
  -    _esql_connection = new EsqlConnection();
  +    _esql_connection = new EsqlConnection<xsl:value-of select="$environment"/>();
       try {
         <xsl:choose>
  -        <xsl:when test="esql:pool and $environment = 'cocoon1'">
  +        <xsl:when test="esql:pool and $environment = 'Cocoon1'">
             try {
               _esql_connection.db_connection = _esql_pool.getConnection(String.valueOf(<xsl:copy-of select="$pool"/>));
               _esql_connection.connection = _esql_connection.db_connection.getConnection();
  @@ -405,7 +352,7 @@
               throw new RuntimeException("Could not open pooled connection: "+String.valueOf(<xsl:copy-of select="$pool"/>));
             }
           </xsl:when>
  -        <xsl:when test="esql:pool and $environment = 'cocoon2'">
  +        <xsl:when test="esql:pool and $environment = 'Cocoon2'">
             try {
               _esql_connection.datasource = (DataSourceComponent) _esql_selector.select(String.valueOf(<xsl:copy-of select="$pool"/>));
               _esql_connection.connection = _esql_connection.datasource.getConnection();
  @@ -423,15 +370,15 @@
             }
             </xsl:if>
             try {
  -            _esql_connection.dburl = String.valueOf(<xsl:copy-of select="$dburl"/>);
  +            _esql_connection.setUrl(String.valueOf(<xsl:copy-of select="$dburl"/>));
               <xsl:if test="esql:username">
  -              _esql_connection.info.put("user", String.valueOf(<xsl:copy-of select="$username"/>));
  +              _esql_connection.setUser(String.valueOf(<xsl:copy-of select="$username"/>));
               </xsl:if>
               <xsl:if test="esql:password">
  -              _esql_connection.info.put("password", String.valueOf(<xsl:copy-of select="$password"/>));
  +              _esql_connection.setPassword("password", String.valueOf(<xsl:copy-of select="$password"/>));
               </xsl:if>
               <xsl:for-each select="esql:property">
  -              _esql_connection.info.put("<xsl:value-of select="@name"/>",<xsl:call-template name="get-nested-string"><xsl:with-param name="content" select="."/></xsl:call-template>);
  +              _esql_connection.setProperty("<xsl:value-of select="@name"/>",<xsl:call-template name="get-nested-string"><xsl:with-param name="content" select="."/></xsl:call-template>);
               </xsl:for-each>
               _esql_connection.connection = DriverManager.getConnection(_esql_connection.dburl, _esql_connection.info);
             } catch (Exception _esql_exception_<xsl:value-of select="generate-id(.)"/>) {
  @@ -441,57 +388,38 @@
         </xsl:choose>
         try {
           if ("false".equals(String.valueOf(<xsl:copy-of select="$autocommit"/>))) {
  -          if (_esql_connection.connection.getAutoCommit()) {
  -            _esql_connection.connection.setAutoCommit(false);
  +          if (_esql_connection.getAutoCommit()) {
  +            _esql_connection.setAutoCommit(false);
             }
           } else {
  -          if (!_esql_connection.connection.getAutoCommit()) {
  -            _esql_connection.connection.setAutoCommit(true);
  +          if (!_esql_connection.getAutoCommit()) {
  +            _esql_connection.setAutoCommit(true);
             }
           }
         } catch (Exception _esql_exception_<xsl:value-of select="generate-id(.)"/>) {
           // do NOT: throw new RuntimeException("Error setting connection autocommit");
         }
         <xsl:if test="esql:use-limit-clause">
  -        {
  -          String _esql_use_limit_clause = String.valueOf(<xsl:copy-of select="$use-limit-clause"/>);
  -          if ("".equals(_esql_use_limit_clause)) {
  -            try {
  -              if (_esql_connection.connection.getMetaData().getURL().startsWith("jdbc:postgresql:")) {
  -                _esql_connection.use_limit_clause = _esql_connection.LIMIT_CLAUSE_POSTGRESQL;
  -              } else if (_esql_connection.connection.getMetaData().getURL().startsWith("jdbc:mysql:")) {
  -                _esql_connection.use_limit_clause = _esql_connection.LIMIT_CLAUSE_MYSQL;
  -              }
  -            } catch (Exception _esql_exception_<xsl:value-of select="generate-id(.)"/>) {
  -              throw new RuntimeException("Error accessing connection metadata: "+_esql_exception_<xsl:value-of select="generate-id(.)"/>.getMessage());
  -            }
  -          } else if ("postgresql".equals(_esql_use_limit_clause)) {
  -            _esql_connection.use_limit_clause = _esql_connection.LIMIT_CLAUSE_POSTGRESQL;
  -          } else if ("mysql".equals(_esql_use_limit_clause)) {
  -            _esql_connection.use_limit_clause = _esql_connection.LIMIT_CLAUSE_MYSQL;
  -          } else {
  -            throw new RuntimeException("Invalid limit clause: "+_esql_use_limit_clause);
  -          }
  -        }
  +        _esql_connection.setLimitMethod(String.valueOf(<xsl:copy-of select="$use-limit-clause"/>));
         </xsl:if>
         <xsl:apply-templates/>
       } finally {
         try {
  -        if(!_esql_connection.connection.getAutoCommit()) {
  -          _esql_connection.connection.commit();
  +        if(!_esql_connection.getAutoCommit()) {
  +          _esql_connection.commit();
           }
           <xsl:choose>
  -          <xsl:when test="esql:pool and $environment = 'cocoon1'">
  +          <xsl:when test="esql:pool and $environment = 'Cocoon1'">
               _esql_pool.releaseConnection(_esql_connection.db_connection);
             </xsl:when>
             <xsl:otherwise>
  -            _esql_connection.connection.close();
  +            _esql_connection.close();
             </xsl:otherwise>
           </xsl:choose>
           if (_esql_connections.empty()) {
             _esql_connection = null;
           } else {
  -          _esql_connection = (EsqlConnection)_esql_connections.pop();
  +          _esql_connection = (EsqlConnection<xsl:value-of select="$environment"/>)_esql_connections.pop();
           }
         } catch (Exception _esql_exception_<xsl:value-of select="generate-id(.)"/>) {}
       }
  @@ -515,48 +443,31 @@
       if (_esql_query != null) {
         _esql_queries.push(_esql_query);
       }
  -    _esql_query = new EsqlQuery();
  -    _esql_query.query = String.valueOf(<xsl:copy-of select="$query"/>);
  -    try {
  -      _esql_query.max_rows = Integer.parseInt(String.valueOf(<xsl:copy-of select="$maxrows"/>));
  -    } catch (NumberFormatException e) {}
  -    try {
  -      _esql_query.skip_rows = Integer.parseInt(String.valueOf(<xsl:copy-of select="$skiprows"/>));
  -    } catch (NumberFormatException e) {}
  -    if (_esql_connection.use_limit_clause &gt; 0) {
  -      if (_esql_query.max_rows &gt; -1) {
  -        if (_esql_query.skip_rows &gt; 0) {
  -          if (_esql_connection.use_limit_clause == _esql_connection.LIMIT_CLAUSE_POSTGRESQL) {
  -            _esql_query.query += " LIMIT "+_esql_query.max_rows+","+_esql_query.skip_rows;
  -          } else if (_esql_connection.use_limit_clause == _esql_connection.LIMIT_CLAUSE_MYSQL) {
  -            _esql_query.query += " LIMIT "+_esql_query.skip_rows+","+_esql_query.max_rows;
  -          }
  -        } else {
  -          _esql_query.query += " LIMIT "+_esql_query.max_rows;
  -        }
  -      } else {
  -        if (_esql_query.skip_rows &gt; 0) {
  -          if (_esql_connection.use_limit_clause == _esql_connection.LIMIT_CLAUSE_POSTGRESQL) {
  -            _esql_query.query += " OFFSET "+_esql_query.skip_rows;
  -          } else if (_esql_connection.use_limit_clause == _esql_connection.LIMIT_CLAUSE_MYSQL) {
  -            throw new RuntimeException("Limit clause may not be used for this query - mysql has not semantics for skipping rows with no maximum");
  -          }
  -        }
  -      }
  -    }
  +    _esql_query = new EsqlQuery( _esql_connection, String.valueOf(<xsl:copy-of select="$query"/>) );
  +
  +    <xsl:if test="esql:max-rows">
  +      try {
  +        _esql_query.setMaxRows( Integer.parseInt(String.valueOf(<xsl:copy-of select="$maxrows"/>)) );
  +      } catch (NumberFormatException e) {}
  +    </xsl:if>
  +
  +    <xsl:if test="esql:skip-rows">
  +      try {
  +        _esql_query.setSkipRows( Integer.parseInt(String.valueOf(<xsl:copy-of select="$skiprows"/>)) );
  +      } catch (NumberFormatException e) {}
  +    </xsl:if>
  +
       try {
         <xsl:choose>
  -        <!-- this is a prepared statement -->
           <xsl:when test="esql:query//esql:parameter">
             try {
  -            _esql_query.prepared_statement = _esql_connection.connection.prepareStatement(_esql_query.query);
  +            _esql_query.prepareStatement();
             } catch (SQLException _esql_exception_<xsl:value-of select="generate-id(.)"/>) {
  -            throw new RuntimeException("Error preparing statement: "+_esql_query.query+": "+_esql_exception_<xsl:value-of select="generate-id(.)"/>.getMessage());
  +            throw new RuntimeException("Error preparing statement: " + _esql_query.getQueryString() + ": "+_esql_exception_<xsl:value-of select="generate-id(.)"/>.getMessage());
             }
  -          _esql_query.statement = _esql_query.prepared_statement;
             <xsl:for-each select="esql:query//esql:parameter">
               try {
  -              <xsl:text>_esql_query.prepared_statement.</xsl:text>
  +              <xsl:text>_esql_query.getPreparedStatement().</xsl:text>
                 <xsl:choose>
                   <xsl:when test="@type">
                     <xsl:variable name="type"><xsl:value-of select="concat(translate(substring(@type,1,1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ'),substring(@type,2))"/></xsl:variable>
  @@ -569,62 +480,55 @@
                   </xsl:otherwise>
                 </xsl:choose>
               } catch (SQLException _esql_exception_<xsl:value-of select="generate-id(.)"/>) {
  -              throw new RuntimeException("Error setting parameter on statement: "+_esql_query.query+": "+_esql_exception_<xsl:value-of select="generate-id(.)"/>);
  +              throw new RuntimeException("Error setting parameter on statement: " + _esql_query.getQueryString() + ": "+_esql_exception_<xsl:value-of select="generate-id(.)"/>);
               }
             </xsl:for-each>
             try {
  -            _esql_query.results = _esql_query.prepared_statement.execute();
  +            _esql_query.execute();
             } catch (SQLException _esql_exception_<xsl:value-of select="generate-id(.)"/>) {
  -            throw new RuntimeException("Error executed prepared statement: "+_esql_query.query+": "+_esql_exception_<xsl:value-of select="generate-id(.)"/>);
  +            throw new RuntimeException("Error executing prepared statement: " + _esql_query.getQueryString() + ": "+_esql_exception_<xsl:value-of select="generate-id(.)"/>);
             }
           </xsl:when>
  -        <!-- this is a normal query -->
           <xsl:otherwise>
  -          _esql_query.statement = _esql_connection.connection.createStatement();
  -          _esql_query.results = _esql_query.statement.execute(_esql_query.query);
  +          _esql_query.createStatement();
  +          try {
  +            _esql_query.execute();
  +          } catch (SQLException _esql_exception_<xsl:value-of select="generate-id(.)"/>) {
  +            throw new RuntimeException("Error executing statement: " + _esql_query.getQueryString() + ": "+_esql_exception_<xsl:value-of select="generate-id(.)"/>);
  +          }
           </xsl:otherwise>
         </xsl:choose>
         <xsl:choose>
  -        <xsl:when test="$environment = 'cocoon1'">
  -          System.err.println("QUERY: "+_esql_query.query);
  +        <xsl:when test="$environment = 'Cocoon1'">
  +          System.err.println("QUERY: " + _esql_query.getQueryString());
           </xsl:when>
           <xsl:otherwise>
  -          getLogger().debug("esql query: "+_esql_query.query);
  +          getLogger().debug("esql query: " + _esql_query.getQueryString());
           </xsl:otherwise>
         </xsl:choose>
  -      if (_esql_query.results) {
  +      if (_esql_query.hasResultSet()) {
           do {
  -          _esql_query.resultset = _esql_query.statement.getResultSet();
  -          _esql_query.resultset_metadata = _esql_query.resultset.getMetaData();
  -          _esql_query.position = 0;
  -          if (_esql_connection.use_limit_clause == 0 &amp;&amp; _esql_query.skip_rows &gt; 0) {
  -            while (_esql_query.resultset.next()) {
  -              _esql_query.position++;
  -              if (_esql_query.position == _esql_query.skip_rows) {
  -                break;
  -              }
  -            }
  -          }
  +          _esql_query.getResultRows();
   
  -          if (_esql_query.resultset.next()) {
  +          if (_esql_query.nextRow()) {
               <xsl:apply-templates select="esql:results"/>
             }
             else {
               <xsl:apply-templates select="esql:no-results"/>
             }
  +          _esql_query.getResultSet().close();
   
  -          _esql_query.resultset.close();
  -        } while(_esql_query.statement.getMoreResults());
  +        } while(_esql_query.getMoreResults());
         } else {
  -        _esql_query.position = _esql_query.statement.getUpdateCount();
  -        if (_esql_query.position &gt;= 0) {
  +        int _esql_update_count = _esql_query.getStatement().getUpdateCount();
  +        if (_esql_update_count &gt;= 0) {
             <xsl:apply-templates select="esql:update-results/*"/>
           }
           else{
             <xsl:apply-templates select="esql:no-results"/>
           }
         }
  -      _esql_query.statement.close();
  +      _esql_query.getStatement().close();
       } catch (SQLException _esql_exception_<xsl:value-of select="generate-id(.)"/>) {
         try {
           <xsl:choose>
  @@ -633,13 +537,13 @@
               _esql_exception_writer = new StringWriter();
               _esql_exception.printStackTrace(new PrintWriter(_esql_exception_writer));
               <xsl:apply-templates select="esql:error-results"/>
  -            if (!_esql_connection.connection.getAutoCommit()) {
  -              _esql_connection.connection.rollback();
  +            if (!_esql_connection.getAutoCommit()) {
  +              _esql_connection.rollback();
               }
             </xsl:when>
             <xsl:otherwise>
  -            if (!_esql_connection.connection.getAutoCommit()) {
  -              _esql_connection.connection.rollback();
  +            if (!_esql_connection.getAutoCommit()) {
  +              _esql_connection.rollback();
               }
             </xsl:otherwise>
           </xsl:choose>
  @@ -674,7 +578,7 @@
   </xsl:template>
   
   <xsl:template match="esql:update-results//esql:get-update-count">
  -  <xsp:expr>_esql_query.position</xsp:expr>
  +  <xsp:expr>_esql_update_count</xsp:expr>
   </xsl:template>
   
   <xsl:template match="esql:results//esql:row-results">
  @@ -683,20 +587,29 @@
       <xsp:content>
         <xsl:apply-templates/>
       </xsp:content>
  -      if (_esql_connection.use_limit_clause == 0 &amp;&amp; _esql_query.max_rows != -1 &amp;&amp; _esql_query.position - _esql_query.skip_rows == _esql_query.max_rows-1) {
  -        _esql_query.position++;
  +      if (_esql_query.getMaxRows() != -1 &amp;&amp; _esql_query.getCurrentRow() - _esql_query.getSkipRows() == _esql_query.getMaxRows() - 1 ) {
           break;
         }
  -      _esql_query.position++;
  -    } while (_esql_query.resultset.next());
  +    } while (_esql_query.nextRow());
  +
  +    if (_esql_query.getSkipRows() > 0 ) {
  +        <xsl:apply-templates select="ancestor::esql:results//esql:previous-results" mode="more"/>
  +    }
   
  -    if (_esql_query.resultset.next()) {
  -        <xsl:apply-templates select="following-sibling::esql:more-results" mode="more"/>
  -      _esql_query.position++;
  +    if (_esql_query.nextRow()) {
  +        <xsl:apply-templates select="ancestor::esql:results//esql:more-results" mode="more"/>
       }
     </xsp:logic>
   </xsl:template>
   
  +<xsl:template match="esql:results//esql:previous-results"/>
  +
  +<xsl:template match="esql:results//esql:previous-results" mode="more">
  +  <xsp:content>
  +    <xsl:apply-templates/>
  +  </xsp:content>
  +</xsl:template>
  +
   <xsl:template match="esql:results//esql:more-results"/>
   
   <xsl:template match="esql:results//esql:more-results" mode="more">
  @@ -709,36 +622,36 @@
   <xsl:template match="esql:row-results//esql:get-columns">
     <xsl:variable name="tagcase"><xsl:value-of select="@tag-case"/></xsl:variable>
     <xsl:choose>
  -    <xsl:when test="$environment = 'cocoon1'">
  +    <xsl:when test="$environment = 'Cocoon1'">
         <xsp:logic>
  -        for (int _esql_i=1; _esql_i &lt;= _esql_query.resultset_metadata.getColumnCount(); _esql_i++) {
  +        for (int _esql_i=1; _esql_i &lt;= _esql_query.getResultSetMetaData().getColumnCount(); _esql_i++) {
             Node _esql_node = document.createElement(
               <xsl:choose>
                 <xsl:when test="$tagcase='lower'">
  -                _esql_query.resultset_metadata.getColumnName(_esql_i).toLowerCase()
  +                _esql_query.getResultSetMetaData().getColumnName(_esql_i).toLowerCase()
                 </xsl:when>
                 <xsl:when test="$tagcase='upper'">
  -                _esql_query.resultset_metadata.getColumnName(_esql_i).toUpperCase()
  +                _esql_query.getResultSetMetaData().getColumnName(_esql_i).toUpperCase()
                 </xsl:when>
                 <xsl:otherwise>
  -                _esql_query.resultset_metadata.getColumnName(_esql_i)
  +                _esql_query.getResultSetMetaData().getColumnName(_esql_i)
                 </xsl:otherwise>
               </xsl:choose>
             );
             _esql_node.appendChild(document.createTextNode(
               <xsl:call-template name="get-string-encoded">
                 <xsl:with-param name="column-spec">_esql_i</xsl:with-param>
  -              <xsl:with-param name="resultset">_esql_query.resultset</xsl:with-param>
  +              <xsl:with-param name="resultset">_esql_query.getResultSet()</xsl:with-param>
               </xsl:call-template>
             ));
             xspCurrentNode.appendChild(_esql_node);
           }
         </xsp:logic>
       </xsl:when>
  -    <xsl:when test="$environment = 'cocoon2'">
  +    <xsl:when test="$environment = 'Cocoon2'">
         <xsp:logic>
  -        for (int _esql_i = 1; _esql_i &lt;= _esql_query.resultset_metadata.getColumnCount(); _esql_i++) {
  -          String _esql_tagname = _esql_query.resultset_metadata.getColumnName(_esql_i);
  +        for (int _esql_i = 1; _esql_i &lt;= _esql_query.getResultSetMetaData().getColumnCount(); _esql_i++) {
  +          String _esql_tagname = _esql_query.getResultSetMetaData().getColumnName(_esql_i);
             <xsp:element>
               <xsp:param name="name">
                 <xsl:choose>
  @@ -754,12 +667,12 @@
                 </xsl:choose>
               </xsp:param>
               <xsp:logic>
  -              switch(_esql_query.resultset.getMetaData().getColumnType(_esql_i)){
  +              switch(_esql_query.getResultSet().getMetaData().getColumnType(_esql_i)){
                    case java.sql.Types.ARRAY:
                    case java.sql.Types.STRUCT:
                       <xsp:element name="sql-row">
                         <xsp:logic>
  -                        Object[] _esql_struct = ((Struct) _esql_query.resultset.getObject(_esql_i)).getAttributes();
  +                        Object[] _esql_struct = ((Struct) _esql_query.getResultSet().getObject(_esql_i)).getAttributes();
                           for ( int _esql_k=0; _esql_k&lt;_esql_struct.length; _esql_k++){
                           <xsp:element name="sql-row-item"><xsp:logic>this._esql_printObject(_esql_struct[_esql_k],xspAttr);</xsp:logic></xsp:element>
                           }
  @@ -768,7 +681,7 @@
                       break;
   
                    case java.sql.Types.OTHER: // This is what Informix uses for Sets, Bags, Lists
  -                    this._esql_printObject(_esql_query.resultset.getObject(_esql_i), xspAttr);
  +                    this._esql_printObject(_esql_query.getResultSet().getObject(_esql_i), xspAttr);
                       break;
   
                    default:
  @@ -777,7 +690,7 @@
                       <xsp:expr>
                         <xsl:call-template name="get-string-encoded">
                           <xsl:with-param name="column-spec">_esql_i</xsl:with-param>
  -                        <xsl:with-param name="resultset">_esql_query.resultset</xsl:with-param>
  +                        <xsl:with-param name="resultset">_esql_query.getResultSet()</xsl:with-param>
                         </xsl:call-template>
                       </xsp:expr></xsp:content>
                 }
  @@ -897,7 +810,7 @@
   
   <xspdoc:desc>returns the value of the given column as a clob</xspdoc:desc>
   <xsl:template match="esql:row-results//esql:get-ascii">
  -  <xsp:expr>this.getAscii(<xsl:call-template name="get-resultset"/>, <xsl:call-template name="get-column"/>)</xsp:expr>
  +  <xsp:expr>EsqlHelper.getAscii(<xsl:call-template name="get-resultset"/>, <xsl:call-template name="get-column"/>)</xsp:expr>
   </xsl:template>
   
    <xspdoc:desc>returns the value of the given column interpeted as an xml fragment.
  @@ -908,7 +821,6 @@
     <xsl:variable name="content">
       <xsl:choose>
         <xsl:when test="@root">
  -        <!-- <xsl:call-template name="add-xml-decl"> not needed -->
           <xsl:text>"&lt;</xsl:text>
           <xsl:value-of select="@root"/>
           <xsl:text>&gt;"+</xsl:text>
  @@ -918,13 +830,12 @@
           <xsl:text>&gt;"</xsl:text>
         </xsl:when>
         <xsl:otherwise>
  -        <!-- <xsl:call-template name="add-xml-decl"> not needed -->
           <xsl:call-template name="get-string"/>
         </xsl:otherwise>
       </xsl:choose>
     </xsl:variable>
     <xsl:choose>
  -    <xsl:when test="$environment = 'cocoon1'">
  +    <xsl:when test="$environment = 'Cocoon1'">
         <xsl:choose>
           <xsl:when test="../esql:row-results">
             <xsp:logic>
  @@ -936,7 +847,7 @@
           </xsl:otherwise>
         </xsl:choose>
       </xsl:when>
  -    <xsl:when test="$environment = 'cocoon2'">
  +    <xsl:when test="$environment = 'Cocoon2'">
         <xsp:logic>
         {
             org.apache.cocoon.components.parser.Parser newParser = null;
  @@ -1024,7 +935,7 @@
   </xsl:template>
   
   <xsl:template name="get-resultset">
  -  <xsl:call-template name="get-query"/><xsl:text>.resultset</xsl:text>
  +  <xsl:call-template name="get-query"/><xsl:text>.getResultSet()</xsl:text>
   </xsl:template>
   
   <xsl:template name="get-query">
  @@ -1088,26 +999,12 @@
       </xsl:when>
       <xsl:otherwise>
         <xsl:value-of select="$resultset"/>.getBytes(<xsl:value-of select="$column-spec"/>)
  -      != null ? getStringFromByteArray(<xsl:value-of select="$resultset"/>.getBytes
  +      != null ? EsqlHelper.getStringFromByteArray(<xsl:value-of select="$resultset"/>.getBytes
           (<xsl:value-of select="$column-spec"/>), <xsl:value-of select="$encoding"/>)
         : ""
       </xsl:otherwise>
     </xsl:choose>
   </xsl:template>
  -
  -<!-- added by mistake. Not needed, I think - RDG
  -<xsl:template name="add-xml-decl">
  -  <xsl:choose>
  -    <xsl:when test="@encoding">
  -      "&lt;?xml version=\"1.0\" encoding=\"<xsl:value-of select="@encoding"/>\"?&gt;"
  -    </xsl:when>
  -    <xsl:otherwise>
  -      "&lt;?xml version=\"1.0\"?&gt;"
  -    </xsl:otherwise>
  -  </xsl:choose>
  -  +
  -</xsl:template>
  --->
   
   <xsl:template match="@*|node()" priority="-1">
     <xsl:copy>
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


RE: cvs commit: xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/java esql.xsl

Posted by Torsten Curdt <tc...@dff.st>.
> On 17.Oct.2001 -- 02:12 PM, haul@apache.org wrote:
> > haul        01/10/17 07:12:14
> > 
> >   Modified:    src/org/apache/cocoon/components/language/markup/xsp/java
> >                         esql.xsl
> >   Added:       src/org/apache/cocoon/components/language/markup/xsp
> >                         EsqlConnection.java EsqlConnectionCocoon2.java
> >                         EsqlHelper.java EsqlQuery.java
> >   Log:
> >   Patch from Thorsten
> >     - removed the inner classes (created real ones)
> >     - moved redundant code into a helper class
> >     - added support for jdbc ResultSet positioning
> >       (now we can do paging not only for MySQL and PostgreSQL
> >        and it's quite easy to add more)
> >     - added a <esql:previous-results> as counterpart of <esql:more-results>
> 
> Team,
> 
> on purpose have I not committed this to 2.0 nor 1.0 since 1.0 seems to
> be in maintenance mode and although I honestly believe this patch is
> sane I don't want to break anything so short before rc2 or final.
> 
> I'd be happy to commit it to the other branches if so desired. Note
> that for C1 some differences in helper classes exist
> (i.e. org.apache.cocoon.processor.xsp.library.sql as opposed to
> org.apache.cocoon.components.language.markup.xsp) 

I crosschecked. Seems to be fine.
Thanks!
--
Torsten

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: cvs commit: xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/java esql.xsl

Posted by Christian Haul <ha...@dvs1.informatik.tu-darmstadt.de>.
On 17.Oct.2001 -- 02:12 PM, haul@apache.org wrote:
> haul        01/10/17 07:12:14
> 
>   Modified:    src/org/apache/cocoon/components/language/markup/xsp/java
>                         esql.xsl
>   Added:       src/org/apache/cocoon/components/language/markup/xsp
>                         EsqlConnection.java EsqlConnectionCocoon2.java
>                         EsqlHelper.java EsqlQuery.java
>   Log:
>   Patch from Thorsten
>     - removed the inner classes (created real ones)
>     - moved redundant code into a helper class
>     - added support for jdbc ResultSet positioning
>       (now we can do paging not only for MySQL and PostgreSQL
>        and it's quite easy to add more)
>     - added a <esql:previous-results> as counterpart of <esql:more-results>

Team,

on purpose have I not committed this to 2.0 nor 1.0 since 1.0 seems to
be in maintenance mode and although I honestly believe this patch is
sane I don't want to break anything so short before rc2 or final.

I'd be happy to commit it to the other branches if so desired. Note
that for C1 some differences in helper classes exist
(i.e. org.apache.cocoon.processor.xsp.library.sql as opposed to
org.apache.cocoon.components.language.markup.xsp) 

	Chris.

-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org