Class: Linkage::Functions::Length
- Inherits:
-
Linkage::Function
- Object
- Data
- Linkage::Function
- Linkage::Functions::Length
- Defined in:
- lib/linkage/functions/length.rb
Overview
Returns the number of characters in a string.
Constant Summary
Constants inherited from Data
Instance Attribute Summary
Attributes inherited from Linkage::Function
Attributes inherited from Data
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Linkage::Function
#==, [], #collation, #dataset, #dataset=, #initialize, #name, register, #static?
Methods inherited from Data
#collation, #database_type, #initialize, #merge, #static?
Constructor Details
This class inherits a constructor from Linkage::Function
Class Method Details
.function_name ⇒ Object
5 6 7 |
# File 'lib/linkage/functions/length.rb', line 5 def self.function_name "length" end |
.parameters ⇒ Object
9 10 11 |
# File 'lib/linkage/functions/length.rb', line 9 def self.parameters [[String]] end |
Instance Method Details
#ruby_type ⇒ Object
13 14 15 |
# File 'lib/linkage/functions/length.rb', line 13 def ruby_type {:type => Fixnum} end |
#to_expr(options = {}) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/linkage/functions/length.rb', line 17 def to_expr( = {}) expr = case dataset.database_type when :mysql, :postgres :char_length.sql_function(@values[0]) else :length.sql_function(@values[0]) end end |