Class: Sequel::LiteralString

Inherits:
String show all
Includes:
Postgres::ArrayOpMethods, Postgres::HStoreOpMethods, Postgres::InetOpMethods, Postgres::JSONOpMethods, Postgres::PGRowOp::ExpressionMethods, Postgres::RangeOpMethods, SQL::AliasMethods, SQL::BooleanMethods, SQL::CastMethods, SQL::ComplexExpressionMethods, SQL::InequalityMethods, SQL::IsDistinctFrom::Methods, SQL::NumericMethods, SQL::OrderMethods, SQL::StringMethods, SQLite::JSONOpMethods
Defined in:
lib/sequel/sql.rb,
lib/sequel/sql.rb,
lib/sequel/extensions/pg_row_ops.rb,
lib/sequel/extensions/pg_inet_ops.rb,
lib/sequel/extensions/pg_json_ops.rb,
lib/sequel/extensions/pg_array_ops.rb,
lib/sequel/extensions/pg_range_ops.rb,
lib/sequel/extensions/pg_hstore_ops.rb,
lib/sequel/extensions/sqlite_json_ops.rb,
lib/sequel/extensions/is_distinct_from.rb

Overview

LiteralString is used to represent literal SQL expressions. A LiteralString is copied verbatim into an SQL statement. Instances of LiteralString can be created by calling Sequel.lit.

Instance Method Summary collapse

Methods included from SQL::IsDistinctFrom::Methods

#is_distinct_from

Methods included from SQLite::JSONOpMethods

#sqlite_json_op, #sqlite_jsonb_op

Methods included from Postgres::HStoreOpMethods

#hstore

Methods included from Postgres::RangeOpMethods

#pg_range

Methods included from Postgres::ArrayOpMethods

#pg_array

Methods included from Postgres::JSONOpMethods

#pg_json, #pg_jsonb

Methods included from Postgres::InetOpMethods

#pg_inet

Methods included from Postgres::PGRowOp::ExpressionMethods

#pg_row

Methods included from SQL::CastMethods

#cast, #cast_numeric, #cast_string

Methods included from SQL::AliasMethods

#as

Methods included from SQL::StringMethods

#escaped_ilike, #escaped_like, #ilike, #like

Methods included from SQL::NumericMethods

#+, #coerce

Methods included from SQL::BooleanMethods

#~

Methods included from SQL::ComplexExpressionMethods

#extract, #sql_boolean, #sql_number, #sql_string

Methods included from SQL::OrderMethods

#asc, #desc

Methods inherited from String

#blank?, #camelize, #classify, #constantize, #dasherize, #demodulize, #foreign_key, #humanize, inflections, #pluralize, #singularize, #tableize, #titleize, #to_date, #to_datetime, #to_sequel_time, #to_time, #underscore

Instance Method Details

#inspectObject

Show that the current string is a literal string in addition to the output.



2030
2031
2032
# File 'lib/sequel/sql.rb', line 2030

def inspect
  "#<#{self.class} #{super}>"
end

#lit(*args) ⇒ Object

Return self if no args are given, otherwise return a SQL::PlaceholderLiteralString with the current string and the given args.



2036
2037
2038
# File 'lib/sequel/sql.rb', line 2036

def lit(*args)
  args.empty? ? self : SQL::PlaceholderLiteralString.new(self, args)
end

#to_sequel_blobObject

Convert a literal string to a SQL::Blob.



2041
2042
2043
# File 'lib/sequel/sql.rb', line 2041

def to_sequel_blob
  SQL::Blob.new(self)
end