db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r419657 - /db/torque/runtime/trunk/src/java/org/apache/torque/adapter/
Date Thu, 06 Jul 2006 18:55:51 GMT
Author: tv
Date: Thu Jul  6 11:55:49 2006
New Revision: 419657

URL: http://svn.apache.org/viewvc?rev=419657&view=rev
Log:
- Made DB an interface
- Made all database adapters extend AbstractDBAdapter
- moved generateLimits methods to the adapters (LimitHelper will die)
- deprecated getLimitStyle and associated constants because this
  should be handled transparently for the user.
- added Serial version IDs (Why are these Serializable anyway?)

Added:
    db/torque/runtime/trunk/src/java/org/apache/torque/adapter/AbstractDBAdapter.java
Modified:
    db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DB.java
    db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBAxion.java
    db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBCloudscape.java
    db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBDB2400.java
    db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBDB2App.java
    db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBDB2Net.java
    db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBDerby.java
    db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBFirebird.java
    db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBHypersonicSQL.java
    db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBInformix.java
    db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBInstantDB.java
    db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBInterbase.java
    db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBMM.java
    db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBMSSQL.java
    db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBNone.java
    db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBOdbc.java
    db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBOracle.java
    db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBPostgres.java
    db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBSapDB.java
    db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBSybase.java
    db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBWeblogic.java

Added: db/torque/runtime/trunk/src/java/org/apache/torque/adapter/AbstractDBAdapter.java
URL: http://svn.apache.org/viewvc/db/torque/runtime/trunk/src/java/org/apache/torque/adapter/AbstractDBAdapter.java?rev=419657&view=auto
==============================================================================
--- db/torque/runtime/trunk/src/java/org/apache/torque/adapter/AbstractDBAdapter.java (added)
+++ db/torque/runtime/trunk/src/java/org/apache/torque/adapter/AbstractDBAdapter.java Thu Jul  6 11:55:49 2006
@@ -0,0 +1,245 @@
+package org.apache.torque.adapter;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Timestamp;
+import java.util.Date;
+
+import org.apache.torque.util.Query;
+
+/**
+ * This class iis the abstract base for any database adapter
+ * Support for new databases is added by subclassing this
+ * class and implementing its abstract methods, and by
+ * registering the new database adapter and its corresponding
+ * JDBC driver in the service configuration file.
+ *
+ * <p>The Torque database adapters exist to present a uniform
+ * interface to database access across all available databases.  Once
+ * the necessary adapters have been written and configured,
+ * transparent swapping of databases is theoretically supported with
+ * <i>zero code changes</i> and minimal configuration file
+ * modifications.
+ *
+ * <p>Torque uses the driver class name to find the right adapter.
+ * A JDBC driver corresponding to your adapter must be added to the properties
+ * file, using the fully-qualified class name of the driver. If no driver is
+ * specified for your database, <code>driver.default</code> is used.
+ *
+ * <pre>
+ * #### MySQL MM Driver
+ * database.default.driver=org.gjt.mm.mysql.Driver
+ * database.default.url=jdbc:mysql://localhost/DATABASENAME
+ * </pre>
+ *
+ * @author <a href="mailto:jon@latchkey.com">Jon S. Stevens</a>
+ * @author <a href="mailto:bmclaugh@algx.net">Brett McLaughlin</a>
+ * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
+ * @author <a href="mailto:vido@ldh.org">Augustin Vidovic</a>
+ * @version $Id: DB.java 393063 2006-04-10 20:59:16Z tfischer $
+ */
+public abstract class AbstractDBAdapter implements DB
+{
+    /**
+     * Empty constructor.
+     */
+    protected AbstractDBAdapter()
+    {
+    }
+
+    /**
+     * This method is used to ignore case.
+     *
+     * @param in The string to transform to upper case.
+     * @return The upper case string.
+     */
+    public abstract String toUpperCase(String in);
+
+    /**
+     * Returns the character used to indicate the beginning and end of
+     * a piece of text used in a SQL statement (generally a single
+     * quote).
+     *
+     * @return The text delimeter.
+     */
+    public char getStringDelimiter()
+    {
+        return '\'';
+    }
+
+    /**
+     * Returns the constant from the {@link
+     * org.apache.torque.adapter.IDMethod} interface denoting which
+     * type of primary key generation method this type of RDBMS uses.
+     *
+     * @return IDMethod constant
+     */
+    public abstract String getIDMethodType();
+
+    /**
+     * Returns SQL used to get the most recently inserted primary key.
+     * Databases which have no support for this return
+     * <code>null</code>.
+     *
+     * @param obj Information used for key generation.
+     * @return The most recently inserted database key.
+     */
+    public abstract String getIDMethodSQL(Object obj);
+
+    /**
+     * Locks the specified table.
+     *
+     * @param con The JDBC connection to use.
+     * @param table The name of the table to lock.
+     * @throws SQLException No Statement could be created or executed.
+     */
+    public abstract void lockTable(Connection con, String table)
+            throws SQLException;
+
+    /**
+     * Unlocks the specified table.
+     *
+     * @param con The JDBC connection to use.
+     * @param table The name of the table to unlock.
+     * @throws SQLException No Statement could be created or executed.
+     */
+    public abstract void unlockTable(Connection con, String table)
+            throws SQLException;
+
+    /**
+     * This method is used to ignore case.
+     *
+     * @param in The string whose case to ignore.
+     * @return The string in a case that can be ignored.
+     */
+    public abstract String ignoreCase(String in);
+
+    /**
+     * This method is used to ignore case in an ORDER BY clause.
+     * Usually it is the same as ignoreCase, but some databases
+     * (Interbase for example) does not use the same SQL in ORDER BY
+     * and other clauses.
+     *
+     * @param in The string whose case to ignore.
+     * @return The string in a case that can be ignored.
+     */
+    public String ignoreCaseInOrderBy(String in)
+    {
+        return ignoreCase(in);
+    }
+
+    /**
+     * This method is used to check whether the database natively
+     * supports limiting the size of the resultset.
+     *
+     * @return True if the database natively supports limiting the
+     * size of the resultset.
+     */
+    public boolean supportsNativeLimit()
+    {
+        return false;
+    }
+
+    /**
+     * This method is used to check whether the database natively
+     * supports returning results starting at an offset position other
+     * than 0.
+     *
+     * @return True if the database natively supports returning
+     * results starting at an offset position other than 0.
+     */
+    public boolean supportsNativeOffset()
+    {
+        return false;
+    }
+
+    /**
+     * This method is used to generate the database specific query
+     * extension to limit the number of record returned.
+     *
+     * @param query The query to modify
+     * @param offset the offset Value
+     * @param limit the limit Value
+     */
+    public void generateLimits(Query query, int offset, int limit)
+    {
+        if (supportsNativeLimit())
+        {
+            query.setLimit(String.valueOf(limit));
+        }
+    }
+
+    /**
+    * This method is for the SqlExpression.quoteAndEscape rules.  The rule is,
+    * any string in a SqlExpression with a BACKSLASH will either be changed to
+    * "\\" or left as "\".  SapDB does not need the escape character.
+    *
+    * @return true if the database needs to escape text in SqlExpressions.
+    */
+
+    public boolean escapeText()
+    {
+        return true;
+    }
+
+    /**
+     * This method is used to check whether the database supports
+     * limiting the size of the resultset.
+     *
+     * @return The limit style for the database.
+     * @deprecated This should not be exposed to the outside     
+     */
+    public int getLimitStyle()
+    {
+        return LIMIT_STYLE_NONE;
+    }
+
+    /**
+     * This method is used to format any date string.
+     * Database can use different default date formats.
+     *
+     * @param date the Date to format
+     * @return The proper date formatted String.
+     */
+    public String getDateString(Date date)
+    {
+        Timestamp ts = null;
+        if (date instanceof Timestamp)
+        {
+            ts = (Timestamp) date;
+        }
+        else
+        {
+            ts = new Timestamp(date.getTime());
+        }
+
+        return ("{ts '" + ts + "'}");
+    }
+
+    /**
+     * This method is used to format a boolean string.
+     *
+     * @param b the Boolean to format
+     * @return The proper date formatted String.
+     */
+    public String getBooleanString(Boolean b)
+    {
+        return (Boolean.TRUE.equals(b) ? "1" : "0");
+    }
+}
\ No newline at end of file

