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