Auto-wrap in a transaction
functionalPut non-read work inside a transaction you can inspect and roll back before it becomes permanent.
With auto-wrap on, anything beyond a plain read runs inside an outer transaction that SQLly rolls back for you. The statement really executes - you see the row counts, the constraint violation, the trigger firing, and then the database is left exactly as it was.
What actually gets sent
SQLly rewrites the batch in your engine's own transaction syntax:
| Engine | Wrap |
|---|---|
| SQL Server | SET XACT_ABORT ON; BEGIN TRANSACTION; …; ROLLBACK TRANSACTION; |
| MySQL / MariaDB | START TRANSACTION; …; ROLLBACK; |
| PostgreSQL, SQLite, libSQL / Turso, DuckDB | BEGIN; …; ROLLBACK; |
| Oracle | …; ROLLBACK; - no BEGIN, which would open a PL/SQL block; the driver turns autocommit off under this policy and the trailing ROLLBACK closes the transaction Oracle opened implicitly |
| ClickHouse | Refused up front - ClickHouse has no transactions, so there is nothing a wrap could roll back |
| Redis | Not applicable - Redis commands are not transactional statements; use read-only or the confirmation for destructive commands instead |
XACT_ABORT ON on SQL Server matters: it makes the server abandon
the whole transaction on the first error instead of continuing with part of the
batch applied. A batch that is nothing but USE <database> is
left alone, there is nothing to undo, and wrapping it would only confuse the
session context.
The cases it refuses rather than fakes
- MySQL and Oracle DDL. Both implicitly commit
CREATE,ALTER,DROP,TRUNCATE,RENAME,GRANT, andREVOKE. Inside the wrap those changes - and everything before them, would silently persist, which breaks the setting's whole promise. SQLly refuses the batch and says so, naming the engine and the verb, rather than pretending it rolled back. (CREATE/DROP TEMPORARY TABLEis exempt on MySQL; it does not commit those.) - ClickHouse, always. There are no transactions to wrap in, so a connection with this setting on refuses to run anything under it and tells you to turn the setting off for that connection instead of pretending.
- T-SQL routine definitions.
CREATE/ALTER PROCEDURE,FUNCTION,TRIGGER, andVIEWmust lead their batch, so aBEGIN TRANSACTIONin front would make SQL Server reject the whole thing with error 111. SQLly instead gives the definition a batch of its own inside the transaction viaEXEC(N'…'), so the deploy runs, is observable, and still rolls back.
Things the wrap cannot undo
A transaction only covers what the engine puts inside it. Sequence and identity values consumed by an insert are not returned, work done by a linked server or an autonomous transaction is outside the scope, and any engine that commits DDL implicitly behaves the way that engine behaves. The wrap is an excellent rehearsal; it is not a time machine.