Package org.fastnate.generator.dialect
Class MySqlDialect
java.lang.Object
org.fastnate.generator.dialect.GeneratorDialect
org.fastnate.generator.dialect.MySqlDialect
Handles MySQL specific conversions.
- Author:
- Tobias Liefke
- See Also:
-
Field Summary
Fields inherited from class org.fastnate.generator.dialect.GeneratorDialect
NOW -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringcreateAddDateExpression(String referenceDate, long value, String unit) Creates an SQL expression to add a value to a date.createBlobExpression(byte[] blob) Create MySQL specific binary expression.The SQL expression to use in an empty insert statement.Returns the string to use when no table is required, e.g. for "SELECT 1, 2 FROM DUAL" this would return "FROM DUAL".booleanIndicates that tables are used in place of sequences, ifGenerationType.SEQUENCEis defined for aGeneratedValue.booleanIndicates that the database usually faster when all statements are executed within an transaction.booleanIndicates that this dialect supports theschemanaming.booleanIndicates that this dialect may select from the same table in an insert statement.quoteIdentifier(String name) Quotes an object name for the current database dialect.quoteString(String value) Create MySQL specific quoting of the string.Methods inherited from class org.fastnate.generator.dialect.GeneratorDialect
addQuotedCharacter, adjustNextIdentityValue, adjustNextSequenceValue, buildCurrentSequenceValue, buildNextSequenceValue, convertBooleanValue, convertNumberValue, convertTemporalValue, convertTemporalValue, convertToDatabaseDate, createHexBlobExpression, getConcatOperator, getLetter, isEmptyStringEqualToNull, isIdentitySupported, isNextSequenceValueInInsertSupported, isSequenceInWhereSupported, isSequenceSupported, isSettingIdentityAllowed, truncateTable
-
Constructor Details
-
MySqlDialect
public MySqlDialect()
-
-
Method Details
-
createAddDateExpression
Description copied from class:GeneratorDialectCreates an SQL expression to add a value to a date.- Overrides:
createAddDateExpressionin classGeneratorDialect- Parameters:
referenceDate- the expression for the reference datevalue- the value to add to the dateunit- the unit of the value- Returns:
- the SQL expression that adds the value
-
createBlobExpression
Create MySQL specific binary expression.- Overrides:
createBlobExpressionin classGeneratorDialect- Parameters:
blob- the bytes to convert- Returns:
- the expression for the bytes
-
getEmptyValuesExpression
Description copied from class:GeneratorDialectThe SQL expression to use in an empty insert statement.- Overrides:
getEmptyValuesExpressionin classGeneratorDialect- Returns:
- the SQL expression if an insert statement contains no values
-
getOptionalTable
Description copied from class:GeneratorDialectReturns the string to use when no table is required, e.g. for "SELECT 1, 2 FROM DUAL" this would return "FROM DUAL".- Overrides:
getOptionalTablein classGeneratorDialect- Returns:
- the SQL to use in "SELECT x [OPTIONALTABLE] WHERE ..."
-
isEmulatingSequences
public boolean isEmulatingSequences()Description copied from class:GeneratorDialectIndicates that tables are used in place of sequences, ifGenerationType.SEQUENCEis defined for aGeneratedValue.- Overrides:
isEmulatingSequencesin classGeneratorDialect- Returns:
trueif sequences are emulated with tables,falseif sequences are supported
-
isFastInTransaction
public boolean isFastInTransaction()Description copied from class:GeneratorDialectIndicates that the database usually faster when all statements are executed within an transaction. For example Oracle is approx. 25% faster but H2 is 200% slower compared to auto commit. Only relevant if executed against a running database.- Overrides:
isFastInTransactionin classGeneratorDialect- Returns:
trueif an transaction is faster than auto commit
-
isSchemaSupported
public boolean isSchemaSupported()Description copied from class:GeneratorDialectIndicates that this dialect supports theschemanaming.- Overrides:
isSchemaSupportedin classGeneratorDialect- Returns:
trueif we support the name of schema when referencing a table
-
isSelectFromSameTableInInsertSupported
public boolean isSelectFromSameTableInInsertSupported()Description copied from class:GeneratorDialectIndicates that this dialect may select from the same table in an insert statement.- Overrides:
isSelectFromSameTableInInsertSupportedin classGeneratorDialect- Returns:
trueif "INSERT INTO MY_TABLE (a) VALUES (SELECT max(a) FROM MY_TABLE)" is supported
-
quoteIdentifier
Description copied from class:GeneratorDialectQuotes an object name for the current database dialect.- Overrides:
quoteIdentifierin classGeneratorDialect- Parameters:
name- the plain object name- Returns:
- the quoted object name
-
quoteString
Create MySQL specific quoting of the string.- Overrides:
quoteStringin classGeneratorDialect- Parameters:
value- the value to quote- Returns:
- the quoted string
-