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
- Defined in:
- lib/sequel_core/core_sql.rb
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.
-
#to_column_ref(ds) ⇒ Object
Delegate the creation of the resulting SQL to the given dataset, since it may be database dependent.
-
#|(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.
Methods included from Sequel::SQL::ComplexExpressionMethods
#extract, #sql_boolean, #sql_number, #sql_string
Methods included from Sequel::SQL::StringMethods
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.
178 179 180 181 |
# File 'lib/sequel_core/core_sql.rb', line 178 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 ruby 1.9 is not being used. ruby 1.9 includes Symbol#[], and Sequel doesn’t override methods defined by ruby itself.
187 188 189 |
# File 'lib/sequel_core/core_sql.rb', line 187 def sql_function(*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.
203 204 205 |
# File 'lib/sequel_core/core_sql.rb', line 203 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.
196 197 198 199 |
# File 'lib/sequel_core/core_sql.rb', line 196 def |(sub) return super unless (Integer === sub) || ((Array === sub) && sub.any?{|x| Integer === x}) Sequel::SQL::Subscript.new(self, Array(sub)) end |