org.teiid.translator.jdbc
Class JDBCExecutionFactory

java.lang.Object
  extended by org.teiid.translator.ExecutionFactory<javax.sql.DataSource,java.sql.Connection>
      extended by org.teiid.translator.jdbc.JDBCExecutionFactory
Direct Known Subclasses:
DB2ExecutionFactory, H2ExecutionFactory, HsqlExecutionFactory, InformixExecutionFactory, MetaMatrixExecutionFactory, ModeShapeExecutionFactory, MySQLExecutionFactory, OracleExecutionFactory, PostgreSQLExecutionFactory, SimpleJDBCExecutionFactory, SybaseExecutionFactory, TeiidExecutionFactory, TeradataExecutionFactory

@Translator(name="jdbc-ansi")
public class JDBCExecutionFactory
extends ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

JDBC implementation of Connector interface.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.teiid.translator.ExecutionFactory
ExecutionFactory.NullOrder, ExecutionFactory.SupportedJoinCriteria
 
Field Summary
static int DEFAULT_MAX_IN_CRITERIA
           
static java.util.TimeZone DEFAULT_TIME_ZONE
           
 
Fields inherited from class org.teiid.translator.ExecutionFactory
DEFAULT_MAX_FROM_GROUPS, DEFAULT_MAX_IN_CRITERIA_SIZE
 
Constructor Summary
JDBCExecutionFactory()
           
 
Method Summary
 boolean addSourceComment()
          Returns true to indicate that SQL should include a comment indicating the session and request ids.
protected  void afterInitialConnectionObtained(java.sql.Connection connection)
          Called exactly once for this source.
 void bindValue(java.sql.PreparedStatement stmt, java.lang.Object param, java.lang.Class<?> paramType, int i)
          Sets prepared statement parameter i with param.
 void closeConnection(java.sql.Connection connection, javax.sql.DataSource factory)
          Closes a connection object from the given connection factory.
 ProcedureExecution createProcedureExecution(Call command, ExecutionContext executionContext, RuntimeMetadata metadata, java.sql.Connection conn)
           
 ResultSetExecution createResultSetExecution(QueryExpression command, ExecutionContext executionContext, RuntimeMetadata metadata, java.sql.Connection conn)
           
 UpdateExecution createUpdateExecution(Command command, ExecutionContext executionContext, RuntimeMetadata metadata, java.sql.Connection conn)
           
 java.sql.ResultSet executeStoredProcedure(java.sql.CallableStatement statement, TranslatedCommand command, java.lang.Class<?> returnType)
          This is a generic implementation.
 java.lang.String formatDateValue(java.util.Date dateObject)
          Format the dateObject (of type date, time, or timestamp) into a string using the DatabaseTimeZone format.
 java.sql.Connection getConnection(javax.sql.DataSource ds)
          Return a connection object from the given connection factory.
 java.util.Calendar getDatabaseCalendar()
          Gets the database calendar.
 java.lang.String getDatabaseTimeZone()
           
 java.lang.String getDatabaseVersion()
           
 ExecutionFactory.NullOrder getDefaultNullOrder()
          Returns the default null ordering
 java.util.List<java.lang.String> getDefaultSupportedFunctions()
           
 java.util.Map<java.lang.String,FunctionModifier> getFunctionModifiers()
          Return a map of function name in lower case to FunctionModifier.
 int getMaxInCriteriaSize()
          Get the integer value representing the number of values allowed in an IN criteria in the WHERE clause of a query
 int getMaxPreparedInsertBatchSize()
          Get the max number of inserts to perform in one batch.
 void getMetadata(MetadataFactory metadataFactory, java.sql.Connection conn)
          Implement to provide metadata to the metadata for use by the engine.
 java.lang.String getSetOperationString(SetQuery.Operation operation)
          Returns the name for a given SetQuery.Operation
 java.lang.String getSourceComment(ExecutionContext context, Command command)
          Returns the source comment for the given command
 SQLConversionVisitor getSQLConversionVisitor()
          Create the SQLConversionVisitor that will perform translation.
 java.util.List<java.lang.String> getSupportedFunctions()
          Get list of all supported function names.
 int getTimestampNanoPrecision()
          Return the precision of timestamp literals.
 boolean hasTimeType()
          Return false to indicate that time support should be emulated with timestamps.
 boolean isSourceRequired()
          Flag that indicates if a underlying source connection required for this execution factory to work
 boolean isTrimStrings()
           
 void obtainedConnection(java.sql.Connection connection)
          Provides a hook to call source specific logic when a connection is obtained.
 void registerFunctionModifier(java.lang.String name, FunctionModifier modifier)
          Add the FunctionModifier to the set of known modifiers.
