com.partnersoft.sql
Class SqlDataRecordUpdateSink

java.lang.Object
  extended by com.partnersoft.io.DataRecordSink
      extended by com.partnersoft.sql.SqlDataRecordUpdateSink

public class SqlDataRecordUpdateSink
extends DataRecordSink

DataRecordSink for updating existing records into a Sql database.

Copyright 2009 Partner Software, Inc.

Author:
Rich Stepanski

Constructor Summary
SqlDataRecordUpdateSink(SqlConnection connection, java.lang.String tableName, java.lang.String keyFieldName, boolean closeWhenDone, java.util.List<java.lang.String> fieldNames)
          Creates a new SqlDataRecordUpdateSink.
SqlDataRecordUpdateSink(SqlConnection connection, java.lang.String tableName, java.lang.String keyFieldName, boolean closeWhenDone, java.lang.String... fieldNames)
          Creates a new SqlDataRecordUpdateSink.
 
Method Summary
protected  void closeImp()
           
protected  void openImp()
           
protected  void writeImp(java.util.List<java.lang.Object> payload)
           
protected  void writeImp(Naming<java.lang.Object> payload)
           
protected  void writeImp(java.lang.Object... payload)
           
 
Methods inherited from class com.partnersoft.io.DataRecordSink
close, getException, getFieldNames, open, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SqlDataRecordUpdateSink

public SqlDataRecordUpdateSink(SqlConnection connection,
                               java.lang.String tableName,
                               java.lang.String keyFieldName,
                               boolean closeWhenDone,
                               java.util.List<java.lang.String> fieldNames)
Creates a new SqlDataRecordUpdateSink. Updates the passed table that can be reached through the passed connection. Records will be updated by matching the passed keyFieldName.

Note, the fieldNames list must end with the keyFieldName as this is set last in the prepared statement.

Parameters:
connection - - SqlConnection to the database to update.
tableName - - Table name in database to update.
keyFieldName - - Field name to use to find what to update.
closeWhenDone - - If true, the SqlConnection will be closed when the update completes.
fieldNames - - List of names to insert, must end with the key field name.

SqlDataRecordUpdateSink

public SqlDataRecordUpdateSink(SqlConnection connection,
                               java.lang.String tableName,
                               java.lang.String keyFieldName,
                               boolean closeWhenDone,
                               java.lang.String... fieldNames)
Creates a new SqlDataRecordUpdateSink. Updates the passed table that can be reached through the passed connection. Records will be updated by matching the passed keyFieldName.

Note, the fieldNames array must end with the keyFieldName as this is set last in the prepared statement.

Parameters:
connection - - SqlConnection to the database to update.
tableName - - Table name in database to update.
keyFieldName - - Field name to use to find what to update.
closeWhenDone - - If true, the SqlConnection will be closed when the update completes.
fieldNames - - Array of names to insert, must end with the key field name.
Method Detail

closeImp

protected void closeImp()
                 throws java.lang.Exception
Specified by:
closeImp in class DataRecordSink
Throws:
java.lang.Exception

openImp

protected void openImp()
                throws java.lang.Exception
Specified by:
openImp in class DataRecordSink
Throws:
java.lang.Exception

writeImp

protected void writeImp(Naming<java.lang.Object> payload)
                 throws java.lang.Exception
Specified by:
writeImp in class DataRecordSink
Throws:
java.lang.Exception

writeImp

protected void writeImp(java.lang.Object... payload)
                 throws java.lang.Exception
Specified by:
writeImp in class DataRecordSink
Throws:
java.lang.Exception

writeImp

protected void writeImp(java.util.List<java.lang.Object> payload)
                 throws java.lang.Exception
Specified by:
writeImp in class DataRecordSink
Throws:
java.lang.Exception