ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:reference:connection:ignoreerrors

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Last revisionBoth sides next revision
reference:ignoreerrors [2015/07/19 23:17] – created mnewnhamv5:reference:connection:ignoreerrors [2016/01/16 23:54] – ↷ Page moved from v5:reference:ignoreerrors to v5:reference:connection:ignoreerrors mnewnham
Line 1: Line 1:
 ====== ignoreErrors ====== ====== ignoreErrors ======
 ~~NOTOC~~ ~~NOTOC~~
 +<WRAP todo>
 +This page needs expansion to describe all usages of this function
 +</WRAP>
 <WRAP right box> <WRAP right box>
 == Syntax == == Syntax ==
Line 26: Line 29:
      
 ==== 2nd usage ==== ==== 2nd usage ====
 +The second usage requires the construction of the array ''$override'', which can then be passed into the function. The ADODb values are then set to those values. The function returns null in this case. Best practice for usage of this function is to call it in the first way.
 +<code php>
 +/*
 + * database connection assumed
 + */
 +
 +/*
 + * Start a database transaction
 + */
 +$db->startTrans();
 +
 +/*
 + * Update some value successfully
 + */
 +$db->Execute('UPDATE some_table (field_1) VALUES "abcd");
 +
 +</code>
 +
 + Do some other work, which makes us decide to rollback the transaction
 +<code php>
 +
 +if ($resultOfWork == false) {
 +    $currentStatus = $db->ignoreErrors();
 +    
 +    /*
 +     * Force the transaction to fail
 +     */
 +    $currentStatus[1] = false;
 +    
 +    $db->ignoreErrors($currentStatus);
 +}
 +
 +$db->completeTrans();
 +/*
 + * The transaction rolls back because the $db->_transOk flag was manually
 + * set to false
 + */
 +</code>
v5/reference/connection/ignoreerrors.txt · Last modified: 2016/01/16 23:54 by mnewnham