puresql
puresql copied to clipboard
Transactions support (MSSQL)
I tried to create BEGIN TRANSACTION and COMMIT TRANSACTION queries and it works with sqlite and pg, but mssql automatically closes transaction after first query. Am I miss something or we need some explicit transactions support?
Tested both mssql 3.3.0 which defined as 'supported' and latest mssql package.
Unforunately, this is a drawback of the nodeJS mssql library, it has a special process for creating transactions:
https://www.npmjs.com/package/mssql#transaction
I think this applies retroactively to 3.x
The only solution that comes to my mind is extending puresql with another basic function. something like puresql.transactionQuery(), that would call the transaction function instead of normal query function in the mssql adapter. I currently don't have the time to do this, but PRs are welcome :)