Class MariaDBDictionary
- All Implemented Interfaces:
JoinSyntaxes, Configurable, IdentifierConfiguration, ConnectionDecorator, LoggingConnectionDecorator.SQLWarningHandler
-
Nested Class Summary
Nested classes/interfaces inherited from class DBDictionary
DBDictionary.DateMillisecondBehaviors, DBDictionary.SerializedData -
Field Summary
FieldsFields inherited from class AbstractMySQLDictionary
DELIMITER_BACK_TICK, driverDeserializesBlobs, longBlobTypeName, longTextTypeName, mediumBlobTypeName, mediumTextTypeName, optimizeMultiTableDeletes, tableType, tinyBlobTypeName, tinyTextTypeName, useClobsFields 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 TypeMethodDescriptionvoidThis method is called when the dictionary first sees any connection.decorate(Connection conn) Decorate the given connection if needed.protected booleanMariaDB delimits a name that is a reserved word, as MySQL does, unless the compatibility optionUpdatedReservedWords=falseasks for the earlier names, which append a0to such a name instead.String[]MariaDB caches 1000 increments of a sequence per server by default, and discards what is left of that range whenever the cache is flushed - anALTER SEQUENCE, a restart - so the identifiers jump by up to1000 * increment.protected intMariaDB allows a scale of 38; an unsized decimal column still gets a scale of 30, the largest scale MySQL allows, which keeps the DDL the same on both.protected StringThe name of the fetch configuration hint whose value is appended after theSELECTkeyword of a query.protected StringgetSequencesSQL(String schemaName, String sequenceName) MariaDB has noINFORMATION_SCHEMA.SEQUENCESbefore 10.6; a sequence is listed inINFORMATION_SCHEMA.TABLESwith aTABLE_TYPEofSEQUENCEin every version that has sequences at all.protected StringgetSequencesSQL(DBIdentifier schemaName, DBIdentifier sequenceName) booleanisFatalException(int subtype, SQLException ex) Determine if the given SQL Exception is fatal or recoverable (such as a timeout).booleanWhether the given connection was opened by MariaDB Connector/J with ajdbc:mariadb:replication:URL, which routes the statements of a read-only connection to a replica.protected intmatchErrorState(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.protected voidsetDelimitedCase(DatabaseMetaData metaData) voidsetTime(PreparedStatement stmnt, int idx, Time val, Calendar cal, Column col) Set the given value as a parameter to the statement.voidupdateClob(Select sel, JDBCStore store, Reader reader) Write the reader withResultSet.updateCharacterStream(int, Reader)instead of the writer ofClob.setCharacterStream(long).Methods inherited from class AbstractMySQLDictionary
addUpdatedReservedTableWords, addUpdatedReservedWords, appendNullsPrecedence, appendSelectRange, appendXmlComparison, configureNamingRules, getAddPrimaryKeySQL, getBlobObject, getCreateTableSQL, getDeleteTableContentsSQL, getDropForeignKeySQL, getDropIndexSQL, getDropPrimaryKeySQL, getExtractDateTimeFieldFunction, getLocalTime, getPreferredType, getSelectOperation, getSelectTableAliases, getTypeName, indexOf, newColumn, setConfiguration, setLocalTime, toJDBCEscapedDateTimeLiteral, useFractionalSecondTemporalTypes, usesUpdatedReservedWordsMethods inherited from class DBDictionary
addCastAsType, addErrorCode, allowsBulkUpdateOfJoinedTables, appendBulkPrimaryKeysIn, appendCast, appendLength, appendNumericCast, appendSelect, appendSize, appendUpdates, applyRange, assertSupport, calculateValue, canOuterJoin, closeDataSource, combineForeignKey, comment, comparison, convertSchemaCase, convertSchemaCase, copy, copy, createIndexIfNecessary, createIndexIfNecessary, deleteStream, delimitAll, endConfiguration, executeQuery, fromDBName, getAddColumnSQL, getAddForeignKeySQL, getAlterSequenceSQL, getArray, getAsciiStream, getBatchFetchSize, getBatchLimit, getBatchUpdateCount, getBigDecimal, getBigInteger, getBinaryStream, getBlob, getBoolean, getBooleanRepresentation, getByte, getBytes, getCalendar, getCastFunction, getCastFunction, getCatalogNameForMetadata, getCatalogNameForMetadata, getChar, getCharacterStream, getClob, getClobString, getColumnDBName, getColumnIdentifier, getColumnNameForMetadata, getColumnNameForMetadata, getColumns, getColumns, getConversionKey, getCreateIndexSQL, getCreateTableSQL, getDate, getDate, getDateFractionDigits, getDeclareColumnSQL, getDefaultIdentifierRule, getDefaultSchemaName, getDeleteTargets, getDelimitedCase, getDelimitIdentifiers, getDouble, getDropColumnSQL, getDropSequenceSQL, 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, 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, getSelects, getSequence, getSequenceIncrement, getSequences, getSequences, getShort, getStoreCharsAsNumbers, getStoredProcedure, getStoredProcedureCallSQL, getStoredProcedureNameCandidates, getString, getStringCastTypeName, getSupportsDelimitedIdentifiers, getSupportsXMLColumn, getTableNameForMetadata, getTableNameForMetadata, getTables, getTables, getTime, getTimestamp, getTimestampPrecision, getTrailingDelimiter, getTrimSchemaName, 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, isSelect, isStoreCharsAsNumbersExplicit, isSystemIndex, isSystemIndex, isSystemSequence, isSystemSequence, isSystemSequence, isSystemTable, isSystemTable, isUnsizedDecimal, isUsingLimit, isUsingOffset, isUsingOrderBy, isUsingRange, left, makeNameValid, makeNameValid, makeNameValid, makeNameValid, mathFunction, needsToCreateIndex, needsToCreateIndex, newForeignKey, newIndex, newPrimaryKey, newSequence, newStoreException, newTable, normalize, prepareStatement, processDBColumnName, putBytes, putChars, putString, refSchemaComponents, replace, right, serialize, setArray, setAsciiStream, setBatchLimit, setBigDecimal, setBigInteger, setBinaryStream, setBlob, setBlobObject, setBoolean, setBooleanRepresentation, setByte, setBytes, setCalendar, setChar, setCharacterStream, setClob, setClobString, setDate, setDate, setDateMillisecondBehavior, setDefaultSchemaName, setDelimitIdentifiers, setDouble, setFloat, setInstant, setInt, setJoinSyntax, setLeadingDelimiter, setLocalDate, setLocalDateTime, setLocale, setLong, setMajorVersion, setMinorVersion, setNull, setNumber, setObject, setOffsetDateTime, setOffsetTime, setQueryTimeout, setRef, setShort, setStatementQueryTimeout, setStoreCharsAsNumbers, setString, setSupportsDelimitedIdentifiers, setSupportsXMLColumn, setTimeouts, setTimeouts, setTimestamp, setTrailingDelimiter, setTrimSchemaName, setTyped, setUnknown, setUnknown, setXMLTypeEncoding, setYear, shorten, startConfiguration, storageWarning, substring, supportsDeferredForeignKeyConstraints, supportsDeferredUniqueConstraints, supportsDeleteAction, supportsIsolationForUpdate, supportsLocking, supportsRandomAccessResultSet, supportsUpdateAction, toBulkOperation, toDBName, toDBName, toDelete, toNativeJoin, toOperation, toOperation, toSelect, toSelect, toSelect, toSelect, toSelect, toSelectCount, toSnakeCase, toSQL92Join, toStringLiteral, toTableUpdate, toTraditionalJoin, toTypedDateTimeLiteral, toUpdate, updateBlob, validateBatchProcess, validateDBSpecificBatchProcess, versionEqualOrEarlierThan, versionEqualOrLaterThan, versionLaterThan
-
Field Details
-
SELECT_HINT
- See Also:
-
-
Constructor Details
-
MariaDBDictionary
public MariaDBDictionary()
-
-
Method Details
-
delimitsReservedWords
protected boolean delimitsReservedWords()MariaDB delimits a name that is a reserved word, as MySQL does, unless the compatibility optionUpdatedReservedWords=falseasks for the earlier names, which append a0to such a name instead.- Specified by:
delimitsReservedWordsin classAbstractMySQLDictionary
-
getSelectHint
Description copied from class:AbstractMySQLDictionaryThe name of the fetch configuration hint whose value is appended after theSELECTkeyword of a query.- Specified by:
getSelectHintin classAbstractMySQLDictionary- See Also:
-
getMaxDecimalScale
protected int getMaxDecimalScale()MariaDB allows a scale of 38; an unsized decimal column still gets a scale of 30, the largest scale MySQL allows, which keeps the DDL the same on both.- Specified by:
getMaxDecimalScalein classAbstractMySQLDictionary
-
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
MariaDB caches 1000 increments of a sequence per server by default, and discards what is left of that range whenever the cache is flushed - anALTER SEQUENCE, a restart - so the identifiers jump by up to1000 * increment. OpenJPA caches values itself, in blocks of the generator's allocation size, andNativeJDBCSeqissuesALTER SEQUENCE ... INCREMENT BYonce per sequence instance to do so, which is exactly such a flush: the server side cache adds nothing but those gaps. Create the sequence withNOCACHE.Measured on MariaDB 11.8 with a sequence created
START WITH 100 INCREMENT BY 7:NEXTVALreturns 100 and leavesNEXT_NOT_CACHED_VALUEat 7100, and afterALTER SEQUENCE ... INCREMENT BY 7the nextNEXTVALreturns 7100; withNOCACHEthe same statements return 100 and then 107.- Overrides:
getCreateSequenceSQLin classDBDictionary
-
getSequencesSQL
MariaDB has noINFORMATION_SCHEMA.SEQUENCESbefore 10.6; a sequence is listed inINFORMATION_SCHEMA.TABLESwith aTABLE_TYPEofSEQUENCEin every version that has sequences at all. Schema names are matched case insensitively becauseDBDictionary.getSequences(DatabaseMetaData, String, String, String, Connection)upper cases the schema it passes, while MariaDB keeps the case of the schema as created.INFORMATION_SCHEMAspans every database on the server, not just the connected one, and every caller in OpenJPA asks for a null schema -SchemaGenerator.generateSequences()passesDBIdentifier.NULLdeliberately, and an unqualified@SequenceGeneratorhas none. Unrestricted, the reflection would report sequences of other applications' databases, which makes the schema tool skip aCREATE SEQUENCEit owes and, on the drop side, issueDROP SEQUENCEoutside the configured database. The no schema case is therefore scoped toDATABASE(), which takes no bind parameter and so leaves the parameter indicesDBDictionary.getSequences(DatabaseMetaData, String, String, String, Connection)binds intact.- Overrides:
getSequencesSQLin classDBDictionary
-
getSequencesSQL
- Overrides:
getSequencesSQLin classDBDictionary
-
setDelimitedCase
- Overrides:
setDelimitedCasein classDBDictionary
-
decorate
Description copied from class:DBDictionaryDecorate the given connection if needed. Some databases require special handling for JDBC bugs. This implementation issues anyDBDictionary.initializationSQLthat has been set for the dictionary but does not decorate the connection.- Specified by:
decoratein interfaceConnectionDecorator- Overrides:
decoratein classDBDictionary- Throws:
SQLException
-
isReplicationConnection
Whether the given connection was opened by MariaDB Connector/J with ajdbc:mariadb:replication:URL, which routes the statements of a read-only connection to a replica. The driver reports that URL in the connection's metadata without a round trip to the server.- Overrides:
isReplicationConnectionin classDBDictionary- Parameters:
conn- a connection of the store, possibly wrapped by OpenJPA's decorators- Throws:
SQLException
-
updateClob
Write the reader withResultSet.updateCharacterStream(int, Reader)instead of the writer ofClob.setCharacterStream(long). The Connector/J clob writer starts at a wrong position when the clob was read from a result set and fails with an ArrayIndexOutOfBoundsException.- Overrides:
updateClobin classDBDictionary- Throws:
SQLException
-
matchErrorState
Description copied from class:DBDictionaryDetermine 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.- Overrides:
matchErrorStatein classDBDictionary- Parameters:
errorStates- classification of SQL error states by their specific nature. The keys of the map represent one of the constants defined inStoreException. The value corresponding to a key represent the set of SQL Error States representing specific category of database error. This supplied map is sourced fromsql-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
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.
-
setTime
public void setTime(PreparedStatement stmnt, int idx, Time val, Calendar cal, Column col) throws SQLException Description copied from class:DBDictionarySet the given value as a parameter to the statement.- Overrides:
setTimein classDBDictionary- Throws:
SQLException
-