× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.





Anyone aware of an issue of where the db2_execute statement can return true
if the statement fails on IBM i? I have a class wrapped around the
db2_execute statement and I test for it to return false. If it does, I
take steps to log the failing statement, the parameters, etc. Problem is, I
have an instance where I am getting notices in the PHP error log file that
db2_execute failed, but I am not seeing any logged information. One way
this would happen is if db2_execute failed and still returned true.

I wouldn't even ask this it I wasn't aware of an old (unrelated) bug in the
db2 extension that actually caused that to happen (see
http://pecl.php.net/bugs/bug.php?id=13185).

I have tested this several times by intentionally causing an error, and so
far the logging occurs as it should. Having a very difficult time figuring
out why this would not work:

class Db2Class {

// other properties and functions

public function executeSql($sqlstmt, $parms)
{
// code snipped

// prepare SQL statement
$this->_stmt = db2_prepare($db2conn, $sqlstmt);

if ($this->checkResult($this->_stmt, $db2conn, $sqlstmt, $parms)) {
// if statement was prepared
if ($this->_stmt) {
$result = db2_execute($this->_stmt, $parms);
if ($this->checkResult($result, $db2conn, $sqlstmt,
$parms))
return $this->_stmt;
}
else {
return false
}
}
}
}

public function checkResult($result, &$sqlconn = null, $sqlstmt = '',
$sqlparms = array())
{
if ($result === false) {
// code snipped - log everything
// in some cases there is error message in php_error_log but
nothing here executed.
return false;
} else {
return true;;
}
}
}


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.