Back
eventPreUpdateSQL
Editing, Updating and Creating Records
eventPreUpdateSQL
Name of function to call before record is changed
Default:
This function will be passed 2 parameters, $key, the primary key of the relevant record, and the $lens object. This function is typically used to initiate a transaction. The transaction is completed in the eventPostUpdateSQL function.

This property is obsolete. We recommend using spEdit instead.

Syntax
function preupdate($key, $lens)
{
GLOBAL $HTTP_POST_VARS;

$lens->connection->BeginTrans();
}


function postupdate($key, $updateok, $lens)
{
if ($updateok) {
$rs = $lens->Execute("update table set values=??? where parentid=$key");
if ($rs) $lens->connection->CommitTrans();
else $updateok= false;
}

if (!$updateok) {
$lens->connection->RollbackTrans();
}
}

$lens->eventPreUpdateSQL = 'preupdate';
$lens->eventPostUpdateSQL = 'postupdate';

 Basic:Yes  Advanced/Enterprise:Yes  DynamicEdit:Yes   [Version 1.0]