]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/WikiDB/adodb/drivers/adodb-firebird.inc.php
Reformat code
[SourceForge/phpwiki.git] / lib / WikiDB / adodb / drivers / adodb-firebird.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 */
12
13 include_once(ADODB_DIR . "/drivers/adodb-ibase.inc.php");
14
15 class ADODB_firebird extends ADODB_ibase
16 {
17     var $databaseType = "firebird";
18
19     function ADODB_firebird()
20     {
21         $this->ADODB_ibase();
22     }
23
24     function ServerInfo()
25     {
26         $arr['dialect'] = $this->dialect;
27         switch ($arr['dialect']) {
28             case '':
29             case '1':
30                 $s = 'Firebird Dialect 1';
31                 break;
32             case '2':
33                 $s = 'Firebird Dialect 2';
34                 break;
35             default:
36             case '3':
37                 $s = 'Firebird Dialect 3';
38                 break;
39         }
40         $arr['version'] = ADOConnection::_findvers($s);
41         $arr['description'] = $s;
42         return $arr;
43     }
44
45     // Note that Interbase 6.5 uses this ROWS instead - don't you love forking wars!
46     //          SELECT col1, col2 FROM table ROWS 5 -- get 5 rows
47     //          SELECT col1, col2 FROM TABLE ORDER BY col1 ROWS 3 TO 7 -- first 5 skip 2
48     function &SelectLimit($sql, $nrows = -1, $offset = -1, $inputarr = false, $secs = 0)
49     {
50         $str = 'SELECT ';
51         if ($nrows >= 0) $str .= "FIRST $nrows ";
52         $str .= ($offset >= 0) ? "SKIP $offset " : '';
53
54         $sql = preg_replace('/^[ \t]*select/i', $str, $sql);
55         if ($secs)
56             $rs =& $this->CacheExecute($secs, $sql, $inputarr);
57         else
58             $rs =& $this->Execute($sql, $inputarr);
59
60         return $rs;
61     }
62
63 }
64
65 ;
66
67 class  ADORecordSet_firebird extends ADORecordSet_ibase
68 {
69
70     var $databaseType = "firebird";
71
72     function ADORecordSet_firebird($id, $mode = false)
73     {
74         $this->ADORecordSet_ibase($id, $mode);
75     }
76 }