× 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.



Try using if ($result !== true). Looking at the db2_execute source it
doesn't always return a boolean, so this should catch all errors.

Regards,
Juliette


On 27 March 2010 04:22, <MattLavinder@xxxxxxxxxxxxxxxxxxx> wrote:


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;;
}
}
}

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
______________________________________________________________________
--
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.