public class MySqlInsertWriter 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 |
|---|
MySqlInsertWriter(String tableName,
File file) |
MySqlInsertWriter(String tableName,
File file,
boolean append) |
MySqlInsertWriter(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() |
boolean |
isBatchMode() |
boolean |
isPretty() |
MySqlInsertWriter |
setBatchSize(int batchSize)
Sets the number of records to chunk together in batch inserts.
|
MySqlInsertWriter |
setFieldNamesInFirstRow(boolean fieldNamesInFirstRow) |
MySqlInsertWriter |
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, writeopen, 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
protected void writeRecord(Record record) throws Throwable
writeRecord in class AbstractWriterThrowablepublic void close()
DataEndpointclose in class TextWriterpublic String getTableName()
public boolean isPretty()
public MySqlInsertWriter 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 MySqlInsertWriter 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 MySqlInsertWriter 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-2025 North Concepts Inc. All Rights Reserved.