]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/WikiDB/adodb/drivers/adodb-borland_ibase.inc.php
No newline at end of file
[SourceForge/phpwiki.git] / lib / WikiDB / adodb / drivers / adodb-borland_ibase.inc.php
1 <?php
2 /*
3 V4.22 15 Apr 2004  (c) 2000-2004 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://php.weblogs.com/
10
11   Support Borland Interbase 6.5 and later
12
13 */
14
15 include_once(ADODB_DIR."/drivers/adodb-ibase.inc.php");
16
17 class ADODB_borland_ibase extends ADODB_ibase {
18     var $databaseType = "borland_ibase";
19
20     function ADODB_borland_ibase()
21     {
22         $this->ADODB_ibase();
23     }
24
25     function ServerInfo()
26     {
27         $arr['dialect'] = $this->dialect;
28         switch($arr['dialect']) {
29         case '':
30         case '1': $s = 'Interbase 6.5, Dialect 1'; break;
31         case '2': $s = 'Interbase 6.5, Dialect 2'; break;
32         default:
33         case '3': $s = 'Interbase 6.5, Dialect 3'; break;
34         }
35         $arr['version'] = '6.5';
36         $arr['description'] = $s;
37         return $arr;
38     }
39
40     // Note that Interbase 6.5 uses ROWS instead - don't you love forking wars!
41     //          SELECT col1, col2 FROM table ROWS 5 -- get 5 rows
42     //          SELECT col1, col2 FROM TABLE ORDER BY col1 ROWS 3 TO 7 -- first 5 skip 2
43     // Firebird uses
44     //          SELECT FIRST 5 SKIP 2 col1, col2 FROM TABLE
45     function &SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
46     {
47         if ($nrows > 0) {
48             if ($offset <= 0) $str = " ROWS $nrows ";
49             else {
50                 $a = $offset+1;
51                 $b = $offset+$nrows;
52                 $str = " ROWS $a TO $b";
53             }
54         } else {
55             // ok, skip
56             $a = $offset + 1;
57             $str = " ROWS $a TO 999999999"; // 999 million
58         }
59         $sql .= $str;
60
61         return ($secs2cache) ?
62                 $this->CacheExecute($secs2cache,$sql,$inputarr)
63             :
64                 $this->Execute($sql,$inputarr);
65     }
66
67 };
68
69
70 class  ADORecordSet_borland_ibase extends ADORecordSet_ibase {
71
72     var $databaseType = "borland_ibase";
73
74     function ADORecordSet_borland_ibase($id,$mode=false)
75     {
76         $this->ADORecordSet_ibase($id,$mode);
77     }
78 }
79 ?>