v5:reference:connection:ignoreerrors
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
reference:ignoreerrors [2015/07/19 23:17] – created mnewnham | v5:reference:connection:ignoreerrors [2016/01/16 23:54] (current) – ↷ Links adapted because of a move operation mnewnham | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== ignoreErrors ====== | ====== ignoreErrors ====== | ||
~~NOTOC~~ | ~~NOTOC~~ | ||
+ | <WRAP todo> | ||
+ | This page needs expansion to describe all usages of this function | ||
+ | </ | ||
<WRAP right box> | <WRAP right box> | ||
== Syntax == | == Syntax == | ||
Line 22: | Line 25: | ||
- The database status is saved off in $override, as described above | - The database status is saved off in $override, as described above | ||
- | - The [[raiseErrorFn]] flag is set to false. | + | - The [[..: |
- The function returns $override. | - The function returns $override. | ||
| | ||
==== 2nd usage ==== | ==== 2nd usage ==== | ||
+ | The second usage requires the construction of the array '' | ||
+ | <code php> | ||
+ | /* | ||
+ | * database connection assumed | ||
+ | */ | ||
+ | |||
+ | /* | ||
+ | * Start a database transaction | ||
+ | */ | ||
+ | $db-> | ||
+ | |||
+ | /* | ||
+ | * Update some value successfully | ||
+ | */ | ||
+ | $db-> | ||
+ | |||
+ | </ | ||
+ | |||
+ | Do some other work, which makes us decide to rollback the transaction | ||
+ | <code php> | ||
+ | |||
+ | if ($resultOfWork == false) { | ||
+ | $currentStatus = $db-> | ||
+ | | ||
+ | /* | ||
+ | * Force the transaction to fail | ||
+ | */ | ||
+ | $currentStatus[1] = false; | ||
+ | | ||
+ | $db-> | ||
+ | } | ||
+ | |||
+ | $db-> | ||
+ | /* | ||
+ | * The transaction rolls back because the $db-> | ||
+ | * set to false | ||
+ | */ | ||
+ | </ |
v5/reference/connection/ignoreerrors.1437340641.txt.gz · Last modified: 2017/04/21 11:34 (external edit)