SqlConn
mixin SqlConn
SqlConn manages a connection to a relational database. See pod-doc.
If auto-commit is true then each statement is executed and committed as an individual transaction
Undo any changes made inside the current transaction
Return if close has been called
Get the database meta-data
Commit all the changes made inside the current transaction
withPrepare creates a prepared Statement, passes the Statement to the callback, and then closes the prepared Statement
Close the database connection
Open a connection to the database specified by the given JDBC uri and username/password credentials
Create a statement for this database
abstract Bool : autoCommit
If auto-commit is true then each statement is executed and committed as an individual transaction. Otherwise statements are grouped into transaction which must be closed via commit or rollback.
abstract Bool close()
Close the database connection. Closing a connection already closed is a no-op. This method is guaranteed to never throw an exception. Return true if the connection was closed successfully or false if closed abnormally.
Do not close connections that were created by SqlConnPool. The pool handles that for you.
abstract Void commit()
Commit all the changes made inside the current transaction.
abstract Bool isClosed()
Return if close has been called.
abstract SqlMeta meta()
Get the database meta-data
static SqlConn open(Str uri, Str? username, Str? password)
Open a connection to the database specified by the given JDBC uri and username/password credentials. Raise exception if connection cannot be established. See pod-doc.
abstract Void rollback()
Undo any changes made inside the current transaction.
abstract Statement sql(Str sql)
Create a statement for this database.
Obj? withPrepare(Str sql, |Statement->Obj?| f)
withPrepare creates a prepared Statement, passes the Statement to the callback, and then closes the prepared Statement.
The method returns the value returned by the callback.