protected  void registerSpecificTypeOfOutParameter(java.sql.CallableStatement statement, java.lang.Class<?> runtimeType, int index)
          For registering specific output parameter types we need to translate these into the appropriate java.sql.Types output parameters We will need to match these up with the appropriate standard sql types
 java.lang.String replaceElementName(java.lang.String group, java.lang.String element)
          Override to return a name other than the default [group.]element
 java.lang.Object retrieveValue(java.sql.CallableStatement results, int parameterIndex, java.lang.Class<?> expectedType)
          Retrieve the value for the given parameter index
 java.lang.Object retrieveValue(java.sql.ResultSet results, int columnIndex, java.lang.Class<?> expectedType)
          Retrieve the value on the current resultset row for the given column index.
 void setDatabaseTimeZone(java.lang.String databaseTimeZone)
           
 void setDatabaseVersion(java.lang.String version)
           
 void setMaxPreparedInsertBatchSize(int maxInsertBatchSize)
           
 void setTrimStrings(boolean trimStrings)
           
 void setUseBindVariables(boolean useBindVariables)
           
 void setUseCommentsInSourceQuery(boolean useCommentsInSourceQuery)
           
 void start()
          Initialize the connector with supplied configuration
 boolean supportsAggregatesAvg()
          Support indicates connector can accept the AVG aggregate function
 boolean supportsAggregatesCount()
          Support indicates connector can accept the COUNT aggregate function
 boolean supportsAggregatesCountStar()
          Support indicates connector can accept the COUNT(*) aggregate function
 boolean supportsAggregatesDistinct()
          Support indicates connector can accept DISTINCT within aggregate functions
 boolean supportsAggregatesMax()
          Support indicates connector can accept the MAX aggregate function
 boolean supportsAggregatesMin()
          Support indicates connector can accept the MIN aggregate function
 boolean supportsAggregatesSum()
          Support indicates connector can accept the SUM aggregate function
 boolean supportsAliasedTable()
          Support indicates connector can accept groups with aliases
 boolean supportsBatchedUpdates()
          Whether the source supports BatchedUpdates
 boolean supportsBetweenCriteria()
          Support indicates connector accepts criteria of form (element BETWEEN constant AND constant)
NOT CURRENTLY USED - between is rewritten as compound compare criteria
 boolean supportsBulkUpdate()
          Whether the source supports updates with multiple value sets
 boolean supportsCaseExpressions()
          Support indicates connector can accept queries with non-searched CASE WHEN ...
 boolean supportsCompareCriteriaEquals()
          Support indicates connector accepts criteria of form (element = constant)
 boolean supportsCompareCriteriaOrdered()
          Support indicates connector accepts criteria of form (element <=|>= constant)
