Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 310 and 400] [Versions 311 and 400] [Versions 39 and 400]

   1  <?php
   2  /**
   3   * Borland Interbase driver.
   4   *
   5   * Support Borland Interbase 6.5 and later
   6   *
   7   * This file is part of ADOdb, a Database Abstraction Layer library for PHP.
   8   *
   9   * @package ADOdb
  10   * @link https://adodb.org Project's web site and documentation
  11   * @link https://github.com/ADOdb/ADOdb Source code and issue tracker
  12   *
  13   * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause
  14   * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option,
  15   * any later version. This means you can use it in proprietary products.
  16   * See the LICENSE.md file distributed with this source code for details.
  17   * @license BSD-3-Clause
  18   * @license LGPL-2.1-or-later
  19   *
  20   * @copyright 2000-2013 John Lim
  21   * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community
  22   */
  23  
  24  // security - hide paths
  25  if (!defined('ADODB_DIR')) die();
  26  
  27  include_once(ADODB_DIR."/drivers/adodb-ibase.inc.php");
  28  
  29  class ADODB_borland_ibase extends ADODB_ibase {
  30  	 var $databaseType = "borland_ibase";
  31  
  32  	function BeginTrans()
  33  	 {
  34  	 	 if ($this->transOff) return true;
  35  	 	 $this->transCnt += 1;
  36  	 	 $this->autoCommit = false;
  37  	  	 $this->_transactionID = ibase_trans($this->ibasetrans, $this->_connectionID);
  38  	 	 return $this->_transactionID;
  39  	 }
  40  
  41  	function ServerInfo()
  42  	 {
  43  	 	 $arr['dialect'] = $this->dialect;
  44  	 	 switch($arr['dialect']) {
  45  	 	 case '':
  46  	 	 case '1': $s = 'Interbase 6.5, Dialect 1'; break;
  47  	 	 case '2': $s = 'Interbase 6.5, Dialect 2'; break;
  48  	 	 default:
  49  	 	 case '3': $s = 'Interbase 6.5, Dialect 3'; break;
  50  	 	 }
  51  	 	 $arr['version'] = '6.5';
  52  	 	 $arr['description'] = $s;
  53  	 	 return $arr;
  54  	 }
  55  
  56  	 // Note that Interbase 6.5 uses ROWS instead - don't you love forking wars!
  57  	 // 	 	 SELECT col1, col2 FROM table ROWS 5 -- get 5 rows
  58  	 //	 	 SELECT col1, col2 FROM TABLE ORDER BY col1 ROWS 3 TO 7 -- first 5 skip 2
  59  	 // Firebird uses
  60  	 //	 	 SELECT FIRST 5 SKIP 2 col1, col2 FROM TABLE
  61  	function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
  62  	 {
  63  	 	 $nrows = (int) $nrows;
  64  	 	 $offset = (int) $offset;
  65  	 	 if ($nrows > 0) {
  66  	 	 	 if ($offset <= 0) $str = " ROWS $nrows ";
  67  	 	 	 else {
  68  	 	 	 	 $a = $offset+1;
  69  	 	 	 	 $b = $offset+$nrows;
  70  	 	 	 	 $str = " ROWS $a TO $b";
  71  	 	 	 }
  72  	 	 } else {
  73  	 	 	 // ok, skip
  74  	 	 	 $a = $offset + 1;
  75  	 	 	 $str = " ROWS $a TO 999999999"; // 999 million
  76  	 	 }
  77  	 	 $sql .= $str;
  78  
  79  	 	 return ($secs2cache) ?
  80  	 	 	 	 $this->CacheExecute($secs2cache,$sql,$inputarr)
  81  	 	 	 :
  82  	 	 	 	 $this->Execute($sql,$inputarr);
  83  	 }
  84  
  85  };
  86  
  87  
  88  class  ADORecordSet_borland_ibase extends ADORecordSet_ibase {
  89  
  90  	 var $databaseType = "borland_ibase";
  91  
  92  }