BaseTransaction.class.php

Go to the documentation of this file.
00001 <?php
00002 /***************************************************************************
00003  *   Copyright (C) 2005-2007 by Konstantin V. Arkhipov                     *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU Lesser General Public License as        *
00007  *   published by the Free Software Foundation; either version 3 of the    *
00008  *   License, or (at your option) any later version.                       *
00009  *                                                                         *
00010  ***************************************************************************/
00011 /* $Id: BaseTransaction.class.php 4687 2007-12-09 18:57:18Z voxus $ */
00012 
00018     abstract class BaseTransaction
00019     {
00020         protected $db       = null;
00021         
00022         protected $isoLevel = null;
00023         protected $mode     = null;
00024         
00025         abstract public function flush();
00026         
00027         public function __construct(DB $db)
00028         {
00029             $this->db = $db;
00030         }
00031         
00035         public function setDB(DB $db)
00036         {
00037             $this->db = $db;
00038             
00039             return $this;
00040         }
00041         
00045         public function getDB()
00046         {
00047             return $this->db;
00048         }
00049         
00053         public function setIsolationLevel(IsolationLevel $level)
00054         {
00055             $this->isoLevel = $level;
00056             
00057             return $this;
00058         }
00059         
00063         public function setAccessMode(AccessMode $mode)
00064         {
00065             $this->mode = $mode;
00066             
00067             return $this;
00068         }
00069         
00070         protected function getBeginString()
00071         {
00072             $begin = 'start transaction';
00073             
00074             if ($this->isoLevel)
00075                 $begin .= ' '.$this->isoLevel->toString();
00076             
00077             if ($this->mode)
00078                 $begin .= ' '.$this->mode->toString();
00079             
00080             return $begin.";\n";
00081         }
00082     }
00083 ?>

Generated on Sun Dec 9 21:56:23 2007 for onPHP by  doxygen 1.5.4