The query engine will may pushdown queries containing < or > if NOT is also supported.
 boolean supportsCorrelatedSubqueries()
          Support indicates connector can accept correlated subqueries wherever subqueries are accepted
 boolean supportsExistsCriteria()
          Support indicates connector accepts the EXISTS criteria
 boolean supportsGroupBy()
          Whether the source supports an explicit GROUP BY clause
 boolean supportsHaving()
          Whether the source supports the HAVING clause
 boolean supportsInCriteria()
          Support indicates connector accepts criteria of form (element IN set)
 boolean supportsInCriteriaSubquery()
          Support indicates connector accepts IN criteria with a subquery on the right side
 boolean supportsInlineViews()
          Support indicates connector can accept inline views (subqueries in the FROM clause).
 boolean supportsInsertWithIterator()
          Support indicates that the connector can accept INSERTs with values specified by an Iterator
 boolean supportsInsertWithQueryExpression()
          Support indicates that the connector can accept INSERTs with values specified by a SetQuery or Select
 boolean supportsIsNullCriteria()
          Support indicates connector accepts criteria of form (element IS NULL)
 boolean supportsLikeCriteria()
          Support indicates connector accepts criteria of form (element LIKE constant)
 boolean supportsLikeCriteriaEscapeCharacter()
          Support indicates connector accepts criteria of form (element LIKE constant ESCAPE char)
 boolean supportsNotCriteria()
          Support indicates connector accepts logical criteria NOT
 boolean supportsOrCriteria()
          Support indicates connector accepts logical criteria connected by OR
 boolean supportsOrderByUnrelated()
          Support indicates connector accepts ORDER BY clause with columns not from the select
 boolean supportsQuantifiedCompareCriteriaAll()
          Support indicates connector accepts the quantified comparison criteria that use ALL
 boolean supportsQuantifiedCompareCriteriaSome()
          Support indicates connector accepts the quantified comparison criteria that use SOME
 boolean supportsScalarSubqueries()
          Support indicates connector can accept scalar subqueries in the SELECT, WHERE, and HAVING clauses
 boolean supportsSearchedCaseExpressions()
          Support indicates connector can accept queries with searched CASE WHEN ...
 boolean supportsSelectExpression()
          Support indicates connector can accept expressions other than element symbols in the SELECT clause.
 boolean supportsSelfJoins()
          Support indicates connector can accept self-joins where a group is joined to itself with aliases.
 boolean supportsSetQueryOrderBy()
          Support indicates that the connector supports an ORDER BY on a SetQuery.
 boolean supportsUnions()
          Support indicates that the connector supports the UNION of two queries.
 java.util.List<?> translate(LanguageObject obj, ExecutionContext context)
          Return a List of translated parts (LanguageObjects and Objects), or null if to rely on the default translation.
 java.util.List<?> translateCommand(Command command, ExecutionContext context)
          Return a List of translated parts (LanguageObjects and Objects), or null if to rely on the default translation.
 java.util.List<?> translateLimit(Limit limit, ExecutionContext context)
          Return a List of translated parts (LanguageObjects and Objects), or null if to rely on the default translation.
 java.lang.String translateLiteralBoolean(java.lang.Boolean booleanValue)
          Subclasses should override this method to provide a different sql translation of the literal boolean value.
 java.lang.String translateLiteralDate(java.sql.Date dateValue)
          Subclasses should override this method to provide a different sql translation of the literal date value.
 java.lang.String translateLiteralTime(java.sql.Time timeValue)
          Subclasses should override this method to provide a different sql translation of the literal time value.
 java.lang.String translateLiteralTimestamp(java.sql.Timestamp timestampValue)
          Subclasses should override this method to provide a different sql translation of the literal timestamp value.
 boolean useAsInGroupAlias()
          Indicates whether group alias should be of the form "...FROM groupA AS X" or "...FROM groupA X".
 boolean useBindVariables()
           
 boolean useCommentsInSourceQuery()
           
 boolean useParensForJoins()
          Set to true to indicate that every branch of a join should have parenthesis.
 boolean useParensForSetQueries()
          Set to true to indicate that every branch of a set query should have parenthesis, i.e.
 boolean usePreparedStatements()
          Use PreparedStatements (or CallableStatements) as appropriate for all commands.
 boolean useSelectLimit()
          Returns whether the limit clause is applied to the select clause.
 
Methods inherited from class org.teiid.translator.ExecutionFactory
createExecution, getInstance, getLanguageFactory, getMaxFromGroups, getSupportedJoinCriteria, getTypeFacility, isImmutable, requiresCriteria, setImmutable, setRequiresCriteria, setSourceRequired, setSupportedJoinCriteria, setSupportsFullOuterJoins, setSupportsInnerJoins, setSupportsOrderBy, setSupportsOuterJoins, setSupportsSelectDistinct, supportsAggregatesEnhancedNumeric, supportsExcept, supportsFullOuterJoins, supportsFunctionsInGroupBy, supportsInnerJoins, supportsIntersect, supportsOrderBy, supportsOrderByNullOrdering, supportsOuterJoins, supportsRowLimit, supportsRowOffset, supportsSelectDistinct, useAnsiJoin
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MAX_IN_CRITERIA

public static final int DEFAULT_MAX_IN_CRITERIA
See Also:
Constant Field Values

DEFAULT_TIME_ZONE

public static final java.util.TimeZone DEFAULT_TIME_ZONE
Constructor Detail

JDBCExecutionFactory

