java.lang.Object
com.pervasive.datarush.operators.AbstractLogicalOperator
com.pervasive.datarush.operators.CompositeOperator
com.pervasive.datarush.operators.io.jdbc.JDBCOperator
com.pervasive.datarush.operators.io.jdbc.AbstractWriteToJDBC
- All Implemented Interfaces:
ConnectionSettings,LogicalOperator
- Direct Known Subclasses:
DeleteFromJDBC,UpdateInJDBC,WriteToJDBC
Abstract implementation of a JDBC writer.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classprotected static classprotected static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected Stringprotected Stringprotected final RecordPortprotected intprotected String[] -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidappendDelimited(StringBuilder command, String delimiter, List<String> fields, String fieldSuffix) protected static StringbuildDeleteStatement(String tableName, List<String> keyFields) protected static StringbuildInsertStatement(String tableName, List<String> fields) protected static Stringprotected Stringprotected StringintRetrieves the commit interval used by the JDBC driver.Retrieves the SQL statement to execute after processing all the records.Retrieves the SQL statement to execute before processing any records.getInput()Returns the input port.intRetrieves the isolation level to use for the transactions.getKeyNameList(List<String> fieldNameList) String[]Retrieves the field names (JDBC column names) to use as keys.Returns the rename mapping.protected StringvoidsetCommitInterval(int commitInterval) Sets the commit interval used by the JDBC driver.voidsetFinalizeTableSQL(String finalizeTableSQL) Sets the SQL statement to execute after processing all the records.voidsetInitializeTableSQL(String initializeTableSQL) Sets the SQL statement to execute before processing any records.voidsetIsolationLevel(int level) Sets the isolation level to use for the transactions.voidsetKeyNames(String[] keyNames) Sets the field names (JDBC column names) to use as keys.voidsetRenameMapping(Map<String, String> renameMapping) Sets a rename mapping.Methods inherited from class com.pervasive.datarush.operators.io.jdbc.JDBCOperator
getConnectionFactory, getDriverName, getErrorAction, getHostNames, getJDBCConnector, getPassword, getSqlWarningLimit, getTableName, getUrl, getUser, setConnectionFactory, setDriverName, setErrorAction, setHostNames, setHostNames, setJDBCConnector, setPassword, setSqlWarningLimit, setTableName, setUrl, setUserMethods inherited from class com.pervasive.datarush.operators.CompositeOperator
composeMethods inherited from class com.pervasive.datarush.operators.AbstractLogicalOperator
disableParallelism, getInputPorts, getOutputPorts, newInput, newInput, newOutput, newRecordInput, newRecordInput, newRecordOutput, notifyError
-
Field Details
-
input
-
renameMapping
-
keyNames
-
commitInterval
protected int commitInterval -
isolationLevel
protected int isolationLevel -
initializeTableSQL
-
finalizeTableSQL
-
-
Constructor Details
-
AbstractWriteToJDBC
public AbstractWriteToJDBC() -
AbstractWriteToJDBC
-
-
Method Details
-
getKeyNames
Retrieves the field names (JDBC column names) to use as keys.- Returns:
- the field names to use as keys
-
setKeyNames
Sets the field names (JDBC column names) to use as keys. Used when#outputModeisOutputMode#UPDATEorOutputMode#DELETE.- Parameters:
keyNames- the list of key name fields
-
getIsolationLevel
public int getIsolationLevel()Retrieves the isolation level to use for the transactions.- Returns:
- the isolation level to use for the transactions
-
setIsolationLevel
public void setIsolationLevel(int level) Sets the isolation level to use for the transactions. SeeConnection.setTransactionIsolation(int)for isolation level explanations.- Parameters:
level- the isolation level to use for the transactions
-
getCommitInterval
public int getCommitInterval()Retrieves the commit interval used by the JDBC driver.- Returns:
- the commit interval used by the JDBC driver
-
setCommitInterval
public void setCommitInterval(int commitInterval) Sets the commit interval used by the JDBC driver. This is the number of operations to execute between commit points.- Parameters:
commitInterval- number of operations executed between commits
-
getInitializeTableSQL
Retrieves the SQL statement to execute before processing any records.- Returns:
- the SQL statement to execute before processing any records
-
setInitializeTableSQL
Sets the SQL statement to execute before processing any records. The most common use is initializing the table with aCREATE TABLEstatement.This statement is executed only once, regardless of
#partitionCount.- Parameters:
initializeTableSQL- the SQL statement to execute before processing any records
-
getFinalizeTableSQL
Retrieves the SQL statement to execute after processing all the records.- Returns:
- the SQL statement to execute after processing all the records
-
setFinalizeTableSQL
Sets the SQL statement to execute after processing all the records. One example use is aCREATE INDEXstatement.This statement is executed only once, regardless of
#partitionCount.- Parameters:
finalizeTableSQL- the SQL statement to execute after processing all the records
-
getRenameMapping
Returns the rename mapping.- Returns:
- the rename mapping.
-
setRenameMapping
Sets a rename mapping. This should be an ordered (i.e. LinkedHashMap) mapping of names. The keys in the map represent the original names in the record port. The values in the map represent column names in the table. Any columns that are not included in the mapping will be dropped.- Parameters:
renameMapping- the mapping from old to new names.
-
getInput
Returns the input port.- Returns:
- the input port
-
buildInsertStatement
-
buildUpdateStatement
-
buildDeleteStatement
-
appendDelimited
protected static void appendDelimited(StringBuilder command, String delimiter, List<String> fields, String fieldSuffix) -
createTruncateTableSQL
-
createDropTableSQL
-
guessTableName
-
getKeyNameList
-