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