public JDBCExecutionFactory()
Method Detail

start

public void start()
           throws TranslatorException
Description copied from class: ExecutionFactory
Initialize the connector with supplied configuration

Overrides:
start in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>
Throws:
TranslatorException

getDatabaseVersion

@TranslatorProperty(display="Database Version",
                    description="Database Version")
public java.lang.String getDatabaseVersion()

setDatabaseVersion

public void setDatabaseVersion(java.lang.String version)

useBindVariables

@TranslatorProperty(display="Use Bind Variables",
                    description="Use prepared statements and bind variables",
                    advanced=true)
public boolean useBindVariables()

setUseBindVariables

public void setUseBindVariables(boolean useBindVariables)

getDatabaseTimeZone

@TranslatorProperty(display="Database time zone",
                    description="Time zone of the database, if different than Integration Server",
                    advanced=true)
public java.lang.String getDatabaseTimeZone()

setDatabaseTimeZone

public void setDatabaseTimeZone(java.lang.String databaseTimeZone)

isTrimStrings

@TranslatorProperty(display="Trim string flag",
                    description="Right Trim fixed character types returned as Strings - note that the native type must be char or nchar and the source must support the rtrim function.",
                    advanced=true)
public boolean isTrimStrings()

setTrimStrings

public void setTrimStrings(boolean trimStrings)

useCommentsInSourceQuery

@TranslatorProperty(display="Use informational comments in Source Queries",
                    description="This will embed a /*comment*/ leading comment with session/request id in source SQL query for informational purposes",
                    advanced=true)
public boolean useCommentsInSourceQuery()

setUseCommentsInSourceQuery

public void setUseCommentsInSourceQuery(boolean useCommentsInSourceQuery)

isSourceRequired

public boolean isSourceRequired()
Description copied from class: ExecutionFactory
Flag that indicates if a underlying source connection required for this execution factory to work

Overrides:
isSourceRequired in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>
Returns:

createResultSetExecution

public ResultSetExecution createResultSetExecution(QueryExpression command,
                                                   ExecutionContext executionContext,
                                                   RuntimeMetadata metadata,
                                                   java.sql.Connection conn)
                                            throws TranslatorException
Overrides:
createResultSetExecution in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>
Throws:
TranslatorException

createProcedureExecution

public ProcedureExecution createProcedureExecution(Call command,
                                                   ExecutionContext executionContext,
                                                   RuntimeMetadata metadata,
                                                   java.sql.Connection conn)
                                            throws TranslatorException
Overrides:
createProcedureExecution in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>
Throws:
TranslatorException

createUpdateExecution

public UpdateExecution createUpdateExecution(Command command,
                                             ExecutionContext executionContext,
                                             RuntimeMetadata metadata,
                                             java.sql.Connection conn)
                                      throws TranslatorException
Overrides:
createUpdateExecution in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>
Throws:
TranslatorException

getConnection

public java.sql.Connection getConnection(javax.sql.DataSource ds)
                                  throws TranslatorException
Description copied from class: ExecutionFactory
Return a connection object from the given connection factory. The default implementation assumes a JCA ConnectionFactory. Subclasses should override, if they use another type of connection factory.

Overrides:
getConnection in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>
Returns:
Throws:
TranslatorException

closeConnection

public void closeConnection(java.sql.Connection connection,
                            javax.sql.DataSource factory)
Description copied from class: ExecutionFactory
Closes a connection object from the given connection factory. The default implementation assumes a JCA Connection. Subclasses should override, if they use another type of connection.

Overrides:
closeConnection in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

getMetadata

public void getMetadata(MetadataFactory metadataFactory,
                        java.sql.Connection conn)
                 throws TranslatorException
Description copied from class: ExecutionFactory
Implement to provide metadata to the metadata for use by the engine. This is the primary method of creating metadata for dynamic VDBs.

Overrides:
getMetadata in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>
Throws:
TranslatorException

getSupportedFunctions

public java.util.List<java.lang.String> getSupportedFunctions()
Description copied from class: ExecutionFactory
Get list of all supported function names. Arithmetic functions have names like "+".

Overrides:
getSupportedFunctions in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

getDefaultSupportedFunctions

public java.util.List<java.lang.String> getDefaultSupportedFunctions()

getMaxInCriteriaSize

