module DB::SessionMethods(Session, Stmt)

Overview

Methods that are shared accross session like objects:

Classes that includes this module are able to execute queries and statements in both prepared and unprepared fashion.

This module serves for dsl reuse over session like objects.

Included Modules

Direct including types

Defined in:

db/session_methods.cr

Instance Method Summary

Instance methods inherited from module DB::QueryMethods(Stmt)

exec(query, *args_, args : Array | Nil = nil) exec, query(query, *args_, args : Array | Nil = nil)
query(query, *args_, args : Array | Nil = nil, &)
query
, query_all(query, *args_, args : Array | Nil = nil, &block : ResultSet -> U) : Array(U) forall U
query_all(query, *args_, args : Array | Nil = nil, as types : Tuple)
query_all(query, *args_, args : Array | Nil = nil, as types : NamedTuple)
query_all(query, *args_, args : Array | Nil = nil, as type : Class)
query_all
, query_each(query, *args_, args : Array | Nil = nil, &) query_each, query_one(query, *args_, args : Array | Nil = nil, &block : ResultSet -> U) : U forall U
query_one(query, *args_, args : Array | Nil = nil, as types : Tuple)
query_one(query, *args_, args : Array | Nil = nil, as types : NamedTuple)
query_one(query, *args_, args : Array | Nil = nil, as type : Class)
query_one
, query_one?(query, *args_, args : Array | Nil = nil, &block : ResultSet -> U) : U | Nil forall U
query_one?(query, *args_, args : Array | Nil = nil, as types : Tuple)
query_one?(query, *args_, args : Array | Nil = nil, as types : NamedTuple)
query_one?(query, *args_, args : Array | Nil = nil, as type : Class)
query_one?
, scalar(query, *args_, args : Array | Nil = nil) scalar

Instance Method Detail

def build(query) : Stmt #
Description copied from module DB::QueryMethods(Stmt)

:nodoc:


[View source]
abstract def build_unprepared_statement(query) : Stmt #

[View source]
abstract def fetch_or_build_prepared_statement(query) : Stmt #

[View source]
def prepared(query) #

Returns a prepared Statement that has not been executed yet.


[View source]
def prepared #

dsl helper to build prepared statements returns a value that includes QueryMethods


[View source]
abstract def prepared_statements? : Bool #

Returns whether by default the statements should be prepared or not.


[View source]
def unprepared(query) #

Returns an unprepared Statement that has not been executed yet.


[View source]
def unprepared #

dsl helper to build unprepared statements returns a value that includes QueryMethods


[View source]