Back

Editing, Updating and Creating Records
eventPreInsertSQL
Name of function to call before New Record is created 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:No Advanced/Enterprise:Yes DynamicEdit:No [Version 1.0]