OctaviusClient
Hands out queries and sessions, and runs transactions over them.
A query from rawQuery, select, insertInto, update or deleteFrom finds its own session when a terminal runs, so nothing has to be opened around it. execute hands over the driver's OctaviusSessionOperations for work that is not a query - copy, largeObjects, notifications, several statements on one session.
val db = OctaviusClient.fromDataSource(hikariDataSource)
val senators = db.rawQuery("SELECT id, cognomen FROM senators WHERE province_id = @p")
.fetchObjects<Senator>("p" to 7)Either way the session joins the transaction running on this thread, if there is one, so the same repository function works standalone and inside a larger transaction.
Failures are thrown. Where one should be a value, asResult covers one query, transactionResult a transaction, and dbResult anything else.
Inheritors
Properties
Functions
Starts a DELETE from table, which renders only with a WHERE.
Runs block on a session: inside a transaction on this thread the transaction's, otherwise one borrowed for this call, whose statements commit as they go.
Runs every step of plan in one transaction, in order, and returns what each produced. A step's TransactionValues are resolved just before it runs.
Starts an INSERT into table.
Starts a SELECT of columns, each passed through as SQL: "id", "count(*) AS total".
Runs block in a transaction, committing when it returns and rolling back when it throws. The receiver offers no commit or rollback of its own.
transaction for the result style. A plain transaction rolls back only on a throw, so a failure turned into a value inside it is committed over; here a returned DataResult.Failure rolls back.
Starts an UPDATE of table, which renders only with a WHERE.