JDBC::Dataset
Derby doesn’t support an expression between CASE and WHEN, so emulate it by using an equality statement for all of the conditions.
# File lib/sequel/adapters/jdbc/derby.rb, line 166 166: def case_expression_sql_append(sql, ce) 167: if ce.expression? 168: e = ce.expression 169: case_expression_sql_append(sql, ::Sequel::SQL::CaseExpression.new(ce.conditions.map{|c, r| [::Sequel::SQL::BooleanExpression.new(:'=', e, c), r]}, ce.default)) 170: else 171: super 172: end 173: 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 178 178: def cast_sql_append(sql, expr, type) 179: if type == String 180: sql << CAST_STRING_OPEN 181: super 182: sql << PAREN_CLOSE 183: else 184: super 185: end 186: end
Handle Derby specific LIKE, extract, and some bitwise compliment support.
# File lib/sequel/adapters/jdbc/derby.rb, line 189 189: def complex_expression_sql_append(sql, op, args) 190: case op 191: when :ILIKE 192: super(sql, :LIKE, [SQL::Function.new(:upper, args.at(0)), SQL::Function.new(:upper, args.at(1))]) 193: when :"NOT ILIKE" 194: super(sql, :"NOT LIKE", [SQL::Function.new(:upper, args.at(0)), SQL::Function.new(:upper, args.at(1))]) 195: when :% 196: sql << complex_expression_arg_pairs(args){|a, b| "MOD(#{literal(a)}, #{literal(b)})"} 197: when :&, :|, :^, :<<, :>> 198: raise Error, "Derby doesn't support the #{op} operator" 199: when :'B~' 200: sql << BITCOMP_OPEN 201: literal_append(sql, args.at(0)) 202: sql << BITCOMP_CLOSE 203: when :extract 204: sql << args.at(0).to_s << PAREN_OPEN 205: literal_append(sql, args.at(1)) 206: sql << PAREN_CLOSE 207: else 208: super 209: end 210: end
Derby supports GROUP BY ROLLUP (but not CUBE)
# File lib/sequel/adapters/jdbc/derby.rb, line 213 213: def supports_group_rollup? 214: true 215: end
Derby does not support IS TRUE.
# File lib/sequel/adapters/jdbc/derby.rb, line 218 218: def supports_is_true? 219: false 220: end
Derby does not support IN/NOT IN with multiple columns
# File lib/sequel/adapters/jdbc/derby.rb, line 223 223: def supports_multiple_column_in? 224: false 225: 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 236 236: def insert_supports_empty_values? 237: false 238: end
Derby needs a hex string casted to BLOB for blobs.
# File lib/sequel/adapters/jdbc/derby.rb, line 230 230: def literal_blob_append(sql, v) 231: sql << BLOB_OPEN << v.unpack(HSTAR).first << BLOB_CLOSE 232: 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 242 242: def literal_false 243: BOOL_FALSE 244: end
Derby handles fractional seconds in timestamps, but not in times
# File lib/sequel/adapters/jdbc/derby.rb, line 247 247: def literal_sqltime(v) 248: v.strftime(TIME_FORMAT) 249: 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 253 253: def literal_true 254: BOOL_TRUE 255: end
Derby doesn’t support common table expressions.
# File lib/sequel/adapters/jdbc/derby.rb, line 258 258: def select_clause_methods 259: SELECT_CLAUSE_METHODS 260: end
Use a default FROM table if the dataset does not contain a FROM table.
# File lib/sequel/adapters/jdbc/derby.rb, line 263 263: def select_from_sql(sql) 264: if @opts[:from] 265: super 266: else 267: sql << DEFAULT_FROM 268: end 269: end
Offset comes before limit in Derby
# File lib/sequel/adapters/jdbc/derby.rb, line 272 272: def select_limit_sql(sql) 273: if o = @opts[:offset] 274: sql << OFFSET 275: literal_append(sql, o) 276: sql << ROWS 277: end 278: if l = @opts[:limit] 279: sql << FETCH_FIRST 280: literal_append(sql, l) 281: sql << ROWS_ONLY 282: end 283: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.