001: /**
002: * Objective Database Abstraction Layer (ODAL)
003: * Copyright (c) 2004, The ODAL Development Group
004: * All rights reserved.
005: * For definition of the ODAL Development Group please refer to LICENCE.txt file
006: *
007: * Distributable under LGPL license.
008: * See terms of license at gnu.org.
009: */package com.completex.objective.components.persistency.core;
010:
011: import com.completex.objective.components.persistency.AbstractParameters;
012: import com.completex.objective.components.persistency.LifeCycleController;
013: import com.completex.objective.components.persistency.ResultableQueryManager;
014: import com.completex.objective.components.persistency.core.impl.DatabaseTransactionImpl;
015: import com.completex.objective.components.persistency.core.impl.query.QueryContextImpl;
016: import com.completex.objective.components.persistency.core.impl.query.QueryContext;
017: import com.completex.objective.components.persistency.transact.Transaction;
018: import com.completex.objective.components.persistency.type.MultipartCollection;
019:
020: import java.sql.PreparedStatement;
021: import java.sql.SQLException;
022: import java.util.Collection;
023:
024: /**
025: * @author Gennady Krizhevsky
026: */
027: public interface ResultSetExecutor {
028:
029: /**
030: * Enables to run paginated queries. It can be run repeatedly bringing new pages.
031: * The last collection returned will be of 0 length.
032: *
033: * @param transaction
034: * @param query
035: * @param resultSetCtl
036: * @param controller
037: * @param queryContext
038: * @return Collection Page of results which is never null
039: * @throws SQLException
040: */
041: Collection executeFetch(DatabaseTransactionImpl transaction,
042: ResultableQueryManager query, ResultSetCtl resultSetCtl,
043: LifeCycleController controller, QueryContext queryContext)
044: throws SQLException;
045:
046: /**
047: * Retrieves only the 1st result set if there are multiple ones
048: *
049: * @param transaction
050: * @param statement
051: * @param query
052: * @param resultSetCtl
053: * @param results
054: * @param controller
055: * @throws SQLException
056: */
057: void executeSingleRs(Transaction transaction,
058: PreparedStatement statement, ResultableQueryManager query,
059: ResultSetCtl resultSetCtl, MultipartCollection results,
060: LifeCycleController controller, QueryContext queryContext)
061: throws SQLException;
062:
063: /**
064: * Retrieves all the result sets if there are multiple ones
065: *
066: * @param transaction
067: * @param statement
068: * @param query
069: * @param resultSetCtl
070: * @param results
071: * @param controller
072: * @throws SQLException
073: */
074: void executeMultiRs(Transaction transaction,
075: PreparedStatement statement, ResultableQueryManager query,
076: ResultSetCtl resultSetCtl, MultipartCollection results,
077: LifeCycleController controller, QueryContext queryContext)
078: throws SQLException;
079:
080: /**
081: * Dispatcher method that will redirect either to executeSingleRs or to executeMultiRs
082: * depending on firstOnly parameter
083: *
084: * @param transaction
085: * @param statement
086: * @param query
087: * @param resultSetCtl
088: * @param results
089: * @param controller
090: * @param firstOnly
091: * @throws SQLException
092: */
093: void execute(Transaction transaction, PreparedStatement statement,
094: ResultableQueryManager query, ResultSetCtl resultSetCtl,
095: MultipartCollection results,
096: LifeCycleController controller, boolean firstOnly,
097: QueryContext queryContext) throws SQLException;
098:
099: /**
100: * Creates an instance of ResultSetIterator out of statement
101: *
102: * @param statement
103: * @param parameters
104: * @return ResultSetIterator
105: * @throws SQLException
106: */
107: ResultSetIterator resultSetIterator(PreparedStatement statement,
108: AbstractParameters parameters) throws SQLException;
109: }
|