In Node-red, can I open a database transaction in one node (to lock a row, or several rows), perform calculations/checks etc on the data in subsequent function nodes, then update the database and close the transaction in a later database node further down the flow?
Most database nodes have a configuration node for authorisation etc, so that the [Perform Operations] and [Close Transactions] happen in one node automatically, passing the results of the query, which is usually passed to the DB through msg.topic, in msg.payload.
Is there a reason you need this to happen in different nodes?
In answer to both questions....it's perhaps that I'm doing things in a bad sequence, but we have several dbs and sequences of logic required to identify whether the row we look up will - or will not - subsequently be acted on.
Hence wondering if it was possible to lock the queried row(s) while doing the other db calls (like other DBs) and the calculations to know what we'll actually do (or not) so that when we know whether we'll change the rows (or not) we don't have to worry about those rows having been changed in the interim.
I think you want to be very careful if you are actually considering this strategy. Database locking is not the way to go (read on ACID properties).
Why can't you perform the check/calculations inside the query ? You could create triggers that are automatically performed based on the trigger criteria.