public int getMaxInCriteriaSize()
Description copied from class: ExecutionFactory
Get the integer value representing the number of values allowed in an IN criteria in the WHERE clause of a query

Overrides:
getMaxInCriteriaSize in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsGroupBy

public boolean supportsGroupBy()
Description copied from class: ExecutionFactory
Whether the source supports an explicit GROUP BY clause

Overrides:
supportsGroupBy in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsAggregatesAvg

public boolean supportsAggregatesAvg()
Description copied from class: ExecutionFactory
Support indicates connector can accept the AVG aggregate function

Overrides:
supportsAggregatesAvg in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsAggregatesCount

public boolean supportsAggregatesCount()
Description copied from class: ExecutionFactory
Support indicates connector can accept the COUNT aggregate function

Overrides:
supportsAggregatesCount in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsAggregatesCountStar

public boolean supportsAggregatesCountStar()
Description copied from class: ExecutionFactory
Support indicates connector can accept the COUNT(*) aggregate function

Overrides:
supportsAggregatesCountStar in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsAggregatesDistinct

public boolean supportsAggregatesDistinct()
Description copied from class: ExecutionFactory
Support indicates connector can accept DISTINCT within aggregate functions

Overrides:
supportsAggregatesDistinct in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsAggregatesMax

public boolean supportsAggregatesMax()
Description copied from class: ExecutionFactory
Support indicates connector can accept the MAX aggregate function

Overrides:
supportsAggregatesMax in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsAggregatesMin

public boolean supportsAggregatesMin()
Description copied from class: ExecutionFactory
Support indicates connector can accept the MIN aggregate function

Overrides:
supportsAggregatesMin in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsAggregatesSum

public boolean supportsAggregatesSum()
Description copied from class: ExecutionFactory
Support indicates connector can accept the SUM aggregate function

Overrides:
supportsAggregatesSum in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsAliasedTable

public boolean supportsAliasedTable()
Description copied from class: ExecutionFactory
Support indicates connector can accept groups with aliases

Overrides:
supportsAliasedTable in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsBetweenCriteria

public boolean supportsBetweenCriteria()
Description copied from class: ExecutionFactory
Support indicates connector accepts criteria of form (element BETWEEN constant AND constant)
NOT CURRENTLY USED - between is rewritten as compound compare criteria

Overrides:
supportsBetweenCriteria in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsCaseExpressions

public boolean supportsCaseExpressions()
Description copied from class: ExecutionFactory
Support indicates connector can accept queries with non-searched CASE WHEN ... END
NOT CURRENTLY USED - case is pushed down as searched case

Overrides:
supportsCaseExpressions in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsCompareCriteriaEquals

public boolean supportsCompareCriteriaEquals()
Description copied from class: ExecutionFactory
Support indicates connector accepts criteria of form (element = constant)

Overrides:
supportsCompareCriteriaEquals in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsCorrelatedSubqueries

public boolean supportsCorrelatedSubqueries()
Description copied from class: ExecutionFactory
Support indicates connector can accept correlated subqueries wherever subqueries are accepted

Overrides:
supportsCorrelatedSubqueries in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsExistsCriteria

public boolean supportsExistsCriteria()
Description copied from class: ExecutionFactory
Support indicates connector accepts the EXISTS criteria

Overrides:
supportsExistsCriteria in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsInCriteria

public boolean supportsInCriteria()
Description copied from class: ExecutionFactory
Support indicates connector accepts criteria of form (element IN set)

Overrides:
supportsInCriteria in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsInCriteriaSubquery

public boolean supportsInCriteriaSubquery()
Description copied from class: ExecutionFactory
Support indicates connector accepts IN criteria with a subquery on the right side

Overrides:
supportsInCriteriaSubquery in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsIsNullCriteria

public boolean supportsIsNullCriteria()
Description copied from class: ExecutionFactory
Support indicates connector accepts criteria of form (element IS NULL)

Overrides:
supportsIsNullCriteria in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsLikeCriteria

public boolean supportsLikeCriteria()
Description copied from class: ExecutionFactory
Support indicates connector accepts criteria of form (element LIKE constant)

Overrides:
supportsLikeCriteria in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsLikeCriteriaEscapeCharacter

public boolean supportsLikeCriteriaEscapeCharacter()
Description copied from class: ExecutionFactory
Support indicates connector accepts criteria of form (element LIKE constant ESCAPE char)

