public class H2InsertWriter extends TextWriter
DataEndpoint.State| Modifier and Type | Field and Description |
|---|---|
protected int |
batchedInserts |
protected int |
batchSize |
protected boolean |
pretty |
protected String |
tableName |
currentRecordlastRecord, PRODUCT, PRODUCT_VERSION, VENDOR, XML_INPUT_FACTORY_KEYBUFFER_SIZE, captureElapsedTime, DEFAULT_READ_BUFFER_SIZEid, log, name, TIMESTAMP_FORMAT| Constructor and Description |
|---|
H2InsertWriter(String tableName,
File file)
Constructs an H2InsertWriter for the specified table and file.
|
H2InsertWriter(String tableName,
File file,
boolean append)
Constructs an H2InsertWriter for the specified table, file, and append mode.
|
H2InsertWriter(String tableName,
Writer writer)
Constructs an H2InsertWriter for the specified table and 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()
Returns the batch size.
|
protected String |
getSqlValueLiteral(Field field) |
String |
getTableName()
Returns the table name.
|
boolean |
isBatchMode()
Returns whether batch mode is enabled.
|
boolean |
isPretty()
Returns whether pretty formatting is enabled.
|
H2InsertWriter |
setBatchSize(int batchSize)
Sets the number of records to chunk together in batch inserts.
|
H2InsertWriter |
setFieldNamesInFirstRow(boolean fieldNamesInFirstRow) |
H2InsertWriter |
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, writecreateHeaderRecord, isHeaderRow, open, writeImplavailable, getNestedEndpoint, getNestedWriter, getRootEndpoint, getRootWriter, getWriterdecrementRecordCount, enableJmx, getLastRecord, getRecordCount, getRecordCountAsBigInteger, getRecordCountAsString, incrementRecordCount, isRecordCountBigInteger, resetRecordCount, toStringaddElapsedtime, assertClosed, assertNotOpened, assertOpened, finalize, getClosedOn, getDescription, getElapsedTime, getElapsedTimeAsString, getOpenedOn, getOpenElapsedTime, getOpenElapsedTimeAsString, getSelfTime, getSelfTimeAsString, getState, isCaptureElapsedTime, isClosed, isOpen, setCaptureElapsedTime, setDescriptionprotected boolean pretty
protected int batchSize
protected int batchedInserts
protected final String tableName
public H2InsertWriter(String tableName, File file, boolean append)
tableName - the name of the tablefile - the file to write toappend - true to append to existing filepublic H2InsertWriter(String tableName, File file)
tableName - the name of the tablefile - the file to write toprotected void writeRecord(Record record) throws Throwable
writeRecord in class AbstractWriterThrowablepublic void close()
DataEndpointclose in class TextWriterpublic String getTableName()
public boolean isPretty()
public H2InsertWriter 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 H2InsertWriter 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);public boolean isBatchMode()
public H2InsertWriter setFieldNamesInFirstRow(boolean fieldNamesInFirstRow)
setFieldNamesInFirstRow in class AbstractWriterpublic DataException addExceptionProperties(DataException exception)
EndpointDataException. Since this method is called whenever an
exception is thrown, subclasses should override it to add their specific information.addExceptionProperties in class TextWriterCopyright (c) 2006-2026 North Concepts Inc. All Rights Reserved.