Module Sequel::DB2::DatasetMethods
In: lib/sequel/adapters/shared/db2.rb

Methods

Included Modules

EmulateOffsetWithRowNumber

Constants

PAREN_CLOSE = Dataset::PAREN_CLOSE
PAREN_OPEN = Dataset::PAREN_OPEN
BITWISE_METHOD_MAP = {:& =>:BITAND, :| => :BITOR, :^ => :BITXOR, :'B~'=>:BITNOT}
EMULATED_FUNCTION_MAP = {:char_length=>'length'.freeze}
BOOL_TRUE = '1'.freeze
BOOL_FALSE = '0'.freeze
CAST_STRING_OPEN = "RTRIM(CHAR(".freeze
CAST_STRING_CLOSE = "))".freeze
FETCH_FIRST_ROW_ONLY = " FETCH FIRST ROW ONLY".freeze
FETCH_FIRST = " FETCH FIRST ".freeze
ROWS_ONLY = " ROWS ONLY".freeze
EMPTY_FROM_TABLE = ' FROM "SYSIBM"."SYSDUMMY1"'.freeze
HSTAR = "H*".freeze
BLOB_OPEN = "BLOB(X'".freeze
BLOB_CLOSE = "')".freeze

Public Instance methods

DB2 casts strings using RTRIM and CHAR instead of VARCHAR.

[Source]

     # File lib/sequel/adapters/shared/db2.rb, line 247
247:       def cast_sql_append(sql, expr, type)
248:         if(type == String)
249:           sql << CAST_STRING_OPEN
250:           literal_append(sql, expr)
251:           sql << CAST_STRING_CLOSE
252:         else
253:           super
254:         end
255:       end

[Source]

     # File lib/sequel/adapters/shared/db2.rb, line 257
257:       def complex_expression_sql_append(sql, op, args)
258:         case op
259:         when :&, :|, :^
260:           # works with db2 v9.5 and after
261:           op = BITWISE_METHOD_MAP[op]
262:           sql << complex_expression_arg_pairs(args){|a, b| literal(SQL::Function.new(op, a, b))}
263:         when :<<
264:           sql << complex_expression_arg_pairs(args){|a, b| "(#{literal(a)} * POWER(2, #{literal(b)}))"}
265:         when :>>
266:           sql << complex_expression_arg_pairs(args){|a, b| "(#{literal(a)} / POWER(2, #{literal(b)}))"}
267:         when :%
268:           sql << complex_expression_arg_pairs(args){|a, b| "MOD(#{literal(a)}, #{literal(b)})"}
269:         when 'B~''B~'
270:           literal_append(sql, SQL::Function.new(:BITNOT, *args))
271:         when :extract
272:           sql << args.at(0).to_s
273:           sql << PAREN_OPEN
274:           literal_append(sql, args.at(1))
275:           sql << PAREN_CLOSE
276:         else
277:           super
278:         end
279:       end

DB2 supports GROUP BY CUBE

[Source]

     # File lib/sequel/adapters/shared/db2.rb, line 282
282:       def supports_group_cube?
283:         true
284:       end

DB2 supports GROUP BY ROLLUP

[Source]

     # File lib/sequel/adapters/shared/db2.rb, line 287
287:       def supports_group_rollup?
288:         true
289:       end

DB2 does not support IS TRUE.

[Source]

     # File lib/sequel/adapters/shared/db2.rb, line 292
292:       def supports_is_true?
293:         false
294:       end

DB2 does not support multiple columns in IN.

[Source]

     # File lib/sequel/adapters/shared/db2.rb, line 297
297:       def supports_multiple_column_in?
298:         false
299:       end

DB2 only allows * in SELECT if it is the only thing being selected.

[Source]

     # File lib/sequel/adapters/shared/db2.rb, line 302
302:       def supports_select_all_and_column?
303:         false
304:       end

DB2 does not support fractional seconds in timestamps.

[Source]

     # File lib/sequel/adapters/shared/db2.rb, line 307
307:       def supports_timestamp_usecs?
308:         false
309:       end

DB2 does not support WHERE 1.

[Source]

     # File lib/sequel/adapters/shared/db2.rb, line 317
317:       def supports_where_true?
318:         false
319:       end

DB2 supports window functions

[Source]

     # File lib/sequel/adapters/shared/db2.rb, line 312
312:       def supports_window_functions?
313:         true
314:       end

[Validate]