com.simba.dsi.dataengine.interfaces
Interface IDataEngine

All Known Implementing Classes:
DSIDataEngine, SqlDataEngine

public interface IDataEngine

IDataEngine provides the gateway into query execution and data processing. An IDataEngine is provided by an IStatement and may be used to produce an IQueryExecutor used to execute a SQL query, or an IResultSet holding metadata information.


Method Summary
 void close()
          Closes the IDataEngine and releases any resources held by it.
 IResultSet makeNewMetadataResult(MetadataSourceID metadataSourceId, java.util.ArrayList<java.lang.String> filterValues, java.lang.String escapeChar, java.lang.String identifierQuoteChar, boolean filterAsIdentifier)
          Produces an IResultSet filled with metadata.
 IResultSet makeNewMetadataResult(MetadataSourceID metadataSourceId, java.util.ArrayList<java.lang.String> filterValues, java.lang.String escapeChar, java.lang.String identifierQuoteChar, boolean filterAsIdentifier, OrderType orderType)
          Produces an IResultSet filled with metadata.
 IQueryExecutor prepare(java.lang.String query)
          Produces an IQueryExecutor which can be used to execute the given query.
 IQueryExecutor prepareBatch(java.util.List<java.lang.String> queries)
          Produces an IQueryExecutor which can be used to execute the given batch of queries.
 void setDirectExecute()
          Indicate that any queries prepared by this data engine will be executed immediately, and only once.
 void setMetadataNeeded(boolean isNeeded)
          Indicate whether this data engine will need to create an IQueryExecutor that can return metadata before the execute call.
 

Method Detail

close

void close()
Closes the IDataEngine and releases any resources held by it.


makeNewMetadataResult

IResultSet makeNewMetadataResult(MetadataSourceID metadataSourceId,
                                 java.util.ArrayList<java.lang.String> filterValues,
                                 java.lang.String escapeChar,
                                 java.lang.String identifierQuoteChar,
                                 boolean filterAsIdentifier,
                                 OrderType orderType)
                                 throws com.simba.support.exceptions.ErrorException
Produces an IResultSet filled with metadata. The result set's columns are determined by the metadata result indicator. The rest of the arguments specify how filtering is to be done for the results provided by the IResultSet.

There is no IQueryExecutor produced for metadata results, just an IResultSet. Internally, the client may convert the metadata request into a SQL query and use an IQueryExecutor to execute, but externally all that's provided is the results.

The IResultSet returned by this call must be non-null. Even if there are no rows, column metadata is still needed.

Parameters:
metadataSourceId - Identifies the type of metadata information to be produced.
filterValues - An ArrayList of String values used to filter the columns of the result set. These filters are passed in by the application that calls the catalog function and cannot be modified. For example, the catalog function "SQLTables" contains the arguments "CatalogName", "SchemaName", "TableName", and "TableType". These arguments are extracted to the filterValues String. While these values cannot be modified, if the CatalogName is NULL, the current catalog name is used.
escapeChar - Escape character used in filtering.
identifierQuoteChar - Character used as a quote around identifiers.
filterAsIdentifier - Indicates if string filters are treated as identifiers.
orderType - The order to use : JDBC 3.0, JDBC 4.0 or not order.
Returns:
IMetadataSource holding the requested metadata results.
Throws:
com.simba.support.exceptions.ErrorException - If an error occurs

makeNewMetadataResult

IResultSet makeNewMetadataResult(MetadataSourceID metadataSourceId,
                                 java.util.ArrayList<java.lang.String> filterValues,
                                 java.lang.String escapeChar,
                                 java.lang.String identifierQuoteChar,
                                 boolean filterAsIdentifier)
                                 throws com.simba.support.exceptions.ErrorException
Produces an IResultSet filled with metadata. The result set's columns are determined by the metadata result indicator. The rest of the arguments specify how filtering is to be done for the results provided by the IResultSet.

There is no IQueryExecutor produced for metadata results, just an IResultSet. Internally, the client may convert the metadata request into a SQL query and use an IQueryExecutor to execute, but externally all that's provided is the results.

The IResultSet returned by this call must be non-null. Even if there are no rows, column metadata is still needed.

Parameters:
metadataSourceId - Identifies the type of metadata information to be produced.
filterValues - An ArrayList of String values used to filter the columns of the result set.
escapeChar - Escape character used in filtering.
identifierQuoteChar - Character used as a quote around identifiers.
filterAsIdentifier - Indicates if string filters are treated as identifiers.
Returns:
IMetadataSource holding the requested metadata results.
Throws:
com.simba.support.exceptions.ErrorException - If an error occurs

prepare

IQueryExecutor prepare(java.lang.String query)
                       throws ParsingException,
                              com.simba.support.exceptions.ErrorException
Produces an IQueryExecutor which can be used to execute the given query. The query string is guaranteed to have already been converted into "native SQL" using IConnection.toNativeSQL().

The resultant IQueryExecutor should expose IResult*s for each anticipated result set, including column metadata describing the results if possible.

Parameters:
query - SQL query, in "native SQL" form.
Returns:
IQueryExecutor which can be used for executing query.
Throws:
ParsingException - If an error occurs in parsing the query.
com.simba.support.exceptions.ErrorException - If any other error occurs.

prepareBatch

IQueryExecutor prepareBatch(java.util.List<java.lang.String> queries)
                            throws ParsingException,
                                   com.simba.support.exceptions.ErrorException
Produces an IQueryExecutor which can be used to execute the given batch of queries. The query strings are guaranteed to have already been converted into "native SQL" using IConnection.toNativeSQL().

The batch of queries must be queries that return row count results. Queries that return result sets are not allowed to be included in a batch because Statement.executeBatch() can only return an array of row counts and not result sets.

If errors are encountered during batch processing, the IQueryExecutor should create and add IErrorResult objects to the IQueryExecutor's list of results so that they can be used to properly report errors after batch processing.

Parameters:
queries - SQL queries, in "native SQL" form.
Returns:
IQueryExecutor which can be used for executing the batch of queries.
Throws:
ParsingException - If an error occurs in parsing the queries.
com.simba.support.exceptions.ErrorException - If any other error occurs.

setDirectExecute

void setDirectExecute()
Indicate that any queries prepared by this data engine will be executed immediately, and only once.

If this function is not called, then the prepared query may be executed multiple times.

If not needed, this hint can be safely ignored.


setMetadataNeeded

void setMetadataNeeded(boolean isNeeded)
Indicate whether this data engine will need to create an IQueryExecutor that can return metadata before the execute call.

If this method is not called or called with a true value, the data engine must create an IQueryExecutor that can return metadata at any time after the prepare call. If this method is called with a false value, the data engine can create an IQueryExecutor that only needs to return metadata after the execute call.

If not needed, this hint can be safely ignored.

Parameters:
isNeeded - Indicates whether this data engine will need to create an IQueryExecutor that can return metadata before the execute call.


Copyright © 2006-2014 Simba Technologies Incorporated. All Rights Reserved.