[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/adodb/drivers/ -> adodb-borland_ibase.inc.php (source)

   1  <?php
   2  /*
   3  @version   v5.20.3  01-Jan-2016
   4  @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
   5  @copyright (c) 2014      Damien Regad, Mark Newnham and the ADOdb community
   6    Released under both BSD license and Lesser GPL library license.
   7    Whenever there is any discrepancy between the two licenses,
   8    the BSD license will take precedence.
   9  Set tabs to 4 for best viewing.
  10  
  11    Latest version is available at http://adodb.sourceforge.net
  12  
  13    Support Borland Interbase 6.5 and later
  14  
  15  */
  16  
  17  // security - hide paths
  18  if (!defined('ADODB_DIR')) die();
  19  
  20  include_once(ADODB_DIR."/drivers/adodb-ibase.inc.php");
  21  
  22  class ADODB_borland_ibase extends ADODB_ibase {
  23      var $databaseType = "borland_ibase";
  24  
  25  	function BeginTrans()
  26      {
  27          if ($this->transOff) return true;
  28          $this->transCnt += 1;
  29          $this->autoCommit = false;
  30           $this->_transactionID = ibase_trans($this->ibasetrans, $this->_connectionID);
  31          return $this->_transactionID;
  32      }
  33  
  34  	function ServerInfo()
  35      {
  36          $arr['dialect'] = $this->dialect;
  37          switch($arr['dialect']) {
  38          case '':
  39          case '1': $s = 'Interbase 6.5, Dialect 1'; break;
  40          case '2': $s = 'Interbase 6.5, Dialect 2'; break;
  41          default:
  42          case '3': $s = 'Interbase 6.5, Dialect 3'; break;
  43          }
  44          $arr['version'] = '6.5';
  45          $arr['description'] = $s;
  46          return $arr;
  47      }
  48  
  49      // Note that Interbase 6.5 uses ROWS instead - don't you love forking wars!
  50      //         SELECT col1, col2 FROM table ROWS 5 -- get 5 rows
  51      //        SELECT col1, col2 FROM TABLE ORDER BY col1 ROWS 3 TO 7 -- first 5 skip 2
  52      // Firebird uses
  53      //        SELECT FIRST 5 SKIP 2 col1, col2 FROM TABLE
  54  	function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
  55      {
  56          if ($nrows > 0) {
  57              if ($offset <= 0) $str = " ROWS $nrows ";
  58              else {
  59                  $a = $offset+1;
  60                  $b = $offset+$nrows;
  61                  $str = " ROWS $a TO $b";
  62              }
  63          } else {
  64              // ok, skip
  65              $a = $offset + 1;
  66              $str = " ROWS $a TO 999999999"; // 999 million
  67          }
  68          $sql .= $str;
  69  
  70          return ($secs2cache) ?
  71                  $this->CacheExecute($secs2cache,$sql,$inputarr)
  72              :
  73                  $this->Execute($sql,$inputarr);
  74      }
  75  
  76  };
  77  
  78  
  79  class  ADORecordSet_borland_ibase extends ADORecordSet_ibase {
  80  
  81      var $databaseType = "borland_ibase";
  82  
  83  	function __construct($id,$mode=false)
  84      {
  85          parent::__construct($id,$mode);
  86      }
  87  }


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1