db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/platforms PlatformPostgreSQLImpl.java PlatformSapdbImpl.java
Date Sun, 16 Nov 2003 18:22:39 GMT
brj         2003/11/16 10:22:39

  Modified:    src/java/org/apache/ojb/broker/platforms
                        PlatformPostgreSQLImpl.java PlatformSapdbImpl.java
  Log:
  added support for LIMIT
  
  Revision  Changes    Path
  1.7       +30 -1     db-ojb/src/java/org/apache/ojb/broker/platforms/PlatformPostgreSQLImpl.java
  
  Index: PlatformPostgreSQLImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/platforms/PlatformPostgreSQLImpl.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- PlatformPostgreSQLImpl.java	15 Jan 2003 11:23:01 -0000	1.6
  +++ PlatformPostgreSQLImpl.java	16 Nov 2003 18:22:39 -0000	1.7
  @@ -94,4 +94,33 @@
       {
           return "drop sequence " + sequenceName;
       }
  +    
  +    /* (non-Javadoc)
  +     * @see org.apache.ojb.broker.platforms.Platform#addPagingSql(java.lang.StringBuffer)
  +     */
  +    public void addPagingSql(StringBuffer anSqlString)
  +    {
  +        anSqlString.append(" LIMIT ? OFFSET ?");
  +    }
  +    
  +    /* (non-Javadoc)
  +     * @see org.apache.ojb.broker.platforms.Platform#supportsPaging()
  +     */
  +    public boolean supportsPaging()
  +    {
  +        return true;
  +    }
  +
  +    /* (non-Javadoc)
  +     * @see org.apache.ojb.broker.platforms.Platform#bindPagingParameters(java.sql.PreparedStatement,
int, int, int)
  +     */
  +    public int bindPagingParameters(PreparedStatement ps, int index, int startAt, int endAt)
throws SQLException
  +    {
  +        ps.setInt(index, endAt - (startAt - 1));    // number of rows to fetch
  +        index++;
  +        ps.setInt(index, startAt - 1);              // zero based start
  +        index++;
  +        return index;
  +    }
  +    
   }
  
  
  
  1.8       +28 -1     db-ojb/src/java/org/apache/ojb/broker/platforms/PlatformSapdbImpl.java
  
  Index: PlatformSapdbImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/platforms/PlatformSapdbImpl.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- PlatformSapdbImpl.java	9 Jan 2003 17:01:34 -0000	1.7
  +++ PlatformSapdbImpl.java	16 Nov 2003 18:22:39 -0000	1.8
  @@ -116,4 +116,31 @@
       {
           return "drop sequence " + sequenceName;
       }
  +    
  +    /* (non-Javadoc)
  +     * @see org.apache.ojb.broker.platforms.Platform#addPagingSql(java.lang.StringBuffer)
  +     */
  +    public void addPagingSql(StringBuffer anSqlString)
  +    {
  +        anSqlString.append(" ROWNO <= ? ");
  +    }
  +
  +    /* (non-Javadoc)
  +     * @see org.apache.ojb.broker.platforms.Platform#bindPagingParameters(java.sql.PreparedStatement,
int, int, int)
  +     */
  +    public int bindPagingParameters(PreparedStatement ps, int index, int startAt, int endAt)
throws SQLException
  +    {
  +        
  +        ps.setInt(index, endAt - 1);    // IGNORE startAt !!
  +        index++;
  +        return index;
  +    }    
  +    
  +    /* (non-Javadoc)
  +     * @see org.apache.ojb.broker.platforms.Platform#supportsPaging()
  +     */
  +    public boolean supportsPaging()
  +    {
  +        return true;
  +    }    
   }
  
  
  

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


Mime
View raw message