PG class updates, basic class updates

In basic class, do SET_SESSION_NAME check with isset to avoid notice log
entries.

Change log/error return for execute data error

base postgresql calss calls set the last run query on error if no result
is returned for prepare and execute
This commit is contained in:
Clemens Schwaighofer
2017-07-28 15:52:37 +09:00
parent fd191877cd
commit dc94fa1cd5
3 changed files with 11 additions and 4 deletions

View File

@@ -312,7 +312,7 @@
if (!session_id())
{
// check if we have an external session name given, else skip this step
if (SET_SESSION_NAME)
if (isset(SET_SESSION_NAME))
{
// set the session name for possible later check
$this->session_name = SET_SESSION_NAME;

View File

@@ -1530,7 +1530,8 @@ $this->debug('ExecuteData', 'ERROR in STM['.$stm_name.'|'.$this->prepare_cursor[
// failed to get insert id
$this->insert_id = '';
$this->warning_id = 33;
$this->_db_error('db', '<span style="color: orange;"><b>DB-Warning</b> '.$stm_name.': insert id returned no data</span>', 'DB_WARNING');
$this->_db_error();
$this->_db_debug('db', '<span style="color: orange;"><b>DB-Warning</b> '.$stm_name.': insert id returned no data</span>', 'DB_WARNING');
}
}
// this error handling is only for pgsql

View File

@@ -112,7 +112,10 @@
// DESC : wrapper for pg_prepare
public function _db_prepare($name, $query)
{
return @pg_prepare($this->dbh, $name, $query);
$result = @pg_prepare($this->dbh, $name, $query);
if (!$result)
$this->last_error_query = $query;
return $result;
}
// METHOD: _db_execute
@@ -121,7 +124,10 @@
// DESC : wrapper for pg_execute for running a prepared statement
public function _db_execute($name, $data)
{
return @pg_execute($this->dbh, $name, $data);
$result = @pg_execute($this->dbh, $name, $data);
if (!$result)
$this->last_error_query = $query;
return $result;
}
// METHOD: _db_num_rows