abstract class DB::Statement
- DB::Statement
- Reference
- Object
Overview
Represents a query in a Connection
.
It should be created by QueryMethods
.
Note to implementors
- Subclass
Statements
Statements
are created from a custom driverConnection#prepare
method.#perform_query
executes a query that is expected to return aResultSet
#perform_exec
executes a query that is expected to return anExecResult
#do_close
is called to release the statement resources.
Included Modules
Defined in:
db/statement.crConstructors
Instance Method Summary
- #command : String
- #exec : DB::ExecResult
- #exec(*args_, args : Array? = nil) : DB::ExecResult
- #query : DB::ResultSet
- #query(*args_, args : Array? = nil) : DB::ResultSet
- #release_connection
Macro Summary
-
def_around_query_or_exec(&block)
This macro allows injecting code to be run before and after the execution of the request.
Instance methods inherited from module DB::StatementMethods
exec : ExecResultexec(*args_, args : Array? = nil) : ExecResult exec, query(*args_, args : Array? = nil, &)
query : ResultSet
query(*args_, args : Array? = nil) : ResultSet query, scalar(*args_, args : Array? = nil) scalar
Instance methods inherited from module DB::Disposable
close
close,
closed?
closed?
Constructor Detail
Instance Method Detail
Macro Detail
macro def_around_query_or_exec(&block)
#
This macro allows injecting code to be run before and after the execution
of the request. It should return the yielded value. It must be called with 1
block argument that will be used to pass the args : Enumerable
.
class DB::Statement
def_around_query_or_exec do |args|
# do something before query or exec
res = yield
# do something after query or exec
res
end
end