public abstract class DatabaseDialect extends Object
| Modifier and Type | Field and Description |
|---|---|
protected org.slf4j.Logger |
logger |
boolean |
quoteTableNames |
protected boolean |
sequenceSupported |
| Constructor and Description |
|---|
DatabaseDialect(String system,
boolean quoteTableNames,
boolean sequenceSupported,
String datePattern,
String timePattern,
String datetimePattern) |
| Modifier and Type | Method and Description |
|---|---|
protected UnsupportedOperationException |
checkSequenceSupport(String methodName) |
void |
createSequence(String name,
long initialValue,
Connection connection) |
String |
formatTimestamp(Timestamp timestamp) |
String |
formatValue(Object value) |
Set<String> |
getReservedWords(Connection connection) |
DBSequence |
getSequence(String sequenceName,
Connection connection) |
String |
getSystem() |
protected void |
importReservedWords(Connection connection)
Imports the reserved words defined in a configuration file, then adds words retrieved by
DatabaseMetaData.getSQLKeywords(). |
String |
insert(DBTable table,
List<ColumnInfo> columnInfos) |
abstract boolean |
isDefaultCatalog(String catalog,
String user) |
abstract boolean |
isDefaultSchema(String schema,
String user) |
abstract boolean |
isDeterministicFKName(String fkName)
Determines if a foreign key constraint name was explicitly specified creation
or at least generated by the database in a deterministic (reproducible) way
|
abstract boolean |
isDeterministicIndexName(String indexName)
Determines if an index name was explicitly specified creation
or at least generated by the database in a deterministic (reproducible) way
|
abstract boolean |
isDeterministicPKName(String pkName)
Determines if a primary key constraint name was explicitly specified on creation
or at least generated by the database in a deterministic (reproducible) way
|
abstract boolean |
isDeterministicUKName(String ukName)
Determines if a unique key constraint name was explicitly specified on creation
or at least generated by the database in a deterministic (reproducible) way
|
protected static boolean |
isNotOne(BigInteger i) |
boolean |
isReservedWord(String word,
Connection connection) |
boolean |
isSequenceBoundarySupported() |
boolean |
isSequenceSupported() |
List<DBPackage> |
queryPackages(DBSchema schema,
Connection connection) |
DBSequence[] |
querySequences(Connection connection) |
List<DBTrigger> |
queryTriggers(DBSchema schema,
Connection connection) |
String |
regexQuery(String expression,
boolean not,
String regex)
Renders a query condition for a regular expression.
|
String |
renderCase(String columnName,
String elseExpression,
String... whenThenExpressionPairs) |
String |
renderCreateSequence(DBSequence sequence) |
String |
renderDropSequence(String sequenceName) |
String |
renderFetchSequenceValue(String sequenceName) |
protected String |
renderSequenceNameAndType(DBSequence sequence) |
abstract void |
restrictRownums(int rowOffset,
int rowCount,
Query query) |
protected String |
sequenceNoCycle() |
void |
setNextSequenceValue(String sequenceName,
long value,
Connection connection) |
boolean |
supportsRegex()
Tells if the database supports regular expressions
|
String |
trim(String expression) |
String |
update(DBTable table,
String[] pkColumnNames,
List<ColumnInfo> columnInfos) |
protected final org.slf4j.Logger logger
public final boolean quoteTableNames
protected final boolean sequenceSupported
public String getSystem()
public boolean isReservedWord(String word, Connection connection) throws SQLException
SQLExceptionpublic Set<String> getReservedWords(Connection connection) throws SQLException
SQLExceptionprotected void importReservedWords(Connection connection) throws SQLException
DatabaseMetaData.getSQLKeywords(). If no system-specific configuration file is found,
jdbacl falls back to the keywords defined in SQL:2003. The combination of both approaches
happens, since the documentation of DatabaseMetaData.getSQLKeywords() says that it
"Retrieves a comma-separated list of all of this database's SQL keywords that are NOT also
SQL:2003 keywords. By adding keywords dynamically retrieved from the JDBC driver I also get
the chance to automatically handle keywords introduced in a new database version without
having loads of different reserved-words-files.SQLExceptionpublic boolean isSequenceSupported()
public boolean isSequenceBoundarySupported()
public DBSequence[] querySequences(Connection connection) throws SQLException
SQLExceptionpublic void createSequence(String name, long initialValue, Connection connection) throws SQLException
SQLExceptionpublic String renderCreateSequence(DBSequence sequence)
protected String renderSequenceNameAndType(DBSequence sequence)
protected String sequenceNoCycle()
protected static boolean isNotOne(BigInteger i)
public void setNextSequenceValue(String sequenceName, long value, Connection connection) throws SQLException
SQLExceptionpublic DBSequence getSequence(String sequenceName, Connection connection) throws SQLException
SQLExceptionpublic String insert(DBTable table, List<ColumnInfo> columnInfos)
public String update(DBTable table, String[] pkColumnNames, List<ColumnInfo> columnInfos)
protected UnsupportedOperationException checkSequenceSupport(String methodName)
public abstract boolean isDeterministicPKName(String pkName)
public abstract boolean isDeterministicUKName(String ukName)
public abstract boolean isDeterministicFKName(String fkName)
public abstract boolean isDeterministicIndexName(String indexName)
public boolean supportsRegex()
public String regexQuery(String expression, boolean not, String regex)
expression - a column name or a SQL value expression to be checked with a regular expressionnot - if set to true, the query fits expressions which do not match the regular expressionregex - the regular expression to check withUnsupportedOperationException - if the database does not support regular expressionspublic String renderCase(String columnName, String elseExpression, String... whenThenExpressionPairs)
public List<DBTrigger> queryTriggers(DBSchema schema, Connection connection) throws SQLException
SQLExceptionpublic List<DBPackage> queryPackages(DBSchema schema, Connection connection) throws SQLException
SQLExceptionpublic abstract void restrictRownums(int rowOffset,
int rowCount,
Query query)
Copyright © 2006–2014 Volker Bergmann. All rights reserved.