zendtech / IbmiToolkit

PHP frontend to XMLSERVICE for IBM i development.
BSD 3-Clause "New" or "Revised" License
46 stars 34 forks source link

PDO statement execute stored proc XML bound parameter error #140

Closed csears123 closed 3 years ago

csears123 commented 3 years ago

Using the latest RPM-based PHP (7.4.13) and Toolkit version 1.8.5 on IBMi (V7R3), I am receiving errors from the execXMLStoredProcedure() function in PdoSupp.php with the InputXML parameter being bound to the PDO execute().

Error: [2] PDOStatement::execute(): SQLSTATE[HY000]: General error: -7034 CWBNL0202 - cwbodmsg.dllCWBNL0202 - cwbodmsg.dllCWBNL0202 - cwbodmsg.dllSQL7034 - LOB and XML locators are not allowed with COMMIT(*NONE). (SQLExecute[-7034] at /home/calvin/rpmbuild/BUILD/php-7.4.13/ext/pdo_odbc/odbc_stmt.c:259)

The ToolkitService::getInstance() function is using a PDO database connection as the first parameter, and 'pdo' as the transport type (4th parameter). The connection object is successful, however when I call either CLCommand() or PgmCall() functions the error above is encountered, and fails in the same location where the XML string is being bound as the 3rd input parameter to the PDO execute() function (Line 138 in PdoSupp.php).

I found that removing the PDO beginTransaction() and commit() functions, from execXMLStoredProcedure(), the error no longer occurs. For some reason the XML string parameter being bound only fails when inside a transaction. I even tried to bind all the parameters individually using PDO bindParam() and explicitly indicated the parameter type PDO::PARAM_LOB (and PARAM_STR) for the 3rd parameter, but the error continued when inside a transaction.

alanseiden commented 3 years ago

Fixed by #141