Module: Sequel::DB2::DatasetMethods
- Includes:
- EmulateOffsetWithRowNumber
- Included in:
- IBMDB::Dataset, JDBC::DB2::Dataset
- Defined in:
- lib/sequel/adapters/shared/db2.rb
Constant Summary collapse
- BITWISE_METHOD_MAP =
.freeze # SEQUEL5
{:& =>:BITAND, :| => :BITOR, :^ => :BITXOR, :'B~'=>:BITNOT}
- PAREN_CLOSE =
')'.freeze
- PAREN_OPEN =
'('.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
- EMULATED_FUNCTION_MAP =
{:char_length=>'length'.freeze}
Instance Method Summary collapse
-
#cast_sql_append(sql, expr, type) ⇒ Object
DB2 casts strings using RTRIM and CHAR instead of VARCHAR.
- #complex_expression_sql_append(sql, op, args) ⇒ Object
- #quote_identifiers? ⇒ Boolean
- #supports_cte?(type = :select) ⇒ Boolean
-
#supports_group_cube? ⇒ Boolean
DB2 supports GROUP BY CUBE.
-
#supports_group_rollup? ⇒ Boolean
DB2 supports GROUP BY ROLLUP.
-
#supports_grouping_sets? ⇒ Boolean
DB2 supports GROUPING SETS.
-
#supports_is_true? ⇒ Boolean
DB2 does not support IS TRUE.
-
#supports_lateral_subqueries? ⇒ Boolean
DB2 supports lateral subqueries.
-
#supports_multiple_column_in? ⇒ Boolean
DB2 does not support multiple columns in IN.
-
#supports_select_all_and_column? ⇒ Boolean
DB2 only allows * in SELECT if it is the only thing being selected.
-
#supports_timestamp_usecs? ⇒ Boolean
DB2 does not support fractional seconds in timestamps.
-
#supports_where_true? ⇒ Boolean
DB2 does not support WHERE 1.
-
#supports_window_functions? ⇒ Boolean
DB2 supports window functions.
Methods included from EmulateOffsetWithRowNumber
#empty?, #select_sql, #supports_offsets_in_correlated_subqueries?
Instance Method Details
#cast_sql_append(sql, expr, type) ⇒ Object
DB2 casts strings using RTRIM and CHAR instead of VARCHAR.
321 322 323 324 325 326 327 328 329 |
# File 'lib/sequel/adapters/shared/db2.rb', line 321 def cast_sql_append(sql, expr, type) if(type == String) sql << "RTRIM(CHAR(" literal_append(sql, expr) sql << "))" else super end end |
#complex_expression_sql_append(sql, op, args) ⇒ Object
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 |
# File 'lib/sequel/adapters/shared/db2.rb', line 331 def complex_expression_sql_append(sql, op, args) case op when :&, :|, :^, :%, :<<, :>> complex_expression_emulate_append(sql, op, args) when :'B~' literal_append(sql, SQL::Function.new(:BITNOT, *args)) when :extract sql << args[0].to_s sql << '(' literal_append(sql, args[1]) sql << ')' else super end end |
#quote_identifiers? ⇒ Boolean
347 348 349 |
# File 'lib/sequel/adapters/shared/db2.rb', line 347 def quote_identifiers? @opts.fetch(:quote_identifiers, false) end |
#supports_cte?(type = :select) ⇒ Boolean
351 352 353 |
# File 'lib/sequel/adapters/shared/db2.rb', line 351 def supports_cte?(type=:select) type == :select end |
#supports_group_cube? ⇒ Boolean
DB2 supports GROUP BY CUBE
356 357 358 |
# File 'lib/sequel/adapters/shared/db2.rb', line 356 def supports_group_cube? true end |
#supports_group_rollup? ⇒ Boolean
DB2 supports GROUP BY ROLLUP
361 362 363 |
# File 'lib/sequel/adapters/shared/db2.rb', line 361 def supports_group_rollup? true end |
#supports_grouping_sets? ⇒ Boolean
DB2 supports GROUPING SETS
366 367 368 |
# File 'lib/sequel/adapters/shared/db2.rb', line 366 def supports_grouping_sets? true end |
#supports_is_true? ⇒ Boolean
DB2 does not support IS TRUE.
371 372 373 |
# File 'lib/sequel/adapters/shared/db2.rb', line 371 def supports_is_true? false end |
#supports_lateral_subqueries? ⇒ Boolean
DB2 supports lateral subqueries
376 377 378 |
# File 'lib/sequel/adapters/shared/db2.rb', line 376 def supports_lateral_subqueries? true end |
#supports_multiple_column_in? ⇒ Boolean
DB2 does not support multiple columns in IN.
381 382 383 |
# File 'lib/sequel/adapters/shared/db2.rb', line 381 def supports_multiple_column_in? false end |
#supports_select_all_and_column? ⇒ Boolean
DB2 only allows * in SELECT if it is the only thing being selected.
386 387 388 |
# File 'lib/sequel/adapters/shared/db2.rb', line 386 def supports_select_all_and_column? false end |
#supports_timestamp_usecs? ⇒ Boolean
DB2 does not support fractional seconds in timestamps.
391 392 393 |
# File 'lib/sequel/adapters/shared/db2.rb', line 391 def false end |
#supports_where_true? ⇒ Boolean
DB2 does not support WHERE 1.
401 402 403 |
# File 'lib/sequel/adapters/shared/db2.rb', line 401 def supports_where_true? false end |
#supports_window_functions? ⇒ Boolean
DB2 supports window functions
396 397 398 |
# File 'lib/sequel/adapters/shared/db2.rb', line 396 def supports_window_functions? true end |