public class StandardDialect extends java.lang.Object implements Dialect
Constructor and Description |
---|
StandardDialect() |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
alterIdentityColumnFormat() |
protected java.lang.String |
alterSequenceFormat() |
protected java.lang.String |
createForeignKeyConstraintFormat() |
protected java.lang.String |
createUniqueConstraintFormat() |
protected java.lang.String |
currentDatePattern() |
protected java.lang.String |
currentTimePattern() |
protected java.lang.String |
currentTimestampFunction() |
protected java.lang.String |
currentTimestampPattern() |
protected java.lang.String |
dateLiteralFormat() |
protected java.lang.String |
dropConstraintFormat() |
protected java.lang.String |
dropForeignKeyConstraintFormat() |
protected java.lang.String |
dropUniqueConstraintFormat() |
protected java.lang.String |
dummyTable() |
java.lang.String |
evaluateCurrentDate(java.lang.String sql,
java.sql.Date date)
Replaces non-deterministic CURRENT_DATE functions with deterministic static values.
|
java.lang.String |
evaluateCurrentTime(java.lang.String sql,
java.sql.Time time)
Replaces non-deterministic CURRENT_TIME functions with deterministic static values.
|
java.lang.String |
evaluateCurrentTimestamp(java.lang.String sql,
java.sql.Timestamp timestamp)
Replaces non-deterministic CURRENT_TIMESTAMP functions with deterministic static values.
|
java.lang.String |
evaluateRand(java.lang.String sql)
Replaces non-deterministic RAND() functions with deterministic static values.
|
protected java.lang.String |
executeFunction(java.sql.Connection connection,
java.lang.String function) |
protected java.lang.String |
executeFunctionFormat() |
protected java.lang.String |
executeFunctionSQL(java.lang.String function) |
protected java.util.List<java.lang.String> |
executeQuery(java.sql.Connection connection,
java.lang.String sql) |
java.lang.String |
getAlterIdentityColumnSQL(TableProperties table,
ColumnProperties column,
long value)
Returns a SQL statement used reset the current value of an identity column.
|
java.lang.String |
getAlterSequenceSQL(SequenceProperties sequence,
long value)
Returns a SQL statement used reset the current value of a sequence.
|
int |
getColumnType(ColumnProperties properties)
Returns the data type of the specified column of the specified schema and table.
|
java.lang.String |
getCreateForeignKeyConstraintSQL(ForeignKeyConstraint key)
Returns a SQL statement used to create a foreign key constraint.
|
java.lang.String |
getCreateUniqueConstraintSQL(UniqueConstraint constraint)
Returns a SQL statement used to create a unique constraint.
|
java.util.List<java.lang.String> |
getDefaultSchemas(java.sql.DatabaseMetaData metaData)
Returns a search path of schemas
|
java.lang.String |
getDropForeignKeyConstraintSQL(ForeignKeyConstraint key)
Returns a SQL statement used to drop a foreign key constraint.
|
java.lang.String |
getDropUniqueConstraintSQL(UniqueConstraint constraint)
Returns a SQL statement used to drop a unique constraint.
|
java.util.regex.Pattern |
getIdentifierPattern(java.sql.DatabaseMetaData metaData)
Returns a pattern for identifiers that do not require quoting
|
java.lang.String |
getNextSequenceValueSQL(SequenceProperties sequence)
Returns a SQL statement for obtaining the next value the specified sequence
|
java.util.Collection<QualifiedName> |
getSequences(java.sql.DatabaseMetaData metaData)
Returns a collection of all sequences in this database.
|
java.lang.String |
getSimpleSQL()
Returns a simple SQL statement used to validate whether a database is alive or not.
|
java.lang.String |
getTruncateTableSQL(TableProperties properties)
Returns a SQL statement used to truncate a table.
|
protected java.lang.String |
insertIntoTablePattern() |
boolean |
isSelectForUpdate(java.lang.String sql)
Determines whether the specified SQL is a SELECT ...
|
protected java.lang.String |
nextSequenceValueFormat() |
protected java.lang.String |
parse(java.util.regex.Pattern pattern,
java.lang.String string) |
java.lang.String |
parseInsertTable(java.lang.String sql)
Parses a table name from the specified INSERT SQL statement that may contain identity columns.
|
java.lang.String |
parseSequence(java.lang.String sql)
Parses a sequence name from the specified SQL statement.
|
protected java.lang.String |
randomPattern() |
protected java.lang.String |
selectForUpdatePattern() |
protected java.lang.String |
sequencePattern() |
protected java.lang.String |
sequenceTableType() |
protected java.lang.String |
timeLiteralFormat() |
protected java.lang.String |
timestampLiteralFormat() |
protected java.lang.String |
truncateTableFormat() |
public StandardDialect()
protected java.lang.String selectForUpdatePattern()
protected java.lang.String insertIntoTablePattern()
protected java.lang.String sequencePattern()
protected java.lang.String currentDatePattern()
protected java.lang.String currentTimePattern()
protected java.lang.String currentTimestampPattern()
protected java.lang.String randomPattern()
public java.lang.String getSimpleSQL()
Dialect
getSimpleSQL
in interface Dialect
Dialect.getSimpleSQL()
protected java.lang.String executeFunctionFormat()
protected java.lang.String executeFunctionSQL(java.lang.String function)
protected java.lang.String currentTimestampFunction()
protected java.lang.String dummyTable()
public java.lang.String getTruncateTableSQL(TableProperties properties)
Dialect
getTruncateTableSQL
in interface Dialect
properties
- table meta dataDialect.getTruncateTableSQL(net.sf.hajdbc.TableProperties)
protected java.lang.String truncateTableFormat()
public java.lang.String getCreateForeignKeyConstraintSQL(ForeignKeyConstraint key)
Dialect
getCreateForeignKeyConstraintSQL
in interface Dialect
key
- foreign key constraint meta dataDialect.getCreateForeignKeyConstraintSQL(net.sf.hajdbc.ForeignKeyConstraint)
protected java.lang.String createForeignKeyConstraintFormat()
public java.lang.String getDropForeignKeyConstraintSQL(ForeignKeyConstraint key)
Dialect
getDropForeignKeyConstraintSQL
in interface Dialect
key
- foreign key constraint meta dataDialect.getDropForeignKeyConstraintSQL(net.sf.hajdbc.ForeignKeyConstraint)
protected java.lang.String dropForeignKeyConstraintFormat()
protected java.lang.String dropConstraintFormat()
public java.lang.String getCreateUniqueConstraintSQL(UniqueConstraint constraint)
Dialect
getCreateUniqueConstraintSQL
in interface Dialect
constraint
- unique constraint meta dataDialect.getCreateUniqueConstraintSQL(net.sf.hajdbc.UniqueConstraint)
protected java.lang.String createUniqueConstraintFormat()
public java.lang.String getDropUniqueConstraintSQL(UniqueConstraint constraint)
Dialect
getDropUniqueConstraintSQL
in interface Dialect
constraint
- unique constraint meta dataDialect.getDropUniqueConstraintSQL(net.sf.hajdbc.UniqueConstraint)
protected java.lang.String dropUniqueConstraintFormat()
public boolean isSelectForUpdate(java.lang.String sql)
Dialect
isSelectForUpdate
in interface Dialect
sql
- a SQL statementDialect.isSelectForUpdate(java.lang.String)
public java.lang.String parseInsertTable(java.lang.String sql)
Dialect
parseInsertTable
in interface Dialect
sql
- a SQL statementDialect.parseInsertTable(java.lang.String)
public java.util.List<java.lang.String> getDefaultSchemas(java.sql.DatabaseMetaData metaData) throws java.sql.SQLException
Dialect
getDefaultSchemas
in interface Dialect
java.sql.SQLException
Dialect.getDefaultSchemas(java.sql.DatabaseMetaData)
protected java.lang.String executeFunction(java.sql.Connection connection, java.lang.String function) throws java.sql.SQLException
java.sql.SQLException
protected java.util.List<java.lang.String> executeQuery(java.sql.Connection connection, java.lang.String sql) throws java.sql.SQLException
java.sql.SQLException
public java.lang.String parseSequence(java.lang.String sql)
Dialect
parseSequence
in interface Dialect
sql
- a SQL statementDialect.parseSequence(java.lang.String)
public int getColumnType(ColumnProperties properties)
Dialect
getColumnType
in interface Dialect
properties
- table column meta dataDialect.getColumnType(net.sf.hajdbc.ColumnProperties)
public java.util.Collection<QualifiedName> getSequences(java.sql.DatabaseMetaData metaData) throws java.sql.SQLException
Dialect
getSequences
in interface Dialect
metaData
- database meta datajava.sql.SQLException
Dialect.getSequences(java.sql.DatabaseMetaData)
protected java.lang.String sequenceTableType()
public java.lang.String getNextSequenceValueSQL(SequenceProperties sequence)
Dialect
getNextSequenceValueSQL
in interface Dialect
sequence
- a sequence nameDialect.getNextSequenceValueSQL(net.sf.hajdbc.SequenceProperties)
protected java.lang.String nextSequenceValueFormat()
public java.lang.String getAlterSequenceSQL(SequenceProperties sequence, long value)
Dialect
getAlterSequenceSQL
in interface Dialect
sequence
- a sequence namevalue
- a sequence valueDialect.getAlterSequenceSQL(net.sf.hajdbc.SequenceProperties, long)
protected java.lang.String alterSequenceFormat()
public java.lang.String getAlterIdentityColumnSQL(TableProperties table, ColumnProperties column, long value) throws java.sql.SQLException
Dialect
getAlterIdentityColumnSQL
in interface Dialect
table
- a sequence namecolumn
- a sequence namevalue
- a sequence valuejava.sql.SQLException
protected java.lang.String alterIdentityColumnFormat()
public java.util.regex.Pattern getIdentifierPattern(java.sql.DatabaseMetaData metaData) throws java.sql.SQLException
Dialect
getIdentifierPattern
in interface Dialect
java.sql.SQLException
Dialect.getIdentifierPattern(java.sql.DatabaseMetaData)
protected java.lang.String parse(java.util.regex.Pattern pattern, java.lang.String string)
public java.lang.String evaluateCurrentDate(java.lang.String sql, java.sql.Date date)
Dialect
evaluateCurrentDate
in interface Dialect
sql
- an SQL statementdate
- the replacement dateDialect.evaluateCurrentDate(java.lang.String, java.sql.Date)
protected java.lang.String dateLiteralFormat()
public java.lang.String evaluateCurrentTime(java.lang.String sql, java.sql.Time time)
Dialect
evaluateCurrentTime
in interface Dialect
sql
- an SQL statementtime
- the replacement timeDialect.evaluateCurrentTime(java.lang.String, java.sql.Time)
protected java.lang.String timeLiteralFormat()
public java.lang.String evaluateCurrentTimestamp(java.lang.String sql, java.sql.Timestamp timestamp)
Dialect
evaluateCurrentTimestamp
in interface Dialect
sql
- an SQL statementtimestamp
- the replacement timestampDialect.evaluateCurrentTimestamp(java.lang.String, java.sql.Timestamp)
protected java.lang.String timestampLiteralFormat()
public java.lang.String evaluateRand(java.lang.String sql)
Dialect
evaluateRand
in interface Dialect
sql
- an SQL statementDialect.evaluateRand(java.lang.String)