struct Interro::QueryExpression

Defined in:

query_expression.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(parts : Array(Interro::Any | String)) #

[View source]
def self.new(*parts : Part) : self #

[View source]
def self.parse(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.


[View source]

Instance Method Detail

def &(other : self) : self #

[View source]
def |(other : self) : self #

[View source]
def parts : Array(Part) #

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.


[View source]
def to_sql(io : IO, args : Array(Any)) : Nil #

[View source]
def to_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.


[View source]
def to_sql #

[View source]
def values : Array(Any) #

The values this fragment binds, in the order #to_sql renders them.


[View source]