Modified: db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DB.java
URL: http://svn.apache.org/viewvc/db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DB.java?rev=419657&r1=419656&r2=419657&view=diff
==============================================================================
--- db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DB.java (original)
+++ db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DB.java Thu Jul  6 11:55:49 2006
@@ -16,18 +16,20 @@
  * limitations under the License.
  */
 
-import java.util.Date;
 import java.io.Serializable;
 import java.sql.Connection;
 import java.sql.SQLException;
-import java.sql.Timestamp;
+import java.util.Date;
+
+import org.apache.torque.util.Query;
 
 /**
  * <code>DB</code> defines the interface for a Torque database
- * adapter.  Support for new databases is added by subclassing
- * <code>DB</code> and implementing its abstract interface, and by
- * registering the new database adapter and its corresponding
- * JDBC driver in the service configuration file.
+ * adapter.  Support for new databases is added by implementing this 
+ * interface. A couple of default settings is provided by
+ * subclassing <code>AbstractDBAdapter</code>. The new database adapter
+ * and its corresponding JDBC driver need to be registered in the service
+ * configuration file.
  *
  * <p>The Torque database adapters exist to present a uniform
  * interface to database access across all available databases.  Once
@@ -51,26 +53,39 @@
  * @author <a href="mailto:bmclaugh@algx.net">Brett McLaughlin</a>
  * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
  * @author <a href="mailto:vido@ldh.org">Augustin Vidovic</a>
+ * @author <a href="mailto:tv@apache.org">Thomas Vandahl</a>
  * @version $Id$
  */
