| Class | Sequel::JDBC::Derby::Dataset |
| In: |
lib/sequel/adapters/jdbc/derby.rb
|
| Parent: | JDBC::Dataset |
| PAREN_CLOSE | = | Dataset::PAREN_CLOSE |
| PAREN_OPEN | = | Dataset::PAREN_OPEN |
| OFFSET | = | Dataset::OFFSET |
| CAST_STRING_OPEN | = | "RTRIM(".freeze |
| BITCOMP_OPEN | = | "((0 - ".freeze |
| BITCOMP_CLOSE | = | ") - 1)".freeze |
| BLOB_OPEN | = | "CAST(X'".freeze |
| BLOB_CLOSE | = | "' AS BLOB)".freeze |
| HSTAR | = | "H*".freeze |
| TIME_FORMAT | = | "'%H:%M:%S'".freeze |
| DEFAULT_FROM | = | " FROM sysibm.sysdummy1".freeze |
| ROWS | = | " ROWS".freeze |
| FETCH_FIRST | = | " FETCH FIRST ".freeze |
| ROWS_ONLY | = | " ROWS ONLY".freeze |
| BOOL_TRUE_OLD | = | '(1 = 1)'.freeze |
| BOOL_FALSE_OLD | = | '(1 = 0)'.freeze |
| BOOL_TRUE | = | 'TRUE'.freeze |
| BOOL_FALSE | = | 'FALSE'.freeze |
| SELECT_CLAUSE_METHODS | = | clause_methods(:select, %w'select distinct columns from join where group having compounds order limit lock') |
| EMULATED_FUNCTION_MAP | = | {:char_length=>'length'.freeze} |
| JAVA_SQL_CLOB | = | Java::JavaSQL::Clob |
| DERBY_CLOB_METHOD | = | TYPE_TRANSLATOR_INSTANCE.method(:derby_clob) |
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 203
203: def cast_sql_append(sql, expr, type)
204: if type == String
205: sql << CAST_STRING_OPEN
206: super
207: sql << PAREN_CLOSE
208: else
209: super
210: end
211: end
# File lib/sequel/adapters/jdbc/derby.rb, line 213
213: def complex_expression_sql_append(sql, op, args)
214: case op
215: when :%
216: sql << complex_expression_arg_pairs(args){|a, b| "MOD(#{literal(a)}, #{literal(b)})"}
217: when :&, :|, :^, :<<, :>>
218: raise Error, "Derby doesn't support the #{op} operator"
219: when 'B~''B~'
220: sql << BITCOMP_OPEN
221: literal_append(sql, args.at(0))
222: sql << BITCOMP_CLOSE
223: when :extract
224: sql << args.at(0).to_s << PAREN_OPEN
225: literal_append(sql, args.at(1))
226: sql << PAREN_CLOSE
227: else
228: super
229: end
230: end