smchamberlin / node-red-contrib-ibm-db2

Node-RED nodes to work with a Db2 LUW database. Works with "Db2 on Cloud" and "Db2 Warehouse on Cloud" services as well as standalone installation of Db2 LUW.
4 stars 14 forks source link

DashDB In node does not return SQL error for DELETE #6

Closed tonykambo closed 8 years ago

tonykambo commented 8 years ago

I added a DashDB In node with the following:

DELETE JOBS WHERE JOBID=?;

The parameter marker is:

msg.jobId

If the row doesn't exist for a specific jobId (e.g. 7030593) the DashDB In node does not pass on any error. The msg.payload is empty. Is there some other variable that I should check for an error state?

When attempting to delete a non-existent row using DashDB directly the following error is returned by DashDB:

No row was found for FETCH, UPDATE or DELETE; or the result of a query is an empty table. SQL CODE=100, SQLSTATE=02000, DRIVER=3

Not sure if this is a defect or a feature request (-:

smchamberlin commented 8 years ago

Now, if there is an error during the query , the msg.payload will be null and the error coming back from ibm_db module will be written to the msg.error (also in JSON format, so you can parse the JSON to get the specific error code). It will also write the error to the debug console as well.