add missing reset for error variable in the db_pgsql class.

cosmetic changes in db_pgsql class.
This commit is contained in:
Clemens Schwaighofer
2014-01-23 12:57:57 +09:00
parent 0658514e2e
commit c0bbec3295

View File

@@ -2,8 +2,8 @@
/********************************************************************* /*********************************************************************
* $HeadURL: svn://svn/development/core_data/php/www/libs/db_pgsql.inc $ * $HeadURL: svn://svn/development/core_data/php/www/libs/db_pgsql.inc $
* $LastChangedBy: gullevek $ * $LastChangedBy: gullevek $
* $LastChangedDate: 2014-01-23 12:03:55 +0900 (Thu, 23 Jan 2014) $ * $LastChangedDate: 2014-01-23 12:57:54 +0900 (Thu, 23 Jan 2014) $
* $LastChangedRevision: 4835 $ * $LastChangedRevision: 4836 $
********************************************************************* *********************************************************************
* AUTHOR: Clemens "Gullevek" Schwaighofer (www.gullevek.org) * AUTHOR: Clemens "Gullevek" Schwaighofer (www.gullevek.org)
* CREATED: 2003/04/09 * CREATED: 2003/04/09
@@ -93,11 +93,10 @@
// DESC : wrapper for pg_get_result // DESC : wrapper for pg_get_result
public function _db_get_result() public function _db_get_result()
{ {
$this->last_error_query = '';
$result = pg_get_result($this->dbh); $result = pg_get_result($this->dbh);
if ($error = pg_result_error($result)) if ($error = pg_result_error($result))
{
$this->last_error_query = $error; $this->last_error_query = $error;
}
return $result; return $result;
} }
@@ -195,9 +194,9 @@
$_table = $array[2]; $_table = $array[2];
// if there is a dot inside, we need to split // if there is a dot inside, we need to split
if (strstr($_table, '.')) if (strstr($_table, '.'))
list($schema, $table) = explode('.', $_table); list($schema, $table) = explode('.', $_table);
else else
$table = $_table; $table = $_table;
// no PK name given at all // no PK name given at all
if (!$pk_name) if (!$pk_name)
{ {
@@ -210,7 +209,6 @@
$seq = (($schema) ? $schema.'.' : '').$table."_".$pk_name."_seq"; $seq = (($schema) ? $schema.'.' : '').$table."_".$pk_name."_seq";
$q = "SELECT CURRVAL('$seq') AS insert_id"; $q = "SELECT CURRVAL('$seq') AS insert_id";
// $this->currval_query = $q; // $this->currval_query = $q;
//echo "Q: $q<Br>";
// I have to do manually or I overwrite the original insert internal vars ... // I have to do manually or I overwrite the original insert internal vars ...
if ($q = $this->_db_query($q)) if ($q = $this->_db_query($q))
{ {
@@ -222,7 +220,7 @@
} }
return $id; return $id;
} }
} }
// METHOD: _db_primary_key // METHOD: _db_primary_key
// PARAMS: table and optional schema // PARAMS: table and optional schema
@@ -235,12 +233,12 @@
// check if schema set is different from schema given, only needed if schema is not empty // check if schema set is different from schema given, only needed if schema is not empty
$table_prefix = ''; $table_prefix = '';
if ($schema) if ($schema)
{ {
$q = "SHOW search_path"; $q = "SHOW search_path";
$cursor = $this->_db_query($q); $cursor = $this->_db_query($q);
$search_path = $this->_db_fetch_array($cursor)['search_path']; $search_path = $this->_db_fetch_array($cursor)['search_path'];
if ($search_path != $schema) if ($search_path != $schema)
{ {
$table_prefix = $schema.'.'; $table_prefix = $schema.'.';
} }
} }
@@ -351,7 +349,7 @@
// RETURN: databse version // RETURN: databse version
// DESC : wrapper for pg_version // DESC : wrapper for pg_version
public function _db_version() public function _db_version()
{ {
// array has client, protocol, server // array has client, protocol, server
// we just need the server // we just need the server
$v = pg_version($this->dbh); $v = pg_version($this->dbh);
@@ -390,5 +388,5 @@
} }
} }
// $Id: db_pgsql.inc 4835 2014-01-23 03:03:55Z gullevek $ // $Id: db_pgsql.inc 4836 2014-01-23 03:57:54Z gullevek $
?> ?>