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

Dataset class for Derby datasets accessed via JDBC.

Methods

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 = '(1 = 1)'.freeze
BOOL_FALSE = '(1 = 0)'.freeze
SELECT_CLAUSE_METHODS = clause_methods(:select, %w'select distinct columns from join where group having compounds order limit lock')

Public Instance methods

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 128
128:         def case_expression_sql_append(sql, ce)
129:           if ce.expression?
130:             e = ce.expression
131:             case_expression_sql_append(sql, ::Sequel::SQL::CaseExpression.new(ce.conditions.map{|c, r| [::Sequel::SQL::BooleanExpression.new('=''=', e, c), r]}, ce.default))
132:           else
133:             super
134:           end
135:         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.

[Source]

     # File lib/sequel/adapters/jdbc/derby.rb, line 140
140:         def cast_sql_append(sql, expr, type)
141:           if type == String
142:             sql << CAST_STRING_OPEN
143:             super
144:             sql << PAREN_CLOSE
145:           else
146:             super
147:           end
148:         end

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

[Source]

     # File lib/sequel/adapters/jdbc/derby.rb, line 151
151:         def complex_expression_sql_append(sql, op, args)
152:           case op
153:           when :ILIKE
154:             super(sql, :LIKE, [SQL::Function.new(:upper, args.at(0)), SQL::Function.new(:upper, args.at(1))])
155:           when "NOT ILIKE""NOT ILIKE"
156:             super(sql, "NOT LIKE""NOT LIKE", [SQL::Function.new(:upper, args.at(0)), SQL::Function.new(:upper, args.at(1))])
157:           when :&, :|, :^, :<<, :>>
158:             raise Error, "Derby doesn't support the #{op} operator"
159:           when 'B~''B~'
160:             sql << BITCOMP_OPEN
161:             literal_append(sql, args.at(0))
162:             sql << BITCOMP_CLOSE
163:           when :extract
164:             sql << args.at(0).to_s << PAREN_OPEN
165:             literal_append(sql, args.at(1))
166:             sql << PAREN_CLOSE
167:           else
168:             super
169:           end
170:         end

Derby supports GROUP BY ROLLUP (but not CUBE)

[Source]

     # File lib/sequel/adapters/jdbc/derby.rb, line 173
173:         def supports_group_rollup?
174:           true
175:         end

Derby does not support IS TRUE.

[Source]

     # File lib/sequel/adapters/jdbc/derby.rb, line 178
178:         def supports_is_true?
179:           false
180:         end

Derby does not support IN/NOT IN with multiple columns

[Source]

     # File lib/sequel/adapters/jdbc/derby.rb, line 183
183:         def supports_multiple_column_in?
184:           false
185:         end

[Validate]