OXID eShop CE  4.10.1
 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 setFetchMode($iFetchMode)
42  {
43  $this->_oDb->setFetchMode($iFetchMode);
44 
45  }
46 
56  public function getDb($blType = true)
57  {
58 
59  return $this->_oDb;
60  }
61 
65  public function getOne($sSql, $aParams = array(), $blType = true)
66  {
67  return $this->getDb($blType)->getOne($sSql, $aParams);
68  }
69 
81  public function getArray($sSql, $aParams = array(), $blType = true)
82  {
83  return $this->getDb($blType)->getArray($sSql, $aParams);
84  }
85 
89  public function getRow($sSql, $aParams = array(), $blType = true)
90  {
91  return $this->getDb($blType)->getRow($sSql, $aParams);
92  }
93 
97  public function getAll($sSql, $aParams = array(), $blType = true)
98  {
99 
100  return $this->getDb($blType)->getAll($sSql, $aParams);
101  }
102 
106  public function select($sSql, $aParams = array(), $blType = true)
107  {
108  return $this->getDb($blType)->execute($sSql, $aParams);
109  }
110 
123  public function getAssoc($sSql, $aParams = array(), $blType = true)
124  {
125  return $this->getDb($blType)->getAssoc($sSql, $aParams);
126  }
127 
131  public function getCol($sSql, $aParams = array(), $blType = true)
132  {
133  return $this->getDb($blType)->getCol($sSql, $aParams);
134  }
135 
139  public function selectLimit($sSql, $iRows = -1, $iOffset = -1, $aParams = array(), $blType = true)
140  {
141  return $this->getDb($blType)->SelectLimit($sSql, $iRows, $iOffset, $aParams);
142  }
143 
147  public function execute($sSql, $aParams = array())
148  {
149  return $this->getDb(false)->execute($sSql, $aParams);
150  }
151 
162  public function query($sSql, $aParams = array())
163  {
164  return $this->getDb(false)->Query($sSql, $aParams);
165  }
166 
175  public function Affected_Rows()
176  {
177  return $this->getDb(false)->Affected_Rows();
178  }
179 
188  public function errorNo()
189  {
190  return $this->getDb(false)->ErrorNo();
191  }
192 
201  public function errorMsg()
202  {
203  return $this->getDb(false)->ErrorMsg();
204  }
205 
215  public function qstr($sValue)
216  {
217  return $this->getDb(false)->qstr($sValue);
218  }
219 
223  public function quote($sValue)
224  {
225  return $this->getDb(false)->quote($sValue);
226  }
227 
231  public function quoteArray($aStrArray)
232  {
233  foreach ($aStrArray as $sKey => $sString) {
234  $aStrArray[$sKey] = $this->quote($sString);
235  }
236 
237  return $aStrArray;
238  }
239 
243  public function metaColumns($sTable)
244  {
245  return $this->getDb(false)->MetaColumns($sTable);
246  }
247 
258  public function metaColumnNames($sTable, $blNumIndexes = false)
259  {
260  return $this->getDb(false)->MetaColumnNames($sTable, $blNumIndexes);
261  }
262 
266  public function startTransaction()
267  {
268  return $this->getDb(false)->execute('START TRANSACTION');
269  }
270 
274  public function commitTransaction()
275  {
276  return $this->getDb(false)->execute('COMMIT');
277  }
278 
282  public function rollbackTransaction()
283  {
284  return $this->getDb(false)->execute('ROLLBACK');
285  }
286 
290  public function setTransactionIsolationLevel($sLevel = null)
291  {
292  $blResult = false;
293 
294  $aLevels = array('READ UNCOMMITTED', 'READ COMMITTED', 'REPEATABLE READ', 'SERIALIZABLE');
295  if (in_array(strtoupper($sLevel), $aLevels)) {
296  $blResult = $this->getDb(false)->execute('SET TRANSACTION ISOLATION LEVEL ' . $sLevel);
297  }
298 
299  return $blResult;
300  }
301 
309  public function UI($iPollSecs = 5)
310  {
311  $this->getDb(false)->UI($iPollSecs);
312  }
313 
322  public function Insert_ID()
323  {
324  return $this->lastInsertId();
325  }
326 
332  public function lastInsertId()
333  {
334  return $this->getDb(false)->Insert_ID();
335  }
336 }