Interro::QueryExpression
Inherits Struct < Value < Object
Constructors
new(*parts : Part) : self
Sourceparse(fragment : String, values : Array(Any) = [] of Any) : self
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 methods
&(other : self) : self
Source|(other : self) : self
Sourceparts
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.
to_sql(io : IO, args : Array(Any)) : Nil
Sourceto_sql(io : IO) : Nil
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.
to_sql
Source