Subversion Repositories svnkaklik

Rev

Go to most recent revision | Details | Last modification | View Log

Rev Author Line No. Line
36 kaklik 1
<?php
2
/* 
3
V4.80 8 Mar 2006  (c) 2000-2006 John Lim (jlim@natsoft.com.my). 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
 
20
class ADODB_borland_ibase extends ADODB_ibase {
21
	var $databaseType = "borland_ibase";	
22
 
23
	function ADODB_borland_ibase()
24
	{
25
		$this->ADODB_ibase();
26
	}
27
 
28
	function BeginTrans()
29
	{	 
30
		if ($this->transOff) return true;
31
		$this->transCnt += 1;
32
		$this->autoCommit = false;
33
	 	$this->_transactionID = ibase_trans($this->ibasetrans, $this->_connectionID);
34
		return $this->_transactionID;
35
	}
36
 
37
	function ServerInfo()
38
	{
39
		$arr['dialect'] = $this->dialect;
40
		switch($arr['dialect']) {
41
		case '': 
42
		case '1': $s = 'Interbase 6.5, Dialect 1'; break;
43
		case '2': $s = 'Interbase 6.5, Dialect 2'; break;
44
		default:
45
		case '3': $s = 'Interbase 6.5, Dialect 3'; break;
46
		}
47
		$arr['version'] = '6.5';
48
		$arr['description'] = $s;
49
		return $arr;
50
	}
51
 
52
	// Note that Interbase 6.5 uses ROWS instead - don't you love forking wars!
53
	// 		SELECT col1, col2 FROM table ROWS 5 -- get 5 rows 
54
	//		SELECT col1, col2 FROM TABLE ORDER BY col1 ROWS 3 TO 7 -- first 5 skip 2
55
	// Firebird uses
56
	//		SELECT FIRST 5 SKIP 2 col1, col2 FROM TABLE
57
	function &SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
58
	{
59
		if ($nrows > 0) {
60
			if ($offset <= 0) $str = " ROWS $nrows "; 
61
			else {
62
				$a = $offset+1;
63
				$b = $offset+$nrows;
64
				$str = " ROWS $a TO $b";
65
			}
66
		} else {
67
			// ok, skip 
68
			$a = $offset + 1;
69
			$str = " ROWS $a TO 999999999"; // 999 million
70
		}
71
		$sql .= $str;
72
 
73
		return ($secs2cache) ? 
74
				$this->CacheExecute($secs2cache,$sql,$inputarr)
75
			:
76
				$this->Execute($sql,$inputarr);
77
	}
78
 
79
};
80
 
81
 
82
class  ADORecordSet_borland_ibase extends ADORecordSet_ibase {	
83
 
84
	var $databaseType = "borland_ibase";		
85
 
86
	function ADORecordSet_borland_ibase($id,$mode=false)
87
	{
88
		$this->ADORecordSet_ibase($id,$mode);
89
	}
90
}
91
?>