mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-08-09 16:35:02 +02:00
imported ADOdb version 4.20 released 27 Feb 2004
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
V3.94 13 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence.
|
||||
@ -24,16 +24,19 @@ class ADODB_postgres7 extends ADODB_postgres64 {
|
||||
$this->ADODB_postgres64();
|
||||
}
|
||||
|
||||
|
||||
// the following should be compat with postgresql 7.2,
|
||||
// which makes obsolete the LIMIT limit,offset syntax
|
||||
function &SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
|
||||
{
|
||||
$offsetStr = ($offset >= 0) ? " OFFSET $offset" : '';
|
||||
$limitStr = ($nrows >= 0) ? " LIMIT $nrows" : '';
|
||||
return $secs2cache ?
|
||||
$this->CacheExecute($secs2cache,$sql."$limitStr$offsetStr",$inputarr)
|
||||
:
|
||||
$this->Execute($sql."$limitStr$offsetStr",$inputarr);
|
||||
$offsetStr = ($offset >= 0) ? " OFFSET $offset" : '';
|
||||
$limitStr = ($nrows >= 0) ? " LIMIT $nrows" : '';
|
||||
if ($secs2cache)
|
||||
$rs =& $this->CacheExecute($secs2cache,$sql."$limitStr$offsetStr",$inputarr);
|
||||
else
|
||||
$rs =& $this->Execute($sql."$limitStr$offsetStr",$inputarr);
|
||||
|
||||
return $rs;
|
||||
}
|
||||
/*
|
||||
function Prepare($sql)
|
||||
@ -45,7 +48,44 @@ class ADODB_postgres7 extends ADODB_postgres64 {
|
||||
return $sql;
|
||||
}
|
||||
*/
|
||||
function MetaForeignKeys($table, $owner=false, $upper=false)
|
||||
|
||||
// from Edward Jaramilla, improved version - works on pg 7.4
|
||||
function MetaForeignKeys($table, $owner=false, $upper=false)
|
||||
{
|
||||
$sql = 'SELECT t.tgargs as args
|
||||
FROM
|
||||
pg_trigger t,pg_class c,pg_proc p
|
||||
WHERE
|
||||
t.tgenabled AND
|
||||
t.tgrelid = c.oid AND
|
||||
t.tgfoid = p.oid AND
|
||||
p.proname = \'RI_FKey_check_ins\' AND
|
||||
c.relname = \''.strtolower($table).'\'
|
||||
ORDER BY
|
||||
t.tgrelid';
|
||||
|
||||
$rs = $this->Execute($sql);
|
||||
|
||||
if ($rs && !$rs->EOF) {
|
||||
$arr =& $rs->GetArray();
|
||||
$a = array();
|
||||
foreach($arr as $v)
|
||||
{
|
||||
$data = explode(chr(0), $v['args']);
|
||||
if ($upper) {
|
||||
$a[strtoupper($data[2])][] = strtoupper($data[4].'='.$data[5]);
|
||||
} else {
|
||||
$a[$data[2]][] = $data[4].'='.$data[5];
|
||||
}
|
||||
}
|
||||
return $a;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function xMetaForeignKeys($table, $owner=false, $upper=false)
|
||||
{
|
||||
|
||||
$sql = '
|
||||
@ -135,7 +175,7 @@ class ADORecordSet_postgres7 extends ADORecordSet_postgres64{
|
||||
$this->fields = @pg_fetch_array($this->_queryID,$this->_currentRow,$this->fetchMode);
|
||||
|
||||
if (is_array($this->fields)) {
|
||||
if (isset($this->_blobArr)) $this->_fixblobs();
|
||||
if ($this->fields && isset($this->_blobArr)) $this->_fixblobs();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user