mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
Merged from McMasterReports branch
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
V4.94 23 Jan 2007 (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights reserved.
|
||||
V5.08 6 Apr 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). 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.
|
||||
@@ -11,11 +11,11 @@ V4.94 23 Jan 2007 (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights rese
|
||||
|
||||
class ADODB_pdo_pgsql extends ADODB_pdo {
|
||||
var $metaDatabasesSQL = "select datname from pg_database where datname not in ('template0','template1') order by 1";
|
||||
var $metaTablesSQL = "select tablename,'T' from pg_tables where tablename not like 'pg_%'
|
||||
var $metaTablesSQL = "select tablename,'T' from pg_tables where tablename not like 'pg\_%'
|
||||
and tablename not in ('sql_features', 'sql_implementation_info', 'sql_languages',
|
||||
'sql_packages', 'sql_sizing', 'sql_sizing_profiles')
|
||||
union
|
||||
select viewname,'V' from pg_views where viewname not like 'pg_%'";
|
||||
select viewname,'V' from pg_views where viewname not like 'pg\_%'";
|
||||
//"select tablename from pg_tables where tablename not like 'pg_%' order by 1";
|
||||
var $isoDates = true; // accepts dates in ISO format
|
||||
var $sysDate = "CURRENT_DATE";
|
||||
@@ -69,26 +69,26 @@ WHERE relkind in ('r','v') AND (c.relname='%s' or c.relname = lower('%s'))
|
||||
return $arr;
|
||||
}
|
||||
|
||||
function &SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
|
||||
function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
|
||||
{
|
||||
$offsetStr = ($offset >= 0) ? " OFFSET $offset" : '';
|
||||
$limitStr = ($nrows >= 0) ? " LIMIT $nrows" : '';
|
||||
if ($secs2cache)
|
||||
$rs =& $this->CacheExecute($secs2cache,$sql."$limitStr$offsetStr",$inputarr);
|
||||
$rs = $this->CacheExecute($secs2cache,$sql."$limitStr$offsetStr",$inputarr);
|
||||
else
|
||||
$rs =& $this->Execute($sql."$limitStr$offsetStr",$inputarr);
|
||||
$rs = $this->Execute($sql."$limitStr$offsetStr",$inputarr);
|
||||
|
||||
return $rs;
|
||||
}
|
||||
|
||||
function &MetaTables($ttype=false,$showSchema=false,$mask=false)
|
||||
function MetaTables($ttype=false,$showSchema=false,$mask=false)
|
||||
{
|
||||
$info = $this->ServerInfo();
|
||||
if ($info['version'] >= 7.3) {
|
||||
$this->metaTablesSQL = "select tablename,'T' from pg_tables where tablename not like 'pg_%'
|
||||
$this->metaTablesSQL = "select tablename,'T' from pg_tables where tablename not like 'pg\_%'
|
||||
and schemaname not in ( 'pg_catalog','information_schema')
|
||||
union
|
||||
select viewname,'V' from pg_views where viewname not like 'pg_%' and schemaname not in ( 'pg_catalog','information_schema') ";
|
||||
select viewname,'V' from pg_views where viewname not like 'pg\_%' and schemaname not in ( 'pg_catalog','information_schema') ";
|
||||
}
|
||||
if ($mask) {
|
||||
$save = $this->metaTablesSQL;
|
||||
@@ -104,7 +104,7 @@ select tablename,'T' from pg_tables where tablename like $mask
|
||||
union
|
||||
select viewname,'V' from pg_views where viewname like $mask";
|
||||
}
|
||||
$ret =& ADOConnection::MetaTables($ttype,$showSchema);
|
||||
$ret = ADOConnection::MetaTables($ttype,$showSchema);
|
||||
|
||||
if ($mask) {
|
||||
$this->metaTablesSQL = $save;
|
||||
@@ -112,7 +112,7 @@ select viewname,'V' from pg_views where viewname like $mask";
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function &MetaColumns($table,$normalize=true)
|
||||
function MetaColumns($table,$normalize=true)
|
||||
{
|
||||
global $ADODB_FETCH_MODE;
|
||||
|
||||
@@ -125,8 +125,8 @@ select viewname,'V' from pg_views where viewname like $mask";
|
||||
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
|
||||
if ($this->fetchMode !== false) $savem = $this->SetFetchMode(false);
|
||||
|
||||
if ($schema) $rs =& $this->Execute(sprintf($this->metaColumnsSQL1,$table,$table,$schema));
|
||||
else $rs =& $this->Execute(sprintf($this->metaColumnsSQL,$table,$table));
|
||||
if ($schema) $rs = $this->Execute(sprintf($this->metaColumnsSQL1,$table,$table,$schema));
|
||||
else $rs = $this->Execute(sprintf($this->metaColumnsSQL,$table,$table));
|
||||
if (isset($savem)) $this->SetFetchMode($savem);
|
||||
$ADODB_FETCH_MODE = $save;
|
||||
|
||||
@@ -144,7 +144,7 @@ select viewname,'V' from pg_views where viewname like $mask";
|
||||
|
||||
$rskey = $this->Execute(sprintf($this->metaKeySQL,($table)));
|
||||
// fetch all result in once for performance.
|
||||
$keys =& $rskey->GetArray();
|
||||
$keys = $rskey->GetArray();
|
||||
if (isset($savem)) $this->SetFetchMode($savem);
|
||||
$ADODB_FETCH_MODE = $save;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user