Package org.fastnate.generator.dialect
Class MsSqlDialect
java.lang.Object
org.fastnate.generator.dialect.GeneratorDialect
org.fastnate.generator.dialect.MsSqlDialect
Handles MS SQL 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 voidaddQuotedCharacter(StringBuilder result, char c) Adds a quoted character to the result string buffer.buildCurrentSequenceValue(String sequence, int incrementSize, boolean firstCall) Builds the SQL expression that is used for referencing the current value of the given sequence.buildNextSequenceValue(String sequence, int incrementSize) Builds the SQL expression resp. statement that is used for creating the next value of the given sequence.protected StringconvertTemporalValue(Date value) Builds the SQL expression for a date / time / timestamp.convertTemporalValue(Date value, jakarta.persistence.TemporalType type) Converts a date to an appropriate SQL expression.createBlobExpression(byte[] blob) Converts the given byte array to an SQL expression for the current database.The operator used to concat two Strings.booleanIndicates that tables are used in place of sequences, ifGenerationType.SEQUENCEis defined for aGeneratedValue.booleanIndicates if this dialect supports writing absolute values to anGenerationType.IDENTITYcolumn.quoteIdentifier(String name) Quotes an object name for the current database dialect.Methods inherited from class org.fastnate.generator.dialect.GeneratorDialect
adjustNextIdentityValue, adjustNextSequenceValue, convertBooleanValue, convertNumberValue, convertToDatabaseDate, createAddDateExpression, createHexBlobExpression, getEmptyValuesExpression, getLetter, getOptionalTable, isEmptyStringEqualToNull, isFastInTransaction, isIdentitySupported, isNextSequenceValueInInsertSupported, isSchemaSupported, isSelectFromSameTableInInsertSupported, isSequenceInWhereSupported, isSequenceSupported, quoteString, truncateTable
-
Constructor Details
-
MsSqlDialect
public MsSqlDialect()
-
-
Method Details
-
addQuotedCharacter
Description copied from class:GeneratorDialectAdds a quoted character to the result string buffer.- Overrides:
addQuotedCharacterin classGeneratorDialect- Parameters:
result- the current result bufferc- the character to quote
-
buildCurrentSequenceValue
Description copied from class:GeneratorDialectBuilds the SQL expression that is used for referencing the current value of the given sequence.- Overrides:
buildCurrentSequenceValuein classGeneratorDialect- Parameters:
sequence- the fully qualified name of the sequenceincrementSize- the expected incrementSize, as given in the schema - used by some dialects to ensure that exactly that inrement is usedfirstCall- indicates that the sequence was not updated before in this session - we may need to use a different approach to get the current value- Returns:
- the SQL expression to use in statement
-
buildNextSequenceValue
Description copied from class:GeneratorDialectBuilds the SQL expression resp. statement that is used for creating the next value of the given sequence. Depending onGeneratorDialect.isNextSequenceValueInInsertSupported()this will return an expression or a statement.- Overrides:
buildNextSequenceValuein classGeneratorDialect- Parameters:
sequence- the fully qualified name of the sequenceincrementSize- the expected incrementSize, as given in the schema - used by some dialects to ensure that exactly that inrement is used- Returns:
- the SQL to use in resp. before the insert / update statement
-
convertTemporalValue
Description copied from class:GeneratorDialectBuilds the SQL expression for a date / time / timestamp.- Overrides:
convertTemporalValuein classGeneratorDialect- Parameters:
value- the date, already converted to one fromjavax.sql.*- Returns:
- the SQL expression representing the value.
-
convertTemporalValue
Description copied from class:GeneratorDialectConverts a date to an appropriate SQL expression.- Overrides:
convertTemporalValuein classGeneratorDialect- Parameters:
value- the timestamp valuetype- the type- Returns:
- SQL expression representing the value.
-
createBlobExpression
Description copied from class:GeneratorDialectConverts the given byte array to an SQL expression for the current database.- Overrides:
createBlobExpressionin classGeneratorDialect- Parameters:
blob- the bytes to convert- Returns:
- the expression for the bytes
-
getConcatOperator
Description copied from class:GeneratorDialectThe operator used to concat two Strings.- Overrides:
getConcatOperatorin classGeneratorDialect- Returns:
- the operator to use for "string1 OPERATOR string2" (including any necessary whitespace) or
nullif this dialect does not have such an operator
-
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
-
isSettingIdentityAllowed
public boolean isSettingIdentityAllowed()Description copied from class:GeneratorDialectIndicates if this dialect supports writing absolute values to anGenerationType.IDENTITYcolumn.- Overrides:
isSettingIdentityAllowedin classGeneratorDialect- Returns:
trueif we can write fix values for identity columns
-
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
-