public abstract class AbstractStatementsWriter extends Object implements StatementsWriter
StatementsWriter
.Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractStatementsWriter.AbstractTableStatement
Base class for insert and update statements.
|
protected static class |
AbstractStatementsWriter.InsertStatement
Holds the information for an SQL Insert statement.
|
protected static class |
AbstractStatementsWriter.PlainStatement
A single (unparsed) SQL statement.
|
protected static class |
AbstractStatementsWriter.UpdateStatement
Holds the information for an SQL update statement.
|
Constructor and Description |
---|
AbstractStatementsWriter() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
TableStatement |
createInsertStatement(GeneratorDialect dialect,
GeneratorTable table)
Creates a container for a dedicated "insert into table" statement.
|
EntityStatement |
createPlainStatement(GeneratorDialect dialect,
String sql)
Creates a container for a plain SQL statement, which is just executed "as is".
|
TableStatement |
createUpdateStatement(GeneratorDialect dialect,
GeneratorTable table,
GeneratorColumn idColumn,
ColumnExpression idValue)
Creates a container for a dedicated "update table" statement.
|
void |
flush()
Flushes any open statements.
|
void |
writeComment(String comment)
Writes a SQL comment to the target.
|
void |
writeSectionSeparator()
Writes a new line to the target file to separate different sections in the SQL file.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
truncateTables, writePlainStatement, writeStatement
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public TableStatement createInsertStatement(GeneratorDialect dialect, GeneratorTable table)
StatementsWriter
createInsertStatement
in interface StatementsWriter
dialect
- the current database dialecttable
- the name of the tablepublic EntityStatement createPlainStatement(GeneratorDialect dialect, String sql)
StatementsWriter
createPlainStatement
in interface StatementsWriter
dialect
- the current database dialectsql
- the content of the sql statement (without any delimiter)public TableStatement createUpdateStatement(GeneratorDialect dialect, GeneratorTable table, GeneratorColumn idColumn, ColumnExpression idValue)
StatementsWriter
createUpdateStatement
in interface StatementsWriter
dialect
- the current database dialecttable
- the name of the affected tableidColumn
- the column that contains the id of the changed entityidValue
- the expression for the id of the changed entitypublic void flush() throws IOException
StatementsWriter
flush
in interface StatementsWriter
IOException
- if the target throws an exceptionpublic void writeComment(String comment) throws IOException
StatementsWriter
writeComment
in interface StatementsWriter
comment
- the comment to writeIOException
- if the target throws an exceptionpublic void writeSectionSeparator() throws IOException
StatementsWriter
writeSectionSeparator
in interface StatementsWriter
IOException
- if the target throws such an exceptionCopyright © 2022 fastnate.org. All rights reserved.