module
CQL::Executable
Overview
Runs a statement that renders to {sql, params}. Result caching,
performance tracking and connection handling live here once, for every
query type that can be executed.
Included Modules
Direct including types
Defined in:
executable.crInstance Method Summary
-
#all(as kind)
All rows, each mapped to kind.
- #all!(as kind)
- #build : Expression::Statement
-
#each(as kind : U.class, & : U -> ) : Nil forall U
Yields each row mapped to kind.
-
#explain(analyze : Bool = false) : String
The database's execution plan for this statement, one line per plan row.
-
#get(as kind)
The first row (or scalar) mapped to kind, nil when there is none.
-
#get!(as kind)
Like
#get, but raisesDB::NoResultsErrorwhen there is no row. -
#returns_rows?(count : Int32) : Bool
Whether the statement returns at least count rows.
-
#to_sql(gen : Expression::Generator | Nil = nil)
The SQL text and its bound parameters, rendered for the schema's dialect (or by the given generator).
-
#to_sql(for adapter : Adapter)
Renders for another dialect without needing a connection to it.
Instance methods inherited from module CQL::Pinnable
executor : Executor
executor,
schema : Schema
schema,
using(connection : DB::Connection) : selfusing(executor : Executor) : self using
Instance Method Detail
Yields each row mapped to kind. The rows are read first and the connection released
before the block runs, so the block may run other queries; use find_each for large results.
The database's execution plan for this statement, one line per plan row.
With analyze: true the statement is actually run and timed.
Whether the statement returns at least count rows. Steps through at most count rows without reading a column, so nothing is decoded.
The SQL text and its bound parameters, rendered for the schema's dialect (or by the given generator).
Renders for another dialect without needing a connection to it.