Class: Symbol

Inherits:
Object show all
Includes:
Sequel::SQL::GenericExpressionMethods, Sequel::SQL::QualifyingMethods
Defined in:
lib/sequel_core/core_sql.rb

Instance Method Summary collapse

Methods included from Sequel::SQL::ComplexExpressionMethods

#extract, #sql_boolean, #sql_number, #sql_string

Methods included from Sequel::SQL::StringMethods

#ilike, #like

Methods included from Sequel::SQL::BooleanMethods

#~

Methods included from Sequel::SQL::OrderMethods

#asc, #desc

Methods included from Sequel::SQL::CastMethods

#cast, #cast_numeric, #cast_string

Methods included from Sequel::SQL::AliasMethods

#as

Methods included from Sequel::SQL::QualifyingMethods

#qualify

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.



152
153
154
155
# File 'lib/sequel_core/core_sql.rb', line 152

def *(ce=(arg=false;nil))
  return super(ce) unless arg == false
  Sequel::SQL::ColumnAll.new(self);
end

#[](*args) ⇒ Object

Returns a Sequel::SQL::Function with this as the function name, and the given arguments.



159
160
161
# File 'lib/sequel_core/core_sql.rb', line 159

def [](*args)
  Sequel::SQL::Function.new(self, *args)
end

#to_column_ref(ds) ⇒ Object

Delegate the creation of the resulting SQL to the given dataset, since it may be database dependent.



174
175
176
# File 'lib/sequel_core/core_sql.rb', line 174

def to_column_ref(ds)
  ds.symbol_to_column_ref(self)
end

#|(sub) ⇒ Object

If the given argument is an Integer or an array containing an Integer, returns a Sequel::SQL::Subscript with this column and the given arg. Otherwise returns a Sequel::SQL::BooleanExpression where this column (which should be boolean) or the given argument is true.



167
168
169
170
# File 'lib/sequel_core/core_sql.rb', line 167

def |(sub)
  return super unless (Integer === sub) || ((Array === sub) && sub.any?{|x| Integer === x})
  Sequel::SQL::Subscript.new(self, Array(sub))
end