Module: Sequel::SQL::ComplexExpressionMethods
- Included in:
- Dataset, LiteralString, GenericExpression, Symbol
- Defined in:
- lib/sequel/sql.rb
Overview
Adds methods that allow you to treat an object as an instance of a specific ComplexExpression subclass.
Instance Method Summary collapse
- 
  
    
      #extract(datetime_part)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Extract a datetime part (e.g. year, month) from self:. 
- 
  
    
      #sql_boolean  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Return a BooleanExpression representation of self.
- 
  
    
      #sql_number  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Return a NumericExpression representation of self.
- 
  
    
      #sql_string  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Return a StringExpression representation of self.
Instance Method Details
#extract(datetime_part) ⇒ Object
Extract a datetime part (e.g. year, month) from self:
Sequel[:date].extract(:year) # extract(year FROM "date")
Also has the benefit of returning the result as a NumericExpression instead of a generic ComplexExpression.
| 729 730 731 | # File 'lib/sequel/sql.rb', line 729 def extract(datetime_part) NumericExpression.new(:extract, datetime_part, self) end | 
#sql_boolean ⇒ Object
Return a BooleanExpression representation of self.
| 734 735 736 | # File 'lib/sequel/sql.rb', line 734 def sql_boolean BooleanExpression.new(:NOOP, self) end | 
#sql_number ⇒ Object
| 742 743 744 | # File 'lib/sequel/sql.rb', line 742 def sql_number NumericExpression.new(:NOOP, self) end | 
#sql_string ⇒ Object
| 750 751 752 | # File 'lib/sequel/sql.rb', line 750 def sql_string StringExpression.new(:NOOP, self) end |