Overrides:
supportsLikeCriteriaEscapeCharacter in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsNotCriteria

public boolean supportsNotCriteria()
Description copied from class: ExecutionFactory
Support indicates connector accepts logical criteria NOT

Overrides:
supportsNotCriteria in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsOrCriteria

public boolean supportsOrCriteria()
Description copied from class: ExecutionFactory
Support indicates connector accepts logical criteria connected by OR

Overrides:
supportsOrCriteria in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsOrderByUnrelated

public boolean supportsOrderByUnrelated()
Description copied from class: ExecutionFactory
Support indicates connector accepts ORDER BY clause with columns not from the select

Overrides:
supportsOrderByUnrelated in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>
Returns:

supportsQuantifiedCompareCriteriaAll

public boolean supportsQuantifiedCompareCriteriaAll()
Description copied from class: ExecutionFactory
Support indicates connector accepts the quantified comparison criteria that use ALL

Overrides:
supportsQuantifiedCompareCriteriaAll in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsScalarSubqueries

public boolean supportsScalarSubqueries()
Description copied from class: ExecutionFactory
Support indicates connector can accept scalar subqueries in the SELECT, WHERE, and HAVING clauses

Overrides:
supportsScalarSubqueries in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsSearchedCaseExpressions

public boolean supportsSearchedCaseExpressions()
Description copied from class: ExecutionFactory
Support indicates connector can accept queries with searched CASE WHEN ... END

Overrides:
supportsSearchedCaseExpressions in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsSelfJoins

public boolean supportsSelfJoins()
Description copied from class: ExecutionFactory
Support indicates connector can accept self-joins where a group is joined to itself with aliases. Connector must also support ExecutionFactory.supportsAliasedTable().

Overrides:
supportsSelfJoins in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsInlineViews

public boolean supportsInlineViews()
Description copied from class: ExecutionFactory
Support indicates connector can accept inline views (subqueries in the FROM clause).

Overrides:
supportsInlineViews in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsQuantifiedCompareCriteriaSome

public boolean supportsQuantifiedCompareCriteriaSome()
Description copied from class: ExecutionFactory
Support indicates connector accepts the quantified comparison criteria that use SOME

Overrides:
supportsQuantifiedCompareCriteriaSome in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsSetQueryOrderBy

public boolean supportsSetQueryOrderBy()
Description copied from class: ExecutionFactory
Support indicates that the connector supports an ORDER BY on a SetQuery.

Overrides:
supportsSetQueryOrderBy in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsUnions

public boolean supportsUnions()
Description copied from class: ExecutionFactory
Support indicates that the connector supports the UNION of two queries.

Overrides:
supportsUnions in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsBulkUpdate

public boolean supportsBulkUpdate()
Description copied from class: ExecutionFactory
Whether the source supports updates with multiple value sets

Overrides:
supportsBulkUpdate in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsInsertWithIterator

public boolean supportsInsertWithIterator()
Description copied from class: ExecutionFactory
Support indicates that the connector can accept INSERTs with values specified by an Iterator

Overrides:
supportsInsertWithIterator in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>
Returns:

supportsBatchedUpdates

public boolean supportsBatchedUpdates()
Description copied from class: ExecutionFactory
Whether the source supports BatchedUpdates

Overrides:
supportsBatchedUpdates in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsCompareCriteriaOrdered

public boolean supportsCompareCriteriaOrdered()
Description copied from class: ExecutionFactory
Support indicates connector accepts criteria of form (element <=|>= constant)
The query engine will may pushdown queries containing < or > if NOT is also supported.

Overrides:
supportsCompareCriteriaOrdered in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsHaving

public boolean supportsHaving()
Description copied from class: ExecutionFactory
Whether the source supports the HAVING clause

Overrides:
supportsHaving in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsSelectExpression

public boolean supportsSelectExpression()
Description copied from class: ExecutionFactory
Support indicates connector can accept expressions other than element symbols in the SELECT clause. Specific supports for the expression type are still checked.

Overrides:
supportsSelectExpression in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

supportsInsertWithQueryExpression

public boolean supportsInsertWithQueryExpression()
Description copied from class: ExecutionFactory
Support indicates that the connector can accept INSERTs with values specified by a SetQuery or Select

