Module: Sequel::DB2::DatasetMethods
- Includes:
- EmulateOffsetWithRowNumber
- Included in:
- IBMDB::Dataset
- Defined in:
- lib/sequel/adapters/shared/db2.rb
Constant Summary collapse
- BITWISE_METHOD_MAP =
{:& =>:BITAND, :| => :BITOR, :^ => :BITXOR, :'B~'=>:BITNOT}.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_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.
280 281 282 283 284 285 286 287 288 |
# File 'lib/sequel/adapters/shared/db2.rb', line 280 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
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
# File 'lib/sequel/adapters/shared/db2.rb', line 290 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
306 307 308 |
# File 'lib/sequel/adapters/shared/db2.rb', line 306 def quote_identifiers? @opts.fetch(:quote_identifiers, false) end |
#supports_cte?(type = :select) ⇒ Boolean
310 311 312 |
# File 'lib/sequel/adapters/shared/db2.rb', line 310 def supports_cte?(type=:select) type == :select end |
#supports_group_cube? ⇒ Boolean
DB2 supports GROUP BY CUBE
315 316 317 |
# File 'lib/sequel/adapters/shared/db2.rb', line 315 def supports_group_cube? true end |
#supports_group_rollup? ⇒ Boolean
DB2 supports GROUP BY ROLLUP
320 321 322 |
# File 'lib/sequel/adapters/shared/db2.rb', line 320 def supports_group_rollup? true end |
#supports_grouping_sets? ⇒ Boolean
DB2 supports GROUPING SETS
325 326 327 |
# File 'lib/sequel/adapters/shared/db2.rb', line 325 def supports_grouping_sets? true end |
#supports_is_true? ⇒ Boolean
DB2 does not support IS TRUE.
330 331 332 |
# File 'lib/sequel/adapters/shared/db2.rb', line 330 def supports_is_true? false end |
#supports_lateral_subqueries? ⇒ Boolean
DB2 supports lateral subqueries
335 336 337 |
# File 'lib/sequel/adapters/shared/db2.rb', line 335 def supports_lateral_subqueries? true end |
#supports_multiple_column_in? ⇒ Boolean
DB2 does not support multiple columns in IN.
340 341 342 |
# File 'lib/sequel/adapters/shared/db2.rb', line 340 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.
345 346 347 |
# File 'lib/sequel/adapters/shared/db2.rb', line 345 def supports_select_all_and_column? false end |
#supports_where_true? ⇒ Boolean
DB2 does not support WHERE 1.
355 356 357 |
# File 'lib/sequel/adapters/shared/db2.rb', line 355 def supports_where_true? false end |
#supports_window_functions? ⇒ Boolean
DB2 supports window functions
350 351 352 |
# File 'lib/sequel/adapters/shared/db2.rb', line 350 def supports_window_functions? true end |