- 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:settransactionmode

# setTransactionMode

##### See Also

metaTransaction()

##### Syntax

    void setTransactionMode(
        string $mode
        )

## Description

SetTransactionMode allows you to pass in the transaction mode to use for all subsequent transactions.

Note: if you have persistent connections and using mssql or mysql, you might have to explicitly reset your transaction mode at the beginning of each page request.

This is only supported in postgresql, mssql, mysql with InnoDB and oci8 currently.

## Usage

    /*
    * Set the mode
    */
    $db->SetTransactionMode('serializable');
    $db->BeginTrans();
    $db->Execute(...); $db->Execute(...);
    $db->CommitTrans();

    /*
    * restore to default
    */
    $db->SetTransactionMode("");
    $db->StartTrans();
    $db->Execute(...);
    $db->Execute(...);
    $db->CompleteTrans();

Supported values to pass in:

- READ UNCOMMITTED (allows dirty reads, but fastest)
- READ COMMITTED (default postgres, mssql and oci8)
- REPEATABLE READ (default mysql)
- SERIALIZABLE (slowest and most restrictive)

You can also pass in database specific values such as 'SNAPSHOT' for mssql or 'READ ONLY' for oci8/postgres.

v5/reference/connection/settransactionmode.txt · Last modified: 2016/01/16 16:20 by mnewnham

### Page Tools

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