forked from extern/egroupware
dont try oids for new postgres versions
This commit is contained in:
parent
b2378bb7a8
commit
e2b84e8c32
@ -152,11 +152,17 @@ WHERE relkind in ('r','v') AND (c.relname='%s' or c.relname = lower('%s'))
|
|||||||
Using a OID as a unique identifier is not generally wise.
|
Using a OID as a unique identifier is not generally wise.
|
||||||
Unless you are very careful, you might end up with a tuple having
|
Unless you are very careful, you might end up with a tuple having
|
||||||
a different OID if a database must be reloaded. */
|
a different OID if a database must be reloaded. */
|
||||||
function _insertid($table,$column)
|
function _insertid($table,$column,$try_oid=true)
|
||||||
|
{
|
||||||
|
if ($try_oid)
|
||||||
{
|
{
|
||||||
if (!is_resource($this->_resultid) || get_resource_type($this->_resultid) !== 'pgsql result') return false;
|
if (!is_resource($this->_resultid) || get_resource_type($this->_resultid) !== 'pgsql result') return false;
|
||||||
$oid = pg_getlastoid($this->_resultid);
|
$oid = pg_getlastoid($this->_resultid);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$oid = false;
|
||||||
|
}
|
||||||
if ($oid === false && $table && $column) // table might not use oid's, default for 8.1+
|
if ($oid === false && $table && $column) // table might not use oid's, default for 8.1+
|
||||||
{
|
{
|
||||||
// try the standard sequence name first, due to table renames etc. this might not be the correct one
|
// try the standard sequence name first, due to table renames etc. this might not be the correct one
|
||||||
|
@ -121,6 +121,19 @@ function MetaForeignKeys($table, $owner=false, $upper=false)
|
|||||||
} else return true;
|
} else return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// use pg_escape_string if available
|
||||||
|
function qstr($s,$magic_quotes=false)
|
||||||
|
{
|
||||||
|
if (!$magic_quotes && function_exists('pg_escape_string')) {
|
||||||
|
return "'".pg_escape_string($s)."'";
|
||||||
|
}
|
||||||
|
return parent::qstr($s,$magic_quotes);
|
||||||
|
}
|
||||||
|
|
||||||
|
function _insertid($table,$column)
|
||||||
|
{
|
||||||
|
return parent::_insertid($table,$column,false); // dont try oid
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------------------
|
/*--------------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user