Queryable

scalasql.core.Queryable
See theQueryable companion object
trait Queryable[-Q, R]

Typeclass to indicate that we are able to evaluate a query of type Q to return a result of type R. Involves two operations: flattening a structured query to a flat list of expressions via walkLabelsAndExprs, and reading a JSON-ish tree-shaped blob back into a return value via valueReader

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait Row[Q, R]
class ExprQueryable[E, T]

Members list

Value members

Abstract methods

def construct(q: Q, args: ResultSetIterator): R

Construct a Scala return value from the Queryable.ResultSetIterator representing the return value of this queryable value

Construct a Scala return value from the Queryable.ResultSetIterator representing the return value of this queryable value

Attributes

def isExecuteUpdate(q: Q): Boolean

Whether this queryable value is executed using java.sql.Statement.executeUpdate instead of .executeQuery. Note that this needs to be known ahead of time, and cannot be discovered by just calling .execute, because some JDBC drivers do not properly handle updates in the .execute call

Whether this queryable value is executed using java.sql.Statement.executeUpdate instead of .executeQuery. Note that this needs to be known ahead of time, and cannot be discovered by just calling .execute, because some JDBC drivers do not properly handle updates in the .execute call

Attributes

def isGetGeneratedKeys(q: Q): Option[Row[_, _]]

Whether this queryable value is executed using java.sql.Statement.getGeneratedKeys instead of .executeQuery.

Whether this queryable value is executed using java.sql.Statement.getGeneratedKeys instead of .executeQuery.

Attributes

def isSingleRow(q: Q): Boolean

Whether this query expects a single row to be returned, if so we can assert on the number of rows and raise an error if 0 rows or 2+ rows are present

Whether this query expects a single row to be returned, if so we can assert on the number of rows and raise an error if 0 rows or 2+ rows are present

Attributes

def renderSql(q: Q, ctx: Context): SqlStr

Converts the given queryable value into a SqlStr, that can then be executed by the underlying SQL JDBC interface

Converts the given queryable value into a SqlStr, that can then be executed by the underlying SQL JDBC interface

Attributes

def walkExprs(q: Q): Seq[Expr[_]]

Returns a sequence of expressions created by this queryable value. Used to generate the column list SELECT clauses, both for nested and top level SELECTs

Returns a sequence of expressions created by this queryable value. Used to generate the column list SELECT clauses, both for nested and top level SELECTs

Attributes

def walkLabels(q: Q): Seq[List[String]]

Returns a sequence of labels, each represented by a list of tokens, representing the expressions created by this queryable value. Used to add AS foo_bar labels to the generated queries, to aid in readability

Returns a sequence of labels, each represented by a list of tokens, representing the expressions created by this queryable value. Used to add AS foo_bar labels to the generated queries, to aid in readability

Attributes

Concrete methods