“片段”视图的 EGL 抽屉中的 databaseUpdate 片段是一个 EGL 函数,用于在从页面处理程序传递记录时更新关系表的一行。此片段将放在 EGL 库中。要插入并配置此片段,遵循下列指示信息:
Function updateRec(${TableName}New ${TableName}) // Function name - call this function // passing the ${TableName} Record as a parameter ${TableName}Old ${TableName}; // A copy of the Record, used // to lock the table row and to obtain // the existing row values prior to update try ${TableName}Old.${KeyColumn} = ${TableName}New.${KeyColumn}; get ${TableName}Old forUpdate; // Get the existing row. // Note that if you had custom processing to do, // you would insert your code after this call move ${TableName}New to ${TableName}Old byName; //Move the updated values to the copy-row replace ${TableName}Old; //And replace the row in the database. sysLib.commit(); //Commit your changes to the Database onException //If the update fails... sysLib.rollback(); // cancel all database updates // (assuming this is permitted // by your database) and call // a custom error handling routine end end