node-firebird
node-firebird copied to clipboard
How to get rows affected count in update or delete statement
Hi, i run an update query and need return affected rows count for the statement.
I try to add in the index.js, line 1347 inside the switch, two news cases for isc_info_sql_stmt_update and isc_info_sql_stmt_delete respectively, this is correct, but i have no idea what put inside this to make it works.
can help me?
You could put the UPDATE/DELETE statements in a stored procedure call which also returns ROW_COUNT.
some way to return ROW_COUNT without using STORE PROCEDURE
I have achieved that with the following:
db.query(`` EXECUTE BLOCK RETURNS ( VAR1 INTEGER ) AS BEGIN UPDATE TABLE SET FIELD = 'ABC' WHERE NUMBER > 1000 RETURNING ROW_COUNT INTO :VAR1; SUSPEND; END ``,function(err, result){ console.log(result) })
Unfortunately this seems not to work when using parameterized queries. Maybe an issue with node-firebird package...
Any changes to this? how come we get absolutely no feedback out of an update statement?