00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
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 ?>