java.lang.Object
com.github.fabriciofx.cactoos.jdbc.query.QueryOf
All Implemented Interfaces:
Query, org.cactoos.Text

public final class QueryOf extends Object implements Query
Simple parameters query.
Since:
0.1
  • Constructor Details

    • QueryOf

      public QueryOf(String sql, Param... prms)
      Ctor.
      Parameters:
      sql - The SQL query
      prms - SQL query parameters
    • QueryOf

      public QueryOf(org.cactoos.Text sql, Param... prms)
      Ctor.
      Parameters:
      sql - The SQL query
      prms - An array of SQL query parameters
    • QueryOf

      public QueryOf(org.cactoos.Text sql, Params prms)
      Ctor.
      Parameters:
      sql - The SQL query
      prms - SQL query parameters
  • Method Details

    • prepared

      public PreparedStatement prepared(Connection connection) throws Exception
      Description copied from interface: Query
      Create a PreparedStatement.
      Specified by:
      prepared in interface Query
      Parameters:
      connection - A connection to the DataSource
      Returns:
      A PreparedStatement
      Throws:
      Exception - If fails
    • params

      public Params params()
      Description copied from interface: Query
      Return the Query params.
      Specified by:
      params in interface Query
      Returns:
      The query parameters
    • named

      public String named()
      Description copied from interface: Query
      Return a named query string.
      Specified by:
      named in interface Query
      Returns:
      A named query string
    • asString

      public String asString() throws Exception
      Specified by:
      asString in interface org.cactoos.Text
      Throws:
      Exception