Das Fragment 'Datenbankaktualisierung' im EGL-Fach der Snippetansicht ist eine Funktion, mit der eine einzelne Zeile einer relationalen Tabelle aktualisiert wird, wenn ein Datensatz von einem JSF-Handler übergeben wird. Dieses Fragment ist für eine EGL-Bibliothek bestimmt.
Gehen Sie wie folgt vor, um dieses Fragment einzufügen und zu konfigurieren:
Function updateRec(EGL_RecordNameNew EGL_RecordName)
//Function name - call this function passing
//the EGL_RecordName Record as a parameter
EGL_RecordNameOld EGL_RecordName; //A copy of the Record,
//used to lock the table row, and obtain the existing row values
//prior to update
try
EGL_RecordNameOld.Table_Key_column_ID
= EGL_RecordNameNew.Table_Key_column_ID;
get EGL_RecordNameOld forUpdate; //Get the existing row.
//Note that if you had custom processing to do,
//you would insert after this call
move EGL_RecordNameNew to EGL_RecordNameOld byName;
//Move the updated values to the copy-row
replace EGL_RecordNameOld; //And replace the row in the database.
sysLib.commit(); //Commit your changes to the Database
onException (ex AnyException) //If the update fails...
sysLib.rollback(); //cancel all database updates
//(assuming this is permitted by your database)
// and call a custom error handling routine or something
end
end