OptionalleaseLeases a dedicated connection for one batch. Takes precedence over SQLBatchOptions.singleConnection and over pool autodetection, and is the escape hatch for a handle CollegeDB does not recognize.
OptionalsingleDeclares that the handle is one dedicated connection, so BEGIN/COMMIT
can be issued straight through it. Set this for a pg.Client, a mysql2
connection, or any SQLite handle. Do not set it for a pool.
Controls whether an adapter may run a SQLDatabase.runBatch group inside one transaction, and on which connection.
A transaction is only correct when every statement in it,
BEGINandCOMMITincluded, travels down the same connection. A pool does not guarantee that, and a pool cannot be told apart from a single connection by inspection:pg'sClientandPoolboth exposeconnect(), and any of them can be wrapped in something that exposes onlyquery(). So the adapter never guesses. It batches when it recognizes a pool it knows how to lease from, when you hand it a SQLBatchOptions.lease of your own, or when you state that the handle is a single connection. Otherwise statements run one at a time, exactly as before.Since
1.4.0