minor bug fixes
[openemr.git] / library / adodb / drivers / adodb-firebird.inc.php
blob5e6546d6542a2956b47240f148c4e05265f08c74
1 <?php
2 /*
3 @version v5.20.2 27-Dec-2015
4 @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
5 @copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
6 Released under both BSD license and Lesser GPL library license.
7 Whenever there is any discrepancy between the two licenses,
8 the BSD license will take precedence.
9 Set tabs to 4 for best viewing.
11 Latest version is available at http://adodb.sourceforge.net
15 // security - hide paths
16 if (!defined('ADODB_DIR')) die();
18 include_once(ADODB_DIR."/drivers/adodb-ibase.inc.php");
20 class ADODB_firebird extends ADODB_ibase {
21 var $databaseType = "firebird";
22 var $dialect = 3;
24 var $sysTimeStamp = "CURRENT_TIMESTAMP"; //"cast('NOW' as timestamp)";
26 function ServerInfo()
28 $arr['dialect'] = $this->dialect;
29 switch($arr['dialect']) {
30 case '':
31 case '1': $s = 'Firebird Dialect 1'; break;
32 case '2': $s = 'Firebird Dialect 2'; break;
33 default:
34 case '3': $s = 'Firebird Dialect 3'; break;
36 $arr['version'] = ADOConnection::_findvers($s);
37 $arr['description'] = $s;
38 return $arr;
41 // Note that Interbase 6.5 uses this ROWS instead - don't you love forking wars!
42 // SELECT col1, col2 FROM table ROWS 5 -- get 5 rows
43 // SELECT col1, col2 FROM TABLE ORDER BY col1 ROWS 3 TO 7 -- first 5 skip 2
44 function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false, $secs=0)
46 $nrows = (integer) $nrows;
47 $offset = (integer) $offset;
48 $str = 'SELECT ';
49 if ($nrows >= 0) $str .= "FIRST $nrows ";
50 $str .=($offset>=0) ? "SKIP $offset " : '';
52 $sql = preg_replace('/^[ \t]*select/i',$str,$sql);
53 if ($secs)
54 $rs = $this->CacheExecute($secs,$sql,$inputarr);
55 else
56 $rs = $this->Execute($sql,$inputarr);
58 return $rs;
65 class ADORecordSet_firebird extends ADORecordSet_ibase {
67 var $databaseType = "firebird";
69 function __construct($id,$mode=false)
71 parent::__construct($id,$mode);