Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00017 abstract class BaseTransaction
00018 {
00019 protected $db = null;
00020
00021 protected $isoLevel = null;
00022 protected $mode = null;
00023
00024 abstract public function flush();
00025
00026 public function __construct(DB $db)
00027 {
00028 $this->db = $db;
00029 }
00030
00034 public function setDB(DB $db)
00035 {
00036 $this->db = $db;
00037
00038 return $this;
00039 }
00040
00044 public function getDB()
00045 {
00046 return $this->db;
00047 }
00048
00052 public function setIsolationLevel(IsolationLevel $level)
00053 {
00054 $this->isoLevel = $level;
00055
00056 return $this;
00057 }
00058
00062 public function setAccessMode(AccessMode $mode)
00063 {
00064 $this->mode = $mode;
00065
00066 return $this;
00067 }
00068
00069 protected function getBeginString()
00070 {
00071 $begin = 'start transaction';
00072
00073 if ($this->isoLevel)
00074 $begin .= ' '.$this->isoLevel->toString();
00075
00076 if ($this->mode)
00077 $begin .= ' '.$this->mode->toString();
00078
00079 return $begin.";\n";
00080 }
00081 }
00082 ?>