Class: Babik::Selection::Operation::Time
- Inherits:
-
DateOperation
- Object
- Base
- DateOperation
- Babik::Selection::Operation::Time
- Defined in:
- lib/babik/queryset/lib/selection/operation/date.rb
Overview
Time date operation
Constant Summary
Constants inherited from DateOperation
Constants included from ValidDBMS
ValidDBMS::SUPPORTED_DB_ADAPTERS
Instance Attribute Summary
Attributes inherited from Base
#field, #sql_operation, #sql_operation_template, #value
Instance Method Summary collapse
Methods inherited from DateOperation
Methods included from ValidDBMS
Methods inherited from Base
#_init_sql_operation, date_special_cases, #db_engine, escape, factory, #initialize, initialize_operation, initialize_operators, operator?, special_cases, #to_s
Constructor Details
This class inherits a constructor from Babik::Selection::Operation::DateOperation
Instance Method Details
#sql_function ⇒ Object
167 168 169 170 171 172 173 |
# File 'lib/babik/queryset/lib/selection/operation/date.rb', line 167 def sql_function dbms_adapter = db_engine return 'DATE_FORMAT(#field, \'%H:%i:%s\')' if dbms_adapter == 'mysql2' return 'date_trunc(\'second\', #field::time)' if dbms_adapter == 'postgresql' return 'strftime(\'%H:%M:%S\', #field)' if dbms_adapter == 'sqlite3' raise NotImplementedError, "#{self.class} lookup not implemented for #{dbms_adapter}" end |