public class PostgreSqlInsertWriter extends TextWriter
DataEndpoint.State
Modifier and Type | Field and Description |
---|---|
protected int |
batchedInserts |
protected int |
batchSize |
protected boolean |
pretty |
protected String |
tableName |
currentRecord
lastRecord, PRODUCT, PRODUCT_VERSION, VENDOR, XML_INPUT_FACTORY_KEY
BUFFER_SIZE, captureElapsedTime, DEFAULT_READ_BUFFER_SIZE
id, log, name, TIMESTAMP_FORMAT
Constructor and Description |
---|
PostgreSqlInsertWriter(String tableName,
File file) |
PostgreSqlInsertWriter(String tableName,
File file,
boolean append) |
PostgreSqlInsertWriter(String tableName,
Writer writer) |
Modifier and Type | Method and Description |
---|---|
DataException |
addExceptionProperties(DataException exception)
Adds this endpoint's current state to a
DataException . |
void |
close()
Indicates that this endpoint has finished reading or writing.
|
int |
getBatchSize() |
protected String |
getSqlValueLiteral(Field field) |
String |
getTableName() |
protected boolean |
isBatchMode() |
boolean |
isPretty() |
PostgreSqlInsertWriter |
setBatchSize(int batchSize)
Sets the number of records to chunk together in batch inserts.
|
PostgreSqlInsertWriter |
setFieldNamesInFirstRow(boolean fieldNamesInFirstRow) |
PostgreSqlInsertWriter |
setPretty(boolean pretty)
Indicates if line breaks and indentations should be added to output insert statement (default false).
Example output (pretty = true): INSERT INTO "tableName" ("col1", "col2", "col3") |
protected void |
writeRecord(Record record) |
getFile, getWriter, isAppend, isAutoCloseWriter, isFieldNamesInFirstRow, isFlushOnWrite, setAutoCloseWriter, setFlushOnWrite, write
open, writeImpl
available, getNestedEndpoint, getNestedWriter, getRootEndpoint, getRootWriter
decrementRecordCount, enableJmx, getLastRecord, getRecordCount, getRecordCountAsBigInteger, getRecordCountAsString, incrementRecordCount, isRecordCountBigInteger, resetRecordCount, toString
addElapsedtime, assertClosed, assertNotOpened, assertOpened, finalize, getClosedOn, getDescription, getElapsedTime, getElapsedTimeAsString, getOpenedOn, getOpenElapsedTime, getOpenElapsedTimeAsString, getSelfTime, getSelfTimeAsString, getState, isCaptureElapsedTime, isClosed, isOpen, setCaptureElapsedTime, setDescription
protected boolean pretty
protected int batchSize
protected int batchedInserts
protected final String tableName
protected void writeRecord(Record record) throws Throwable
writeRecord
in class AbstractWriter
Throwable
public void close()
DataEndpoint
close
in class TextWriter
public String getTableName()
public boolean isPretty()
public PostgreSqlInsertWriter setPretty(boolean pretty)
INSERT INTO "tableName" ("col1", "col2", "col3")
VALUES (val1, val2, val3),
(val1, val2, val3),
(val1, val2, val3),...
INSERT INTO "tableName" ("col1", "col2", "col3") VALUES (val1, val2, val3), (val1, val2, val3), (val1, val2, val3),...
public int getBatchSize()
public PostgreSqlInsertWriter setBatchSize(int batchSize)
INSERT INTO "tableName" ("col1", "col2", "col3")
VALUES (val1, val2, val3),
(val1, val2, val3);
Example output (batchSize = 0):
INSERT INTO "tableName" ("col1", "col2", "col3") VALUES (val1, val2, val3);
INSERT INTO "tableName" ("col1", "col2", "col3") VALUES (val1, val2, val3);
protected boolean isBatchMode()
public PostgreSqlInsertWriter setFieldNamesInFirstRow(boolean fieldNamesInFirstRow)
setFieldNamesInFirstRow
in class AbstractWriter
public DataException addExceptionProperties(DataException exception)
Endpoint
DataException
. Since this method is called whenever an
exception is thrown, subclasses should override it to add their specific information.addExceptionProperties
in class TextWriter
Copyright (c) 2006-2024 North Concepts Inc. All Rights Reserved.