|
[image removed]true
Re: [WEB400] PHP db2_execute function
Juliette Vaillant
to:
Web Enabling the AS400/iSeries
03/26/2010 05:49 PM
Sent by:
web400-bounces@xxxxxxxxxxxx
Please respond to Web Enabling the AS400 / iSeries
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
is, Iif 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
thathave an instance where I am getting notices in the PHP error log file
waydb2_execute failed, but I am not seeing any logged information. One
thethis 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
sodb2 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
figuringfar the logging occurs as it should. Having a very difficult time
$parms)) {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,
'',// 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.
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.
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
______________________________________________________________________
As an Amazon Associate we earn from qualifying purchases.
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.