cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pier Fumagalli (JIRA)" <j...@apache.org>
Subject [jira] Updated: (COCOON-640) AbstractEsqlConnection: fix for Sybase ASE
Date Tue, 25 Oct 2005 13:22:01 GMT
     [ http://issues.apache.org/jira/browse/COCOON-640?page=all ]

Pier Fumagalli updated COCOON-640:
----------------------------------

    Assign To: Torsten Curdt  (was: Torsten Curdt)

> AbstractEsqlConnection: fix for Sybase ASE
> ------------------------------------------
>
>          Key: COCOON-640
>          URL: http://issues.apache.org/jira/browse/COCOON-640
>      Project: Cocoon
>         Type: Bug
>   Components: - Components: Avalon
>     Versions: 2.1.8-dev (Current SVN)
>  Environment: Operating System: other
> Platform: All
>     Reporter: Neil Bacon
>     Assignee: Torsten Curdt

>
> Here's a patch for
> cocoon-
> 2.1/src/blocks/databases/java/org/apache/cocoon/components/language/markup/xsp/A
> bstractEsqlConnection.java
> to:
> - fix an error with Sybase ASE (unlike Sybase ASA, ASE doesn't support "select 
> top")
> - enhance behavior with MS Sql Server (it supports "select top" like Sybase ASA)
> --- AbstractEsqlConnection.java-1.2	2003-04-01 14:20:08.000000000 +1000
> +++ AbstractEsqlConnection.java	2003-04-01 14:12:48.000000000 +1000
> @@ -147,12 +147,26 @@
>  
>  
>      /**
> +     * 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()
> +     * --------------------------------------  --------------------------------
> ---------
> +     * Adaptive Server Anywhere                7.0.4.3373
> +     * 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.
>       * (This type does not work for some databases like mssql though)
>       *
> -     * @param type {sybase|postgresql|mysql|oracle|jdbc}
> +     * @param type {sybase|sybase-ase|ms-
> sqlserver|postgresql|mysql|oracle|jdbc}
>       * @param queryString
>       * @return implementation of the AbstractEsqlQuery
>       * @throws SQLException
> @@ -169,6 +183,15 @@
>                  query = new MysqlEsqlQuery(getConnection(),queryString);
>              }
>              else if (url.startsWith("jdbc:sybase:")) {
> +                if (isSybaseAdaptiveServerAnywhere()) {
> +		    query = new SybaseEsqlQuery(getConnection(),queryString);
> +		} else {
> +		    query = new JdbcEsqlQuery(getConnection(),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(getConnection(),queryString);
>              }
>              else if (url.startsWith("jdbc:oracle:")) {
> @@ -182,7 +205,7 @@
>                  query = new JdbcEsqlQuery(getConnection(),queryString);
>              }
>          }
> -        else if ("sybase".equalsIgnoreCase(type)) {
> +        else if ("sybase".equalsIgnoreCase(type) || "ms-
> sqlserver".equalsIgnoreCase(type)) {
>              query = new SybaseEsqlQuery(getConnection(),queryString);
>          }
>          else if ("postgresql".equalsIgnoreCase(type)) {
> @@ -200,7 +223,7 @@
>          else if ("pervasive".equalsIgnoreCase(type)) {
>              query = new PervasiveEsqlQuery(getConnection(),queryString);
>          }
> -        else if ("jdbc".equalsIgnoreCase(type)) {
> +        else if ("jdbc".equalsIgnoreCase(type) || "sybase-ase".equalsIgnoreCase
> (type)) {
>              query = new JdbcEsqlQuery(getConnection(),queryString);
>          }
>          else {

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message