Interface DBTranslator
- All Known Implementing Classes:
DefaultDBTranslator
public interface DBTranslator
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionapplyLimit(String query, Integer limit) Takes a SELECT query and applies the given limit to it, resulting in a select query with a limiting clause.getAlterCommand(String tableName, ColumnList columns) Returns the character that this driver uses to quote names in queriesgetCreateCommand(String tableName, ColumnList columns) getCreateIndexCommand(String tableName, Column column) Returns a query that can be used to get the current database time.default StringgetDatabaseTypeName(DataType type) The database-specific column type keyword this translator emits for the given platformDataTypein aCREATE/ALTERstatement — e.g.getFetchKeyQuery(String tableName, String columnName) A query to be executed instead of using JDBC's built-in facility for obtaining auto-generated keys.Returns a filter that will be used to narrow the list of tables returned from the database.booleandefault booleanWhether this translator mapsDataType.Booleanto a native boolean SQL type -- one that requires a real boolean bind rather than an integer0/1.
-
Method Details
-
getCreateCommand
-
getAlterCommand
-
getCreateIndexCommand
-
applyLimit
-
getCurrentTimeQuery
String getCurrentTimeQuery()Returns a query that can be used to get the current database time. -
getColumnQuoteChar
String getColumnQuoteChar()Returns the character that this driver uses to quote names in queries -
isSupportsRGK
boolean isSupportsRGK()- Returns:
- whether or not this driver supports returning generated keys on insert queries
-
getFetchKeyQuery
A query to be executed instead of using JDBC's built-in facility for obtaining auto-generated keys. Only used if supportsRGK is false. Takes the table name and column name in case the query needs to use them- it will depend on the database as to whether or not they are. -
getTableListFilter
String getTableListFilter()Returns a filter that will be used to narrow the list of tables returned from the database. A semi-colon separated list of simple patterns, like "apex_*;sys_info*" -
getDatabaseTypeName
The database-specific column type keyword this translator emits for the given platformDataTypein aCREATE/ALTERstatement — e.g. Postgres mapsDataType.DateTimeto"timestamp"while SQLite maps it to"text". Returnsnullif this translator declares no mapping for the type.Lets schema validation compare an existing column against the type auto-create would actually produce, rather than against an abstract ideal: an audit
event_timestampisDataType.DateTime, but on a SQLite datasource auto-create declares ittext(timestamps are stored as epoch-millis in TEXT), so validating it as a temporal column would fault the very table auto-create just wrote. The default returnsnull;DefaultDBTranslatoroverrides it to expose its configured type map. -
usesNativeBooleanType
default boolean usesNativeBooleanType()Whether this translator mapsDataType.Booleanto a native boolean SQL type -- one that requires a real boolean bind rather than an integer0/1. This is the best available signal for the type a boolean column was most likely created with when the column's actual type cannot be read back from the database; it is consulted only as a fallback, since the mapping is mutable and can diverge from an already-created column. Defaults tofalse;DefaultDBTranslatoroverrides it to classify its configured boolean keyword, and any translator that wraps another (e.g. a datasource's swap-able delegate) must forward this call so the wrapped mapping is not lost.
-