- skip to content

# Database Abstraction Layer

### User Tools

- Login

### Site Tools

- Recent changes
- Media Manager
- Sitemap

### Sidebar

##### Resources

- Reference Manual
- User Guide
- The Data Dictionary
- ADOdb-xmlschema
- ADOdb Active Record
- Performance Monitoring
- Date/Time Library
- Session Management Library
- Unsupported Addons
- Coding Standards

##### Supported Databases

- Access
- ADO
- CSV
- Firebird
- Frontbase
- IBM DB2
- Informix
- Interbase
- LDAP
- Microsoft SQL Server
- MySQL
- Netezza
- ODBC
- ODBTP
- Oracle
- PDO
- Postgresql
- SAP ADS
- SAP ASE
- SAP Maxdb
- SAP Sqlanywhere
- Sqlite
- Sybase
- Plain Text
- Visual Foxpro

##### Other

- Feature Comparison Matrix
- Connection Matrix
- Include File Guide

v5:reference:connection:ignoreerrors

# ignoreErrors

This page needs expansion to describe all usages of this function

##### Syntax

    mixed function ignoreErrors(
                   mixed $override
                   )

## Description

The function `ignoreErrors()` provides a way of overriding certain aspects of error handling within ADOdb. There are 2 different behaviours based on what parameters are passed.

### Parameter Format

Whether used as a setter or getter, The parameter array format is as follows:

Index | Database Setting | Description
--- | --- | ---
0 | raiseErrorFn | An indication the current database object error status. This flag is set automatically if a connection or executed statement fails
1 | _transOk | An indicator of a the current transactional status

This array is represented by `$override` in the options below.

### 1st Usage

If the function is used as `ignoreErrors()` or `ignoreErrors(false)` the following behaviour occurs:

1. The database status is saved off in $override, as described above
2. The raiseerrorfn flag is set to false.
3. The function returns $override.

### 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.

    /*
     * database connection assumed
     */

    /*
     * Start a database transaction
     */
    $db->startTrans();

    /*
     * Update some value successfully
     */
    $db->Execute('UPDATE some_table (field_1) VALUES "abcd");

Do some other work, which makes us decide to rollback the transaction

    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
     */

v5/reference/connection/ignoreerrors.txt · Last modified: 2016/01/16 14:54 by mnewnham

### Page Tools

- Show pagesource
- Old revisions
- Backlinks
- Rename Page
- Back to top