Class: Linkage::Functions::Strftime
Constant Summary
Constants inherited
from Data
Data::TYPE_CONVERSION_TREE
Instance Attribute Summary
#args
Attributes inherited from Data
#dataset, #name
Class Method Summary
collapse
Instance Method Summary
collapse
#==, [], #collation, #dataset, #dataset=, #initialize, #name, register, #static?
Methods inherited from Data
#collation, #database_type, #initialize, #merge, #static?
Class Method Details
.function_name ⇒ Object
4
5
6
|
# File 'lib/linkage/functions/strftime.rb', line 4
def self.function_name
"strftime"
end
|
.parameters ⇒ Object
8
9
10
|
# File 'lib/linkage/functions/strftime.rb', line 8
def self.parameters
[[Date, Time, DateTime], [String]]
end
|
Instance Method Details
#ruby_type ⇒ Object
12
13
14
15
|
# File 'lib/linkage/functions/strftime.rb', line 12
def ruby_type
{:type => String}
end
|
#to_expr(options = {}) ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/linkage/functions/strftime.rb', line 17
def to_expr(options = {})
expr =
case dataset.database_type
when :mysql
:date_format.sql_function(*@values)
when :sqlite
:strftime.sql_function(@values[1], @values[0])
when :postgres
:to_char.sql_function(*@values)
else
:strftime.sql_function(@values[0], @values[1])
end
end
|