00001 <?php 00002 00006 //include_once(FAREOFFICE_LIB_ROOT . 'creole/Creole.php'); 00007 include_once('creole/Creole.php'); 00008 00015 class Db 00016 { 00020 public function Db(Config $config_) 00021 { 00022 $this->_config = $config_; 00023 } 00024 00033 public function executeQuery($sql_) 00034 { 00035 $conn = $this->getConnection(); 00036 return $conn->executeQuery($sql_); 00037 } 00038 00044 function getConnection() 00045 { 00046 $dsn = $this->_config->getDBDSN($this->getConfigName()); 00047 00048 return Creole::getConnection($dsn); 00049 } 00050 00057 public function setConfigName($configName_) 00058 { 00059 $this->_configName = $configName_; 00060 } 00061 00067 public function getConfigName() 00068 { 00069 return $this->_configName; 00070 } 00071 00078 public function pushConfigName($configName_) 00079 { 00080 array_push($this->_configNameStack, $this->_configName); 00081 $this->setConfigName($configName_); 00082 } 00083 00088 public function popConfigName() 00089 { 00090 $this->_configName = array_pop($this->_configNameStack); 00091 } 00092 00096 private $_configName = 'foMaster'; 00097 00103 private $_configNameStack = array(); 00104 } 00105 ?>