@ComponentProfile(summary="Insert/Update a CSV file into a database", tag="service,csv,jdbc", since="3.6.5") public class JdbcUpsertCSV extends JdbcMapUpsert
firstname, lastname, dob,id
alice, smith, 2017-01-01,1234
will effectively execute the following statement INSERT INTO table (firstname,lastname,dob,id) VALUES (?,?,?,?)
or
UPDATE table SET firstname=?, lastname=?, dob=? WHERE id = ?;
if 1234
already exists as a row.
Note that no parsing/assertion of the column names will be done, so if they are invalid SQL columns then it's going to be fail.
In the adapter configuration file this class is aliased as csv-jdbc-batch-insert which is the preferred alternative to the fully qualified classname when building your configuration.
JdbcMapUpsert.SelectWrapper, JdbcMapUpsert.UpdateWrapper
JdbcMapInsert.BasicType, JdbcMapInsert.InsertWrapper, JdbcMapInsert.StatementParam, JdbcMapInsert.StatementWrapper
DEFAULT_ID_FIELD
log
CONFIRMATION_ID_KEY
Constructor and Description |
---|
JdbcUpsertCSV() |
Modifier and Type | Method and Description |
---|---|
void |
doService(AdaptrisMessage msg) |
PreferenceBuilder |
getPreferenceBuilder() |
void |
setPreferenceBuilder(PreferenceBuilder b) |
getIdField, handleUpsert, idField, setIdField, withId
buildStatementParam, closeJdbcService, columnBookend, getColumnBookendCharacter, getFieldMappings, getTable, handleInsert, initJdbcService, prepareService, setColumnBookendCharacter, setFieldMappings, setTable, startService, stopService, table, withColumnBookend, withMappings, withTable
applyTimeout, closeService, commit, createStatement, getConnection, getConnection, getStatementTimeout, initService, prepare, prepareStatement, prepareStatement, rollback, setConnection, setStatementTimeout, start, stop
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsConfirmation, getIsTrackingEndpoint, getLookupName, getUniqueId, init, isBranching, isConfirmation, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, rethrowServiceException, retrieveComponentState, setContinueOnFail, setIsConfirmation, setIsTrackingEndpoint, setLookupName, setUniqueId
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
continueOnFailure, isBranching, setUniqueId
createName, createQualifier, isConfirmation, isTrackingEndpoint
changeState, requestClose, requestInit, requestStart, requestStop, retrieveComponentState
getUniqueId
close, init
getLookupName
public PreferenceBuilder getPreferenceBuilder()
public void setPreferenceBuilder(PreferenceBuilder b)
b
- the PreferenceBuilder to setpublic void doService(AdaptrisMessage msg) throws ServiceException
ServiceException