Creates a connection, managed with given handler.
Creates a connection, managed with given handler.
connection handler
connection properties
a new Acolyte connection
import acolyte.jdbc.{ AcolyteDSL, ConnectionHandler } import AcolyteDSL.connection def foo(handler: ConnectionHandler) = connection(handler) // without connection properties // With connection property to fallback untyped null def bar(handler: ConnectionHandler) = connection(handler, "acolyte.parameter.untypedNull" -> "true")
Creates a connection, whose statement will be passed to given handler.
Creates a connection, whose statement will be passed to given handler.
the statement handler
the resource handler
the connection properties
a new Acolyte connection
import acolyte.jdbc.{ AcolyteDSL, ConnectionHandler } import AcolyteDSL.connection def foo(handler: ConnectionHandler) = connection(handler) // without connection properties // With connection property to fallback untyped null def bar(handler: ConnectionHandler) = connection(handler, "acolyte.parameter.untypedNull" -> "true")
Creates a connection, whose statement will be passed to given handler.
Creates a connection, whose statement will be passed to given handler.
the statement handler
the connection properties
a new Acolyte connection
import acolyte.jdbc.{ AcolyteDSL, ConnectionHandler } import AcolyteDSL.connection def foo(handler: ConnectionHandler) = connection(handler) // without connection properties // With connection property to fallback untyped null def bar(handler: ConnectionHandler) = connection(handler, "acolyte.parameter.untypedNull" -> "true")
Manages a scope to debug any JDBC execution
Manages a scope to debug any JDBC execution
the operation to print any QueryExecution that occurs within the scope of debuging.
the function working with the debug connection.
import acolyte.jdbc.AcolyteDSL AcolyteDSL.debuging() { con => val stmt = con.prepareStatement("SELECT * FROM Test WHERE id = ?") stmt.setString(1, "foo") stmt.executeQuery() } // print on stdout: // => Executed query: QueryExecution(SELECT * FROM Test WHERE id = ?,List(Param(foo, VARCHAR)))
Creates a new handler detecting all statements as queries
(like handleStatement.withQueryDetection(".*").withQueryHandler(h)
).
Creates a new handler detecting all statements as queries
(like handleStatement.withQueryDetection(".*").withQueryHandler(h)
).
import acolyte.jdbc.QueryResult import acolyte.jdbc.AcolyteDSL.{ connection, handleQuery } def foo(res: QueryResult) = connection(handleQuery { _ => res })
Creates an empty handler.
Creates an empty handler.
import acolyte.jdbc.AcolyteDSL.{ connection, handleStatement }
connection { handleStatement }
Returns a resource handler intercepting transaction commit or rollback.
Returns a resource handler intercepting transaction commit or rollback.
the function handling commit
the function handling rollback
java.sql.Connection.rollback
java.sql.Connection.commit
Returns an update result with row count
and generated keys
.
Returns an update result with row count
and generated keys
.
Updated (row) count
Generated keys
import acolyte.jdbc.AcolyteDSL.updateResult import acolyte.jdbc.RowLists updateResult(2, RowLists.stringList("a", "b")) // 2 = updated rows
Executes f
using a connection accepting only queries,
and answering with result
to any query.
Executes f
using a connection accepting only queries,
and answering with result
to any query.
import acolyte.jdbc.QueryResult import acolyte.jdbc.AcolyteDSL.withQueryResult def str(queryRes: QueryResult): String = withQueryResult(queryRes) { con => "str" }
Acolyte DSL for JDBC.