-public abstract class DB implements Serializable, IDMethod
+public interface DB extends Serializable, IDMethod
 {
-    /** Database does not support limiting result sets. */
+    /** Database does not support limiting result sets. 
+     *  @deprecated This should not be exposed to the outside     
+     */
     public static final int LIMIT_STYLE_NONE = 0;
 
-    /** <code>SELECT ... LIMIT <limit>, [&lt;offset&gt;]</code> */
+    /** <code>SELECT ... LIMIT <limit>, [&lt;offset&gt;]</code> 
+     *  @deprecated This should not be exposed to the outside     
+     */
     public static final int LIMIT_STYLE_POSTGRES = 1;
 
-    /** <code>SELECT ... LIMIT [<offset>, ] &lt;offset&gt;</code> */
+    /** <code>SELECT ... LIMIT [<offset>, ] &lt;offset&gt;</code> 
+     *  @deprecated This should not be exposed to the outside     
+     */
     public static final int LIMIT_STYLE_MYSQL = 2;
 
-    /** <code>SET ROWCOUNT &lt;offset&gt; SELECT ... SET ROWCOUNT 0</code> */
+    /** <code>SET ROWCOUNT &lt;offset&gt; SELECT ... SET ROWCOUNT 0</code> 
+     *  @deprecated This should not be exposed to the outside     
+     */
     public static final int LIMIT_STYLE_SYBASE = 3;
 
-    /** <code><pre>SELECT ... WHERE ... AND ROWNUM < <limit></pre></code> */
+    /** <code><pre>SELECT ... WHERE ... AND ROWNUM < <limit></pre></code> 
+     *  @deprecated This should not be exposed to the outside     
+     */
     public static final int LIMIT_STYLE_ORACLE = 4;
 
-    /** <code><pre>SELECT ... WHERE ... AND ROW_NUMBER() OVER() < <limit></pre></code> */
+    /** <code><pre>SELECT ... WHERE ... AND ROW_NUMBER() OVER() < <limit></pre></code> 
+     *  @deprecated This should not be exposed to the outside     
+     */
     public static final int LIMIT_STYLE_DB2 = 5;
 
 	/**
@@ -84,19 +99,12 @@
     public static final String DRIVER_KEY = "driver";
 
     /**
-     * Empty constructor.
-     */
-    protected DB()
-    {
-    }
-
-    /**
      * This method is used to ignore case.
      *
      * @param in The string to transform to upper case.
      * @return The upper case string.
      */
-    public abstract String toUpperCase(String in);
+    public String toUpperCase(String in);
 
     /**
      * Returns the character used to indicate the beginning and end of
@@ -105,10 +113,7 @@
      *
      * @return The text delimeter.
      */
-    public char getStringDelimiter()
-    {
-        return '\'';
-    }
+    public char getStringDelimiter();
 
     /**
      * Returns the constant from the {@link
@@ -117,7 +122,7 @@
      *
      * @return IDMethod constant
      */
-    public abstract String getIDMethodType();
+    public String getIDMethodType();
 
     /**
      * Returns SQL used to get the most recently inserted primary key.
@@ -127,7 +132,7 @@
      * @param obj Information used for key generation.
      * @return The most recently inserted database key.
      */
-    public abstract String getIDMethodSQL(Object obj);
+    public String getIDMethodSQL(Object obj);
 
     /**
      * Locks the specified table.
@@ -136,7 +141,7 @@
      * @param table The name of the table to lock.
      * @throws SQLException No Statement could be created or executed.
      */
-    public abstract void lockTable(Connection con, String table)
+    public void lockTable(Connection con, String table)
             throws SQLException;
 
     /**
@@ -146,7 +151,7 @@
      * @param table The name of the table to unlock.
      * @throws SQLException No Statement could be created or executed.
      */
-    public abstract void unlockTable(Connection con, String table)
+    public void unlockTable(Connection con, String table)
             throws SQLException;
 
     /**
@@ -155,7 +160,7 @@
      * @param in The string whose case to ignore.
      * @return The string in a case that can be ignored.
      */
-    public abstract String ignoreCase(String in);
+    public String ignoreCase(String in);
 
     /**
      * This method is used to ignore case in an ORDER BY clause.
@@ -166,10 +171,7 @@
      * @param in The string whose case to ignore.
      * @return The string in a case that can be ignored.
      */
-    public String ignoreCaseInOrderBy(String in)
-    {
-        return ignoreCase(in);
-    }
+    public String ignoreCaseInOrderBy(String in);
 
     /**
      * This method is used to check whether the database natively
@@ -178,10 +180,7 @@
      * @return True if the database natively supports limiting the
      * size of the resultset.
      */
-    public boolean supportsNativeLimit()
-    {
-        return false;
-    }
+    public boolean supportsNativeLimit();
 
     /**
      * This method is used to check whether the database natively
@@ -191,12 +190,19 @@
      * @return True if the database natively supports returning
      * results starting at an offset position other than 0.
      */
-    public boolean supportsNativeOffset()
-    {
-        return false;
-    }
+    public boolean supportsNativeOffset();
 
-   /**
+    /**
+     * This method is used to generate the database specific query
+     * extension to limit the number of record returned.
+     *
+     * @param query The query to modify
+     * @param offset the offset Value
+     * @param limit the limit Value
+     */
+    public void generateLimits(Query query, int offset, int limit);
+
+    /**
     * This method is for the SqlExpression.quoteAndEscape rules.  The rule is,
     * any string in a SqlExpression with a BACKSLASH will either be changed to
     * "\\" or left as "\".  SapDB does not need the escape character.
@@ -204,21 +210,16 @@
     * @return true if the database needs to escape text in SqlExpressions.
     */
 
-    public boolean escapeText()
-    {
-        return true;
-    }
+    public boolean escapeText();
 
     /**
      * This method is used to check whether the database supports
      * limiting the size of the resultset.
      *
      * @return The limit style for the database.
+     * @deprecated This should not be exposed to the outside     
      */
-    public int getLimitStyle()
-    {
-        return LIMIT_STYLE_NONE;
-    }
+    public int getLimitStyle();
 
     /**
      * This method is used to format any date string.
@@ -227,20 +228,7 @@
      * @param date the Date to format
      * @return The proper date formatted String.
      */
-    public String getDateString(Date date)
-    {
-        Timestamp ts = null;
-        if (date instanceof Timestamp)
-        {
-            ts = (Timestamp) date;
-        }
-        else
-        {
-            ts = new Timestamp(date.getTime());
-        }
-
-        return ("{ts '" + ts + "'}");
-    }
+    public String getDateString(Date date);
 
     /**
      * This method is used to format a boolean string.
@@ -248,8 +236,5 @@
      * @param b the Boolean to format
      * @return The proper date formatted String.
      */
-    public String getBooleanString(Boolean b)
-    {
-        return (Boolean.TRUE.equals(b) ? "1" : "0");
-    }
+    public String getBooleanString(Boolean b);
 }

Modified: db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBAxion.java
URL: http://svn.apache.org/viewvc/db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBAxion.java?rev=419657&r1=419656&r2=419657&view=diff
==============================================================================
--- db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBAxion.java (original)
+++ db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBAxion.java Thu Jul  6 11:55:49 2006
@@ -27,8 +27,13 @@
  * @author <a href="mailto:mpoeschl@marmot.at">Martin Poeschl</a>
  * @version $Id$
  */
