Method: Sequel::SQL::CastMethods#cast_string

Defined in:
lib/sequel/sql.rb

#cast_string(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.function(:func).cast_string # CAST(func() AS varchar(255))
Sequel.function(:func).cast_string(:text) # CAST(func() AS text)


690
691
692
# File 'lib/sequel/sql.rb', line 690

def cast_string(sql_type = nil)
  Cast.new(self, sql_type || String).sql_string
end