drizzle-orm icon indicating copy to clipboard operation
drizzle-orm copied to clipboard

Support prepared statements in transactions

Open dankochetov opened this issue 2 years ago • 1 comments

dankochetov avatar May 22 '23 11:05 dankochetov

Same

Benjamin-van-Heerden avatar May 30 '23 13:05 Benjamin-van-Heerden

Would love this!

ngregrichardson avatar Aug 11 '23 04:08 ngregrichardson

It might be that prepared statements created outside of a transaction, but executed in a transaction behave as if they are part of the transaction: https://discord.com/channels/1043890932593987624/1164318289674125392/1164318289674125392

masonbrothers avatar Dec 03 '23 00:12 masonbrothers

Oh, interesting. From the Discord link above:

The tx object passed to the transaction function is just a convenience. You can use db interchangeably, it won't make a difference. It only has a rollback() method which only throws an error. Inside the transaction, it stops execution and rollsback

I'd been waiting for this feature, but sounds like it's already supported? It might be worth updating the transactions documentation to include an example of how this should work then, since this seems like a common point of confusion.

rosszurowski avatar Dec 03 '23 01:12 rosszurowski