Overrides:
supportsInsertWithQueryExpression in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>

getMaxPreparedInsertBatchSize

@TranslatorProperty(display="Max Prepared Insert Batch Size",
                    description="The max size of a prepared insert batch.  Default 2048.",
                    advanced=true)
public int getMaxPreparedInsertBatchSize()
Get the max number of inserts to perform in one batch.

Returns:

setMaxPreparedInsertBatchSize

public void setMaxPreparedInsertBatchSize(int maxInsertBatchSize)

getDatabaseCalendar

public java.util.Calendar getDatabaseCalendar()
Gets the database calendar. This will be set to the time zone specified by the property JDBCPropertyNames#DATABASE_TIME_ZONE, or the local time zone if none is specified.

Returns:
the database calendar

translate

public java.util.List<?> translate(LanguageObject obj,
                                   ExecutionContext context)
Return a List of translated parts (LanguageObjects and Objects), or null if to rely on the default translation. Override with care.

Parameters:
command -
context -
Returns:
list of translated parts

translateCommand

public java.util.List<?> translateCommand(Command command,
                                          ExecutionContext context)
Return a List of translated parts (LanguageObjects and Objects), or null if to rely on the default translation.

Parameters:
command -
context -
Returns:
a list of translated parts

translateLimit

public java.util.List<?> translateLimit(Limit limit,
                                        ExecutionContext context)
Return a List of translated parts (LanguageObjects and Objects), or null if to rely on the default translation.

Parameters:
limit -
context -
Returns:
a list of translated parts

getFunctionModifiers

public java.util.Map<java.lang.String,FunctionModifier> getFunctionModifiers()
Return a map of function name in lower case to FunctionModifier.

Returns:
Map of function name to FunctionModifier.

registerFunctionModifier

public void registerFunctionModifier(java.lang.String name,
                                     FunctionModifier modifier)
Add the FunctionModifier to the set of known modifiers.

Parameters:
name -
modifier -

translateLiteralBoolean

public java.lang.String translateLiteralBoolean(java.lang.Boolean booleanValue)
Subclasses should override this method to provide a different sql translation of the literal boolean value. By default, a boolean literal is represented as: '0' or '1'.

Parameters:
booleanValue - Boolean value, never null
Returns:
Translated string

translateLiteralDate

public java.lang.String translateLiteralDate(java.sql.Date dateValue)
Subclasses should override this method to provide a different sql translation of the literal date value. By default, a date literal is represented as: {d '2002-12-31'}

Parameters:
dateValue - Date value, never null
Returns:
Translated string

translateLiteralTime

public java.lang.String translateLiteralTime(java.sql.Time timeValue)
Subclasses should override this method to provide a different sql translation of the literal time value. By default, a time literal is represented as: {t '23:59:59'} See hasTimeType() to represent literal times as timestamps.

Parameters:
timeValue - Time value, never null
Returns:
Translated string

translateLiteralTimestamp

public java.lang.String translateLiteralTimestamp(java.sql.Timestamp timestampValue)
Subclasses should override this method to provide a different sql translation of the literal timestamp value. By default, a timestamp literal is represented as: {ts '2002-12-31 23:59:59'}. See getTimestampNanoPrecision() to control the literal precision.

Parameters:
timestampValue - Timestamp value, never null
Returns:
Translated string

formatDateValue

public java.lang.String formatDateValue(java.util.Date dateObject)
Format the dateObject (of type date, time, or timestamp) into a string using the DatabaseTimeZone format.

Parameters:
dateObject -
Returns:
Formatted string

addSourceComment

public boolean addSourceComment()
Returns true to indicate that SQL should include a comment indicating the session and request ids.


useAsInGroupAlias

public boolean useAsInGroupAlias()
Indicates whether group alias should be of the form "...FROM groupA AS X" or "...FROM groupA X". Certain data sources (such as Oracle) may not support the first form.

Returns:
boolean

usePreparedStatements

public boolean usePreparedStatements()
Use PreparedStatements (or CallableStatements) as appropriate for all commands. Bind values will be determined by the BindValueVisitor. Literal.setBindValue(boolean) can be used to force a literal to be a bind value.


useParensForSetQueries

public boolean useParensForSetQueries()
Set to true to indicate that every branch of a set query should have parenthesis, i.e. (query) union (query)

