AnyLogic
Expand
Font size
All Implemented Interfaces:
java.io.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

Constructors 
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
Constructor Description

Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods 
abstract void evaluateValues_xjal​(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_xjal(Object[], Object[][]) method)
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
java.lang.String toString()  
Modifier and Type Method Description

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 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_xjal(Object[], Object[][])

Method Detail

evaluateValues_xjal

@AnyLogicInternalCodegenAPI
public abstract void evaluateValues_xjal​(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_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 java.lang.String toString()
Overrides:
toString in class ConnectivityBase
How can we improve this article?