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