puresql icon indicating copy to clipboard operation
puresql copied to clipboard

Transactions support (MSSQL)

Open vitalyster opened this issue 6 years ago • 1 comments

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.

vitalyster avatar Jul 16 '19 08:07 vitalyster

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 :)

neonerd avatar Jul 16 '19 13:07 neonerd