01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: com_mckoi_JDBCDriver.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.database.capabilities;
09:
10: import com.uwyn.rife.database.DbConnection;
11: import com.uwyn.rife.database.DbPreparedStatement;
12: import com.uwyn.rife.database.DbResultSet;
13: import com.uwyn.rife.database.DbResultSetHandler;
14: import com.uwyn.rife.database.exceptions.DatabaseException;
15: import com.uwyn.rife.database.queries.Query;
16:
17: public class com_mckoi_JDBCDriver extends
18: AbstractCapabilitiesCompensator {
19: private LimitOffsetCompensator mLimitOffsetCompensator = null;
20:
21: public com_mckoi_JDBCDriver() {
22: mLimitOffsetCompensator = new LimitOffsetCompensator();
23: mLimitOffsetCompensator.setUseRelativeForScrolling(true);
24: }
25:
26: public DbPreparedStatement getCapablePreparedStatement(Query query,
27: DbResultSetHandler handler, DbConnection connection)
28: throws DatabaseException {
29: query.setExcludeUnsupportedCapabilities(true);
30:
31: // either create a new prepared statement or get it from the handler
32: DbPreparedStatement statement = null;
33: if (null == handler) {
34: statement = connection.getPreparedStatement(query);
35: } else {
36: statement = handler.getPreparedStatement(query, connection);
37: }
38:
39: mLimitOffsetCompensator
40: .handleCapablePreparedStatement(statement);
41:
42: return statement;
43: }
44:
45: public DbResultSet getCapableResultSet(DbPreparedStatement statement)
46: throws DatabaseException {
47: mLimitOffsetCompensator.handleCapableResultSet(statement);
48:
49: return statement.getResultSet();
50: }
51: }
|