Class DBDictionary

java.lang.Object
org.apache.openjpa.jdbc.sql.DBDictionary
All Implemented Interfaces:
JoinSyntaxes, Configurable, IdentifierConfiguration, ConnectionDecorator, LoggingConnectionDecorator.SQLWarningHandler
Direct Known Subclasses:
AbstractDB2Dictionary, AbstractMySQLDictionary, AbstractSQLServerDictionary, AccessDictionary, CacheDictionary, EmpressDictionary, FirebirdDictionary, FoxProDictionary, H2Dictionary, HerdDBDictionary, HSQLDictionary, InformixDictionary, IngresDictionary, InterbaseDictionary, JDataStoreDictionary, MaxDBDictionary, OracleDictionary, PointbaseDictionary, PostgresDictionary, SolidDBDictionary

Class which allows the creation of SQL dynamically, in a database agnostic fashion. Subclass for the nuances of different data stores.
  • Field Details

    • VENDOR_OTHER

      public static final String VENDOR_OTHER
      See Also:
    • VENDOR_DATADIRECT

      public static final String VENDOR_DATADIRECT
      See Also:
    • SCHEMA_CASE_UPPER

      public static final String SCHEMA_CASE_UPPER
      See Also:
    • SCHEMA_CASE_LOWER

      public static final String SCHEMA_CASE_LOWER
      See Also:
    • SCHEMA_CASE_PRESERVE

      public static final String SCHEMA_CASE_PRESERVE
      See Also:
    • CONS_NAME_BEFORE

      public static final String CONS_NAME_BEFORE
      See Also:
    • CONS_NAME_MID

      public static final String CONS_NAME_MID
      See Also:
    • CONS_NAME_AFTER

      public static final String CONS_NAME_AFTER
      See Also:
    • blobBufferSize

      public int blobBufferSize
    • clobBufferSize

      public int clobBufferSize
    • RANGE_POST_SELECT

      protected static final int RANGE_POST_SELECT
      See Also:
    • RANGE_PRE_DISTINCT

      protected static final int RANGE_PRE_DISTINCT
      See Also:
    • RANGE_POST_DISTINCT

      protected static final int RANGE_POST_DISTINCT
      See Also:
    • RANGE_POST_LOCK

      protected static final int RANGE_POST_LOCK
      See Also:
    • NANO

      protected static final int NANO
      See Also:
    • MICRO

      protected static final int MICRO
      See Also:
    • MILLI

      protected static final int MILLI
      See Also:
    • CENTI

      protected static final int CENTI
      See Also:
    • DECI

      protected static final int DECI
      See Also:
    • SEC

      protected static final int SEC
      See Also:
    • NAME_ANY

      protected static final int NAME_ANY
      See Also:
    • NAME_TABLE

      protected static final int NAME_TABLE
      See Also:
    • NAME_SEQUENCE

      protected static final int NAME_SEQUENCE
      See Also:
    • UNLIMITED

      protected static final int UNLIMITED
      See Also:
    • NO_BATCH

      protected static final int NO_BATCH
      See Also:
    • platform

      public String platform
    • databaseProductName

      public String databaseProductName
    • databaseProductVersion

      public String databaseProductVersion
    • driverVendor

      public String driverVendor
    • createPrimaryKeys

      public boolean createPrimaryKeys
    • constraintNameMode

      public String constraintNameMode
    • maxTableNameLength

      public int maxTableNameLength
    • maxColumnNameLength

      public int maxColumnNameLength
    • maxConstraintNameLength

      public int maxConstraintNameLength
    • maxIndexNameLength

      public int maxIndexNameLength
    • maxIndexesPerTable

      public int maxIndexesPerTable
    • supportsForeignKeys

      public boolean supportsForeignKeys
    • supportsParameterInSelect

      public boolean supportsParameterInSelect
    • supportsForeignKeysComposite

      public boolean supportsForeignKeysComposite
    • supportsUniqueConstraints

      public boolean supportsUniqueConstraints
    • supportsDeferredConstraints

      public boolean supportsDeferredConstraints
    • supportsRestrictDeleteAction

      public boolean supportsRestrictDeleteAction
    • supportsCascadeDeleteAction

      public boolean supportsCascadeDeleteAction
    • supportsNullDeleteAction

      public boolean supportsNullDeleteAction
    • supportsNullUniqueColumn

      public boolean supportsNullUniqueColumn
    • supportsDefaultDeleteAction

      public boolean supportsDefaultDeleteAction
    • supportsRestrictUpdateAction

      public boolean supportsRestrictUpdateAction
    • supportsCascadeUpdateAction

      public boolean supportsCascadeUpdateAction
    • supportsNullUpdateAction

      public boolean supportsNullUpdateAction
    • supportsDefaultUpdateAction

      public boolean supportsDefaultUpdateAction
    • supportsAlterTableWithAddColumn

      public boolean supportsAlterTableWithAddColumn
    • supportsAlterTableWithDropColumn

      public boolean supportsAlterTableWithDropColumn
    • supportsComments

      public boolean supportsComments
    • supportsGetGeneratedKeys

      public Boolean supportsGetGeneratedKeys
    • reservedWords

      public String reservedWords
    • systemSchemas

      public String systemSchemas
    • systemTables

      public String systemTables
    • selectWords

      public String selectWords
    • fixedSizeTypeNames

      public String fixedSizeTypeNames
    • schemaCase

      public String schemaCase
    • javaToDbColumnNameProcessing

      public String javaToDbColumnNameProcessing
    • setStringRightTruncationOn

      public boolean setStringRightTruncationOn
    • fullResultCollectionInOrderByRelation

      public boolean fullResultCollectionInOrderByRelation
    • disableSchemaFactoryColumnTypeErrors

      public boolean disableSchemaFactoryColumnTypeErrors
    • disableAlterSeqenceIncrementBy

      public boolean disableAlterSeqenceIncrementBy
    • validationSQL

      public String validationSQL
    • closePoolSQL

      public String closePoolSQL
    • initializationSQL

      public String initializationSQL
    • joinSyntax

      public int joinSyntax
    • outerJoinClause

      public String outerJoinClause
    • innerJoinClause

      public String innerJoinClause
    • crossJoinClause

      public String crossJoinClause
    • requiresConditionForCrossJoin

      public boolean requiresConditionForCrossJoin
    • forUpdateClause

      public String forUpdateClause
    • tableForUpdateClause

      public String tableForUpdateClause
    • distinctCountColumnSeparator

      public String distinctCountColumnSeparator
    • supportsSelectForUpdate

      public boolean supportsSelectForUpdate
    • supportsLockingWithDistinctClause

      public boolean supportsLockingWithDistinctClause
    • supportsLockingWithMultipleTables

      public boolean supportsLockingWithMultipleTables
    • supportsLockingWithOrderClause

      public boolean supportsLockingWithOrderClause
    • supportsLockingWithOuterJoin

      public boolean supportsLockingWithOuterJoin
    • supportsLockingWithInnerJoin

      public boolean supportsLockingWithInnerJoin
    • supportsLockingWithSelectRange

      public boolean supportsLockingWithSelectRange
    • supportsQueryTimeout

      public boolean supportsQueryTimeout
    • allowQueryTimeoutOnFindUpdate

      public boolean allowQueryTimeoutOnFindUpdate
    • simulateLocking

      public boolean simulateLocking
    • supportsSubselect

      public boolean supportsSubselect
    • supportsCorrelatedSubselect

      public boolean supportsCorrelatedSubselect
    • supportsHaving

      public boolean supportsHaving
    • supportsSelectStartIndex

      public boolean supportsSelectStartIndex
    • supportsSelectEndIndex

      public boolean supportsSelectEndIndex
    • rangePosition

      public int rangePosition
    • requiresAliasForSubselect

      public boolean requiresAliasForSubselect
    • requiresTargetForDelete

      public boolean requiresTargetForDelete
    • allowsAliasInBulkClause

      public boolean allowsAliasInBulkClause
    • allowsBulkTargetInSubselect

      public boolean allowsBulkTargetInSubselect
      Whether a subquery in the WHERE clause of a bulk update or delete may read the table that the statement changes. When false, the statement matches the primary keys of the affected rows in a derived table instead, which the database materializes before changing any row.
    • supportsMultipleNontransactionalResultSets

      public boolean supportsMultipleNontransactionalResultSets
    • requiresSearchStringEscapeForLike

      public boolean requiresSearchStringEscapeForLike
      Set to true for a database whose LIKE has a default escape character (e.g. backslash). Jakarta Persistence gives a LIKE pattern without an ESCAPE clause no escape character at all, so such a database is given an explicit searchStringNoEscape ESCAPE clause to make the same JPQL query mean the same thing everywhere.
    • searchStringEscape

      public String searchStringEscape
    • searchStringNoEscape

      public String searchStringNoEscape
      The SQL expression written into the ESCAPE clause of a LIKE whose query supplied no escape character, used when requiresSearchStringEscapeForLike is set. The default empty string literal is a non-standard spelling of "no escape character" which H2 and PostgreSQL accept, and MySQL only while its sql_mode has no NO_BACKSLASH_ESCAPES; a standard conforming database such as Derby rejects it, because the standard wants exactly one character. A dictionary which sets requiresSearchStringEscapeForLike has to make sure that the value is one its database accepts, and otherwise name a single character expression that cannot occur in a pattern.
    • backslashEscapesInStringLiterals

      public boolean backslashEscapesInStringLiterals
      Set to true for a database which may read a backslash inside a string literal as an escape character, such as MySQL and MariaDB unless their sql_mode contains NO_BACKSLASH_ESCAPES, or PostgreSQL with standard_conforming_strings turned off. As that mode can differ between servers and even sessions, a string value with a backslash is then never written into the SQL text as a literal, but bound as a parameter. See toStringLiteral(String).
    • requiresCastForMathFunctions

      public boolean requiresCastForMathFunctions
    • requiresCastForComparisons

      public boolean requiresCastForComparisons
    • requiresCastForExtractOperand

      public boolean requiresCastForExtractOperand
      If true, a parameter or bound literal operand of EXTRACT is cast to DATE, TIME or TIMESTAMP, for databases whose date and time functions reject an untyped parameter.
    • requiresCastForCaseStringResult

      public boolean requiresCastForCaseStringResult
      If true, a string literal, or a parameter bound to a string, returned by a CASE expression is cast to VARCHAR, for databases that type a string literal as CHAR and pad the result of the CASE to the length of its longest result.
    • supportsModOperator

      public boolean supportsModOperator
    • supportsXMLColumn

      public boolean supportsXMLColumn
    • supportsCaseConversionForLob

      public boolean supportsCaseConversionForLob
    • reportsSuccessNoInfoOnBatchUpdates

      public boolean reportsSuccessNoInfoOnBatchUpdates
    • supportsSelectFromFinalTable

      public boolean supportsSelectFromFinalTable
    • supportsSimpleCaseExpression

      public boolean supportsSimpleCaseExpression
    • supportsGeneralCaseExpression

      public boolean supportsGeneralCaseExpression
    • useWildCardForCount

      public boolean useWildCardForCount
    • trimSchemaName

      public boolean trimSchemaName
      Some Databases append whitespace after the schema name
    • castFunction

      public String castFunction
    • toLowerCaseFunction

      public String toLowerCaseFunction
    • toUpperCaseFunction

      public String toUpperCaseFunction
    • stringLengthFunction

      public String stringLengthFunction
    • bitLengthFunction

      public String bitLengthFunction
    • trimLeadingFunction

      public String trimLeadingFunction
    • trimTrailingFunction

      public String trimTrailingFunction
    • trimBothFunction

      public String trimBothFunction
    • concatenateFunction

      public String concatenateFunction
    • concatenateDelimiter

      public String concatenateDelimiter
    • substringFunctionName

      public String substringFunctionName
    • replaceFunctionName

      public String replaceFunctionName
    • leftFunctionName

      public String leftFunctionName
    • rightFunctionName

      public String rightFunctionName
    • currentDateFunction

      public String currentDateFunction
    • currentTimeFunction

      public String currentTimeFunction
    • currentTimestampFunction

      public String currentTimestampFunction
    • naturalLogarithmFunction

      public String naturalLogarithmFunction
    • dropTableSQL

      public String dropTableSQL
    • extractDateTimeFieldFunction

      public String extractDateTimeFieldFunction
    • ceilingFunction

      public String ceilingFunction
    • exceptFunction

      public String exceptFunction
    • storageLimitationsFatal

      public boolean storageLimitationsFatal
    • storeLargeNumbersAsStrings

      public boolean storeLargeNumbersAsStrings
    • storeCharsAsNumbers

      public boolean storeCharsAsNumbers
      Whether Java char fields are stored in numeric columns rather than as CHAR values. Dictionaries may set their own default and may adjust it in connectedConfiguration(Connection) based on the detected database version; use setStoreCharsAsNumbers(boolean) to configure a value that is guaranteed to be left untouched (OPENJPA-2971).
    • trimStringColumns

      public boolean trimStringColumns
    • useGetBytesForBlobs

      public boolean useGetBytesForBlobs
    • useSetBytesForBlobs

      public boolean useSetBytesForBlobs
    • useGetObjectForBlobs

      public boolean useGetObjectForBlobs
    • useGetStringForClobs

      public boolean useGetStringForClobs
    • useSetStringForClobs

      public boolean useSetStringForClobs
    • useJDBC4SetBinaryStream

      public boolean useJDBC4SetBinaryStream
    • maxEmbeddedBlobSize

      public int maxEmbeddedBlobSize
    • maxEmbeddedClobSize

      public int maxEmbeddedClobSize
    • inClauseLimit

      public int inClauseLimit
    • datePrecision

      public int datePrecision
      Attention, while this is named datePrecision it actually only get used for Timestamp handling!
      See Also:
    • roundTimeToMillisec

      @Deprecated public boolean roundTimeToMillisec
      Deprecated.
      Use 'dateMillisecondBehavior' instead.
    • booleanRepresentation

      protected BooleanRepresentation booleanRepresentation
      Defines how Boolean and boolean values get represented in OpenJPA. Default to INT_10. for backward compatibility.
    • indexPhysicalForeignKeys

      public boolean indexPhysicalForeignKeys
      Whether an index is generated for a relation that is also a foreign key. Some database systems (e.g. MySQL) will automatically create an index for a foreign key, others (e.g. Oracle, MS-SQL-Server) do not. See also MappingDefaultsImpl._indexPhysicalFK which may disable this feature for backwards compatibility.
    • characterColumnSize

      public int characterColumnSize
    • arrayTypeName

      public String arrayTypeName
    • bigintTypeName

      public String bigintTypeName
    • binaryTypeName

      public String binaryTypeName
    • bitTypeName

      public String bitTypeName
    • blobTypeName

      public String blobTypeName
    • booleanTypeName

      public String booleanTypeName
    • charTypeName

      public String charTypeName
    • clobTypeName

      public String clobTypeName
    • dateTypeName

      public String dateTypeName
    • decimalTypeName

      public String decimalTypeName
    • distinctTypeName

      public String distinctTypeName
    • doubleTypeName

      public String doubleTypeName
    • floatTypeName

      public String floatTypeName
    • integerTypeName

      public String integerTypeName
    • javaObjectTypeName

      public String javaObjectTypeName
    • longVarbinaryTypeName

      public String longVarbinaryTypeName
    • longVarcharTypeName

      public String longVarcharTypeName
    • nullTypeName

      public String nullTypeName
    • numericTypeName

      public String numericTypeName
    • otherTypeName

      public String otherTypeName
    • realTypeName

      public String realTypeName
    • refTypeName

      public String refTypeName
    • smallintTypeName

      public String smallintTypeName
    • structTypeName

      public String structTypeName
    • timeTypeName

      public String timeTypeName
    • timestampTypeName

      public String timestampTypeName
    • timeWithZoneTypeName

      public String timeWithZoneTypeName
    • timestampWithZoneTypeName

      public String timestampWithZoneTypeName
    • tinyintTypeName

      public String tinyintTypeName
    • varbinaryTypeName

      public String varbinaryTypeName
    • varcharTypeName

      public String varcharTypeName
    • xmlTypeName

      public String xmlTypeName
    • xmlTypeEncoding

      public String xmlTypeEncoding
    • uuidTypeName

      public String uuidTypeName
    • getStringVal

      public String getStringVal
    • typecastToStringTypeName

      public String typecastToStringTypeName
    • useSchemaName

      public boolean useSchemaName
    • tableTypes

      public String tableTypes
    • supportsSchemaForGetTables

      public boolean supportsSchemaForGetTables
    • supportsSchemaForGetColumns

      public boolean supportsSchemaForGetColumns
    • supportsNullTableForGetColumns

      public boolean supportsNullTableForGetColumns
    • supportsNullTableForGetPrimaryKeys

      public boolean supportsNullTableForGetPrimaryKeys
    • supportsNullTableForGetIndexInfo

      public boolean supportsNullTableForGetIndexInfo
    • supportsNullTableForGetImportedKeys

      public boolean supportsNullTableForGetImportedKeys
    • useGetBestRowIdentifierForPrimaryKeys

      public boolean useGetBestRowIdentifierForPrimaryKeys
    • requiresAutoCommitForMetaData

      public boolean requiresAutoCommitForMetaData
    • tableLengthIncludesSchema

      public boolean tableLengthIncludesSchema
    • maxAutoAssignNameLength

      public int maxAutoAssignNameLength
    • autoAssignClause

      public String autoAssignClause
    • autoAssignTypeName

      public String autoAssignTypeName
    • supportsAutoAssign

      public boolean supportsAutoAssign
    • lastGeneratedKeyQuery

      public String lastGeneratedKeyQuery
    • nextSequenceQuery

      public String nextSequenceQuery
    • sequenceSQL

      public String sequenceSQL
    • sequenceSchemaSQL

      public String sequenceSchemaSQL
    • sequenceNameSQL

      public String sequenceNameSQL
    • nativeSequenceType

      public int nativeSequenceType
    • invalidColumnWordSet

      public Set<String> invalidColumnWordSet
      reservedWordSet subset that CANNOT be used as valid column names (i.e., without surrounding them with double-quotes).
    • invalidTableWordSet

      protected final Set<String> invalidTableWordSet
      Words the database rejects as unquoted table and sequence names. Only filled for databases the words were measured on; see getValidDefaultTableName(DBIdentifier) and getValidDefaultSequenceName(DBIdentifier).
    • useNativeSequenceCache

      @Deprecated public boolean useNativeSequenceCache
      Deprecated.
      This variable was used in 2.1.x and prior releases to indicate that OpenJPA should not use the CACHE clause when getting a native sequence; instead the INCREMENT BY clause gets its value equal to the allocationSize property. Post 2.1.x, code was added to allow said functionality by default (see OPENJPA-1376). For forward compatibility, this variable should not be removed.
    • conf

      protected JDBCConfiguration conf
    • log

      protected Log log
    • connected

      protected boolean connected
    • isJDBC3

      protected boolean isJDBC3
    • isJDBC4

      protected boolean isJDBC4
    • reservedWordSet

      protected final Set<String> reservedWordSet
    • systemSchemaSet

      protected final Set<String> systemSchemaSet
    • systemTableSet

      protected final Set<String> systemTableSet
    • fixedSizeTypeNameSet

      protected final Set<String> fixedSizeTypeNameSet
    • fractionalTypeNameSet

      public final Set<String> fractionalTypeNameSet
      set of types that might have an optional fraction (sub-second) part.
    • dateFractionDigits

      public int dateFractionDigits
      Default amount of digits for fractional Types. This is not supported/required by every database. This value is only being used if no explicit @Column(scale=n) is set or n is zero. Use @Column(scale=-1) to disable the explicit fraction part in the SQL generator.
      See Also:
    • typeModifierSet

      protected final Set<String> typeModifierSet
    • supportsDelimitedIdentifiers

      public Boolean supportsDelimitedIdentifiers
    • leadingDelimiter

      public String leadingDelimiter
    • trailingDelimiter

      public String trailingDelimiter
    • nameConcatenator

      public String nameConcatenator
    • delimitedCase

      public String delimitedCase
    • catalogSeparator

      public String catalogSeparator
    • defaultSchemaName

      protected String defaultSchemaName
    • supportsUuidType

      public boolean supportsUuidType
    • supportsUnsizedCharOnCast

      public boolean supportsUnsizedCharOnCast
    • integerCastTypeName

      public String integerCastTypeName
      Type name used as the target of a CAST to a 32 bit integer.

      Note: this is a field initializer, so it is evaluated before any subclass constructor runs. Dictionaries which change integerTypeName do not implicitly change this value. Set it explicitly if the DDL type name is not a valid CAST target.

    • longCastTypeName

      public String longCastTypeName
      Type name used as the target of a CAST to a 64 bit integer.

      If null (the default), bigintTypeName is resolved lazily by getLongCastTypeName(). Resolving lazily rather than in a field initializer is deliberate: several dictionaries assign bigintTypeName in their constructor or even in connectedConfiguration(java.sql.Connection), which happens after field initialization.

    • selectWordSet

      protected final Set<String> selectWordSet
      If a native query begins with any of the values found here then it will be treated as a select statement.
    • batchLimit

      public int batchLimit
    • sqlStateCodes

      public final Map<Integer, Set<String>> sqlStateCodes
    • _proxyManager

      protected ProxyManager _proxyManager
    • _procs

      protected Map<String, StoredProcedure> _procs
  • Constructor Details

    • DBDictionary

      public DBDictionary()
  • Method Details

    • isConnected

      public boolean isConnected()
      Whether connectedConfiguration(Connection) has run, i.e. whether this dictionary has seen a connection and the settings it derives from the server it is talking to are in place. A dictionary that is chosen from the connection URL alone is not connected until something first asks the configuration for its connection factory.
    • connectedConfiguration

      public void connectedConfiguration(Connection conn) throws SQLException
      This method is called when the dictionary first sees any connection. It is used to initialize dictionary metadata if needed. If you override this method, be sure to call super.connectedConfiguration.
      Throws:
      SQLException
    • configureNamingRules

      protected void configureNamingRules()
      Configures the naming rules for this dictionary. Subclasses should override this method, providing their own naming rules.
    • getNormalizingRule

      protected IdentifierRule getNormalizingRule()
      The rule with which normalize(DBIdentifier) decides whether a name is delimited. Like the default rule of Normalizer it delimits no reserved words, unless a dictionary sets them and switches their delimiting on in configureNamingRules().
      Since:
      4.2.0
    • normalize

      public DBIdentifier normalize(DBIdentifier name)
      Returns the given identifier as it is named for this dictionary. Identifiers are created by Normalizer, which delimits a name that is no valid SQL identifier, but no reserved word, as the reserved words differ from database to database and the rule of Normalizer is shared by all dictionaries of the JVM. If the normalizing rule of this dictionary delimits reserved words, as on MySQL and MariaDB, a name of the identifier that is such a word is delimited, as if the identifier had been created with that rule: it keeps its case, and the names built from it are delimited too. Otherwise the identifier is returned as it is.
      Returns:
      the given identifier, or a delimited copy of it
      Since:
      4.2.0
    • getArray

      public Array getArray(ResultSet rs, int column) throws SQLException
      Convert the specified column of the SQL ResultSet to the proper java type.
      Throws:
      SQLException
    • getAsciiStream

      public InputStream getAsciiStream(ResultSet rs, int column) throws SQLException
      Convert the specified column of the SQL ResultSet to the proper java type.
      Throws:
      SQLException
    • getBigDecimal

      public BigDecimal getBigDecimal(ResultSet rs, int column) throws SQLException
      Convert the specified column of the SQL ResultSet to the proper java type.
      Throws:
      SQLException
    • getNumber

      public Number getNumber(ResultSet rs, int column) throws SQLException
      Returns the specified column value as an unknown numeric type; we try from the most generic to the least generic.
      Throws:
      SQLException
    • getBigInteger

      public BigInteger getBigInteger(ResultSet rs, int column) throws SQLException
      Convert the specified column of the SQL ResultSet to the proper java type.
      Throws:
      SQLException
    • getBinaryStream

      public InputStream getBinaryStream(ResultSet rs, int column) throws SQLException
      Convert the specified column of the SQL ResultSet to the proper java type.
      Throws:
      SQLException
    • getLOBStream

      public InputStream getLOBStream(JDBCStore store, ResultSet rs, int column) throws SQLException
      Throws:
      SQLException
    • getBlob

      public Blob getBlob(ResultSet rs, int column) throws SQLException
      Convert the specified column of the SQL ResultSet to the proper java type.
      Throws:
      SQLException
    • getBlobObject

      public Object getBlobObject(ResultSet rs, int column, JDBCStore store) throws SQLException
      Convert the specified column of the SQL ResultSet to the proper java type.
      Throws:
      SQLException
    • getBoolean

      public boolean getBoolean(ResultSet rs, int column) throws SQLException
      Convert the specified column of the SQL ResultSet to the proper java type.
      Throws:
      SQLException
    • getByte

      public byte getByte(ResultSet rs, int column) throws SQLException
      Convert the specified column of the SQL ResultSet to the proper java type.
      Throws:
      SQLException
    • getBytes

      public byte[] getBytes(ResultSet rs, int column) throws SQLException
      Convert the specified column of the SQL ResultSet to the proper java type.
      Throws:
      SQLException
    • getCalendar

      public Calendar getCalendar(ResultSet rs, int column) throws SQLException
      Convert the specified column of the SQL ResultSet to the proper java type. Converts the date from a Timestamp by default.
      Throws:
      SQLException
    • getLocalDate

      public LocalDate getLocalDate(ResultSet rs, int column) throws SQLException
      Retrieve the specified column of the SQL ResultSet to the proper LocalDate java type.
      Throws:
      SQLException
    • getLocalTime

      public LocalTime getLocalTime(ResultSet rs, int column) throws SQLException
      Retrieve the specified column of the SQL ResultSet to the proper LocalTime java type.
      Throws:
      SQLException
    • getLocalDateTime

      public LocalDateTime getLocalDateTime(ResultSet rs, int column) throws SQLException
      Retrieve the specified column of the SQL ResultSet to the proper LocalDateTime java type.
      Throws:
      SQLException
    • getOffsetTime

      public OffsetTime getOffsetTime(ResultSet rs, int column) throws SQLException
      Retrieve the specified column of the SQL ResultSet to the proper OffsetTime java type.
      Throws:
      SQLException
    • getOffsetDateTime

      public OffsetDateTime getOffsetDateTime(ResultSet rs, int column) throws SQLException
      Retrieve the specified column of the SQL ResultSet to the proper OffsetDateTime java type.
      Throws:
      SQLException
    • getInstant

      public Instant getInstant(ResultSet rs, int column) throws SQLException
      Retrieve the specified column of the SQL ResultSet to the proper Instant java type.
      Throws:
      SQLException
    • getYear

      public Year getYear(ResultSet rs, int column) throws SQLException
      Retrieve the specified column of the SQL ResultSet to the proper Year java type.
      Throws:
      SQLException
    • getChar

      public char getChar(ResultSet rs, int column) throws SQLException
      Convert the specified column of the SQL ResultSet to the proper java type.
      Throws:
      SQLException
    • getCharacterStream

      public Reader getCharacterStream(ResultSet rs, int column) throws SQLException
      Convert the specified column of the SQL ResultSet to the proper java type.
      Throws:
      SQLException
    • getClob

      public Clob getClob(ResultSet rs, int column) throws SQLException
      Convert the specified column of the SQL ResultSet to the proper java type.
      Throws:
      SQLException
    • getClobString

      public String getClobString(ResultSet rs, int column) throws SQLException
      Convert the specified column of the SQL ResultSet to the proper java type.
      Throws:
      SQLException
    • getDate

      public Date getDate(ResultSet rs, int column) throws SQLException
      Convert the specified column of the SQL ResultSet to the proper java type. Converts the date from a Timestamp by default.
      Throws:
      SQLException
    • getDate

      public Date getDate(ResultSet rs, int column, Calendar cal) throws SQLException
      Convert the specified column of the SQL ResultSet to the proper java type.
      Throws:
      SQLException
    • getDouble

      public double getDouble(ResultSet rs, int column) throws SQLException
      Convert the specified column of the SQL ResultSet to the proper java type.
      Throws:
      SQLException
    • getFloat

      public float getFloat(ResultSet rs, int column) throws SQLException
      Convert the specified column of the SQL ResultSet to the proper java type.
      Throws:
      SQLException
    • getInt

      public int getInt(ResultSet rs, int column) throws SQLException
      Convert the specified column of the SQL ResultSet to the proper java type.
      Throws:
      SQLException
    • getLocale

      public Locale getLocale(ResultSet rs, int column) throws SQLException
      Convert the specified column of the SQL ResultSet to the proper java type.
      Throws:
      SQLException
    • getLong

      public long getLong(ResultSet rs, int column) throws SQLException
      Convert the specified column of the SQL ResultSet to the proper java type.
      Throws:
      SQLException
    • getObject

      public Object getObject(ResultSet rs, int column, Map map) throws SQLException
      Convert the specified column of the SQL ResultSet to the proper java type.
      Throws:
      SQLException
    • getRef

      public Ref getRef(ResultSet rs, int column, Map map) throws SQLException
      Convert the specified column of the SQL ResultSet to the proper java type.
      Throws:
      SQLException
    • getShort

      public short getShort(ResultSet rs, int column) throws SQLException
      Convert the specified column of the SQL ResultSet to the proper java type.
      Throws:
      SQLException
    • getString

      public String getString(ResultSet rs, int column) throws SQLException
      Convert the specified column of the SQL ResultSet to the proper java type.
      Throws:
      SQLException
    • getTime

      public Time getTime(ResultSet rs, int column, Calendar cal) throws SQLException
      Convert the specified column of the SQL ResultSet to the proper java type.
      Throws:
      SQLException
    • getTimestamp

      public Timestamp getTimestamp(ResultSet rs, int column, Calendar cal) throws SQLException
      Convert the specified column of the SQL ResultSet to the proper java type.
      Throws:
      SQLException
    • setArray

      public void setArray(PreparedStatement stmnt, int idx, Array val, Column col) throws SQLException
      Set the given value as a parameter to the statement.
      Throws:
      SQLException
    • setAsciiStream

      public void setAsciiStream(PreparedStatement stmnt, int idx, InputStream val, int length, Column col) throws SQLException
      Set the given value as a parameter to the statement.
      Throws:
      SQLException
    • setBigDecimal

      public void setBigDecimal(PreparedStatement stmnt, int idx, BigDecimal val, Column col) throws SQLException
      Set the given value as a parameter to the statement.
      Throws:
      SQLException
    • setBigInteger

      public void setBigInteger(PreparedStatement stmnt, int idx, BigInteger val, Column col) throws SQLException
      Set the given value as a parameter to the statement.
      Throws:
      SQLException
    • setBinaryStream

      public void setBinaryStream(PreparedStatement stmnt, int idx, InputStream val, int length, Column col) throws SQLException
      Set the given value as a parameter to the statement.
      Throws:
      SQLException
    • setBlob

      public void setBlob(PreparedStatement stmnt, int idx, Blob val, Column col) throws SQLException
      Set the given value as a parameter to the statement.
      Throws:
      SQLException
    • setBlobObject

      public void setBlobObject(PreparedStatement stmnt, int idx, Object val, Column col, JDBCStore store) throws SQLException
      Set the given value as a parameter to the statement. Uses the serialize(Object, JDBCStore) method to serialize the value.
      Throws:
      SQLException
    • setBoolean

      public void setBoolean(PreparedStatement stmnt, int idx, boolean val, Column col) throws SQLException
      Set the given value as a parameter to the statement.
      Throws:
      SQLException
    • setByte

      public void setByte(PreparedStatement stmnt, int idx, byte val, Column col) throws SQLException
      Set the given value as a parameter to the statement.
      Throws:
      SQLException
    • setBytes

      public void setBytes(PreparedStatement stmnt, int idx, byte[] val, Column col) throws SQLException
      Set the given value as a parameter to the statement.
      Throws:
      SQLException
    • setChar

      public void setChar(PreparedStatement stmnt, int idx, char val, Column col) throws SQLException
      Set the given value as a parameter to the statement.
      Throws:
      SQLException
    • setCharacterStream

      public void setCharacterStream(PreparedStatement stmnt, int idx, Reader val, int length, Column col) throws SQLException
      Set the given value as a parameter to the statement.
      Throws:
      SQLException
    • setClob

      public void setClob(PreparedStatement stmnt, int idx, Clob val, Column col) throws SQLException
      Set the given value as a parameter to the statement.
      Throws:
      SQLException
    • setClobString

      public void setClobString(PreparedStatement stmnt, int idx, String val, Column col) throws SQLException
      Set the given value as a parameter to the statement.
      Throws:
      SQLException
    • setDate

      public void setDate(PreparedStatement stmnt, int idx, Date val, Column col) throws SQLException
      Set the given value as a parameter to the statement.
      Throws:
      SQLException
    • setDate

      public void setDate(PreparedStatement stmnt, int idx, Date val, Calendar cal, Column col) throws SQLException
      Set the given value as a parameter to the statement. Without a calendar, a value for a DATE column or for no known column is bound as the date of its day, normalized to the start of the day as JDBC requires: drivers such as Oracle's store and compare the time of day of a Date otherwise.
      Throws:
      SQLException
    • setCalendar

      public void setCalendar(PreparedStatement stmnt, int idx, Calendar val, Column col) throws SQLException
      Set the given value as a parameter to the statement.
      Throws:
      SQLException
    • setLocalDate

      public void setLocalDate(PreparedStatement stmnt, int idx, LocalDate val, Column col) throws SQLException
      Set the given LocalDate value as a parameter to the statement.
      Throws:
      SQLException
    • setLocalTime

      public void setLocalTime(PreparedStatement stmnt, int idx, LocalTime val, Column col) throws SQLException
      Set the given LocalTime value as a parameter to the statement.
      Throws:
      SQLException
    • setLocalDateTime

      public void setLocalDateTime(PreparedStatement stmnt, int idx, LocalDateTime val, Column col) throws SQLException
      Set the given LocalTime value as a parameter to the statement.
      Throws:
      SQLException
    • setOffsetTime

      public void setOffsetTime(PreparedStatement stmnt, int idx, OffsetTime val, Column col) throws SQLException
      Set the given LocalTime value as a parameter to the statement.
      Throws:
      SQLException
    • setOffsetDateTime

      public void setOffsetDateTime(PreparedStatement stmnt, int idx, OffsetDateTime val, Column col) throws SQLException
      Set the given LocalTime value as a parameter to the statement.
      Throws:
      SQLException
    • setInstant

      public void setInstant(PreparedStatement stmnt, int idx, Instant val, Column col) throws SQLException
      Set the given Instant value as a parameter to the statement.
      Throws:
      SQLException
    • setYear

      public void setYear(PreparedStatement stmnt, int idx, Year val, Column col) throws SQLException
      Set the given Year value as a parameter to the statement.
      Throws:
      SQLException
    • setDouble

      public void setDouble(PreparedStatement stmnt, int idx, double val, Column col) throws SQLException
      Set the given value as a parameter to the statement.
      Throws:
      SQLException
    • setFloat

      public void setFloat(PreparedStatement stmnt, int idx, float val, Column col) throws SQLException
      Set the given value as a parameter to the statement.
      Throws:
      SQLException
    • setInt

      public void setInt(PreparedStatement stmnt, int idx, int val, Column col) throws SQLException
      Set the given value as a parameter to the statement.
      Throws:
      SQLException
    • setLong

      public void setLong(PreparedStatement stmnt, int idx, long val, Column col) throws SQLException
      Set the given value as a parameter to the statement.
      Throws:
      SQLException
    • setLocale

      public void setLocale(PreparedStatement stmnt, int idx, Locale val, Column col) throws SQLException
      Set the given value as a parameter to the statement.
      Throws:
      SQLException
    • setNull

      public void setNull(PreparedStatement stmnt, int idx, int colType, Column col) throws SQLException
      Set null as a parameter to the statement. The column type will come from Types.
      Throws:
      SQLException
    • setNumber

      public void setNumber(PreparedStatement stmnt, int idx, Number num, Column col) throws SQLException
      Set the given value as a parameter to the statement.
      Throws:
      SQLException
    • setObject

      public void setObject(PreparedStatement stmnt, int idx, Object val, int colType, Column col) throws SQLException
      Set the given value as a parameter to the statement. The column type will come from Types.
      Throws:
      SQLException
    • setRef

      public void setRef(PreparedStatement stmnt, int idx, Ref val, Column col) throws SQLException
      Set the given value as a parameter to the statement.
      Throws:
      SQLException
    • setShort

      public void setShort(PreparedStatement stmnt, int idx, short val, Column col) throws SQLException
      Set the given value as a parameter to the statement.
      Throws:
      SQLException
    • setString

      public void setString(PreparedStatement stmnt, int idx, String val, Column col) throws SQLException
      Set the given value as a parameter to the statement.
      Throws:
      SQLException
    • setTime

      public void setTime(PreparedStatement stmnt, int idx, Time val, Calendar cal, Column col) throws SQLException
      Set the given value as a parameter to the statement.
      Throws:
      SQLException
    • getTimestampPrecision

      public int getTimestampPrecision(Column col)
      The granularity, in nanoseconds, to which a timestamp bound to the given column is rounded. A column whose precision - the number of fractional digits of a second it keeps - is known holds multiples of the corresponding power of ten; otherwise this is datePrecision. Binding a value at the precision the column stores makes a value read back, or kept in memory, compare equal to the stored one, which a timestamp version column depends on.
      Parameters:
      col - the column the value is bound to; may be null
      See Also:
    • setTimestamp

      public void setTimestamp(PreparedStatement stmnt, int idx, Timestamp val, Calendar cal, Column col) throws SQLException
      Set the given value as a parameter to the statement.
      Throws:
      SQLException
    • setTyped

      public void setTyped(PreparedStatement stmnt, int idx, Object val, Column col, int type, JDBCStore store) throws SQLException
      Set a column value into a prepared statement.
      Parameters:
      stmnt - the prepared statement to parameterize
      idx - the index of the parameter in the prepared statement
      val - the value of the column
      col - the column being set
      type - the field mapping type code for the value
      store - the store manager for the current context
      Throws:
      SQLException
    • setUnknown

      public void setUnknown(PreparedStatement stmt, int idx, Object val, Column col) throws SQLException
      Set a completely unknown parameter into a prepared statement.
      Throws:
      SQLException
    • setUnknown

      public void setUnknown(PreparedStatement stmnt, int idx, Column col, Object val) throws SQLException
      Set a completely unknown parameter into a prepared statement.
      Throws:
      SQLException
    • serialize

      public byte[] serialize(Object val, JDBCStore store) throws SQLException
      Return the serialized bytes for the given object.
      Throws:
      SQLException
    • putBytes

      public void putBytes(Blob blob, byte[] data) throws SQLException
      Invoke the JDK 1.4 setBytes method on the given BLOB object.
      Throws:
      SQLException
    • putString

      public void putString(Clob clob, String data) throws SQLException
      Invoke the JDK 1.4 setString method on the given CLOB object.
      Throws:
      SQLException
    • putChars

      public void putChars(Clob clob, char[] data) throws SQLException
      Invoke the JDK 1.4 setCharacterStream method on the given CLOB object.
      Throws:
      SQLException
    • storageWarning

      protected void storageWarning(Object orig, Object converted)
      Warn that a particular value could not be stored precisely. After the first warning for a particular type, messages will be turned into trace messages.
    • getJDBCType

      public int getJDBCType(int metaTypeCode, boolean lob)
      Return the preferred Types constant for the given JavaTypes or JavaSQLTypes constant.
    • getJDBCType

      public int getJDBCType(int metaTypeCode, boolean lob, int precis, int scale, boolean xml)
      Return the preferred Types constant for the given JavaTypes or JavaSQLTypes constant.
    • getJDBCType

      public int getJDBCType(int metaTypeCode, boolean lob, int precis, int scale)
      Return the preferred Types constant for the given JavaTypes or JavaSQLTypes constant.
    • getPreferredType

      public int getPreferredType(int type)
      Return the preferred Types type for the given one. Returns the given type by default.
    • getTypeName

      public String getTypeName(Column col)
      Return the preferred database type name for the given column's type from Types.
    • isUnsizedDecimal

      protected boolean isUnsizedDecimal(Column col)
      Whether the given column is a NUMERIC or DECIMAL column of a non integral Java type that has no column definition and no precision. Such a column may have a scale. Databases that read an unsized decimal type with scale 0 use this to create a type that keeps the fraction of the value instead.
    • getTypeName

      public String getTypeName(int type)
      Returns the type name for the specific constant as defined by Types.
      Parameters:
      type - the type
      Returns:
      the name for the type
    • appendSize

      protected String appendSize(Column col, String typeName)
      Helper method to add size properties to the specified type. If present, the string "{0}" will be replaced with the size definition; otherwise the size definition will be appended to the type name. If your database has column types that don't allow size definitions, override this method to return the unaltered type name for columns of those types (or add the type names to the fixedSizeTypeNameSet).

      Some databases support "type modifiers", for example the unsigned "modifier" in MySQL. In these cases the size should go between the type and the "modifier", instead of after the modifier. For example CREATE table FOO ( myint INT (10) UNSIGNED . . .) instead of CREATE table FOO ( myint INT UNSIGNED (10) . . .). Type modifiers should be added to typeModifierSet in subclasses.

    • getDateFractionDigits

      protected int getDateFractionDigits(Column col, String typeName)
      Only get's used if no explicit scale is used (@{code @Column(scale=0)} which is the default). Attention! @{code @Column(scale=-1)} disables the scale of a column
      Returns:
      the fraction length of types which have a fraction
      See Also:
    • getIntegerCastTypeName

      public String getIntegerCastTypeName()
      Return the type name to use as the target of a CAST to a 32 bit integer. Defaults to integerTypeName unless integerCastTypeName was set explicitly.
    • getLongCastTypeName

      public String getLongCastTypeName()
      Return the type name to use as the target of a CAST to a 64 bit integer. Defaults to bigintTypeName unless longCastTypeName was set explicitly.
    • getNumberCastTypeName

      public String getNumberCastTypeName(Class<?> type)
      Return the type name to use as the target of a CAST of a numeric value to the given java type. Any DDL size marker ({0}) is stripped, as CAST targets are not sized by the schema.
    • getStringCastTypeName

      public String getStringCastTypeName()
      Return the type name to use as the target of a CAST to a string. Any DDL size marker ({0}) is stripped.
    • insertSize

      protected String insertSize(String typeName, String size)
      Helper method that inserts a size clause for a given SQL type.
      Parameters:
      typeName - The SQL type e.g. INT
      size - The size clause e.g. (10)
      Returns:
      The typeName + size clause. Usually the size clause will be appended to typeName. If the typeName contains a marker : {0} or if typeName contains a modifier the size clause will be inserted appropriately.
    • setJoinSyntax

      public void setJoinSyntax(String syntax)
      Set the name of the join syntax to use: sql92, traditional, database.
    • isImplicitJoin

      public boolean isImplicitJoin()
    • getPlaceholderValueString

      public String getPlaceholderValueString(Column col)
      Return a SQL string to act as a placeholder for the given column.
    • toSelectCount

      public SQLBuffer toSelectCount(Select sel)
      Create a SELECT COUNT statement in the proper join syntax for the given instance.
    • toDelete

      public SQLBuffer toDelete(ClassMapping mapping, Select sel, Object[] params)
      Create a DELETE statement for the specified Select. If the database does not support the bulk delete statement (such as cases where a subselect is required and the database doesn't support subselects), this method should return null.
    • toUpdate

      public SQLBuffer toUpdate(ClassMapping mapping, Select sel, JDBCStore store, Object[] params, Map updates)
    • toBulkOperation

      protected SQLBuffer toBulkOperation(ClassMapping mapping, Select sel, JDBCStore store, Object[] params, Map updateParams)
      Returns the SQL for a bulk operation, either a DELETE or an UPDATE.
      Parameters:
      mapping - the mapping against which we are operating
      sel - the Select that will constitute the WHERE clause
      store - the current store
      updateParams - the Map that holds the update parameters; a null value indicates that this is a delete operation
      Returns:
      the SQLBuffer for the update, or null if it is not possible to perform the bulk update
    • appendBulkPrimaryKeysIn

      protected void appendBulkPrimaryKeysIn(ClassMapping mapping, Select sel, SQLBuffer sql)
      Append a condition that matches the primary keys of the rows that the given select finds, collected in a derived table. The select is changed to select those keys.
      Parameters:
      mapping - the mapping against which we are operating
      sel - the Select that holds the conditions of the bulk statement
      sql - the bulk statement to append the condition to
    • getSelectTableAliases

      protected Collection<String> getSelectTableAliases(Select sel)
    • getDeleteTargets

      protected SQLBuffer getDeleteTargets(Select sel)
    • appendUpdates

      protected void appendUpdates(Select sel, JDBCStore store, SQLBuffer sql, Object[] params, Map updateParams, boolean allowAlias)
    • allowsBulkUpdateOfJoinedTables

      public boolean allowsBulkUpdateOfJoinedTables(Select sel)
      Whether toUpdate(ClassMapping, Select, JDBCStore, Object[], Map) changes a bulk update with the given select in one statement that names the tables of the select under their aliases, so that it can set a column of any of these tables, such as a column of a joined superclass table or of a secondary table. Otherwise the statement only changes the table of the mapping.
    • toTableUpdate

      public SQLBuffer toTableUpdate(Table table, Select sel, JDBCStore store, Object[] params, Map<Path,Value> updates, Map<Column,?> versionUpdates)
      Create an UPDATE statement without a WHERE clause that sets the given fields and version columns, all of which are in the given table. A bulk update that sets columns of several tables, which the database cannot change in one statement, is issued as one such statement per table, restricted by the caller to the primary keys of the matching rows.
      Parameters:
      table - the table to update
      sel - the Select of the bulk update
      store - the current store
      params - the query parameters
      updates - the fields to set, keyed by their paths
      versionUpdates - the values of the version columns to set
    • getDeleteTableContentsSQL

      public String[] getDeleteTableContentsSQL(Table[] tables, Connection conn)
      Create SQL to delete the contents of the specified tables. The default implementation drops all non-deferred RESTRICT foreign key constraints involving the specified tables, issues DELETE statements against the tables, and then adds the dropped constraints back in. Databases with more optimal ways of deleting the contents of several tables should override this method.
    • toSelect

      public SQLBuffer toSelect(Select sel, boolean forUpdate, JDBCFetchConfiguration fetch)
      Create a SELECT statement in the proper join syntax for the given instance.
    • getFrom

      protected SQLBuffer getFrom(Select sel, boolean forUpdate)
      Return the portion of the select statement between the FROM keyword and the WHERE keyword.
    • getFromSelect

      protected SQLBuffer getFromSelect(Select sel, boolean forUpdate)
      Return the FROM clause for a select that selects from a tmp table created by an inner select.
    • getWhere

      protected SQLBuffer getWhere(Select sel, boolean forUpdate)
      Return the WHERE portion of the select statement, or null if no where conditions.
    • toTraditionalJoin

      public SQLBuffer toTraditionalJoin(Join join)
      Use the given join instance to create SQL joining its tables in the traditional style.
    • toSQL92Join

      public SQLBuffer toSQL92Join(Select sel, Join join, boolean forUpdate, boolean first)
      Use the given join instance to create SQL joining its tables in the SQL92 style.
    • toNativeJoin

      public SQLBuffer toNativeJoin(Join join)
      Use the given join instance to create SQL joining its tables in the database's native syntax. Throws an exception by default.
    • canOuterJoin

      public boolean canOuterJoin(int syntax, ForeignKey fk)
      Returns if the given foreign key can be eagerly loaded using other joins.
    • toSelect

      public SQLBuffer toSelect(SQLBuffer selects, JDBCFetchConfiguration fetch, SQLBuffer from, SQLBuffer where, SQLBuffer group, SQLBuffer having, SQLBuffer order, boolean distinct, boolean forUpdate, long start, long end)
      Combine the given components into a SELECT statement.
    • appendNullsPrecedence

      public void appendNullsPrecedence(SQLBuffer ordering, int nullPrecedence)
      Append the SQL representation of a JPA NULLS FIRST / NULLS LAST precedence to an ORDER BY buffer whose last appended term is already &lt;expr&gt; ASC or &lt;expr&gt; DESC.

      Default implementation emits ANSI SQL NULLS FIRST / NULLS LAST. Dialects that do not support the ANSI syntax should override this method to emulate the behavior (e.g. using &lt;expr&gt; IS NULL as an auxiliary sort key).

      Parameters:
      ordering - the in-progress ORDER BY buffer
      nullPrecedence - QueryExpressions.NULLS_FIRST or QueryExpressions.NULLS_LAST
    • toSelect

      protected SQLBuffer toSelect(SQLBuffer selects, JDBCFetchConfiguration fetch, SQLBuffer from, SQLBuffer where, SQLBuffer group, SQLBuffer having, SQLBuffer order, boolean distinct, boolean forUpdate, long start, long end, boolean subselect, Select sel)
      Combine the given components into a SELECT statement.
    • toSelect

      public SQLBuffer toSelect(SQLBuffer selects, JDBCFetchConfiguration fetch, SQLBuffer from, SQLBuffer where, SQLBuffer group, SQLBuffer having, SQLBuffer order, boolean distinct, boolean forUpdate, long start, long end, boolean subselect, boolean checkTableForUpdate)
    • toSelect

      protected SQLBuffer toSelect(SQLBuffer selects, JDBCFetchConfiguration fetch, SQLBuffer from, SQLBuffer where, SQLBuffer group, SQLBuffer having, SQLBuffer order, boolean distinct, boolean forUpdate, long start, long end, Select sel)
      Combine the given components into a SELECT statement.
    • getForUpdateClause

      protected String getForUpdateClause(JDBCFetchConfiguration fetch, boolean isForUpdate, Select sel)
      Get the update clause for the query based on the updateClause and isolationLevel hints
    • supportsIsolationForUpdate

      public boolean supportsIsolationForUpdate()
      Return true if the dictionary uses isolation level to compute the returned getForUpdateClause() SQL clause.
    • getSelectOperation

      public String getSelectOperation(JDBCFetchConfiguration fetch)
      Return the "SELECT" operation clause, adding any available hints, etc.
    • toOperation

      public SQLBuffer toOperation(String op, SQLBuffer selects, SQLBuffer from, SQLBuffer where, SQLBuffer group, SQLBuffer having, SQLBuffer order, boolean distinct, long start, long end, String forUpdateClause)
      Return the SQL for the given selecting operation.
    • toOperation

      public SQLBuffer toOperation(String op, SQLBuffer selects, SQLBuffer from, SQLBuffer where, SQLBuffer group, SQLBuffer having, SQLBuffer order, boolean distinct, long start, long end, String forUpdateClause, boolean subselect)
      Return the SQL for the given selecting operation.
    • appendSelectRange

      protected void appendSelectRange(SQLBuffer buf, long start, long end, boolean subselect)
      If this dictionary can select ranges, use this method to append the range SQL.
    • getSelects

      protected SQLBuffer getSelects(Select sel, boolean distinctIdentifiers, boolean forUpdate)
      Return the portion of the select statement between the SELECT keyword and the FROM keyword.
    • appendSelect

      protected void appendSelect(SQLBuffer selectSQL, Object elem, Select sel, int idx)
      Append elem to selectSQL.
      Parameters:
      selectSQL - The SQLBuffer to append to.
      elem - A SQLBuffer or a String to append.
      Since:
      1.1.0
    • supportsLocking

      public boolean supportsLocking(Select sel)
      Returns true if a "FOR UPDATE" clause can be used for the specified Select object.
    • supportsRandomAccessResultSet

      public boolean supportsRandomAccessResultSet(Select sel, boolean forUpdate)
      Return false if the given select requires a forward-only result set.
    • assertSupport

      public void assertSupport(boolean feature, String property)
      Assert that the given dictionary flag is true. If it is not true, throw an error saying that the given setting needs to return true for the current operation to work.
    • substring

      public void substring(SQLBuffer buf, FilterValue str, FilterValue start, FilterValue length)
      Invoke this database's substring function. Numeric parameters are inlined if possible. This is to handle grouping by SUBSTRING - most databases do not allow parameter binding in this case.
      Parameters:
      buf - the SQL buffer to write the substring invocation to
      str - a query value representing the target string
      start - a query value representing the start index
      length - a query value representing the length of substring, or null for none
    • replace

      public void replace(SQLBuffer buf, FilterValue from, FilterValue subs, FilterValue replacement)
    • left

      public void left(SQLBuffer buf, FilterValue str, FilterValue length)
    • right

      public void right(SQLBuffer buf, FilterValue str, FilterValue length)
    • indexOf

      public void indexOf(SQLBuffer buf, FilterValue str, FilterValue find, FilterValue start)
      Invoke this database's indexOf function.
      Parameters:
      buf - the SQL buffer to write the indexOf invocation to
      str - a query value representing the target string
      find - a query value representing the search string
      start - a query value representing the start index, or null to start at the beginning
    • mathFunction

      public void mathFunction(SQLBuffer buf, String op, FilterValue lhs, FilterValue rhs)
      Append the numeric parts of a mathematical function.
      Parameters:
      buf - the SQL buffer to write the math function
      op - the mathematical operation to perform
      lhs - the left hand side of the math function
      rhs - the right hand side of the math function
    • comparison

      public void comparison(SQLBuffer buf, String op, FilterValue lhs, FilterValue rhs)
      Append a comparison.
      Parameters:
      buf - the SQL buffer to write the comparison
      op - the comparison operation to perform
      lhs - the left hand side of the comparison
      rhs - the right hand side of the comparison
    • appendXmlComparison

      public void appendXmlComparison(SQLBuffer buf, String op, FilterValue lhs, FilterValue rhs, boolean lhsxml, boolean rhsxml)
      If this dictionary supports XML type, use this method to append xml predicate.
    • appendNumericCast

      protected void appendNumericCast(SQLBuffer buf, FilterValue val)
      Append SQL for the given numeric value to the buffer, casting as needed.
    • appendCast

      public void appendCast(SQLBuffer buf, Object val, int type)
      Cast the specified value to the specified type.
      Parameters:
      buf - the buffer to append the cast to
      val - the value to cast
      type - the type of the case, e.g. Types.NUMERIC
    • appendLength

      protected void appendLength(SQLBuffer buf, int type)
    • getExtractOperandCastType

      public String getExtractOperandCastType(int type)
      Return the SQL type to cast a parameter or literal operand of EXTRACT to, see requiresCastForExtractOperand.
      Parameters:
      type - the JDBC type of the operand, Types.DATE, Types.TIME or Types.TIMESTAMP
    • addCastAsType

      public String addCastAsType(String func, Val val)
      add CAST for a function operator where operand is a param
      Parameters:
      func - function name
      val -
      Returns:
      updated func
    • refSchemaComponents

      public void refSchemaComponents(Table table)
      Increment the reference count of any table components that this dictionary adds that are not used by mappings. Does nothing by default.
    • getColumnIdentifier

      public DBIdentifier getColumnIdentifier(Column column)
      Returns the name of the column using database specific delimiters.
    • getColumnDBName

      public String getColumnDBName(Column column)
    • toSnakeCase

      public String toSnakeCase(String name)
    • getFullIdentifier

      public DBIdentifier getFullIdentifier(Table table, boolean logical)
      Returns the full name of the table, including the schema (delimited by catalogSeparator).
    • getFullName

      public String getFullName(Table table, boolean logical)
    • getFullName

      public String getFullName(Index index)
      Returns the full name of the index, including the schema (delimited by the result of catalogSeparator).
    • getFullName

      public String getFullName(Sequence seq)
      Returns the full name of the sequence, including the schema (delimited by the result of catalogSeparator).
    • getInvalidColumnWordSet

      public final Set<String> getInvalidColumnWordSet()
      Return the subset of the words in reservedWordSet that cannot be used as valid column names for the current DB. If the column name is invalid the getValidColumnName method of the DB dictionary should be invoked to make it valid.
      See Also:
    • getValidTableName

      @Deprecated public String getValidTableName(String name, Schema schema)
      Deprecated.
      Make any necessary changes to the given table name to make it valid for the current DB.
    • getValidTableName

      public DBIdentifier getValidTableName(DBIdentifier name, Schema schema)
      Make any necessary changes to the given table name to make it valid for the current DB.
    • getInvalidTableWordSet

      public final Set<String> getInvalidTableWordSet()
      Return the words the database rejects as unquoted table and sequence names. The set is empty for databases the words were not measured on.
    • getValidDefaultTableName

      public DBIdentifier getValidDefaultTableName(DBIdentifier name)
      Make the given default table name valid if the database rejects it, that is if it is neither delimited nor all identifiers are delimited, and it is one of the invalid table words. Such a name is made valid like getValidTableName(DBIdentifier, Schema) does, but without making it unique in the schema, so that the same name is derived whether the table exists already or not. For any other name, including reserved words the database accepts as table names, the given identifier itself is returned.
    • getValidDefaultSequenceName

      public DBIdentifier getValidDefaultSequenceName(DBIdentifier name)
      Make the given default sequence name, the generator name of a sequence generator that names no sequence, valid if the database rejects it, under the same conditions as getValidDefaultTableName(DBIdentifier). Such a name is made valid like getValidSequenceName(DBIdentifier, Schema) does, but without making it unique in the schema. For any other name, including reserved words the database accepts as sequence names, the given identifier itself is returned.
    • getValidSequenceName

      @Deprecated public String getValidSequenceName(String name, Schema schema)
      Deprecated.
      Make any necessary changes to the given sequence name to make it valid for the current DB.
    • getValidSequenceName

      public DBIdentifier getValidSequenceName(DBIdentifier name, Schema schema)
      Make any necessary changes to the given sequence name to make it valid for the current DB.
    • getValidColumnName

      @Deprecated public String getValidColumnName(String name, Table table)
      Deprecated.
      Make any necessary changes to the given column name to make it valid for the current DB. The column name will be made unique for the specified table.
    • processDBColumnName

      public DBIdentifier processDBColumnName(DBIdentifier name)
    • getValidColumnName

      public DBIdentifier getValidColumnName(DBIdentifier name, Table table)
      Make any necessary changes to the given column name to make it valid for the current DB. The column name will be made unique for the specified table.
    • getValidColumnName

      @Deprecated public String getValidColumnName(String name, Table table, boolean checkForUniqueness)
      Deprecated.
      Make any necessary changes to the given column name to make it valid for the current DB. If checkForUniqueness is true, the column name will be made unique for the specified table.
    • getValidColumnName

      public DBIdentifier getValidColumnName(DBIdentifier name, Table table, boolean checkForUniqueness)
      Make any necessary changes to the given column name to make it valid for the current DB. If checkForUniqueness is true, the column name will be made unique for the specified table.
    • getValidPrimaryKeyName

      public String getValidPrimaryKeyName(String name, Table table)
      Make any necessary changes to the given primary key name to make it valid for the current DB.
    • getValidForeignKeyName

      @Deprecated public String getValidForeignKeyName(String name, Table table, Table toTable)
      Deprecated.
      Make any necessary changes to the given foreign key name to make it valid for the current DB.
    • getValidForeignKeyName

      public DBIdentifier getValidForeignKeyName(DBIdentifier name, Table table, Table toTable)
      Make any necessary changes to the given foreign key name to make it valid for the current DB.
    • getValidIndexName

      @Deprecated public String getValidIndexName(String name, Table table)
      Deprecated.
      Make any necessary changes to the given index name to make it valid for the current DB.
    • getValidIndexName

      public DBIdentifier getValidIndexName(DBIdentifier name, Table table)
      Make any necessary changes to the given index name to make it valid for the current DB.
    • getValidUniqueName

      @Deprecated public String getValidUniqueName(String name, Table table)
      Deprecated.
      Make any necessary changes to the given unique constraint name to make it valid for the current DB.
    • getValidUniqueName

      public DBIdentifier getValidUniqueName(DBIdentifier name, Table table)
      Make any necessary changes to the given unique constraint name to make it valid for the current DB.
    • shorten

      public static String shorten(String name, int targetLength)
      Shorten the specified name to the specified target name. This will be done by first stripping out the vowels, and then removing characters from the middle of the word until it reaches the target length.
    • makeNameValid

      @Deprecated protected String makeNameValid(String name, NameSet set, int maxLen, int nameType)
      Deprecated.
      Shortens the given name to the given maximum length, then checks that it is not a reserved word. If it is reserved, appends a "0". If the name conflicts with an existing schema component, the last character is replace with '0', then '1', etc. Note that the given max len may be 0 if the database metadata is incomplete.
    • makeNameValid

      protected DBIdentifier makeNameValid(DBIdentifier name, NameSet set, int maxLen, int nameType)
      Shortens the given name to the given maximum length, then checks that it is not a reserved word. If it is reserved, appends a "0". If the name conflicts with an existing schema component, the last character is replace with '0', then '1', etc. Note that the given max len may be 0 if the database metadata is incomplete.
    • makeNameValid

      protected String makeNameValid(String name, NameSet set, int maxLen, int nameType, boolean checkForUniqueness)
      Shortens the given name to the given maximum length, then checks that it is not a reserved word. If it is reserved, appends a "0". If the name conflicts with an existing schema component and uniqueness checking is enabled, the last character is replace with '0', then '1', etc. Note that the given max len may be 0 if the database metadata is incomplete. Note: If the name is delimited, make sure the ending delimiter is not stripped off.
    • makeNameValid

      protected DBIdentifier makeNameValid(DBIdentifier name, NameSet set, int maxLen, int nameType, boolean checkForUniqueness)
      Shortens the given name to the given maximum length, then checks that it is not a reserved word. If it is reserved, appends a "0". If the name conflicts with an existing schema component and uniqueness checking is enabled, the last character is replace with '0', then '1', etc. Note that the given max len may be 0 if the database metadata is incomplete. Note: If the name is delimited, make sure the ending delimiter is not stripped off.
    • getCreateTableSQL

      public String[] getCreateTableSQL(Table table, SchemaGroup group)
      Return a series of SQL statements to create the given table, complete with columns. Indexes and constraints will be created separately.
    • getCreateTableSQL

      public String[] getCreateTableSQL(Table table)
      Return a series of SQL statements to create the given table, complete with columns. Indexes and constraints will be created separately.
    • getBatchFetchSize

      public int getBatchFetchSize(int batchFetchSize)
    • comment

      protected StringBuilder comment(StringBuilder buf, String comment)
    • getDropTableSQL

      public String[] getDropTableSQL(Table table)
      Return a series of SQL statements to drop the given table. Indexes will be dropped separately. Returns DROP TABLE <table name> by default.
    • getCreateSequenceSQL

      public String[] getCreateSequenceSQL(Sequence seq)
      Return a series of SQL statements to create the given sequence. Returns CREATE SEQUENCE <sequence name>[ START WITH <start>] [ INCREMENT BY <increment>] by default.
    • getAlterSequenceSQL

      public String getAlterSequenceSQL(Sequence seq)
    • getSequenceIncrement

      public Long getSequenceIncrement(Connection conn, Sequence seq) throws SQLException
      Return the INCREMENT BY that the given sequence has in the database. NativeJDBCSeq asks for it when disableAlterSeqenceIncrementBy is set, so that it only caches values between two calls of the sequence which the database will not hand out itself.
      Returns:
      null if this dictionary cannot read the increment of a sequence (the default), a value below 1 if the sequence was not found, the increment otherwise
      Throws:
      SQLException
    • getDropSequenceSQL

      public String[] getDropSequenceSQL(Sequence seq)
      Return a series of SQL statements to drop the given sequence. Returns DROP SEQUENCE <sequence name> by default.
    • getCreateIndexSQL

      public String[] getCreateIndexSQL(Index index)
      Return a series of SQL statements to create the given index. Returns CREATE [UNIQUE] INDEX <index name> ON <table name> (<col list>) by default.
    • getDropIndexSQL

      public String[] getDropIndexSQL(Index index)
      Return a series of SQL statements to drop the given index. Returns DROP INDEX <index name> by default.
    • getAddColumnSQL

      public String[] getAddColumnSQL(Column column)
      Return a series of SQL statements to add the given column to its table. Return an empty array if operation not supported. Returns ALTER TABLE <table name> ADD (<col dec>) by default.
    • getDropColumnSQL

      public String[] getDropColumnSQL(Column column)
      Return a series of SQL statements to drop the given column from its table. Return an empty array if operation not supported. Returns ALTER TABLE <table name> DROP COLUMN <col name> by default.
    • getAddPrimaryKeySQL

      public String[] getAddPrimaryKeySQL(PrimaryKey pk)
      Return a series of SQL statements to add the given primary key to its table. Return an empty array if operation not supported. Returns ALTER TABLE <table name> ADD <pk cons sql > by default.
    • getDropPrimaryKeySQL

      public String[] getDropPrimaryKeySQL(PrimaryKey pk)
      Return a series of SQL statements to drop the given primary key from its table. Return an empty array if operation not supported. Returns ALTER TABLE <table name> DROP CONSTRAINT <pk name> by default.
    • getAddForeignKeySQL

      public String[] getAddForeignKeySQL(ForeignKey fk)
      Return a series of SQL statements to add the given foreign key to its table. Return an empty array if operation not supported. Returns ALTER TABLE <table name> ADD <fk cons sql > by default.
    • getDropForeignKeySQL

      public String[] getDropForeignKeySQL(ForeignKey fk, Connection conn)
      Return a series of SQL statements to drop the given foreign key from its table. Return an empty array if operation not supported. Returns ALTER TABLE <table name> DROP CONSTRAINT <fk name> by default.
    • getDeclareColumnSQL

      protected String getDeclareColumnSQL(Column col, boolean alter)
      Return the declaration SQL for the given column. This method is used for each column from within getCreateTableSQL(Table, SchemaGroup) and getAddColumnSQL(Column).
    • getPrimaryKeyConstraintSQL

      protected String getPrimaryKeyConstraintSQL(PrimaryKey pk)
      Return the declaration SQL for the given primary key. This method is used from within getCreateTableSQL(Table, SchemaGroup) and getAddPrimaryKeySQL(PrimaryKey). Returns CONSTRAINT <pk name> PRIMARY KEY (<col list>) by default.
    • getForeignKeyConstraintSQL

      protected String getForeignKeyConstraintSQL(ForeignKey fk)
      Return the declaration SQL for the given foreign key, or null if it is not supported. This method is used from within getCreateTableSQL(Table, SchemaGroup) and getAddForeignKeySQL(ForeignKey). Returns CONSTRAINT <cons name> FOREIGN KEY (<col list>) REFERENCES <foreign table> (<col list>) [ON DELETE <action>] [ON UPDATE <action>] by default.
    • supportsDeferredForeignKeyConstraints

      protected boolean supportsDeferredForeignKeyConstraints()
      Whether or not this dictionary supports deferred foreign key constraints. This implementation returns supportsUniqueConstraints.
      Since:
      1.1.0
    • supportsDeleteAction

      public boolean supportsDeleteAction(int action)
      Whether this database supports the given foreign key delete action.
    • supportsUpdateAction

      public boolean supportsUpdateAction(int action)
      Whether this database supports the given foreign key update action.
    • getUniqueConstraintSQL

      protected String getUniqueConstraintSQL(Unique unq)
      Return the declaration SQL for the given unique constraint. This method is used from within getCreateTableSQL(Table, SchemaGroup). Returns CONSTRAINT <name> UNIQUE (<col list>) by default.
    • supportsDeferredUniqueConstraints

      protected boolean supportsDeferredUniqueConstraints()
      Whether or not this dictionary supports deferred unique constraints. This implementation returns supportsUniqueConstraints.
      Since:
      1.1.0
    • isSystemTable

      @Deprecated public boolean isSystemTable(String name, String schema, boolean targetSchema)
      Deprecated.
      This method is used to filter system tables from database metadata. Return true if the given table name represents a system table that should not appear in the schema definition. By default, returns true only if the given table is in the internal list of system tables, or if the given schema is in the list of system schemas and is not the target schema.
      Parameters:
      name - the table name
      schema - the table schema; may be null
      targetSchema - if true, then the given schema was listed by the user as one of his schemas
    • isSystemTable

      public boolean isSystemTable(DBIdentifier name, DBIdentifier schema, boolean targetSchema)
      This method is used to filter system tables from database metadata. Return true if the given table name represents a system table that should not appear in the schema definition. By default, returns true only if the given table is in the internal list of system tables, or if the given schema is in the list of system schemas and is not the target schema.
      Parameters:
      name - the table name
      schema - the table schema; may be null
      targetSchema - if true, then the given schema was listed by the user as one of his schemas
    • isSystemIndex

      @Deprecated public boolean isSystemIndex(String name, Table table)
      Deprecated.
      This method is used to filter system indexes from database metadata. Return true if the given index name represents a system index that should not appear in the schema definition. Returns false by default.
      Parameters:
      name - the index name
      table - the index table
    • isSystemIndex

      public boolean isSystemIndex(DBIdentifier name, Table table)
      This method is used to filter system indexes from database metadata. Return true if the given index name represents a system index that should not appear in the schema definition. Returns false by default.
      Parameters:
      name - the index name
      table - the index table
    • isSystemSequence

      @Deprecated public boolean isSystemSequence(String name, String schema, boolean targetSchema)
      Deprecated.
      This method is used to filter system sequences from database metadata. Return true if the given sequence represents a system sequence that should not appear in the schema definition. Returns true if system schema by default.
      Parameters:
      name - the table name
      schema - the table schema; may be null
      targetSchema - if true, then the given schema was listed by the user as one of his schemas
    • isDroppable

      public boolean isDroppable(Sequence seq)
      Subclasses can override this method to implement custom logic
      Parameters:
      seq - - Sequence to check
      Returns:
      true if Sequence can be deleted, false otherwise
    • isSystemSequence

      public boolean isSystemSequence(DBIdentifier name, DBIdentifier schema, boolean targetSchema)
      This method is used to filter system sequences from database metadata. Return true if the given sequence represents a system sequence that should not appear in the schema definition. Returns true if system schema by default.
      Parameters:
      name - the table name
      schema - the table schema; may be null
      targetSchema - if true, then the given schema was listed by the user as one of his schemas
    • isSystemSequence

      public boolean isSystemSequence(DBIdentifier name, DBIdentifier schema, boolean targetSchema, Connection conn)
      This method is used to filter system sequences from database metadata. Return true if the given sequence represents a system sequence that should not appear in the schema definition. Returns true if system schema by default.
      Parameters:
      name - the table name
      schema - the table schema; may be null
      targetSchema - if true, then the given schema was listed by the user as one of his schemas
      conn - connection to the database
    • getTables

      @Deprecated public Table[] getTables(DatabaseMetaData meta, String catalog, String schemaName, String tableName, Connection conn) throws SQLException
      Deprecated.
      not used by openjpa internally anymore
      Reflect on the schema to find tables matching the given name pattern.
      Throws:
      SQLException
      See Also:
    • getTables

      public Table[] getTables(DatabaseMetaData meta, DBIdentifier sqlCatalog, DBIdentifier sqlSchemaName, DBIdentifier sqlTableName, Connection conn) throws SQLException
      Reflect on the schema to find tables matching the given name pattern.
      Throws:
      SQLException
    • newTable

      protected Table newTable(ResultSet tableMeta) throws SQLException
      Create a new table from the information in the schema metadata.
      Throws:
      SQLException
    • getSequences

      @Deprecated public Sequence[] getSequences(DatabaseMetaData meta, String catalog, String schemaName, String sequenceName, Connection conn) throws SQLException
      Deprecated.
      Reflect on the schema to find sequences matching the given name pattern. Returns an empty array by default, as there is no standard way to retrieve a list of sequences.
      Throws:
      SQLException
    • getSequences

      public Sequence[] getSequences(DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier sequenceName, Connection conn) throws SQLException
      Throws:
      SQLException
    • newSequence

      protected Sequence newSequence(ResultSet sequenceMeta) throws SQLException
      Create a new sequence from the information in the schema metadata.
      Throws:
      SQLException
    • getSequencesSQL

      @Deprecated protected String getSequencesSQL(String schemaName, String sequenceName)
      Deprecated.
      Return the SQL needed to select the list of sequences.
    • getSequencesSQL

      protected String getSequencesSQL(DBIdentifier schemaName, DBIdentifier sequenceName)
    • getColumns

      @Deprecated public Column[] getColumns(DatabaseMetaData meta, String catalog, String schemaName, String tableName, String columnName, Connection conn) throws SQLException
      Deprecated.
      Reflect on the schema to find columns matching the given table and column patterns.
      Throws:
      SQLException
    • getColumns

      public Column[] getColumns(DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier tableName, DBIdentifier columnName, Connection conn) throws SQLException
      Reflect on the schema to find columns matching the given table and column patterns.
      Throws:
      SQLException
    • newColumn

      protected Column newColumn(ResultSet colMeta) throws SQLException
      Create a new column from the information in the schema metadata.
      Throws:
      SQLException
    • getPrimaryKeys

      @Deprecated public PrimaryKey[] getPrimaryKeys(DatabaseMetaData meta, String catalog, String schemaName, String tableName, Connection conn) throws SQLException
      Deprecated.
      Reflect on the schema to find primary keys for the given table pattern.
      Throws:
      SQLException
    • getPrimaryKeys

      public PrimaryKey[] getPrimaryKeys(DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier tableName, Connection conn) throws SQLException
      Reflect on the schema to find primary keys for the given table pattern.
      Throws:
      SQLException
    • getPrimaryKeysFromGetPrimaryKeys

      @Deprecated protected PrimaryKey[] getPrimaryKeysFromGetPrimaryKeys(DatabaseMetaData meta, String catalog, String schemaName, String tableName, Connection conn) throws SQLException
      Deprecated.
      Reflect on the schema to find primary keys for the given table pattern.
      Throws:
      SQLException
    • getPrimaryKeysFromGetPrimaryKeys

      protected PrimaryKey[] getPrimaryKeysFromGetPrimaryKeys(DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier tableName, Connection conn) throws SQLException
      Reflect on the schema to find primary keys for the given table pattern.
      Throws:
      SQLException
    • newPrimaryKey

      protected PrimaryKey newPrimaryKey(ResultSet pkMeta) throws SQLException
      Create a new primary key from the information in the schema metadata.
      Throws:
      SQLException
    • getPrimaryKeysFromBestRowIdentifier

      @Deprecated protected PrimaryKey[] getPrimaryKeysFromBestRowIdentifier(DatabaseMetaData meta, String catalog, String schemaName, String tableName, Connection conn) throws SQLException
      Deprecated.
      Reflect on the schema to find primary keys for the given table pattern.
      Throws:
      SQLException
    • getPrimaryKeysFromBestRowIdentifier

      protected PrimaryKey[] getPrimaryKeysFromBestRowIdentifier(DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier tableName, Connection conn) throws SQLException
      Reflect on the schema to find primary keys for the given table pattern.
      Throws:
      SQLException
    • getIndexInfo

      @Deprecated public Index[] getIndexInfo(DatabaseMetaData meta, String catalog, String schemaName, String tableName, boolean unique, boolean approx, Connection conn) throws SQLException
      Deprecated.
      Reflect on the schema to find indexes matching the given table pattern.
      Throws:
      SQLException
    • getIndexInfo

      public Index[] getIndexInfo(DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier tableName, boolean unique, boolean approx, Connection conn) throws SQLException
      Reflect on the schema to find indexes matching the given table pattern.
      Throws:
      SQLException
    • newIndex

      protected Index newIndex(ResultSet idxMeta) throws SQLException
      Create a new index from the information in the schema metadata.
      Throws:
      SQLException
    • getImportedKeys

      @Deprecated public ForeignKey[] getImportedKeys(DatabaseMetaData meta, String catalog, String schemaName, String tableName, Connection conn) throws SQLException
      Deprecated.
      Reflect on the schema to return foreign keys imported by the given table pattern.
      Throws:
      SQLException
    • getImportedKeys

      public ForeignKey[] getImportedKeys(DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier tableName, Connection conn) throws SQLException
      Reflect on the schema to return foreign keys imported by the given table pattern.
      Throws:
      SQLException
    • getImportedKeys

      @Deprecated public ForeignKey[] getImportedKeys(DatabaseMetaData meta, String catalog, String schemaName, String tableName, Connection conn, boolean partialKeys) throws SQLException
      Deprecated.
      Reflect on the schema to return full foreign keys imported by the given table pattern.
      Throws:
      SQLException
    • getImportedKeys

      public ForeignKey[] getImportedKeys(DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier tableName, Connection conn, boolean partialKeys) throws SQLException
      Reflect on the schema to return full foreign keys imported by the given table pattern.
      Throws:
      SQLException
    • combineForeignKey

      protected ForeignKey combineForeignKey(Map<ForeignKey.FKMapKey, ForeignKey> fkMap, ForeignKey fk)
      Combines partial foreign keys into singular key
    • newForeignKey

      protected ForeignKey newForeignKey(ResultSet fkMeta) throws SQLException
      Create a new foreign key from the information in the schema metadata.
      Throws:
      SQLException
    • getTableNameForMetadata

      protected String getTableNameForMetadata(String tableName)
      Returns the table name that will be used for obtaining information from DatabaseMetaData.
    • getTableNameForMetadata

      protected String getTableNameForMetadata(DBIdentifier tableName)
      Returns the table name that will be used for obtaining information from DatabaseMetaData.
    • getSchemaNameForMetadata

      protected String getSchemaNameForMetadata(String schemaName)
      Returns the schema name that will be used for obtaining information from DatabaseMetaData.
    • getSchemaNameForMetadata

      protected String getSchemaNameForMetadata(DBIdentifier schemaName)
      Returns the schema name that will be used for obtaining information from DatabaseMetaData.
    • getCatalogNameForMetadata

      protected String getCatalogNameForMetadata(String catalogName)
      Returns the catalog name that will be used for obtaining information from DatabaseMetaData.
    • getCatalogNameForMetadata

      protected String getCatalogNameForMetadata(DBIdentifier catalogName)
      Returns the catalog name that will be used for obtaining information from DatabaseMetaData.
    • getColumnNameForMetadata

      protected String getColumnNameForMetadata(String columnName)
      Returns the column name that will be used for obtaining information from DatabaseMetaData.
    • getColumnNameForMetadata

      protected String getColumnNameForMetadata(DBIdentifier columnName)
      Returns the column name that will be used for obtaining information from DatabaseMetaData.
    • convertSchemaCase

      public String convertSchemaCase(String objectName)
      Convert the specified schema name to a name that the database will be able to understand.
    • convertSchemaCase

      public String convertSchemaCase(DBIdentifier objectName)
      Convert the specified schema name to a name that the database will be able to understand.
    • getSchemaCase

      public String getSchemaCase()
      Return DB specific schemaCase
      Specified by:
      getSchemaCase in interface IdentifierConfiguration
      Returns:
      upper, lower, or preserve
    • getGeneratedKey

      public Object getGeneratedKey(Column col, Connection conn) throws SQLException
      Return the last generated value for the given column. Throws an exception by default if lastGeneratedKeyQuery is null.
      Throws:
      SQLException
    • getGenKeySeqName

      protected String getGenKeySeqName(String query, Column col)
    • getGeneratedKeySequenceName

      protected String getGeneratedKeySequenceName(Column col)
      Return the sequence name used by databases for the given autoassigned column. This is only used by databases that require an explicit name to be used for auto-assign support.
    • getStoredProcedure

      public StoredProcedure getStoredProcedure(DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schema, String procedure) throws SQLException
      Gets the metadata of the stored procedure by the given name either from the cached version or by enquiring the database.
      Parameters:
      meta - the database meta data
      catalog - the catalog name or null
      schema - the schema name or null
      procedure - the procedure name
      Returns:
      metadata about the named procedure or null
      Throws:
      SQLException - when metadata query goes wrong
    • getStoredProcedureNameCandidates

      protected List<String> getStoredProcedureNameCandidates(String procedure)
      The names to look up a stored procedure with in the database metadata, in order of preference. Metadata lookups are case sensitive, but the procedure was most likely created with an unquoted name, which the database folded according to its schemaCase: e.g. Derby and Oracle store unquoted names in upper case, PostgreSQL in lower case. Hence the given name is tried as is first, then folded to upper case if this database folds to upper case, then in lower case and finally in upper case.
    • getStoredProcedureCallSQL

      public String getStoredProcedureCallSQL(StoredProcedure procedure)
      Gets the SQL to pass to Connection.prepareCall(String) for calling the given procedure. Defaults to StoredProcedure.getCallSQL().
    • setConfiguration

      public void setConfiguration(Configuration conf)
      ////////////////////////////
      Specified by:
      setConfiguration in interface Configurable
    • startConfiguration

      public void startConfiguration()
      Description copied from interface: Configurable
      Invoked before bean property configuration is begun on this object.
      Specified by:
      startConfiguration in interface Configurable
    • endConfiguration

      public void endConfiguration()
      Description copied from interface: Configurable
      Invoked upon completion of bean property configuration for this object.
      Specified by:
      endConfiguration in interface Configurable
    • addErrorCode

      public void addErrorCode(int errorType, String errorCode)
    • setTimeouts

      public void setTimeouts(PreparedStatement stmnt, JDBCFetchConfiguration fetch, boolean forUpdate) throws SQLException
      FIXME - OPENJPA-957 - lockTimeout is a server-side function and shouldn't be using client-side setQueryTimeout for lock timeouts. This method is to provide override for non-JDBC or JDBC-like implementation of setting query and lock timeouts.
      Parameters:
      stmnt -
      fetch - - optional lock and query timeouts in milliseconds
      forUpdate - - true if we should also try setting a lock timeout
      Throws:
      SQLException
    • setTimeouts

      public void setTimeouts(PreparedStatement stmnt, JDBCConfiguration conf, boolean forUpdate) throws SQLException
      FIXME - OPENJPA-957 - lockTimeout is a server-side function and shouldn't be using client-side setQueryTimeout for lock timeouts. This method is to provide override for non-JDBC or JDBC-like implementation of setting query and lock timeouts.
      Parameters:
      stmnt -
      conf - - optional lock and query timeouts in milliseconds
      forUpdate - - true if we should also try setting a lock timeout
      Throws:
      SQLException
    • setQueryTimeout

      public void setQueryTimeout(PreparedStatement stmnt, int timeout) throws SQLException
      Provides the default validation handling of setting a query timeout.
      Parameters:
      stmnt -
      timeout - in milliseconds
      Throws:
      SQLException
    • setStatementQueryTimeout

      protected void setStatementQueryTimeout(PreparedStatement stmnt, int timeout) throws SQLException
      Allow subclasses to provide DB unique override implementations of setting query timeouts, while preserving the default timeout logic in the public setQueryTimeout method.
      Parameters:
      stmnt -
      timeout - in milliseconds
      Throws:
      SQLException
    • decorate

      public Connection decorate(Connection conn) throws SQLException
      Decorate the given connection if needed. Some databases require special handling for JDBC bugs. This implementation issues any initializationSQL that has been set for the dictionary but does not decorate the connection.
      Specified by:
      decorate in interface ConnectionDecorator
      Throws:
      SQLException
    • isReplicationConnection

      public boolean isReplicationConnection(Connection conn) throws SQLException
      Whether the given connection is a replication connection, whose driver sends the statements of a read-only connection to a replica. The store keeps such a connection read-only outside of a transaction, so that the reads go to a replica, and makes it writable when a transaction begins. This implementation returns false.
      Parameters:
      conn - a connection of the store, possibly wrapped by OpenJPA's decorators
      Throws:
      SQLException
      Since:
      4.2.0
    • handleWarning

      public void handleWarning(SQLWarning warning) throws SQLException
      Implementation of the LoggingConnectionDecorator.SQLWarningHandler interface that allows customization of the actions to perform when a SQLWarning occurs at any point on a Connection, Statement, or ResultSet. This method may be used determine those warnings the application wants to consider critical failures, and throw the warning in those cases. By default, this method does nothing.
      Specified by:
      handleWarning in interface LoggingConnectionDecorator.SQLWarningHandler
      Throws:
      SQLException
      See Also:
    • newStoreException

      public OpenJPAException newStoreException(String msg, SQLException[] causes, Object failed)
      Return a new exception that wraps causes. However, the details of exactly what type of exception is returned can be determined by the implementation. This may take into account DB-specific exception information in causes.
    • matchErrorState

      protected int matchErrorState(Map<Integer, Set<String>> errorStates, SQLException ex)
      Determine the more appropriate type of store exception by matching the SQL Error State of the the given SQLException to the given Error States categorized by error types. Dictionary subclass can override this method and extract SQLException data to figure out if the exception is recoverable.
      Parameters:
      errorStates - classification of SQL error states by their specific nature. The keys of the map represent one of the constants defined in StoreException. The value corresponding to a key represent the set of SQL Error States representing specific category of database error. This supplied map is sourced from sql-error-state-codes.xml and filtered the error states for the current database.
      ex - original SQL Exception as raised by the database driver.
      Returns:
      A constant indicating the category of error as defined in StoreException.
    • isFatalException

      public boolean isFatalException(int subtype, SQLException ex)
      Determine if the given SQL Exception is fatal or recoverable (such as a timeout). This implementation always returns true (i.e. all exceptions are fatal). The current dictionary implementation can overwrite this method to mark certain exception conditions as recoverable error.
      Parameters:
      subtype - A constant indicating the category of error as defined in StoreException.
      ex - original SQL Exception as raised by the database driver.
      Returns:
      false if the error is fatal.
    • closeDataSource

      public void closeDataSource(DataSource dataSource)
      Closes the specified DataSource and releases any resources associated with it.
      Parameters:
      dataSource - the DataSource to close
    • getVersionColumn

      public String getVersionColumn(Column column, String tableAlias)
      Return version column name
      Parameters:
      column -
      tableAlias - : this is needed for platform specific version column
    • getVersionColumn

      public DBIdentifier getVersionColumn(Column column, DBIdentifier tableAlias)
    • insertBlobForStreamingLoad

      public void insertBlobForStreamingLoad(Row row, Column col, JDBCStore store, Object ob, Select sel) throws SQLException
      Throws:
      SQLException
    • insertClobForStreamingLoad

      public void insertClobForStreamingLoad(Row row, Column col, Object ob) throws SQLException
      Throws:
      SQLException
    • updateBlob

      public void updateBlob(Select sel, JDBCStore store, InputStream is) throws SQLException
      Throws:
      SQLException
    • updateClob

      public void updateClob(Select sel, JDBCStore store, Reader reader) throws SQLException
      Throws:
      SQLException
    • copy

      protected long copy(InputStream in, OutputStream out) throws IOException
      Throws:
      IOException
    • copy

      protected long copy(Reader reader, Writer writer) throws IOException
      Throws:
      IOException
    • getCastFunction

      public String getCastFunction(Val val, String func)
      Attach CAST to the current function if necessary
      Parameters:
      val - operand value
      Returns:
      a String with the correct CAST function syntax
    • getCastFunction

      public String getCastFunction(Val val, String func, Column col)
      Return the correct CAST function syntax. This should be overriden by subclasses that need access to the Column information.
      Parameters:
      val - operand of cast
      func - original string
      col - database column
      Returns:
      a String with the correct CAST function syntax
    • createIndexIfNecessary

      @Deprecated public void createIndexIfNecessary(Schema schema, String table, Column pkColumn)
      Deprecated.
      Create an index if necessary for some database tables
    • createIndexIfNecessary

      public void createIndexIfNecessary(Schema schema, DBIdentifier table, Column pkColumn)
    • getBatchLimit

      public int getBatchLimit()
      Return the batchLimit
    • setBatchLimit

      public void setBatchLimit(int limit)
      Set the batchLimit value
    • validateBatchProcess

      public boolean validateBatchProcess(RowImpl row, Column[] autoAssign, OpenJPAStateManager sm, ClassMapping cmd)
      Validate the batch process. In some cases, we can't batch the statements due to some restrictions. For example, if the GeneratedType=IDENTITY, we have to disable the batch process because we need to get the ID value right away for the in-memory entity to use.
    • validateDBSpecificBatchProcess

      public boolean validateDBSpecificBatchProcess(boolean disableBatch, RowImpl row, Column[] autoAssign, OpenJPAStateManager sm, ClassMapping cmd)
      Allow each Dictionary to validate its own batch process.
    • executeQuery

      protected ResultSet executeQuery(Connection conn, PreparedStatement stmnt, String sql) throws SQLException
      This method is to provide override for non-JDBC or JDBC-like implementation of executing query.
      Throws:
      SQLException
    • prepareStatement

      protected PreparedStatement prepareStatement(Connection conn, String sql) throws SQLException
      This method is to provide override for non-JDBC or JDBC-like implementation of preparing statement.
      Throws:
      SQLException
    • getSequence

      protected Sequence[] getSequence(ResultSet rs) throws SQLException
      This method is to provide override for non-JDBC or JDBC-like implementation of getting sequence from the result set.
      Throws:
      SQLException
    • getKey

      protected Object getKey(ResultSet rs, Column col) throws SQLException
      This method is to provide override for non-JDBC or JDBC-like implementation of getting key from the result set.
      Throws:
      SQLException
    • calculateValue

      protected void calculateValue(Val val, Select sel, ExpContext ctx, ExpState state, Path path, ExpState pathState)
      This method is to provide override for non-JDBC or JDBC-like implementation of calculating value.
    • isSelect

      public boolean isSelect(String sql)
      Determine whether the provided sql may be treated as a select statement on this database.
      Parameters:
      sql - A sql statement.
      Returns:
      true if sql represents a select statement.
    • needsToCreateIndex

      public boolean needsToCreateIndex(Index idx, Table table, Unique[] uniques)
    • needsToCreateIndex

      public boolean needsToCreateIndex(Index idx, Table table)
    • getBatchUpdateCount

      public int getBatchUpdateCount(PreparedStatement ps) throws SQLException
      Return batched statements update success count
      Parameters:
      ps - A PreparedStatement
      Returns:
      return update count
      Throws:
      SQLException
    • getTrimSchemaName

      public boolean getTrimSchemaName()
    • setTrimSchemaName

      public void setTrimSchemaName(boolean trimSchemaName)
    • deleteStream

      public void deleteStream(JDBCStore store, Select sel) throws SQLException
      Throws:
      SQLException
    • setDelimitedCase

      protected void setDelimitedCase(DatabaseMetaData metaData)
    • getSupportsDelimitedIdentifiers

      public boolean getSupportsDelimitedIdentifiers()
      Description copied from interface: IdentifierConfiguration
      Returns true if delimiting is supported
      Specified by:
      getSupportsDelimitedIdentifiers in interface IdentifierConfiguration
      Returns:
      the supportsDelimitedIds
    • setSupportsDelimitedIdentifiers

      public void setSupportsDelimitedIdentifiers(boolean supportsDelimitedIds)
      Parameters:
      supportsDelimitedIds - the supportsDelimitedIds to set
    • getStoreCharsAsNumbers

      public boolean getStoreCharsAsNumbers()
      Whether Java char fields are stored in numeric columns rather than as CHAR values.
      See Also:
    • setStoreCharsAsNumbers

      public void setStoreCharsAsNumbers(boolean storeCharsAsNumbers)
      Explicitly configure whether Java char fields are stored in numeric columns rather than as CHAR values. User configuration such as openjpa.jdbc.DBDictionary=postgres(StoreCharsAsNumbers=true) goes through this setter. A value set this way is treated as an explicit user choice: dictionaries that auto-detect a database specific default in connectedConfiguration(Connection) must not override it (see isStoreCharsAsNumbersExplicit()). Programmatic configuration and subclasses should prefer this setter over assigning the public storeCharsAsNumbers field, which dictionaries are free to adjust for the detected database version.
    • isStoreCharsAsNumbersExplicit

      protected boolean isStoreCharsAsNumbersExplicit()
      Whether setStoreCharsAsNumbers(boolean) was called, i.e. whether the user explicitly configured StoreCharsAsNumbers. Dictionaries auto-detecting a database specific default must respect an explicit user value.
    • getDelimitIdentifiers

      public boolean getDelimitIdentifiers()
      Returns:
      the delimitIds
    • setDelimitIdentifiers

      public void setDelimitIdentifiers(boolean delimitIds)
      Parameters:
      delimitIds - the delimitIds to set
    • getSupportsXMLColumn

      public boolean getSupportsXMLColumn()
      Returns:
      supportsXMLColumn
    • setSupportsXMLColumn

      public void setSupportsXMLColumn(boolean b)
      Parameters:
      b - boolean representing if XML columns are supported
    • getXMLTypeEncoding

      public String getXMLTypeEncoding()
      Returns:
      xmlTypeEncoding
    • setXMLTypeEncoding

      public void setXMLTypeEncoding(String encoding)
      Parameters:
      encoding - database required JAXB encoding for the XML value
    • getLog

      public Log getLog()
    • delimitAll

      public boolean delimitAll()
      Description copied from interface: IdentifierConfiguration
      Returns true if global name delimiting is enabled.
      Specified by:
      delimitAll in interface IdentifierConfiguration
    • getLeadingDelimiter

      public String getLeadingDelimiter()
      Description copied from interface: IdentifierConfiguration
      Returns the leading delimiter value to use when delimiting a name.
      Specified by:
      getLeadingDelimiter in interface IdentifierConfiguration
    • setLeadingDelimiter

      public void setLeadingDelimiter(String delim)
    • getIdentifierDelimiter

      public String getIdentifierDelimiter()
      Description copied from interface: IdentifierConfiguration
      Returns the value used to delimit between individual names. For example: "." used in MYSCHEMA.MYTABLE
      Specified by:
      getIdentifierDelimiter in interface IdentifierConfiguration
    • getIdentifierConcatenator

      public String getIdentifierConcatenator()
      Description copied from interface: IdentifierConfiguration
      Returns the value used to concatenate multiple names together. For example: "_" used in TABLE1_TABLE2
      Specified by:
      getIdentifierConcatenator in interface IdentifierConfiguration
    • getTrailingDelimiter

      public String getTrailingDelimiter()
      Description copied from interface: IdentifierConfiguration
      Returns the trailing delimiter value to use when delimiting a name.
      Specified by:
      getTrailingDelimiter in interface IdentifierConfiguration
    • setTrailingDelimiter

      public void setTrailingDelimiter(String delim)
    • getDefaultIdentifierRule

      public IdentifierRule getDefaultIdentifierRule()
      Description copied from interface: IdentifierConfiguration
      Gets the default naming rule
      Specified by:
      getDefaultIdentifierRule in interface IdentifierConfiguration
    • getIdentifierRule

      public <T> IdentifierRule getIdentifierRule(T t)
      Description copied from interface: IdentifierConfiguration
      Returns a naming rule or null if the rule is not found.
      Specified by:
      getIdentifierRule in interface IdentifierConfiguration
    • getIdentifierRules

      public Map<String, IdentifierRule> getIdentifierRules()
      Description copied from interface: IdentifierConfiguration
      Returns all naming rules
      Specified by:
      getIdentifierRules in interface IdentifierConfiguration
    • getNamingUtil

      public DBIdentifierUtil getNamingUtil()
      Returns the naming utility used by this dictionary instance
    • getDelimitedCase

      public String getDelimitedCase()
      Description copied from interface: IdentifierConfiguration
      Returns the case that is used when delimiting.
      Specified by:
      getDelimitedCase in interface IdentifierConfiguration
      Returns:
      upper, lower, or preserve
    • toDBName

      public String toDBName(DBIdentifier name)
    • toDBName

      public String toDBName(DBIdentifier name, boolean delimit)
    • fromDBName

      public DBIdentifier fromDBName(String name, DBIdentifier.DBIdentifierType id)
    • setDefaultSchemaName

      public void setDefaultSchemaName(String defaultSchemaName)
    • getDefaultSchemaName

      public String getDefaultSchemaName()
    • getConversionKey

      public String getConversionKey()
      Description copied from interface: IdentifierConfiguration
      Returns a key that can be used to determine whether conversion should take place. Id configurations should create a key unique to their configuration. The typical key is: leading delimiter (") + name separator(.) + trailing delimiter(")
      Specified by:
      getConversionKey in interface IdentifierConfiguration
    • getMarkerForInsertUpdate

      public String getMarkerForInsertUpdate(Column col, Object val)
      Return parameter marker for INSERT and UPDATE statements. Usually it is ? but some database-specific types might require customization.
      Parameters:
      col - column definition
      val - value to be inserted/updated
      Returns:
      parameter marker
    • getIsNullSQL

      public String getIsNullSQL(String colAlias, int colType)
    • getIsNotNullSQL

      public String getIsNotNullSQL(String colAlias, int colType)
    • getIdentityColumnName

      public String getIdentityColumnName()
    • getMillisecondBehavior

      public DBDictionary.DateMillisecondBehaviors getMillisecondBehavior()
      Default behavior is ROUND
    • setDateMillisecondBehavior

      public void setDateMillisecondBehavior(String str)
    • getBooleanRepresentation

      public BooleanRepresentation getBooleanRepresentation()
    • setBooleanRepresentation

      public void setBooleanRepresentation(String booleanRepresentationKey)
    • toJDBCEscapedDateTimeLiteral

      public String toJDBCEscapedDateTimeLiteral(String escape, int parseType)
    • toStringLiteral

      public String toStringLiteral(String value)
      Return the given value as a SQL string literal which the database reads back as exactly this value, or null if the value cannot be written as such a literal and has to be bound as a parameter instead. Single quotes are doubled. A value with a backslash is not written as a literal if backslashEscapesInStringLiterals is set, because escaping the backslash would change the value on a server which does not read it as an escape character. A dictionary overrides this method if its database may read other values in a literal differently.
    • toTypedDateTimeLiteral

      protected String toTypedDateTimeLiteral(String escape, int parseType)
      Return the given JDBC escaped date-time literal, such as {ts '...'}, as the SQL standard typed literal DATE '...', TIME '...' or TIMESTAMP '...', or the escape unchanged if it has no quoted value. For drivers that translate the escape into a plain string literal, which has no date-time type in expressions such as COALESCE or CASE.
    • getExtractField

      public String getExtractField(DateTimeExtractField extField)
    • getExtractDateTimeFieldFunction

      public String getExtractDateTimeFieldFunction(DateTimeExtractField extField)
      Return the SQL that extracts the given field from a date or time value, where {1} stands for the value and may occur more than once. By default this is extractDateTimeFieldFunction with {0} replaced by getExtractField(DateTimeExtractField). Override for databases that need a different function per field.
    • getExtractDateTimePartFunction

      public String getExtractDateTimePartFunction(DateTimeExtractPart part)
      Return the SQL that extracts the date or the time part of a date-time value, where {1} stands for the value and may occur more than once, in which case a parameter is bound once for each occurrence. By default the value is cast to DATE or TIME. Override for databases whose DATE type has a time of day or which have no TIME type.
    • isUsingRange

      protected boolean isUsingRange(long start, long end)
    • isUsingOffset

      protected boolean isUsingOffset(long start)
    • isUsingLimit

      protected boolean isUsingLimit(long end)
    • isUsingOrderBy

      protected boolean isUsingOrderBy(SQLBuffer sql)
    • versionEqualOrLaterThan

      protected boolean versionEqualOrLaterThan(int maj, int min)
    • versionEqualOrEarlierThan

      protected boolean versionEqualOrEarlierThan(int maj, int min)
    • versionLaterThan

      protected boolean versionLaterThan(int maj)
    • getMajorVersion

      public final int getMajorVersion()
      Gets major version of the database server.
    • setMajorVersion

      public void setMajorVersion(int maj)
      Sets major version of the database server.
    • getMinorVersion

      public final int getMinorVersion()
      Gets minor version of the database server.
    • setMinorVersion

      public void setMinorVersion(int min)
      Sets minor version of the database server.
    • applyRange

      public int applyRange(Select select, int count)