-public class DBAxion extends DB
+public class DBAxion extends AbstractDBAdapter
 {
+    /**
+     * Serial version
+     */
+    private static final long serialVersionUID = -5982548040625874572L;
+
     /**
      * Constructor.
      */

Modified: db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBCloudscape.java
URL: http://svn.apache.org/viewvc/db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBCloudscape.java?rev=419657&r1=419656&r2=419657&view=diff
==============================================================================
--- db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBCloudscape.java (original)
+++ db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBCloudscape.java Thu Jul  6 11:55:49 2006
@@ -26,8 +26,13 @@
  * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
  * @version $Id$
  */
-public class DBCloudscape extends DB
+public class DBCloudscape extends AbstractDBAdapter
 {
+    /**
+     * Serial version
+     */
+    private static final long serialVersionUID = -7475830417640153351L;
+
     /** qualifier */
     private static final String QUALIFIER = ".";
 

Modified: db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBDB2400.java
URL: http://svn.apache.org/viewvc/db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBDB2400.java?rev=419657&r1=419656&r2=419657&view=diff
==============================================================================
--- db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBDB2400.java (original)
+++ db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBDB2400.java Thu Jul  6 11:55:49 2006
@@ -25,6 +25,11 @@
  */
 public class DBDB2400 extends DBDB2App
 {
+    /**
+     * Serial version
+     */
+    private static final long serialVersionUID = -6185644296549139007L;
+
    /**
     * UpperCase/IgnoreCase sql function in DB2/400
     */
@@ -73,16 +78,5 @@
     private String formatCase(String in)
     {
         return new StringBuffer(UCASE + "(").append(in).append(")").toString();
-    }
-
-    /**
-     * This method is used to check whether the database supports
-     * limiting the size of the resultset.
-     *
-     * @return LIMIT_STYLE_DB2.
-     */
-    public int getLimitStyle()
-    {
-        return DB.LIMIT_STYLE_DB2;
     }
 }

Modified: db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBDB2App.java
URL: http://svn.apache.org/viewvc/db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBDB2App.java?rev=419657&r1=419656&r2=419657&view=diff
==============================================================================
--- db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBDB2App.java (original)
+++ db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBDB2App.java Thu Jul  6 11:55:49 2006
@@ -19,6 +19,8 @@
 import java.sql.Connection;
 import java.sql.SQLException;
 
+import org.apache.torque.util.Query;
+
 /**
  * This is used to connect via the Application-Driver to DB2
  * databases.
@@ -29,9 +31,14 @@
  * @author <a href="mailto:vido@ldh.org">Augustin Vidovic</a>
  * @version $Id$
  */
-public class DBDB2App extends DB
+public class DBDB2App extends AbstractDBAdapter
 {
     /**
+     * Serial version
+     */
+    private static final long serialVersionUID = -3097347241360840675L;
+
+    /**
      * Empty constructor.
      */
     protected DBDB2App()
@@ -105,9 +112,77 @@
      * limiting the size of the resultset.
      *
      * @return LIMIT_STYLE_DB2.
+     * @deprecated This should not be exposed to the outside     
      */
     public int getLimitStyle()
     {
         return DB.LIMIT_STYLE_DB2;
+    }
+
+    /**
+     * Return true for DB2
+     * @see org.apache.torque.adapter.AbstractDBAdapter#supportsNativeLimit()
+     */
+    public boolean supportsNativeLimit()
+    {
+        return true;
+    }
+
+    /**
+     * Return true for DB2
+     * @see org.apache.torque.adapter.AbstractDBAdapter#supportsNativeOffset()
+     */
+    public boolean supportsNativeOffset()
+    {
+        return true;
+    }
+
+    /**
+     * Build DB2 (OLAP) -style query with limit or offset.
+     * If the original SQL is in variable: query then the requlting
+     * SQL looks like this:
+     * <pre>
+     * SELECT B.* FROM (
+     *          SELECT A.*, row_number() over() as TORQUE$ROWNUM FROM (
+     *                  query
+     *          ) A
+     *     ) B WHERE B.TORQUE$ROWNUM > offset AND B.TORQUE$ROWNUM
+     *     <= offset + limit
+     * </pre>
+     *
+     * @param query The query to modify
+     * @param offset the offset Value
+     * @param limit the limit Value
+     */
+    public void generateLimits(Query query, int offset, int limit)
+    {
+        StringBuffer preLimit = new StringBuffer()
+        .append("SELECT B.* FROM ( ")
+        .append("SELECT A.*, row_number() over() AS TORQUE$ROWNUM FROM ( ");
+
+        StringBuffer postLimit = new StringBuffer()
+                .append(" ) A ")
+                .append(" ) B WHERE ");
+        
+        if (offset > 0)
+        {
+            postLimit.append(" B.TORQUE$ROWNUM > ")
+                    .append(offset);
+        
+            if (limit >= 0)
+            {
+                postLimit.append(" AND B.TORQUE$ROWNUM <= ")
+                        .append(offset + limit);
+            }
+        }
+        else
+        {
+            postLimit.append(" B.TORQUE$ROWNUM <= ")
+                    .append(limit);
+        }
+        
+        query.setPreLimit(preLimit.toString());
+        query.setPostLimit(postLimit.toString());
+        query.setLimit(null);
     }
 }

Modified: db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBDB2Net.java
URL: http://svn.apache.org/viewvc/db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBDB2Net.java?rev=419657&r1=419656&r2=419657&view=diff
==============================================================================
--- db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBDB2Net.java (original)
+++ db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBDB2Net.java Thu Jul  6 11:55:49 2006
@@ -16,8 +16,6 @@
  * limitations under the License.
  */
 
-import java.sql.Connection;
-import java.sql.SQLException;
 
 /**
  * This is used to connect via the NET-Driver to DB2 databases.
@@ -31,86 +29,17 @@
  * @author <a href="mailto:vido@ldh.org">Augustin Vidovic</a>
  * @version $Id$
  */
-public class DBDB2Net
-    extends DB
+public class DBDB2Net extends DBDB2App
 {
     /**
-     * Empty constructor.
-     */
-    protected DBDB2Net()
-    {
-    }
-
-    /**
-     * This method is used to ignore case.
-     *
-     * @param in The string to transform to upper case.
-     * @return The upper case string.
+     * Serial version
      */
-    public String toUpperCase(String in)
-    {
-        String s = new StringBuffer("UPPER(").append(in).append(")").toString();
-        return s;
-    }
-
-    /**
-     * This method is used to ignore case.
-     *
-     * @param in The string whose case to ignore.
-     * @return The string in a case that can be ignored.
-     */
-    public String ignoreCase(String in)
-    {
-        String s = new StringBuffer("UPPER(").append(in).append(")").toString();
-        return s;
-    }
-
-    /**
-     * @see org.apache.torque.adapter.DB#getIDMethodType()
-     */
-    public String getIDMethodType()
-    {
-        return NO_ID_METHOD;
-    }
+    private static final long serialVersionUID = -4370111912358224176L;
 
     /**
-     * @see org.apache.torque.adapter.DB#getIDMethodSQL(Object obj)
-     */
-    public String getIDMethodSQL(Object obj)
-    {
-        return null;
-    }
-
-    /**
-     * Locks the specified table.
-     *
-     * @param con The JDBC connection to use.
-     * @param table The name of the table to lock.
-     * @exception SQLException No Statement could be created or executed.
-     */
-    public void lockTable(Connection con, String table) throws SQLException
-    {
-    }
-
-    /**
-     * Unlocks the specified table.
-     *
-     * @param con The JDBC connection to use.
-     * @param table The name of the table to unlock.
-     * @exception SQLException No Statement could be created or executed.
-     */
-    public void unlockTable(Connection con, String table) throws SQLException
-    {
-    }
-
-    /**
-     * This method is used to check whether the database supports
-     * limiting the size of the resultset.
-     *
-     * @return LIMIT_STYLE_DB2.
+     * Empty constructor.
      */
-    public int getLimitStyle()
+    protected DBDB2Net()
     {
-        return DB.LIMIT_STYLE_DB2;
     }
 }

Modified: db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBDerby.java
URL: http://svn.apache.org/viewvc/db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBDerby.java?rev=419657&r1=419656&r2=419657&view=diff
==============================================================================
--- db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBDerby.java (original)
+++ db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBDerby.java Thu Jul  6 11:55:49 2006
@@ -27,9 +27,13 @@
  * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
  * @version $Id$
  */
-public class DBDerby
-        extends DB
+public class DBDerby extends AbstractDBAdapter
 {
+    /**
+     * Serial version
+     */
+    private static final long serialVersionUID = 6265962681516206415L;
+
     /**
      * Empty constructor.
      */

Modified: db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBFirebird.java
URL: http://svn.apache.org/viewvc/db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBFirebird.java?rev=419657&r1=419656&r2=419657&view=diff
==============================================================================
--- db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBFirebird.java (original)
+++ db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBFirebird.java Thu Jul  6 11:55:49 2006
@@ -28,8 +28,12 @@
  * @author Joerg Friedrich
  * @version $Id: DBInterbase.java 239630 2005-08-24 12:25:32Z henning $
  */
-public class DBFirebird extends DB
+public class DBFirebird extends AbstractDBAdapter
 {
+    /**
+     * Serial version
+     */
+    private static final long serialVersionUID = -2782124791802056450L;
 
     private static final String DATE_FORMAT = "yyyy-MM-dd HH:MM:ss";
 

Modified: db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBHypersonicSQL.java
URL: http://svn.apache.org/viewvc/db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBHypersonicSQL.java?rev=419657&r1=419656&r2=419657&view=diff
==============================================================================
--- db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBHypersonicSQL.java (original)
+++ db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBHypersonicSQL.java Thu Jul  6 11:55:49 2006
@@ -27,9 +27,13 @@
  * @author <a href="mailto:celkins@scardini.com">Christopher Elkins</a>
  * @version $Id$
  */
-public class DBHypersonicSQL
-    extends DB
+public class DBHypersonicSQL extends AbstractDBAdapter
 {
+    /**
+     * Serial version
+     */
+    private static final long serialVersionUID = 8392727399615702372L;
+
     /**
      * Constructor.
      */

Modified: db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBInformix.java
URL: http://svn.apache.org/viewvc/db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBInformix.java?rev=419657&r1=419656&r2=419657&view=diff
==============================================================================
--- db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBInformix.java (original)
+++ db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBInformix.java Thu Jul  6 11:55:49 2006
@@ -27,8 +27,13 @@
  * @author <a href="mailto:bpm@ec-group.com">Brian P Millett</a>
  * @version $Id$
  */
-public class DBInformix extends DB
+public class DBInformix extends AbstractDBAdapter
 {
+    /**
+     * Serial version
+     */
+    private static final long serialVersionUID = 2599963509284952957L;
+
     /**
      * Empty constructor.
      */

Modified: db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBInstantDB.java
URL: http://svn.apache.org/viewvc/db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBInstantDB.java?rev=419657&r1=419656&r2=419657&view=diff
==============================================================================
--- db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBInstantDB.java (original)
+++ db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBInstantDB.java Thu Jul  6 11:55:49 2006
@@ -30,9 +30,13 @@
  * @author <a href="mailto:bmclaugh@algx.net">Brett McLaughlin</a>
  * @version $Id$
  */
-public class DBInstantDB
-    extends DB
+public class DBInstantDB extends AbstractDBAdapter
 {
+    /**
+     * Serial version
+     */
+    private static final long serialVersionUID = -3988631220284628238L;
+
     /**
      * Empty constructor.
      */

Modified: db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBInterbase.java
URL: http://svn.apache.org/viewvc/db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBInterbase.java?rev=419657&r1=419656&r2=419657&view=diff
==============================================================================
--- db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBInterbase.java (original)
+++ db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBInterbase.java Thu Jul  6 11:55:49 2006
@@ -28,8 +28,12 @@
  * @author <a href="mailto:frank@opticode.co.za">Frank Conradie</a>
  * @version $Id$
  */
-public class DBInterbase extends DB
+public class DBInterbase extends AbstractDBAdapter
 {
+    /**
+     * Serial version
+     */
+    private static final long serialVersionUID = -6709312389168248070L;
 
     private static final String DATE_FORMAT = "yyyy-MM-dd HH:MM:ss";
 

Modified: db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBMM.java
URL: http://svn.apache.org/viewvc/db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBMM.java?rev=419657&r1=419656&r2=419657&view=diff
==============================================================================
--- db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBMM.java (original)
+++ db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBMM.java Thu Jul  6 11:55:49 2006
@@ -22,6 +22,8 @@
 import java.util.Date;
 import java.text.SimpleDateFormat;
 
+import org.apache.torque.util.Query;
+
 /**
  * This is used in order to connect to a MySQL database using the MM
  * drivers.  Simply comment the above and uncomment this code below and
@@ -37,8 +39,12 @@
  * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
  * @version $Id$
  */
-public class DBMM extends DB
+public class DBMM extends AbstractDBAdapter
 {
+    /**
+     * Serial version
+     */
+    private static final long serialVersionUID = 7547291410802807010L;
 
     /** A specialized date format for MySQL. */
     private static final String DATE_FORMAT = "yyyyMMddHHmmss";
@@ -123,37 +129,65 @@
     }
 
     /**
-     * This method is used to chek whether the database natively
-     * supports limiting the size of the resultset.
+     * Generate a LIMIT offset, limit clause if offset &gt; 0
+     * or an LIMIT limit clause if limit is &gt; 0 and offset
+     * is 0.
+     *
+     * @param query The query to modify
+     * @param offset the offset Value
+     * @param limit the limit Value
+     */
+    public void generateLimits(Query query, int offset, int limit)
+    {
+        StringBuffer limitStringBuffer = new StringBuffer();
+
+        if (offset > 0)
+        {
+            limitStringBuffer.append(offset)
+                    .append(", ")
+                    .append(limit);
+        }
+        else
+        {
+            if (limit >= 0)
+            {
+                limitStringBuffer.append(limit);
+            }
+        }
+
+        query.setLimit(limitStringBuffer.toString());
+        query.setPreLimit(null);
+        query.setPostLimit(null);
+    }
+
+    /**
+     * This method is used to chek whether the database supports
+     * limiting the size of the resultset.
      *
-     * @return True.
+     * @return LIMIT_STYLE_MYSQL.
+     * @deprecated This should not be exposed to the outside     
      */
-    public boolean supportsNativeLimit()
+    public int getLimitStyle()
     {
-        return true;
+        return DB.LIMIT_STYLE_MYSQL;
     }
 
     /**
-     * This method is used to chek whether the database natively
-     * supports returning results starting at an offset position other
-     * than 0.
-     *
-     * @return True.
+     * Return true for MySQL
+     * @see org.apache.torque.adapter.AbstractDBAdapter#supportsNativeLimit()
      */
-    public boolean supportsNativeOffset()
+    public boolean supportsNativeLimit()
     {
         return true;
     }
 
     /**
-     * This method is used to chek whether the database supports
-     * limiting the size of the resultset.
-     *
-     * @return LIMIT_STYLE_MYSQL.
+     * Return true for MySQL
+     * @see org.apache.torque.adapter.AbstractDBAdapter#supportsNativeOffset()
      */
-    public int getLimitStyle()
+    public boolean supportsNativeOffset()
     {
-        return DB.LIMIT_STYLE_MYSQL;
+        return true;
     }
 
     /**

Modified: db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBMSSQL.java
URL: http://svn.apache.org/viewvc/db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBMSSQL.java?rev=419657&r1=419656&r2=419657&view=diff
==============================================================================
--- db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBMSSQL.java (original)
+++ db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBMSSQL.java Thu Jul  6 11:55:49 2006
@@ -30,20 +30,14 @@
 public class DBMSSQL extends DBSybase
 {
     /**
-     * Empty constructor.
+     * Serial version
      */
-    protected DBMSSQL()
-    {
-    }
+    private static final long serialVersionUID = -2924485528975497044L;
 
     /**
-     * This method is used to chek whether the database natively
-     * supports limiting the size of the resultset.
-     *
-     * @return True.
+     * Empty constructor.
      */
-    public boolean supportsNativeLimit()
+    protected DBMSSQL()
     {
-        return false;
     }
 }

Modified: db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBNone.java
URL: http://svn.apache.org/viewvc/db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBNone.java?rev=419657&r1=419656&r2=419657&view=diff
==============================================================================
--- db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBNone.java (original)
+++ db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBNone.java Thu Jul  6 11:55:49 2006
@@ -27,8 +27,12 @@
  * @author <a href="mailto:bmclaugh@algx.net">Brett McLaughlin</a>
  * @version $Id$
  */
-public class DBNone extends DB
+public class DBNone extends AbstractDBAdapter
 {
+    /**
+     * Serial version
+     */
+    private static final long serialVersionUID = -285009315025818009L;
 
     /**
      * Empty protected constructor.

Modified: db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBOdbc.java
URL: http://svn.apache.org/viewvc/db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBOdbc.java?rev=419657&r1=419656&r2=419657&view=diff
==============================================================================
--- db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBOdbc.java (original)
+++ db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBOdbc.java Thu Jul  6 11:55:49 2006
@@ -26,9 +26,13 @@
  * @author <a href="mailto:criley@ekmail.com">Cameron Riley</a>
  * @version $Id$
  */
-public class DBOdbc
-    extends DB
+public class DBOdbc extends AbstractDBAdapter
 {
+    /**
+     * Serial version
+     */
+    private static final long serialVersionUID = -4852934297887694803L;
+
     /**
      * Empty constructor.
      */

Modified: db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBOracle.java
URL: http://svn.apache.org/viewvc/db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBOracle.java?rev=419657&r1=419656&r2=419657&view=diff
==============================================================================
--- db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBOracle.java (original)
+++ db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBOracle.java Thu Jul  6 11:55:49 2006
@@ -22,6 +22,8 @@
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
+import org.apache.torque.util.Query;
+
 /**
  * This code should be used for an Oracle database pool.
  *
@@ -31,8 +33,13 @@
  * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
  * @version $Id$
  */
-public class DBOracle extends DB
+public class DBOracle extends AbstractDBAdapter
 {
+    /**
+     * Serial version
+     */
+    private static final long serialVersionUID = 8966976210230241194L;
+
     /** date format used in getDateString() */
     private static final String DATE_FORMAT = "dd-MM-yyyy HH:mm:ss";
 
@@ -137,10 +144,20 @@
     }
 
     /**
-     * This method is used to check whether the database natively
-     * supports limiting the size of the resultset.
+     * This method is used to check whether the database supports
+     * limiting the size of the resultset.
      *
-     * @return True.
+     * @return LIMIT_STYLE_ORACLE.
+     * @deprecated This should not be exposed to the outside     
+     */
+    public int getLimitStyle()
+    {
+        return DB.LIMIT_STYLE_ORACLE;
+    }
+
+    /**
+     * Return true for Oracle
+     * @see org.apache.torque.adapter.AbstractDBAdapter#supportsNativeLimit()
      */
     public boolean supportsNativeLimit()
     {
@@ -148,14 +165,61 @@
     }
 
     /**
-     * This method is used to check whether the database supports
-     * limiting the size of the resultset.
-     *
-     * @return LIMIT_STYLE_ORACLE.
+     * Return true for Oracle
+     * @see org.apache.torque.adapter.AbstractDBAdapter#supportsNativeOffset()
      */
-    public int getLimitStyle()
+    public boolean supportsNativeOffset()
     {
-        return DB.LIMIT_STYLE_ORACLE;
+        return true;
+    }
+
+    /**
+     * Build Oracle-style query with limit or offset.
+     * If the original SQL is in variable: query then the requlting
+     * SQL looks like this:
+     * <pre>
+     * SELECT B.* FROM (
+     *          SELECT A.*, rownum as TORQUE$ROWNUM FROM (
+     *                  query
+     *          ) A
+     *     ) B WHERE B.TORQUE$ROWNUM > offset AND B.TORQUE$ROWNUM
+     *     <= offset + limit
+     * </pre>
+     *
+     * @param query The query to modify
+     * @param offset the offset Value
+     * @param limit the limit Value
+     */
+    public void generateLimits(Query query, int offset, int limit)
+    {
+        StringBuffer preLimit = new StringBuffer()
+        .append("SELECT B.* FROM ( ")
+        .append("SELECT A.*, rownum AS TORQUE$ROWNUM FROM ( ");
+
+        StringBuffer postLimit = new StringBuffer()
+                .append(" ) A ")
+                .append(" ) B WHERE ");
+        
+        if (offset > 0)
+        {
+            postLimit.append(" B.TORQUE$ROWNUM > ")
+                    .append(offset);
+        
+            if (limit >= 0)
+            {
+                postLimit.append(" AND B.TORQUE$ROWNUM <= ")
+                        .append(offset + limit);
+            }
+        }
+        else
+        {
+            postLimit.append(" B.TORQUE$ROWNUM <= ")
+                    .append(limit);
+        }
+        
+        query.setPreLimit(preLimit.toString());
+        query.setPostLimit(postLimit.toString());
+        query.setLimit(null);
     }
 
     /**

Modified: db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBPostgres.java
URL: http://svn.apache.org/viewvc/db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBPostgres.java?rev=419657&r1=419656&r2=419657&view=diff
==============================================================================
--- db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBPostgres.java (original)
+++ db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBPostgres.java Thu Jul  6 11:55:49 2006
@@ -21,6 +21,8 @@
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
+import org.apache.torque.util.Query;
+
 /**
  * This is used to connect to PostgresQL databases.
  *
@@ -30,8 +32,12 @@
  * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
  * @version $Id$
  */
-public class DBPostgres extends DB
+public class DBPostgres extends AbstractDBAdapter
 {
+    /**
+     * Serial version
+     */
+    private static final long serialVersionUID = 7643304924262475272L;
 
     /** A specialized date format for PostgreSQL. */
     private static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
@@ -112,10 +118,20 @@
     }
 
     /**
-     * This method is used to chek whether the database natively
-     * supports limiting the size of the resultset.
+     * This method is used to chek whether the database supports
+     * limiting the size of the resultset.
      *
-     * @return True.
+     * @return LIMIT_STYLE_POSTGRES.
+     * @deprecated This should not be exposed to the outside     
+     */
+    public int getLimitStyle()
+    {
+        return DB.LIMIT_STYLE_POSTGRES;
+    }
+
+    /**
+     * Return true for PostgreSQL
+     * @see org.apache.torque.adapter.AbstractDBAdapter#supportsNativeLimit()
      */
     public boolean supportsNativeLimit()
     {
@@ -123,11 +139,8 @@
     }
 
     /**
-     * This method is used to chek whether the database natively
-     * supports returning results starting at an offset position other
-     * than 0.
-     *
-     * @return True.
+     * Return true for PostgreSQL
+     * @see org.apache.torque.adapter.AbstractDBAdapter#supportsNativeOffset()
      */
     public boolean supportsNativeOffset()
     {
@@ -135,14 +148,35 @@
     }
 
     /**
-     * This method is used to chek whether the database supports
-     * limiting the size of the resultset.
-     *
-     * @return LIMIT_STYLE_POSTGRES.
-     */
-    public int getLimitStyle()
-    {
-        return DB.LIMIT_STYLE_POSTGRES;
+     * Generate a LIMIT limit OFFSET offset clause if offset &gt; 0
+     * or an LIMIT limit clause if limit is &gt; 0 and offset
+     * is 0.
+     *
+     * @param query The query to modify
+     * @param offset the offset Value
+     * @param limit the limit Value
+     */
+    public void generateLimits(Query query, int offset, int limit)
+    {
+        StringBuffer limitStringBuffer = new StringBuffer();
+
+        if (offset > 0)
+        {
+            limitStringBuffer.append(limit)
+                    .append(" offset ")
+                    .append(offset);
+        }
+        else
+        {
+            if (limit >= 0)
+            {
+                limitStringBuffer.append(limit);
+            }
+        }
+
+        query.setLimit(limitStringBuffer.toString());
+        query.setPreLimit(null);
+        query.setPostLimit(null);
     }
 
     /**

Modified: db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBSapDB.java
URL: http://svn.apache.org/viewvc/db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBSapDB.java?rev=419657&r1=419656&r2=419657&view=diff
==============================================================================
--- db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBSapDB.java (original)
+++ db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBSapDB.java Thu Jul  6 11:55:49 2006
@@ -28,8 +28,13 @@
  * @author <a href="mailto:dave.polito@planetcad.com">Dave Polito</a>
  * @version $Id$
  */
-public class DBSapDB extends DB
+public class DBSapDB extends AbstractDBAdapter
 {
+    /**
+     * Serial version
+     */
+    private static final long serialVersionUID = 8277068258155186370L;
+
     /**
      * Empty constructor.
      */

Modified: db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBSybase.java
URL: http://svn.apache.org/viewvc/db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBSybase.java?rev=419657&r1=419656&r2=419657&view=diff
==============================================================================
--- db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBSybase.java (original)
+++ db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBSybase.java Thu Jul  6 11:55:49 2006
@@ -22,6 +22,8 @@
 import java.util.Date;
 import java.text.SimpleDateFormat;
 
+import org.apache.torque.util.Query;
+
 /**
  * This is used to connect to a Sybase database using Sybase's
  * JConnect JDBC driver.
@@ -33,8 +35,13 @@
  * @author <a href="mailto:ekkerbj@netscape.net">Jeff Brekke</a>
  * @version $Id$
  */
-public class DBSybase extends DB
+public class DBSybase extends AbstractDBAdapter
 {
+    /**
+     * Serial version
+     */
+    private static final long serialVersionUID = 4782996646843056810L;
+
     /** date format */
     private static final String DATE_FORMAT = "yyyyMMdd HH:mm:ss";
 
@@ -121,10 +128,20 @@
     }
 
     /**
-     * This method is used to chek whether the database natively
-     * supports limiting the size of the resultset.
+     * This method is used to chek whether the database supports
+     * limiting the size of the resultset.
      *
-     * @return True.
+     * @return LIMIT_STYLE_SYBASE.
+     * @deprecated This should not be exposed to the outside     
+     */
+    public int getLimitStyle()
+    {
+        return DB.LIMIT_STYLE_SYBASE;
+    }
+
+    /**
+     * Return true for Sybase
+     * @see org.apache.torque.adapter.AbstractDBAdapter#supportsNativeLimit()
      */
     public boolean supportsNativeLimit()
     {
@@ -132,14 +149,15 @@
     }
 
     /**
-     * This method is used to chek whether the database supports
-     * limiting the size of the resultset.
+     * Modify a query to add limit and offset values for Sybase.
      *
-     * @return LIMIT_STYLE_SYBASE.
+     * @param query The query to modify
+     * @param offset the offset Value
+     * @param limit the limit Value
      */
-    public int getLimitStyle()
+    public void generateLimits(Query query, int offset, int limit)
     {
-        return DB.LIMIT_STYLE_SYBASE;
+        query.setRowcount(String.valueOf(limit+offset));
     }
 
     /**

Modified: db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBWeblogic.java
URL: http://svn.apache.org/viewvc/db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBWeblogic.java?rev=419657&r1=419656&r2=419657&view=diff
==============================================================================
--- db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBWeblogic.java (original)
+++ db/torque/runtime/trunk/src/java/org/apache/torque/adapter/DBWeblogic.java Thu Jul  6 11:55:49 2006
@@ -26,8 +26,13 @@
  * @author <a href="mailto:bmclaugh@algx.net">Brett McLaughlin</a>
  * @version $Id$
  */
-public class DBWeblogic extends DB
+public class DBWeblogic extends AbstractDBAdapter
 {
+    /**
+     * Serial version
+     */
+    private static final long serialVersionUID = 6645853000903579587L;
+
     /**
      * Empty constructor.
      */



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message