Module: Imparcial::Driver::AbstractUtil
- Included in:
- AbstractAdapter, Row
- Defined in:
- lib/imparcial/driver/abstract/util.rb
Instance Method Summary collapse
-
#quote(val) ⇒ Object
Description Apply default database quoting system.
-
#quote_value(val) ⇒ Object
Description Apply default database value quoting system.
-
#unquote_value(val) ⇒ Object
Description Apply default database value unquoting system.
Instance Method Details
#quote(val) ⇒ Object
Description
Apply default database quoting system.
45 46 47 48 49 |
# File 'lib/imparcial/driver/abstract/util.rb', line 45 def quote ( val ) raise FeatureNotFound end |
#quote_value(val) ⇒ Object
Description
Apply default database value quoting system.
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/imparcial/driver/abstract/util.rb', line 8 def quote_value ( val ) if val.class == String || val.class == Symbol "\"#{val}\"" else val.to_s end end |
#unquote_value(val) ⇒ Object
Description
Apply default database value unquoting system.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/imparcial/driver/abstract/util.rb', line 25 def unquote_value ( val ) return nil if val == nil return 0 if val == '0' if val.match(/[0-9]\.[0-9]*/) val.to_f else val.to_i == 0 ? val : val.to_i end end |