Returns:
true if parenthesis should be used for each set branch

hasTimeType

public boolean hasTimeType()
Return false to indicate that time support should be emulated with timestamps.

Returns:
true if database has a time type

getSetOperationString

public java.lang.String getSetOperationString(SetQuery.Operation operation)
Returns the name for a given SetQuery.Operation

Parameters:
operation -
Returns:
the name for the set operation

getSourceComment

public java.lang.String getSourceComment(ExecutionContext context,
                                         Command command)
Returns the source comment for the given command

Parameters:
context -
command -
Returns:
the comment

replaceElementName

public java.lang.String replaceElementName(java.lang.String group,
                                           java.lang.String element)
Override to return a name other than the default [group.]element

Parameters:
group -
element -
Returns:
thre replacement name

getTimestampNanoPrecision

public int getTimestampNanoPrecision()
Return the precision of timestamp literals. Defaults to 9.

Returns:
digits of timestamp nano precision.

executeStoredProcedure

public java.sql.ResultSet executeStoredProcedure(java.sql.CallableStatement statement,
                                                 TranslatedCommand command,
                                                 java.lang.Class<?> returnType)
                                          throws java.sql.SQLException
This is a generic implementation. Because different databases handle stored procedures differently, subclasses should override this method if necessary.

Throws:
java.sql.SQLException

registerSpecificTypeOfOutParameter

protected void registerSpecificTypeOfOutParameter(java.sql.CallableStatement statement,
                                                  java.lang.Class<?> runtimeType,
                                                  int index)
                                           throws java.sql.SQLException
For registering specific output parameter types we need to translate these into the appropriate java.sql.Types output parameters We will need to match these up with the appropriate standard sql types

Parameters:
cstmt -
parameter -
Throws:
java.sql.SQLException

bindValue

public void bindValue(java.sql.PreparedStatement stmt,
                      java.lang.Object param,
                      java.lang.Class<?> paramType,
                      int i)
               throws java.sql.SQLException
Sets prepared statement parameter i with param. Performs special handling to translate dates using the database time zone and to translate biginteger, float, and char to JDBC safe objects.

Parameters:
stmt -
param -
paramType -
i -
cal -
Throws:
java.sql.SQLException

retrieveValue

public java.lang.Object retrieveValue(java.sql.ResultSet results,
                                      int columnIndex,
                                      java.lang.Class<?> expectedType)
                               throws java.sql.SQLException
Retrieve the value on the current resultset row for the given column index.

Parameters:
results -
columnIndex -
expectedType -
Returns:
the value
Throws:
java.sql.SQLException

retrieveValue

public java.lang.Object retrieveValue(java.sql.CallableStatement results,
                                      int parameterIndex,
                                      java.lang.Class<?> expectedType)
                               throws java.sql.SQLException
Retrieve the value for the given parameter index

Parameters:
results -
parameterIndex -
expectedType -
Returns:
the value
Throws:
java.sql.SQLException

afterInitialConnectionObtained

protected void afterInitialConnectionObtained(java.sql.Connection connection)
Called exactly once for this source.

Parameters:
connection -

obtainedConnection

public void obtainedConnection(java.sql.Connection connection)
Provides a hook to call source specific logic when a connection is obtained. defect request 13979 & 13978


getSQLConversionVisitor

public SQLConversionVisitor getSQLConversionVisitor()
Create the SQLConversionVisitor that will perform translation. Typical custom JDBC connectors will not need to create custom conversion visitors, rather implementors should override existing JDBCExecutionFactory methods.

Returns:
the SQLConversionVisitor

useParensForJoins

public boolean useParensForJoins()
Set to true to indicate that every branch of a join should have parenthesis.

Returns:
true if every branch of a join should use parenthesis

getDefaultNullOrder

public ExecutionFactory.NullOrder getDefaultNullOrder()
Description copied from class: ExecutionFactory
Returns the default null ordering

Overrides:
getDefaultNullOrder in class ExecutionFactory<javax.sql.DataSource,java.sql.Connection>
Returns:
the ExecutionFactory.NullOrder

useSelectLimit

public boolean useSelectLimit()
Returns whether the limit clause is applied to the select clause.

Returns:
true if the limit clause is part of the select


Copyright © 2010. All Rights Reserved.