Class

acolyte.jdbc

ScalaCompositeHandler

Related Doc: package jdbc

Permalink

final class ScalaCompositeHandler extends AbstractCompositeHandler[ScalaCompositeHandler]

Linear Supertypes
AbstractCompositeHandler[ScalaCompositeHandler], StatementHandler, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ScalaCompositeHandler
  2. AbstractCompositeHandler
  3. StatementHandler
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new ScalaCompositeHandler(qd: Array[Pattern], qh: QueryHandler, uh: UpdateHandler)

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  10. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  11. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  12. def isQuery(arg0: String): Boolean

    Permalink
    Definition Classes
    AbstractCompositeHandler → StatementHandler
  13. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  14. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  15. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  16. def queryDetectionPattern(arg0: <repeated...>[Pattern]): Array[Pattern]

    Permalink
    Attributes
    protected[acolyte.jdbc]
    Definition Classes
    AbstractCompositeHandler
  17. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  18. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  19. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  20. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. def whenSQLQuery(arg0: String, arg1: List[Parameter]): QueryResult

    Permalink
    Definition Classes
    AbstractCompositeHandler → StatementHandler
    Annotations
    @throws( classOf[java.sql.SQLException] )
  23. def whenSQLUpdate(arg0: String, arg1: List[Parameter]): UpdateResult

    Permalink
    Definition Classes
    AbstractCompositeHandler → StatementHandler
    Annotations
    @throws( classOf[java.sql.SQLException] )
  24. def withQueryDetection(pattern: Array[Pattern]): ScalaCompositeHandler

    Permalink

    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")
    Definition Classes
    ScalaCompositeHandler → AbstractCompositeHandler
  25. def withQueryDetection(arg0: <repeated...>[String]): ScalaCompositeHandler

    Permalink
    Definition Classes
    AbstractCompositeHandler
  26. def withQueryHandler(h: (QueryExecution) ⇒ QueryResult): ScalaCompositeHandler

    Permalink

    Returns handler that delegates query execution to h function.

    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 { e: 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
        }
      }
  27. def withUpdateHandler(h: (UpdateExecution) ⇒ UpdateResult): ScalaCompositeHandler

    Permalink

    Returns handler that delegates update execution to h function.

    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 { e: 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
      }
    }

Inherited from AbstractCompositeHandler[ScalaCompositeHandler]

Inherited from StatementHandler

Inherited from AnyRef

Inherited from Any

Ungrouped