node-firebird icon indicating copy to clipboard operation
node-firebird copied to clipboard

How to get rows affected count in update or delete statement

Open codermapuche opened this issue 9 years ago • 4 comments

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?

codermapuche avatar Nov 24 '15 16:11 codermapuche

You could put the UPDATE/DELETE statements in a stored procedure call which also returns ROW_COUNT.

ericlovescode avatar Nov 17 '16 23:11 ericlovescode

some way to return ROW_COUNT without using STORE PROCEDURE

crisgol avatar Feb 15 '20 12:02 crisgol

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

tiagowippel avatar Apr 01 '22 20:04 tiagowippel

Any changes to this? how come we get absolutely no feedback out of an update statement?

nickolasdeluca avatar Sep 19 '23 14:09 nickolasdeluca