The new implementation for <esql:skip-rows> and <esql:max-rows> in src/java/org/apache/cocoon/components/language/markup/xsp/AbstractEsqlConnection.java is pretty neat, especially for oracle.
1) Unfortunately, Sybase Adaptive Server Enterprise does not support "select TOP", only Sybase Adaptive Server Anywhere. Both use urls starting with "jdbc:sybase:" so some other means must be used to distinguish between them. 2) MS SQL Server also supports "select TOP", so SybaseEsqlQuery should be used with it too. Here is a patch to address this stuff: --- /cygdrive/c/xml-cocoon2/src/blocks/databases/java/org/apache/cocoon/components/language/markup/xsp/AbstractEsqlConnection.java Sat Feb 1 09:49:18 2003 +++ +../src/java/org/apache/cocoon/components/language/markup/xsp/AbstractEsqlConnection.java + Tue Feb 18 12:00:38 2003 @@ -122,6 +122,19 @@ /** + * Sybase has 2 RDBMS products. The Sybase JDBC driver uses a url starting with +"jdbc:sybase:" for both. + * Here are the product names and versions returned from the Sybase JDBC driver: + * getMetaData().getDatabaseProductName() +getMetaData().getDatabaseProductVersion() + * 1) Adaptive Server Anywhere 7.0.4.3373 + * 2) Sybase SQL Server Adaptive Server +Enterprise/12.0.0.3/P/SWR 9777 ESD 4/NT (IX86)/OS 4.0/1699/32bit/OPT/Wed Sep 05 21:14:50 2001 + * The first supports "select TOP" as used by SybaseEsqlQuery, but the second +does not. + */ + private boolean isSybaseAdaptiveServerAnywhere() throws SQLException { + String databaseProductName = +getConnection().getMetaData().getDatabaseProductName().toLowerCase(); + return databaseProductName.indexOf("anywhere") > -1; + } + + /** * Factory method for creating an EsqlQuery object. If type is set to * "" or "auto" it will try to find type from the JDBC connection URL. * If this does not succeed the generic JDBC type will be assumed. @@ -144,6 +157,15 @@ query = new MysqlEsqlQuery(this,queryString); } else if (url.startsWith("jdbc:sybase:")) { + if (isSybaseAdaptiveServerAnywhere()) { + query = new SybaseEsqlQuery(this,queryString); + } else { + query = new JdbcEsqlQuery(this,queryString); + } + } + else if(url.startsWith("jdbc:microsoft:sqlserver:")) { + // MS SQL Server also supports "select TOP" like Sybase ASA + // Maybe SybaseEsqlQuery should be renamed to something like +SelectTopEsqlQuery? query = new SybaseEsqlQuery(this,queryString); } else if (url.startsWith("jdbc:oracle:")) { @@ -155,6 +177,13 @@ } } else if ("sybase".equalsIgnoreCase(type)) { + if (isSybaseAdaptiveServerAnywhere()) { + query = new SybaseEsqlQuery(this,queryString); + } else { + query = new JdbcEsqlQuery(this,queryString); + } + } + else if ("mssqlserver".equalsIgnoreCase(type)) { query = new SybaseEsqlQuery(this,queryString); } else if ("postgresql".equalsIgnoreCase(type)) { query = new PostgresEsqlQuery(this,queryString); --------------------------------------------------------------------- Please check that your question has not already been answered in the FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>