Name of function to call before New Record is created Default: This function will be passed 1 parameter, the $lens object (unlike eventPreDeleteSQL and eventPreUpdateSQL which get 2 parameters). This function is typically used to initiate a transaction. The transaction is completed in the eventPostInsertSQL function.
This property is obsolete. We recommend using spNew instead.Syntax
function preinsert($lens)
{
GLOBAL $HTTP_POST_VARS;
$lens->connection->BeginTrans();
}
function postinsert($key,$insertok, $lens)
{
if ($insertok) {
$rs = $lens->Execute('update some table with $key values');
if ($rs) $lens->connection->CommitTrans();
else $insertok = false;
}
if (!$insertok) {
$lens->connection->RollbackTrans();
}
}
$lens->eventPreInsertSQL = 'preinsert';
$lens->eventPostInsertSQL = 'postinsert'; Basic:Yes Advanced/Enterprise:Yes DynamicEdit:Yes [Version 1.0]
|