| Class | Sequel::JDBC::Derby::Dataset |
| In: |
lib/sequel/adapters/jdbc/derby.rb
|
| Parent: | JDBC::Dataset |
If the type is String, trim the extra spaces since CHAR is used instead of varchar. This can cause problems if you are casting a char/varchar to a string and the ending whitespace is important.
# File lib/sequel/adapters/jdbc/derby.rb, line 194
194: def cast_sql_append(sql, expr, type)
195: if type == String
196: sql << "RTRIM("
197: super
198: sql << ')'
199: else
200: super
201: end
202: end
# File lib/sequel/adapters/jdbc/derby.rb, line 204
204: def complex_expression_sql_append(sql, op, args)
205: case op
206: when :%, 'B~''B~'
207: complex_expression_emulate_append(sql, op, args)
208: when :&, :|, :^, :<<, :>>
209: raise Error, "Derby doesn't support the #{op} operator"
210: when :**
211: sql << 'exp('
212: literal_append(sql, args[1])
213: sql << ' * ln('
214: literal_append(sql, args[0])
215: sql << "))"
216: when :extract
217: sql << args[0].to_s << '('
218: literal_append(sql, args[1])
219: sql << ')'
220: else
221: super
222: end
223: end