AnyLogic
Expand
Font size
All Implemented Interfaces:
Serializable

public abstract class Update
extends DatabaseAccessor
Object performing rows update in the database table
This object is only available in the AnyLogic Professional
Author:
AnyLogic North America, LLC https://anylogic.com
See Also:
execute()finish()Serialized Form

Constructor Summary

ConstructorDescription
Update(String name, Database database, String tableName, String keyColumnName, 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

Modifier and TypeMethodDescription
abstract voidevaluateValues_xjal(Object[] keyValues, Object[][] updateValues)
This method should be overridden to fill keyValues and updateValues arrays
intexecute()
Performs update of rows with current values (provided with evaluateValues_xjal(Object[], Object[][]) method)
voidfinish()
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
StringtoString() 

Methods inherited from class com.anylogic.engine.connectivity.ConnectivityBase

destroy, getName

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Details

Update

public Update(String name,
 Database database,
 String tableName,
 String keyColumnName,
 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_xjal(Object[], Object[][])

Method Details

evaluateValues_xjal

@AnyLogicInternalCodegenAPI
public abstract void evaluateValues_xjal(Object[] keyValues,
 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_xjal(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 String toString()
Overrides:
toString in class ConnectivityBase