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,6 +1,6 @@
|
||||
<?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.
|
||||
@@ -159,6 +159,7 @@ a different OID if a database must be reloaded. */
|
||||
// to really return the id, we need the table and column-name, else we can only return the oid != id
|
||||
return empty($table) || empty($column) ? $oid : $this->GetOne("SELECT CURRVAL('".$table."_".$column."_seq')");
|
||||
}
|
||||
|
||||
// I get this error with PHP before 4.0.6 - jlim
|
||||
// Warning: This compilation does not support pg_cmdtuples() in adodb-postgres.inc.php on line 44
|
||||
function _affectedrows()
|
||||
@@ -200,7 +201,7 @@ a different OID if a database must be reloaded. */
|
||||
return @pg_Exec($this->_connectionID, "rollback");
|
||||
}
|
||||
|
||||
function &MetaTables($ttype=false,$showSchema=false,$mask=false)
|
||||
function MetaTables($ttype=false,$showSchema=false,$mask=false)
|
||||
{
|
||||
$info = $this->ServerInfo();
|
||||
if ($info['version'] >= 7.3) {
|
||||
@@ -223,7 +224,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;
|
||||
@@ -235,6 +236,8 @@ select viewname,'V' from pg_views where viewname like $mask";
|
||||
// if magic quotes disabled, use pg_escape_string()
|
||||
function qstr($s,$magic_quotes=false)
|
||||
{
|
||||
if (is_bool($s)) return $s ? 'true' : 'false';
|
||||
|
||||
if (!$magic_quotes) {
|
||||
if (ADODB_PHPVER >= 0x5200) {
|
||||
return "'".pg_escape_string($this->_connectionID,$s)."'";
|
||||
@@ -463,7 +466,7 @@ select viewname,'V' from pg_views where viewname like $mask";
|
||||
// for schema support, pass in the $table param "$schema.$tabname".
|
||||
// converts field names to lowercase, $upper is ignored
|
||||
// see http://phplens.com/lens/lensforum/msgs.php?id=14018 for more info
|
||||
function &MetaColumns($table,$normalize=true)
|
||||
function MetaColumns($table,$normalize=true)
|
||||
{
|
||||
global $ADODB_FETCH_MODE;
|
||||
|
||||
@@ -477,8 +480,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;
|
||||
|
||||
@@ -491,11 +494,11 @@ select viewname,'V' from pg_views where viewname like $mask";
|
||||
// LEFT JOIN would have been much more elegant, but postgres does
|
||||
// not support OUTER JOINS. So here is the clumsy way.
|
||||
|
||||
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
|
||||
$this->fetchMode = ADODB_FETCH_ASSOC;
|
||||
|
||||
$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;
|
||||
|
||||
@@ -505,7 +508,7 @@ select viewname,'V' from pg_views where viewname like $mask";
|
||||
|
||||
$rsdefa = array();
|
||||
if (!empty($this->metaDefaultsSQL)) {
|
||||
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
|
||||
$this->fetchMode = ADODB_FETCH_ASSOC;
|
||||
$sql = sprintf($this->metaDefaultsSQL, ($table));
|
||||
$rsdef = $this->Execute($sql);
|
||||
if (isset($savem)) $this->SetFetchMode($savem);
|
||||
@@ -577,7 +580,7 @@ select viewname,'V' from pg_views where viewname like $mask";
|
||||
|
||||
}
|
||||
|
||||
function &MetaIndexes ($table, $primary = FALSE)
|
||||
function MetaIndexes ($table, $primary = FALSE)
|
||||
{
|
||||
global $ADODB_FETCH_MODE;
|
||||
|
||||
@@ -712,7 +715,7 @@ WHERE (c2.relname=\'%s\' or c2.relname=lower(\'%s\'))';
|
||||
|
||||
|
||||
// returns queryID or false
|
||||
function _query($sql,$inputarr)
|
||||
function _query($sql,$inputarr=false)
|
||||
{
|
||||
$this->_errorMsg = false;
|
||||
if ($inputarr) {
|
||||
@@ -885,10 +888,10 @@ class ADORecordSet_postgres64 extends ADORecordSet{
|
||||
$this->ADORecordSet($queryID);
|
||||
}
|
||||
|
||||
function &GetRowAssoc($upper=true)
|
||||
function GetRowAssoc($upper=true)
|
||||
{
|
||||
if ($this->fetchMode == PGSQL_ASSOC && !$upper) return $this->fields;
|
||||
$row =& ADORecordSet::GetRowAssoc($upper);
|
||||
$row = ADORecordSet::GetRowAssoc($upper);
|
||||
return $row;
|
||||
}
|
||||
|
||||
@@ -924,7 +927,7 @@ class ADORecordSet_postgres64 extends ADORecordSet{
|
||||
return $this->fields[$this->bind[strtoupper($colname)]];
|
||||
}
|
||||
|
||||
function &FetchField($off = 0)
|
||||
function FetchField($off = 0)
|
||||
{
|
||||
// offsets begin at 0
|
||||
|
||||
@@ -942,6 +945,7 @@ class ADORecordSet_postgres64 extends ADORecordSet{
|
||||
|
||||
function _decode($blob)
|
||||
{
|
||||
if ($blob === NULL) return NULL;
|
||||
eval('$realblob="'.adodb_str_replace(array('"','$'),array('\"','\$'),$blob).'";');
|
||||
return $realblob;
|
||||
}
|
||||
@@ -1060,4 +1064,4 @@ class ADORecordSet_postgres64 extends ADORecordSet{
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
?>
|
||||
Reference in New Issue
Block a user