Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
/*
3
 *  $Id: Sqlite.php 7490 2010-03-29 19:53:27Z jwage $
4
 *
5
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
6
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
7
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
8
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
9
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
10
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
11
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
12
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
13
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
14
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
15
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
16
 *
17
 * This software consists of voluntary contributions made by many individuals
18
 * and is licensed under the LGPL. For more information, see
19
 * <http://www.doctrine-project.org>.
20
 */
21
 
22
/**
23
 *
24
 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi>
25
 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
26
 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
27
 * @package     Doctrine
28
 * @subpackage  Transaction
29
 * @link        www.doctrine-project.org
30
 * @since       1.0
31
 * @version     $Revision: 7490 $
32
 */
33
class Doctrine_Transaction_Sqlite extends Doctrine_Transaction
34
{
35
    /**
36
     * Set the transacton isolation level.
37
     *
38
     * @param   string  standard isolation level
39
     *                  READ UNCOMMITTED (allows dirty reads)
40
     *                  READ COMMITTED (prevents dirty reads)
41
     *                  REPEATABLE READ (prevents nonrepeatable reads)
42
     *                  SERIALIZABLE (prevents phantom reads)
43
     * @throws PDOException                         if something fails at the PDO level
44
     * @throws Doctrine_Transaction_Exception       if using unknown isolation level
45
     * @return void
46
     */
47
    public function setIsolation($isolation)
48
    {
49
        switch ($isolation) {
50
            case 'READ UNCOMMITTED':
51
                $isolation = 0;
52
                break;
53
            case 'READ COMMITTED':
54
            case 'REPEATABLE READ':
55
            case 'SERIALIZABLE':
56
                $isolation = 1;
57
                break;
58
            default:
59
                throw new Doctrine_Transaction_Exception('Isolation level ' . $isolation . 'is not supported.');
60
        }
61
 
62
        $query = 'PRAGMA read_uncommitted = ' . $isolation;
63
 
64
        return $this->conn->execute($query);
65
    }
66
}