class
Marten::DB::Query::SQL::RawQuery(Model)
- Marten::DB::Query::SQL::RawQuery(Model)
- Reference
- Object
Included Modules
Defined in:
marten/db/query/sql/raw_query.crConstructors
Instance Method Summary
- #clone
-
#connection(*, write : Bool = false)
Returns the database connection to use for the raw query.
- #execute : Array(Model)
- #params
- #query
- #using
- #using=(using : Nil | String)
Instance methods inherited from module Marten::DB::Query::SQL::Sanitizer
sanitize_named_parameters(query : String, params : Hash(String, ::DB::Any), connection : Connection::Base | Nil = nil)
sanitize_named_parameters,
sanitize_positional_parameters(query : String, params : Array(::DB::Any), connection : Connection::Base | Nil = nil)
sanitize_positional_parameters
Constructor Detail
def self.new(query : String, params : Array(::DB::Any) | Hash(String, ::DB::Any), using : String | Nil)
#
Instance Method Detail
def connection(*, write : Bool = false)
#
Returns the database connection to use for the raw query.
By default the model's read connection is returned. Pass write: true when the raw SQL performs a mutation
so that database routers can resolve the write alias.