ScalaCompositeHandler
Attributes
- Graph
- Supertypes
- class AbstractCompositeHandler[ScalaCompositeHandler]trait StatementHandlerclass Objecttrait Matchableclass Any
Members list
Value members
Concrete methods
Returns handler that detects statement matching given pattern(s) as query.
Returns handler that detects statement matching given pattern(s) as query.
import acolyte.jdbc.AcolyteDSL.handleStatement
// Created handle will detect as query statements
// either starting with 'SELECT ' or containing 'EXEC proc'.
handleStatement.withQueryDetection("^SELECT ", "EXEC proc")
Attributes
Returns handler that delegates query execution to h
function.
Given function will be used only if executed statement is detected
as a query by withQueryDetection.
Returns handler that delegates query execution to h
function.
Given function will be used only if executed statement is detected
as a query by withQueryDetection.
import acolyte.jdbc.{ QueryExecution, QueryResult }
import acolyte.jdbc.AcolyteDSL.handleStatement
import acolyte.jdbc.Implicits.stringAsResult
def aQueryResult: QueryResult = "lorem"
handleStatement withQueryHandler { (_: QueryExecution) => aQueryResult }
// With pattern matching ...
import acolyte.jdbc.{ ExecutedParameter => P }
def foo(otherResult: QueryResult) =
handleStatement withQueryHandler {
_ match {
case QueryExecution(
"SELECT * FROM Test WHERE id = ?", P(1) :: Nil) =>
aQueryResult
case _ => otherResult
}
}
Attributes
Returns handler that delegates update execution to h
function.
Given function will be used only if executed statement is not detected
as a query by withQueryDetection.
Returns handler that delegates update execution to h
function.
Given function will be used only if executed statement is not detected
as a query by withQueryDetection.
import acolyte.jdbc.{ UpdateResult, UpdateExecution }
import acolyte.jdbc.AcolyteDSL.handleStatement
import acolyte.jdbc.Implicits._
val aUpResult: UpdateResult = 1
handleStatement withUpdateHandler { (_: UpdateExecution) => aUpResult }
// With pattern matching ...
import acolyte.jdbc.{ ExecutedParameter => P }
def bar(otherResult: UpdateResult) = handleStatement withUpdateHandler {
_ match {
case UpdateExecution(
"INSERT INTO Country (code, name) VALUES (?, ?)",
P(_/*code*/) :: P(_/*name*/) :: Nil) => 1 // update count
case _ => otherResult
}
}
Attributes
Inherited methods
Attributes
- Inherited from:
- AbstractCompositeHandler
Attributes
- Inherited from:
- AbstractCompositeHandler
Attributes
- Inherited from:
- AbstractCompositeHandler