public class PostgreSqlBulkWriter extends FileStatementsWriter
StatementsWriter that writes bulk text files for each table, and references them in "COPY
INTO".AbstractStatementsWriter.AbstractTableStatement, AbstractStatementsWriter.InsertStatement, AbstractStatementsWriter.PlainStatement, AbstractStatementsWriter.UpdateStatementOUTPUT_ENCODING_KEY, OUTPUT_FILE_KEY| Constructor and Description |
|---|
PostgreSqlBulkWriter(GeneratorContext context)
Creates a new instance for a SQL file with UTF-8 encoding.
|
PostgreSqlBulkWriter(GeneratorContext context,
File sqlFile)
Creates a new instance for a SQL file with UTF-8 encoding.
|
PostgreSqlBulkWriter(GeneratorContext context,
File sqlFile,
Charset encoding)
Creates a new instance for a SQL file.
|
PostgreSqlBulkWriter(GeneratorContext context,
File directory,
Writer writer,
Charset encoding)
Creates a new instance of
PostgreSqlBulkWriter. |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
closeBulkWriter(GeneratorTable table)
Closes the current writer of the given table (for example when the table structure has changed).
|
void |
flush()
Flushes any open statements.
|
File |
getDirectory()
The directory for the bulk files.
|
Charset |
getEncoding()
The encoding of the bulk files.
|
List<File> |
getGeneratedFiles()
All files generated by this writer.
|
int |
getStatementsCount()
The count of written statements.
|
void |
writePlainStatement(GeneratorDialect dialect,
String sql)
Writes a plain SQL statement.
|
void |
writeStatement(EntityStatement stmt)
Writes the given statement to a file or database.
|
ensureDirectoryExists, getStatementSeparator, getWriter, setStatementSeparator, write, writeComment, writeSectionSeparatorcreateInsertStatement, createPlainStatement, createUpdateStatementclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waittruncateTablespublic PostgreSqlBulkWriter(GeneratorContext context) throws FileNotFoundException
context - the current generation contextFileNotFoundException - if the directory is not availablepublic PostgreSqlBulkWriter(GeneratorContext context, File sqlFile) throws FileNotFoundException
context - the current generation contextsqlFile - the file that is feeded with all plain statementsFileNotFoundException - if the directory is not availablepublic PostgreSqlBulkWriter(GeneratorContext context, File sqlFile, Charset encoding) throws FileNotFoundException
context - the current generation contextsqlFile - the file that is feeded with all plain statementsencoding - the encoding of all written filesFileNotFoundException - if the directory is not availablepublic PostgreSqlBulkWriter(GeneratorContext context, File directory, Writer writer, Charset encoding)
PostgreSqlBulkWriter.context - the current generation contextdirectory - the directory for the bulk fileswriter - the SQL file which contains the plain and the "COPY" statementsencoding - The encoding of the bulk files.public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class FileStatementsWriterIOExceptionpublic void closeBulkWriter(GeneratorTable table) throws IOException
table - the table of the writerIOException - if there was a problem when closing the writerpublic void flush()
throws IOException
StatementsWriterflush in interface StatementsWriterflush in class FileStatementsWriterIOException - if the target throws an exceptionpublic void writePlainStatement(GeneratorDialect dialect, String sql) throws IOException
StatementsWriterwriteStatement(createPlainStatement(sql), dialect).writePlainStatement in interface StatementsWriterwritePlainStatement in class FileStatementsWriterdialect - the current database dialectsql - the content of the SQL statementIOException - if the file or database throws an exceptionpublic void writeStatement(EntityStatement stmt) throws IOException
StatementsWriterwriteStatement in interface StatementsWriterwriteStatement in class FileStatementsWriterstmt - contains the values to writeIOException - if the file or database throws an exception@Generated(value="lombok") public File getDirectory()
@Generated(value="lombok") public Charset getEncoding()
@Generated(value="lombok") public List<File> getGeneratedFiles()
@Generated(value="lombok") public int getStatementsCount()
getStatementsCount in class FileStatementsWriterCopyright © 2020 fastnate.org. All rights reserved.