Package me.ahoo.cosid.store.jdbc
Class JdbcSession
java.lang.Object
me.ahoo.cosid.store.jdbc.JdbcSession
One borrowed connection of a JDBC store, as a
JdbcDialect sees it: the connection in auto-commit mode, the
table names, and statements that carry the store timeout (StoreConfig.timeout as queryTimeout).-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceWork on the connection of a session. -
Method Summary
Modifier and TypeMethodDescriptionThe connection; in auto-commit mode outsidetransaction(me.ahoo.cosid.store.jdbc.JdbcSession.SqlWork<T>).Prepares a statement with the store timeout.Prepares a statement with the store timeout that reports generated keys.tables()The table names of the store.<T> Ttransaction(JdbcSession.SqlWork<T> work) Runsworkin oneREAD COMMITTEDtransaction (06 §2.1), then puts the auto-commit mode and the isolation level of the pooled connection back.
-
Method Details
-
connection
The connection; in auto-commit mode outsidetransaction(me.ahoo.cosid.store.jdbc.JdbcSession.SqlWork<T>).- Returns:
- the connection
-
tables
The table names of the store.- Returns:
- the table names
-
prepare
Prepares a statement with the store timeout.- Parameters:
sql- the SQL- Returns:
- the statement; the caller closes it
- Throws:
SQLException- if the driver fails
-
prepare
Prepares a statement with the store timeout that reports generated keys.- Parameters:
sql- the SQLautoGeneratedKeys-Statement.RETURN_GENERATED_KEYSorNO_GENERATED_KEYS- Returns:
- the statement; the caller closes it
- Throws:
SQLException- if the driver fails
-
transaction
Runsworkin oneREAD COMMITTEDtransaction (06 §2.1), then puts the auto-commit mode and the isolation level of the pooled connection back. Rolls back whenworkthrows.- Type Parameters:
T- the result type- Parameters:
work- the work- Returns:
- the result of
work - Throws:
SQLException- if the work or the driver fails
-