Class | Sequel::JDBC::Derby::Dataset
In: | lib/sequel/adapters/jdbc/derby.rb
Parent: | JDBC::Dataset

Dataset class for Derby datasets accessed via JDBC.

### Methods

case_expression_sql_append cast_sql_append complex_expression_sql_append supports_group_rollup? supports_is_true? supports_multiple_column_in?

### Constants

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')
JAVA_SQL_CLOB | = | Java::JavaSQL::Clob
DERBY_CLOB_METHOD | = | TYPE_TRANSLATOR_INSTANCE.method(:derby_clob)

### Public Instance methods

case_expression_sql_append(sql, ce)

Derby doesn‘t support an expression between CASE and WHEN, so emulate it by using an equality statement for all of the conditions.

[Source]

         # File lib/sequel/adapters/jdbc/derby.rb, line 178
    178:         def case_expression_sql_append(sql, ce)
    179:           if ce.expression?
    180:             e = ce.expression
    181:             case_expression_sql_append(sql, ::Sequel::SQL::CaseExpression.new(ce.conditions.map{|c, r| [::Sequel::SQL::BooleanExpression.new('=''=', e, c), r]}, ce.default))
    182:           else
    183:             super
    184:           end
    185:         end

cast_sql_append(sql, expr, type)

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.

[Source]

         # File lib/sequel/adapters/jdbc/derby.rb, line 190
    190:         def cast_sql_append(sql, expr, type)
    191:           if type == String
    192:             sql << CAST_STRING_OPEN
    193:             super
    194:             sql << PAREN_CLOSE
    195:           else
    196:             super
    197:           end
    198:         end

complex_expression_sql_append(sql, op, args)

Handle Derby specific LIKE, extract, and some bitwise compliment support.

[Source]

         # File lib/sequel/adapters/jdbc/derby.rb, line 201
    201:         def complex_expression_sql_append(sql, op, args)
    202:           case op
    203:           when :ILIKE
    204:             super(sql, :LIKE, [SQL::Function.new(:upper, args.at(0)), SQL::Function.new(:upper, args.at(1))])
    205:           when "NOT ILIKE""NOT ILIKE"
    206:             super(sql, "NOT LIKE""NOT LIKE", [SQL::Function.new(:upper, args.at(0)), SQL::Function.new(:upper, args.at(1))])
    207:           when :%
    208:             sql << complex_expression_arg_pairs(args){|a, b| "MOD(#{literal(a)}, #{literal(b)})"}
    209:           when :&, :|, :^, :<<, :>>
    210:             raise Error, "Derby doesn't support the #{op} operator"
    211:           when 'B~''B~'
    212:             sql << BITCOMP_OPEN
    213:             literal_append(sql, args.at(0))
    214:             sql << BITCOMP_CLOSE
    215:           when :extract
    216:             sql << args.at(0).to_s << PAREN_OPEN
    217:             literal_append(sql, args.at(1))
    218:             sql << PAREN_CLOSE
    219:           else
    220:             super
    221:           end
    222:         end

supports_group_rollup?()

Derby supports GROUP BY ROLLUP (but not CUBE)

[Source]

         # File lib/sequel/adapters/jdbc/derby.rb, line 225
    225:         def supports_group_rollup?
    226:           true
    227:         end

supports_is_true?()

Derby does not support IS TRUE.

[Source]

         # File lib/sequel/adapters/jdbc/derby.rb, line 230
    230:         def supports_is_true?
    231:           false
    232:         end

supports_multiple_column_in?()

Derby does not support IN/NOT IN with multiple columns

[Source]

         # File lib/sequel/adapters/jdbc/derby.rb, line 235
    235:         def supports_multiple_column_in?
    236:           false
    237:         end

[Validate]