Package org.fastnate.generator.dialect
Class PostgresDialect
java.lang.Object
org.fastnate.generator.dialect.GeneratorDialect
org.fastnate.generator.dialect.PostgresDialect
Handles PostgreSQL specific conversions.
- 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.voidadjustNextIdentityValue(StatementsWriter writer, GeneratorTable table, GeneratorColumn columnName, long nextValue) Adjusts the next value of the given identity column to ensure that it is bigger than the last generated value.buildCurrentSequenceValue(String sequence, int incrementSize, boolean firstCall) Builds the SQL expression that is used for referencing the current value of the given sequence.convertBooleanValue(boolean value) Converts a boolean value to an SQL expression for the current database type.protected StringcreateAddDateExpression(String referenceDate, long value, String unit) Creates an SQL expression to add a value to a date.createBlobExpression(byte[] blob) Converts the given byte array to an SQL expression for the current database.voidtruncateTable(StatementsWriter writer, GeneratorTable table) Adds a "truncate table" statement to the given writer.Methods inherited from class org.fastnate.generator.dialect.GeneratorDialect
adjustNextSequenceValue, buildNextSequenceValue, convertNumberValue, convertTemporalValue, convertTemporalValue, convertToDatabaseDate, createHexBlobExpression, getConcatOperator, getEmptyValuesExpression, getLetter, getOptionalTable, isEmptyStringEqualToNull, isEmulatingSequences, isFastInTransaction, isIdentitySupported, isNextSequenceValueInInsertSupported, isSchemaSupported, isSelectFromSameTableInInsertSupported, isSequenceInWhereSupported, isSequenceSupported, isSettingIdentityAllowed, quoteIdentifier, quoteString
-
Constructor Details
-
PostgresDialect
public PostgresDialect()
-
-
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
-
adjustNextIdentityValue
public void adjustNextIdentityValue(StatementsWriter writer, GeneratorTable table, GeneratorColumn columnName, long nextValue) throws IOException Description copied from class:GeneratorDialectAdjusts the next value of the given identity column to ensure that it is bigger than the last generated value.- Overrides:
adjustNextIdentityValuein classGeneratorDialect- Parameters:
writer- the target of any generated statementtable- the table of the columncolumnName- the (auto increment) identity columnnextValue- the next value of the identity column- Throws:
IOException- if the writer throws one
-
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
-
convertBooleanValue
Description copied from class:GeneratorDialectConverts a boolean value to an SQL expression for the current database type.- Overrides:
convertBooleanValuein classGeneratorDialect- Parameters:
value- the value to convert- Returns:
- the SQL representation of the value
-
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
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
-
truncateTable
Description copied from class:GeneratorDialectAdds a "truncate table" statement to the given writer.- Overrides:
truncateTablein classGeneratorDialect- Parameters:
writer- the target of the statementtable- the table to truncate- Throws:
IOException- if the writer throws one
-