Method: Sequel::SQL::Builders#cast_string

Defined in:
lib/sequel/sql.rb

#cast_string(arg, sql_type = nil) ⇒ Object

Cast the reciever to the given SQL type (or the database’s default String type if none given), and return the result as a StringExpression, so you can use + directly on the result for SQL string concatenation.

Sequel.cast_string(:a) # CAST(a AS varchar(255))
Sequel.cast_string(:a, :text) # CAST(a AS text)

399
400
401
# File 'lib/sequel/sql.rb', line 399

def cast_string(arg, sql_type = nil)
  cast(arg, sql_type || String).sql_string
end