Class DerbyDictionary
java.lang.Object
org.apache.openjpa.jdbc.sql.DBDictionary
org.apache.openjpa.jdbc.sql.AbstractDB2Dictionary
org.apache.openjpa.jdbc.sql.DerbyDictionary
- All Implemented Interfaces:
JoinSyntaxes, Configurable, IdentifierConfiguration, ConnectionDecorator, LoggingConnectionDecorator.SQLWarningHandler
Dictionary for Apache Derby (formerly Cloudscape).
-
Nested Class Summary
Nested classes/interfaces inherited from class DBDictionary
DBDictionary.DateMillisecondBehaviors, DBDictionary.SerializedData -
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanIf true, we will shutdown the embedded database when closing the DataSource.Fields inherited from class AbstractDB2Dictionary
varcharCastLengthFields inherited from class DBDictionary
_procs, _proxyManager, allowQueryTimeoutOnFindUpdate, allowsAliasInBulkClause, allowsBulkTargetInSubselect, arrayTypeName, autoAssignClause, autoAssignTypeName, backslashEscapesInStringLiterals, batchLimit, bigintTypeName, binaryTypeName, bitLengthFunction, bitTypeName, blobBufferSize, blobTypeName, booleanRepresentation, booleanTypeName, castFunction, catalogSeparator, ceilingFunction, CENTI, characterColumnSize, charTypeName, clobBufferSize, clobTypeName, closePoolSQL, concatenateDelimiter, concatenateFunction, conf, connected, CONS_NAME_AFTER, CONS_NAME_BEFORE, CONS_NAME_MID, constraintNameMode, createPrimaryKeys, crossJoinClause, currentDateFunction, currentTimeFunction, currentTimestampFunction, databaseProductName, databaseProductVersion, dateFractionDigits, datePrecision, dateTypeName, DECI, decimalTypeName, defaultSchemaName, delimitedCase, disableAlterSeqenceIncrementBy, disableSchemaFactoryColumnTypeErrors, distinctCountColumnSeparator, distinctTypeName, doubleTypeName, driverVendor, dropTableSQL, exceptFunction, extractDateTimeFieldFunction, fixedSizeTypeNames, fixedSizeTypeNameSet, floatTypeName, forUpdateClause, fractionalTypeNameSet, fullResultCollectionInOrderByRelation, getStringVal, inClauseLimit, indexPhysicalForeignKeys, initializationSQL, innerJoinClause, integerCastTypeName, integerTypeName, invalidColumnWordSet, invalidTableWordSet, isJDBC3, isJDBC4, javaObjectTypeName, javaToDbColumnNameProcessing, joinSyntax, lastGeneratedKeyQuery, leadingDelimiter, leftFunctionName, log, longCastTypeName, longVarbinaryTypeName, longVarcharTypeName, maxAutoAssignNameLength, maxColumnNameLength, maxConstraintNameLength, maxEmbeddedBlobSize, maxEmbeddedClobSize, maxIndexesPerTable, maxIndexNameLength, maxTableNameLength, MICRO, MILLI, NAME_ANY, NAME_SEQUENCE, NAME_TABLE, nameConcatenator, NANO, nativeSequenceType, naturalLogarithmFunction, nextSequenceQuery, NO_BATCH, nullTypeName, numericTypeName, otherTypeName, outerJoinClause, platform, RANGE_POST_DISTINCT, RANGE_POST_LOCK, RANGE_POST_SELECT, RANGE_PRE_DISTINCT, rangePosition, realTypeName, refTypeName, replaceFunctionName, reportsSuccessNoInfoOnBatchUpdates, requiresAliasForSubselect, requiresAutoCommitForMetaData, requiresCastForCaseStringResult, requiresCastForComparisons, requiresCastForExtractOperand, requiresCastForMathFunctions, requiresConditionForCrossJoin, requiresSearchStringEscapeForLike, requiresTargetForDelete, reservedWords, reservedWordSet, rightFunctionName, roundTimeToMillisec, SCHEMA_CASE_LOWER, SCHEMA_CASE_PRESERVE, SCHEMA_CASE_UPPER, schemaCase, searchStringEscape, searchStringNoEscape, SEC, selectWords, selectWordSet, sequenceNameSQL, sequenceSchemaSQL, sequenceSQL, setStringRightTruncationOn, simulateLocking, smallintTypeName, sqlStateCodes, storageLimitationsFatal, storeCharsAsNumbers, storeLargeNumbersAsStrings, stringLengthFunction, structTypeName, substringFunctionName, supportsAlterTableWithAddColumn, supportsAlterTableWithDropColumn, supportsAutoAssign, supportsCascadeDeleteAction, supportsCascadeUpdateAction, supportsCaseConversionForLob, supportsComments, supportsCorrelatedSubselect, supportsDefaultDeleteAction, supportsDefaultUpdateAction, supportsDeferredConstraints, supportsDelimitedIdentifiers, supportsForeignKeys, supportsForeignKeysComposite, supportsGeneralCaseExpression, supportsGetGeneratedKeys, supportsHaving, supportsLockingWithDistinctClause, supportsLockingWithInnerJoin, supportsLockingWithMultipleTables, supportsLockingWithOrderClause, supportsLockingWithOuterJoin, supportsLockingWithSelectRange, supportsModOperator, supportsMultipleNontransactionalResultSets, supportsNullDeleteAction, supportsNullTableForGetColumns, supportsNullTableForGetImportedKeys, supportsNullTableForGetIndexInfo, supportsNullTableForGetPrimaryKeys, supportsNullUniqueColumn, supportsNullUpdateAction, supportsParameterInSelect, supportsQueryTimeout, supportsRestrictDeleteAction, supportsRestrictUpdateAction, supportsSchemaForGetColumns, supportsSchemaForGetTables, supportsSelectEndIndex, supportsSelectForUpdate, supportsSelectFromFinalTable, supportsSelectStartIndex, supportsSimpleCaseExpression, supportsSubselect, supportsUniqueConstraints, supportsUnsizedCharOnCast, supportsUuidType, supportsXMLColumn, systemSchemas, systemSchemaSet, systemTables, systemTableSet, tableForUpdateClause, tableLengthIncludesSchema, tableTypes, timestampTypeName, timestampWithZoneTypeName, timeTypeName, timeWithZoneTypeName, tinyintTypeName, toLowerCaseFunction, toUpperCaseFunction, trailingDelimiter, trimBothFunction, trimLeadingFunction, trimSchemaName, trimStringColumns, trimTrailingFunction, typecastToStringTypeName, typeModifierSet, UNLIMITED, useGetBestRowIdentifierForPrimaryKeys, useGetBytesForBlobs, useGetObjectForBlobs, useGetStringForClobs, useJDBC4SetBinaryStream, useNativeSequenceCache, useSchemaName, useSetBytesForBlobs, useSetStringForClobs, useWildCardForCount, uuidTypeName, validationSQL, varbinaryTypeName, varcharTypeName, VENDOR_DATADIRECT, VENDOR_OTHER, xmlTypeEncoding, xmlTypeNameFields inherited from interface JoinSyntaxes
SYNTAX_DATABASE, SYNTAX_SQL92, SYNTAX_TRADITIONAL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidappendLength(SQLBuffer buf, int type) Derby rejects a VARCHAR without a length, so give the casts written forDBDictionary.requiresCastForComparisonsandDBDictionary.requiresCastForMathFunctionsthe same length as the other VARCHAR casts of this dictionary.protected voidappendSelectRange(SQLBuffer buf, long start, long end, boolean subselect) Appends a range to the given buffer.intapplyRange(Select select, int count) Applies range calculation on the actual number of rows selected by aCOUNT(*)query.voidcloseDataSource(DataSource dataSource) Closes the specifiedDataSourceand releases any resources associated with it.voidThis method is called when the dictionary first sees any connection.String[]Derby creates a sequence of typeINTEGERunless told otherwise, which runs out at 2^31 - 1.String[]Derby requires theRESTRICTkeyword onDROP SEQUENCE.Derby has no EXTRACT, but a function per field.intgetPreferredType(int type) Derby doesn't support SQL-2003 'WITH TIMEZONE' nor the respective JDBC types.getSequenceIncrement(Connection conn, Sequence seq) Reads the increment of the sequence fromSYS.SYSSEQUENCES.protected StringgetSequencesSQL(String schemaName, String sequenceName) Derby lists sequences inSYS.SYSSEQUENCES.protected StringgetSequencesSQL(DBIdentifier schemaName, DBIdentifier sequenceName) Derby rejects a VARCHAR without a length, so give the cast written for CAST(...booleanisFatalException(int subtype, SQLException ex) Determine if the given SQL Exception is fatal or recoverable (such as a timeout).voidleft(SQLBuffer buf, FilterValue str, FilterValue length) Derby has no LEFT function, so render it with SUBSTR.voidright(SQLBuffer buf, FilterValue str, FilterValue length) Derby has no RIGHT function, so render it with SUBSTR.Methods inherited from class AbstractDB2Dictionary
indexOf, substringMethods inherited from class DBDictionary
addCastAsType, addErrorCode, allowsBulkUpdateOfJoinedTables, appendBulkPrimaryKeysIn, appendCast, appendNullsPrecedence, appendNumericCast, appendSelect, appendSize, appendUpdates, appendXmlComparison, assertSupport, calculateValue, canOuterJoin, combineForeignKey, comment, comparison, configureNamingRules, convertSchemaCase, convertSchemaCase, copy, copy, createIndexIfNecessary, createIndexIfNecessary, decorate, deleteStream, delimitAll, endConfiguration, executeQuery, fromDBName, getAddColumnSQL, getAddForeignKeySQL, getAddPrimaryKeySQL, getAlterSequenceSQL, getArray, getAsciiStream, getBatchFetchSize, getBatchLimit, getBatchUpdateCount, getBigDecimal, getBigInteger, getBinaryStream, getBlob, getBlobObject, getBoolean, getBooleanRepresentation, getByte, getBytes, getCalendar, getCastFunction, getCastFunction, getCatalogNameForMetadata, getCatalogNameForMetadata, getChar, getCharacterStream, getClob, getClobString, getColumnDBName, getColumnIdentifier, getColumnNameForMetadata, getColumnNameForMetadata, getColumns, getColumns, getConversionKey, getCreateIndexSQL, getCreateTableSQL, getCreateTableSQL, getDate, getDate, getDateFractionDigits, getDeclareColumnSQL, getDefaultIdentifierRule, getDefaultSchemaName, getDeleteTableContentsSQL, getDeleteTargets, getDelimitedCase, getDelimitIdentifiers, getDouble, getDropColumnSQL, getDropForeignKeySQL, getDropIndexSQL, getDropPrimaryKeySQL, getDropTableSQL, getExtractDateTimePartFunction, getExtractField, getExtractOperandCastType, getFloat, getForeignKeyConstraintSQL, getForUpdateClause, getFrom, getFromSelect, getFullIdentifier, getFullName, getFullName, getFullName, getGeneratedKey, getGeneratedKeySequenceName, getGenKeySeqName, getIdentifierConcatenator, getIdentifierDelimiter, getIdentifierRule, getIdentifierRules, getIdentityColumnName, getImportedKeys, getImportedKeys, getImportedKeys, getImportedKeys, getIndexInfo, getIndexInfo, getInstant, getInt, getIntegerCastTypeName, getInvalidColumnWordSet, getInvalidTableWordSet, getIsNotNullSQL, getIsNullSQL, getJDBCType, getJDBCType, getJDBCType, getKey, getLeadingDelimiter, getLOBStream, getLocalDate, getLocalDateTime, getLocale, getLocalTime, getLog, getLong, getLongCastTypeName, getMajorVersion, getMarkerForInsertUpdate, getMillisecondBehavior, getMinorVersion, getNamingUtil, getNormalizingRule, getNumber, getNumberCastTypeName, getObject, getOffsetDateTime, getOffsetTime, getPlaceholderValueString, getPrimaryKeyConstraintSQL, getPrimaryKeys, getPrimaryKeys, getPrimaryKeysFromBestRowIdentifier, getPrimaryKeysFromBestRowIdentifier, getPrimaryKeysFromGetPrimaryKeys, getPrimaryKeysFromGetPrimaryKeys, getRef, getSchemaCase, getSchemaNameForMetadata, getSchemaNameForMetadata, getSelectOperation, getSelects, getSelectTableAliases, getSequence, getSequences, getSequences, getShort, getStoreCharsAsNumbers, getStoredProcedure, getStoredProcedureCallSQL, getStoredProcedureNameCandidates, getString, getSupportsDelimitedIdentifiers, getSupportsXMLColumn, getTableNameForMetadata, getTableNameForMetadata, getTables, getTables, getTime, getTimestamp, getTimestampPrecision, getTrailingDelimiter, getTrimSchemaName, getTypeName, getTypeName, getUniqueConstraintSQL, getValidColumnName, getValidColumnName, getValidColumnName, getValidColumnName, getValidDefaultSequenceName, getValidDefaultTableName, getValidForeignKeyName, getValidForeignKeyName, getValidIndexName, getValidIndexName, getValidPrimaryKeyName, getValidSequenceName, getValidSequenceName, getValidTableName, getValidTableName, getValidUniqueName, getValidUniqueName, getVersionColumn, getVersionColumn, getWhere, getXMLTypeEncoding, getYear, handleWarning, insertBlobForStreamingLoad, insertClobForStreamingLoad, insertSize, isConnected, isDroppable, isImplicitJoin, isReplicationConnection, isSelect, isStoreCharsAsNumbersExplicit, isSystemIndex, isSystemIndex, isSystemSequence, isSystemSequence, isSystemSequence, isSystemTable, isSystemTable, isUnsizedDecimal, isUsingLimit, isUsingOffset, isUsingOrderBy, isUsingRange, makeNameValid, makeNameValid, makeNameValid, makeNameValid, matchErrorState, mathFunction, needsToCreateIndex, needsToCreateIndex, newColumn, newForeignKey, newIndex, newPrimaryKey, newSequence, newStoreException, newTable, normalize, prepareStatement, processDBColumnName, putBytes, putChars, putString, refSchemaComponents, replace, serialize, setArray, setAsciiStream, setBatchLimit, setBigDecimal, setBigInteger, setBinaryStream, setBlob, setBlobObject, setBoolean, setBooleanRepresentation, setByte, setBytes, setCalendar, setChar, setCharacterStream, setClob, setClobString, setConfiguration, setDate, setDate, setDateMillisecondBehavior, setDefaultSchemaName, setDelimitedCase, setDelimitIdentifiers, setDouble, setFloat, setInstant, setInt, setJoinSyntax, setLeadingDelimiter, setLocalDate, setLocalDateTime, setLocale, setLocalTime, setLong, setMajorVersion, setMinorVersion, setNull, setNumber, setObject, setOffsetDateTime, setOffsetTime, setQueryTimeout, setRef, setShort, setStatementQueryTimeout, setStoreCharsAsNumbers, setString, setSupportsDelimitedIdentifiers, setSupportsXMLColumn, setTime, setTimeouts, setTimeouts, setTimestamp, setTrailingDelimiter, setTrimSchemaName, setTyped, setUnknown, setUnknown, setXMLTypeEncoding, setYear, shorten, startConfiguration, storageWarning, supportsDeferredForeignKeyConstraints, supportsDeferredUniqueConstraints, supportsDeleteAction, supportsIsolationForUpdate, supportsLocking, supportsRandomAccessResultSet, supportsUpdateAction, toBulkOperation, toDBName, toDBName, toDelete, toJDBCEscapedDateTimeLiteral, toNativeJoin, toOperation, toOperation, toSelect, toSelect, toSelect, toSelect, toSelect, toSelectCount, toSnakeCase, toSQL92Join, toStringLiteral, toTableUpdate, toTraditionalJoin, toTypedDateTimeLiteral, toUpdate, updateBlob, updateClob, validateBatchProcess, validateDBSpecificBatchProcess, versionEqualOrEarlierThan, versionEqualOrLaterThan, versionLaterThan
-
Field Details
-
shutdownOnClose
public boolean shutdownOnCloseIf true, we will shutdown the embedded database when closing the DataSource.
-
-
Constructor Details
-
DerbyDictionary
public DerbyDictionary()
-
-
Method Details
-
getExtractDateTimeFieldFunction
Derby has no EXTRACT, but a function per field. QUARTER is derived from the month, and WEEK, the ISO-8601 week, is computed arithmetically from the year, month and day.- Overrides:
getExtractDateTimeFieldFunctionin classDBDictionary
-
connectedConfiguration
Description copied from class:DBDictionaryThis 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 callsuper.connectedConfiguration.- Overrides:
connectedConfigurationin classDBDictionary- Throws:
SQLException
-
getCreateSequenceSQL
Derby creates a sequence of typeINTEGERunless told otherwise, which runs out at 2^31 - 1. UseBIGINT, as the values are read as longs anyway. Derby accepts the sequence elements in any order, so the clause is appended.- Overrides:
getCreateSequenceSQLin classDBDictionary
-
getSequenceIncrement
Reads the increment of the sequence fromSYS.SYSSEQUENCES. Without a schema the sequence is looked up in the current schema, where Derby resolves an unqualified name.- Overrides:
getSequenceIncrementin classDBDictionary- Returns:
nullif 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
Derby requires theRESTRICTkeyword onDROP SEQUENCE.- Overrides:
getDropSequenceSQLin classDBDictionary
-
getSequencesSQL
Derby lists sequences inSYS.SYSSEQUENCES. Without a schema the query is restricted to the current schema, as an unqualified sequence lives there; theSYSschema holds the internal sequences of identity columns, which never belong to the application.- Overrides:
getSequencesSQLin classDBDictionary
-
getSequencesSQL
- Overrides:
getSequencesSQLin classDBDictionary
-
appendSelectRange
Appends a range to the given buffer.
A range query is never appended to a subselct clause.
If this dictionary supportsoffsetandlimiton queries then the syntax is[ OFFSET {start} ROWS ] [ FETCH NEXT {end-start} ROWS ONLY ]Otherwise, the offset is not used and the syntax is[ FETCH FIRST {end} ROWS ONLY ]- Overrides:
appendSelectRangein classDBDictionary- Parameters:
buf- the SQL buffer to be appendedstart- starting offset.0means offset is not used.end- number of rows to be fetched.Long.MAX_VALUEmeans no limit.subselect- flags if the buffer represents a SQL Subquery clause
-
getStringCastTypeName
Derby rejects a VARCHAR without a length, so give the cast written for CAST(... AS STRING) the same length as the other VARCHAR casts of this dictionary.- Overrides:
getStringCastTypeNamein classDBDictionary
-
appendLength
Derby rejects a VARCHAR without a length, so give the casts written forDBDictionary.requiresCastForComparisonsandDBDictionary.requiresCastForMathFunctionsthe same length as the other VARCHAR casts of this dictionary.- Overrides:
appendLengthin classDBDictionary
-
left
Derby has no LEFT function, so render it with SUBSTR. SUBSTR fails when the length goes past the end of the string, where LEFT returns the whole string, so that case is handled separately.- Overrides:
leftin classDBDictionary
-
right
Derby has no RIGHT function, so render it with SUBSTR. SUBSTR fails when the start goes before the beginning of the string, where RIGHT returns the whole string, so that case is handled separately.- Overrides:
rightin classDBDictionary
-
closeDataSource
Description copied from class:DBDictionaryCloses the specifiedDataSourceand releases any resources associated with it.- Overrides:
closeDataSourcein classDBDictionary- Parameters:
dataSource- the DataSource to close
-
isFatalException
Description copied from class:DBDictionaryDetermine 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.- Overrides:
isFatalExceptionin classDBDictionary- Parameters:
subtype- A constant indicating the category of error as defined inStoreException.ex- original SQL Exception as raised by the database driver.- Returns:
- false if the error is fatal.
-
applyRange
Applies range calculation on the actual number of rows selected by aCOUNT(*)query. A range query may use either only the limit or both offset and limit based on database dictionary support and accordingly the number of rows in the result set needs to be modified.- Overrides:
applyRangein classDBDictionary- Parameters:
select-count-- Returns:
-
getPreferredType
public int getPreferredType(int type) Derby doesn't support SQL-2003 'WITH TIMEZONE' nor the respective JDBC types.- Overrides:
getPreferredTypein classDBDictionary
-