Derby doesn't support an expression between CASE and WHEN, so remove conditions.
# File lib/sequel/adapters/jdbc/derby.rb, line 195 def case_expression_sql_append(sql, ce) super(sql, ce.with_merged_expression) end
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 202 def cast_sql_append(sql, expr, type) if type == String sql << CAST_STRING_OPEN super sql << PAREN_CLOSE else super end end
# File lib/sequel/adapters/jdbc/derby.rb, line 212 def complex_expression_sql_append(sql, op, args) case op when :% sql << complex_expression_arg_pairs(args){|a, b| "MOD(#{literal(a)}, #{literal(b)})"} when :&, :|, :^, :<<, :>> raise Error, "Derby doesn't support the #{op} operator" when :'B~' sql << BITCOMP_OPEN literal_append(sql, args.at(0)) sql << BITCOMP_CLOSE when :extract sql << args.at(0).to_s << PAREN_OPEN literal_append(sql, args.at(1)) sql << PAREN_CLOSE else super end end
Derby supports GROUP BY ROLLUP (but not CUBE)
# File lib/sequel/adapters/jdbc/derby.rb, line 232 def supports_group_rollup? true end
Derby does not support IS TRUE.
# File lib/sequel/adapters/jdbc/derby.rb, line 237 def supports_is_true? false end
Derby does not support IN/NOT IN with multiple columns
# File lib/sequel/adapters/jdbc/derby.rb, line 242 def supports_multiple_column_in? false end
Handle clobs on Derby as strings.
# File lib/sequel/adapters/jdbc/derby.rb, line 257 def convert_type_proc(v) if v.is_a?(JAVA_SQL_CLOB) DERBY_CLOB_METHOD else super end end
Derby needs the standard workaround to insert all default values into a table with more than one column.
# File lib/sequel/adapters/jdbc/derby.rb, line 272 def insert_supports_empty_values? false end
Derby needs a hex string casted to BLOB for blobs.
# File lib/sequel/adapters/jdbc/derby.rb, line 266 def literal_blob_append(sql, v) sql << BLOB_OPEN << v.unpack(HSTAR).first << BLOB_CLOSE end
Derby uses an expression yielding false for false values. Newer versions can use the FALSE literal, but the latest gem version cannot.
# File lib/sequel/adapters/jdbc/derby.rb, line 278 def literal_false if db.svn_version >= 1040133 BOOL_FALSE else BOOL_FALSE_OLD end end
Derby handles fractional seconds in timestamps, but not in times
# File lib/sequel/adapters/jdbc/derby.rb, line 287 def literal_sqltime(v) v.strftime(TIME_FORMAT) end
Derby uses an expression yielding true for true values. Newer versions can use the TRUE literal, but the latest gem version cannot.
# File lib/sequel/adapters/jdbc/derby.rb, line 293 def literal_true if db.svn_version >= 1040133 BOOL_TRUE else BOOL_TRUE_OLD end end
Derby doesn't support common table expressions.
# File lib/sequel/adapters/jdbc/derby.rb, line 302 def select_clause_methods SELECT_CLAUSE_METHODS end
Use a default FROM table if the dataset does not contain a FROM table.
# File lib/sequel/adapters/jdbc/derby.rb, line 307 def select_from_sql(sql) if @opts[:from] super else sql << DEFAULT_FROM end end
Offset comes before limit in Derby
# File lib/sequel/adapters/jdbc/derby.rb, line 316 def select_limit_sql(sql) if o = @opts[:offset] sql << OFFSET literal_append(sql, o) sql << ROWS end if l = @opts[:limit] sql << FETCH_FIRST literal_append(sql, l) sql << ROWS_ONLY end end