Class: Symbol
- Includes:
- Sequel::SQL::AliasMethods, Sequel::SQL::BooleanMethods, Sequel::SQL::CastMethods, Sequel::SQL::ComplexExpressionMethods, Sequel::SQL::IdentifierMethods, Sequel::SQL::InequalityMethods, Sequel::SQL::NumericMethods, Sequel::SQL::OrderMethods, Sequel::SQL::QualifyingMethods, Sequel::SQL::StringMethods, Sequel::SQL::SubscriptMethods
- Defined in:
- lib/sequel/core_sql.rb
Overview
Sequel extends Symbol
to add methods to implement the SQL DSL.
Instance Method Summary collapse
-
#*(ce = (arg=false;nil)) ⇒ Object
If no argument is given, returns a
Sequel::SQL::ColumnAll
object specifying all columns for this table. -
#sql_function(*args) ⇒ Object
(also: #[])
Returns a
Sequel::SQL::Function
with this as the function name, and the given arguments.
Methods included from Sequel::SQL::ComplexExpressionMethods
#extract, #sql_boolean, #sql_number, #sql_string
Methods included from Sequel::SQL::SubscriptMethods
Methods included from Sequel::SQL::StringMethods
Methods included from Sequel::SQL::NumericMethods
Methods included from Sequel::SQL::BooleanMethods
Methods included from Sequel::SQL::OrderMethods
Methods included from Sequel::SQL::CastMethods
#cast, #cast_numeric, #cast_string
Methods included from Sequel::SQL::AliasMethods
Methods included from Sequel::SQL::IdentifierMethods
Methods included from Sequel::SQL::QualifyingMethods
Instance Method Details
#*(ce = (arg=false;nil)) ⇒ Object
If no argument is given, returns a Sequel::SQL::ColumnAll
object specifying all columns for this table. If an argument is given, returns a Sequel::SQL::NumericExpression
using the * (multiplication) operator with this and the given argument.
:table.* # SQL: table.*
:column * 2 # SQL: column * 2
233 234 235 236 |
# File 'lib/sequel/core_sql.rb', line 233 def *(ce=(arg=false;nil)) return super(ce) unless arg == false Sequel::SQL::ColumnAll.new(self); end |
#sql_function(*args) ⇒ Object Also known as: []
Returns a Sequel::SQL::Function
with this as the function name, and the given arguments. This is aliased as Symbol#[]
if the RUBY_VERSION is less than 1.9.0. Ruby 1.9 defines Symbol#[]
, and Sequel doesn’t override methods defined by ruby itself.
:now.sql_function # SQL: now()
:sum.sql_function(:a) # SQL: sum(a)
:concat.sql_function(:a, :b) # SQL: concat(a, b)
246 247 248 |
# File 'lib/sequel/core_sql.rb', line 246 def sql_function(*args) Sequel::SQL::Function.new(self, *args) end |