com.xj.anylogic.engine.connectivity
Class Update

java.lang.Object
  extended by com.xj.anylogic.engine.connectivity.Update
All Implemented Interfaces:
java.io.Serializable

public abstract class Update
extends java.lang.Object

Object performing rows update in the database table
This object is only available in the AnyLogic Professional

Author:
XJ Technologies Company Ltd. www.anylogic.com
See Also:
execute(), finish(), Serialized Form

Constructor Summary
Update(java.lang.String name, Database database, java.lang.String tableName, java.lang.String keyColumnName, java.lang.String[][] columnsToUpdate)
          Creates new Update object for table with given name with names of key column to be checked and columns to be updated specified
 
Method Summary
 void destroy()
          Releases resources acquired by this object
Also destroys all not destroyed contributors associated with this object

Doest nothing if object is already destroyed
abstract  void evaluateValues(java.lang.Object[] keyValues, java.lang.Object[][] updateValues)
          This method should be overridden to fill keyValues and updateValues arrays
 int execute()
          Performs update of rows with current values (provided with evaluateValues(Object[], Object[][]) method)
 void finish()
          Resets this object (after multiple update operations) - releases resources
May be called after all execute() operations completed.
 java.lang.String getName()
          Returns the name of this object
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Update

public Update(java.lang.String name,
              Database database,
              java.lang.String tableName,
              java.lang.String keyColumnName,
              java.lang.String[][] columnsToUpdate)
Creates new Update object for table with given name with names of key column to be checked and columns to be updated specified

Parameters:
name - object name (decoration purpose)
database - the Database object
tableName - the name of the table to be updated
keyColumnName - the name of key column
columnsToUpdate - array of column names to be affected by this update. This array is 2-dimensional: first dimension enumerates update-sets which correspond to some values of key column respectively; second dimension enumerates names of updated columns for each update-set. See also evaluateValues(Object[], Object[][])
Method Detail

evaluateValues

public abstract void evaluateValues(java.lang.Object[] keyValues,
                                    java.lang.Object[][] updateValues)
This method should be overridden to fill keyValues and updateValues arrays

Parameters:
keyValues - values for key column to be checked when applying updates
array of the same length as first dimension in columnToUpdate array passed to the constructor
Given array is initially dirty. Implementation is responsible to fill all its values
updateValues - values for value columns to be filled when applying update changes when corresponding key-checks succeed
array of the same dimensions as in columnToUpdate array passed to the constructor
Given array is initially dirty. Implementation is responsible to fill all its values

execute

public int execute()
Performs update of rows with current values (provided with evaluateValues(Object[], Object[][]) method)

Returns:
number of modified rows

finish

public void finish()
Resets this object (after multiple update operations) - releases resources
May be called after all execute() operations completed.
Called automatically on underlying Database destroy and disconnect


toString

public java.lang.String toString()

getName

public final java.lang.String getName()
Returns the name of this object

Returns:
the name of this object

destroy

public final void destroy()
Releases resources acquired by this object
Also destroys all not destroyed contributors associated with this object

Doest nothing if object is already destroyed



Copyright © 1991-2008 XJ Technlogies. All Rights Reserved.