OXID eShop CE  4.10.7
 All Classes Namespaces Files Functions Variables Pages
oxlegacydb.php
Go to the documentation of this file.
1 <?php
2 
3 require_once 'interface/DatabaseInterface.php';
4 
15 class oxLegacyDb extends oxSuperCfg implements DatabaseInterface
16 {
17 
23  protected $_oDb = null;
24 
25 
33  public function setConnection($oConnection)
34  {
35  $this->_oDb = $oConnection;
36  }
37 
41  public function forceMasterConnection()
42  {
43 
44  }
45 
49  public function setFetchMode($iFetchMode)
50  {
51  $this->_oDb->setFetchMode($iFetchMode);
52 
53  }
54 
64  public function getDb($blType = true)
65  {
66 
67  return $this->_oDb;
68  }
69 
73  public function getOne($sSql, $aParams = array(), $blType = true)
74  {
75  return $this->getDb($blType)->getOne($sSql, $aParams);
76  }
77 
89  public function getArray($sSql, $aParams = array(), $blType = true)
90  {
91  return $this->getDb($blType)->getArray($sSql, $aParams);
92  }
93 
97  public function getRow($sSql, $aParams = array(), $blType = true)
98  {
99  return $this->getDb($blType)->getRow($sSql, $aParams);
100  }
101 
105  public function getAll($sSql, $aParams = array(), $blType = true)
106  {
107 
108  return $this->getDb($blType)->getAll($sSql, $aParams);
109  }
110 
114  public function select($sSql, $aParams = array(), $blType = true)
115  {
116  return $this->getDb($blType)->execute($sSql, $aParams);
117  }
118 
131  public function getAssoc($sSql, $aParams = array(), $blType = true)
132  {
133  return $this->getDb($blType)->getAssoc($sSql, $aParams);
134  }
135 
139  public function getCol($sSql, $aParams = array(), $blType = true)
140  {
141  return $this->getDb($blType)->getCol($sSql, $aParams);
142  }
143 
147  public function selectLimit($sSql, $iRows = -1, $iOffset = -1, $aParams = array(), $blType = true)
148  {
149  return $this->getDb($blType)->SelectLimit($sSql, $iRows, $iOffset, $aParams);
150  }
151 
155  public function execute($sSql, $aParams = array())
156  {
157  return $this->getDb(false)->execute($sSql, $aParams);
158  }
159 
170  public function query($sSql, $aParams = array())
171  {
172  return $this->getDb(false)->Query($sSql, $aParams);
173  }
174 
183  public function Affected_Rows()
184  {
185  return $this->getDb(false)->Affected_Rows();
186  }
187 
196  public function errorNo()
197  {
198  return $this->getDb(false)->ErrorNo();
199  }
200 
209  public function errorMsg()
210  {
211  return $this->getDb(false)->ErrorMsg();
212  }
213 
223  public function qstr($sValue)
224  {
225  return $this->getDb(false)->qstr($sValue);
226  }
227 
231  public function quote($sValue)
232  {
233  return $this->getDb(false)->quote($sValue);
234  }
235 
239  public function quoteArray($aStrArray)
240  {
241  foreach ($aStrArray as $sKey => $sString) {
242  $aStrArray[$sKey] = $this->quote($sString);
243  }
244 
245  return $aStrArray;
246  }
247 
251  public function metaColumns($sTable)
252  {
253  return $this->getDb(false)->MetaColumns($sTable);
254  }
255 
266  public function metaColumnNames($sTable, $blNumIndexes = false)
267  {
268  return $this->getDb(false)->MetaColumnNames($sTable, $blNumIndexes);
269  }
270 
274  public function startTransaction()
275  {
276  return $this->getDb(false)->execute('START TRANSACTION');
277  }
278 
282  public function commitTransaction()
283  {
284  return $this->getDb(false)->execute('COMMIT');
285  }
286 
290  public function rollbackTransaction()
291  {
292  return $this->getDb(false)->execute('ROLLBACK');
293  }
294 
298  public function setTransactionIsolationLevel($sLevel = null)
299  {
300  $blResult = false;
301 
302  $aLevels = array('READ UNCOMMITTED', 'READ COMMITTED', 'REPEATABLE READ', 'SERIALIZABLE');
303  if (in_array(strtoupper($sLevel), $aLevels)) {
304  $blResult = $this->getDb(false)->execute('SET TRANSACTION ISOLATION LEVEL ' . $sLevel);
305  }
306 
307  return $blResult;
308  }
309 
317  public function UI($iPollSecs = 5)
318  {
319  $this->getDb(false)->UI($iPollSecs);
320  }
321 
330  public function Insert_ID()
331  {
332  return $this->getLastInsertId();
333  }
334 
343  public function lastInsertId()
344  {
345  return $this->getLastInsertId();
346  }
347 
353  public function getLastInsertId()
354  {
355  return $this->getDb(false)->Insert_ID();
356  }
357 }