struct
Interro::QueryExpression
- Interro::QueryExpression
- Struct
- Value
- Object
Defined in:
query_expression.crConstructors
- .new(parts : Array(Interro::Any | String))
- .new(*parts : Part) : self
-
.parse(fragment : String, values : Array(Any) = [] of Any) : self
Parses a raw SQL fragment, resolving each
$nplaceholder to the value it references:$1isvalues[0], and so on.
Instance Method Summary
- #&(other : self) : self
- #|(other : self) : self
-
#parts : Array(Part)
The expression is just its parts: SQL text interleaved with the values to bind.
- #to_sql(io : IO, args : Array(Any)) : Nil
-
#to_sql(io : IO) : Nil
Render this expression, numbering placeholders from
$1. - #to_sql
-
#values : Array(Any)
The values this fragment binds, in the order
#to_sqlrenders them.
Constructor Detail
Parses a raw SQL fragment, resolving each $n placeholder to the value it references: $1 is values[0], and so on.
Raises ArgumentError if a placeholder references no value.
Instance Method Detail
The expression is just its parts: SQL text interleaved with the values to bind.
Placeholder numbers are assigned when the query is rendered in #to_sql.
Render this expression, numbering placeholders from $1.
Intended for inspecting an expression; one that is about to executed should use #to_sql(io, args) so that placeholders are numbered relative to the built args array.
The values this fragment binds, in the order #to_sql renders them.