Module: Sequel::SqlAnywhere::DatasetMethods
- Includes:
- Dataset::ColumnsLimit1
- Included in:
- JDBC::SqlAnywhere::Dataset, Dataset
- Defined in:
- lib/sequel/adapters/shared/sqlanywhere.rb
Constant Summary
Constants included from Dataset::ColumnsLimit1
Dataset::ColumnsLimit1::COLUMNS_CLONE_OPTIONS
Instance Method Summary collapse
- #complex_expression_sql_append(sql, op, args) ⇒ Object
-
#constant_sql_append(sql, constant) ⇒ Object
Use today() for CURRENT_DATE and now() for CURRENT_TIMESTAMP and CURRENT_TIME.
-
#convert_smallint_to_bool ⇒ Object
Whether to convert smallint to boolean arguments for this dataset.
-
#cross_apply(table) ⇒ Object
Uses CROSS APPLY to join the given table into the current dataset.
-
#escape_like(string) ⇒ Object
SqlAnywhere uses \ to escape metacharacters, but a ']' should not be escaped.
-
#into(table) ⇒ Object
Specify a table for a SELECT ...
-
#recursive_cte_requires_column_aliases? ⇒ Boolean
SqlAnywhere requires recursive CTEs to have column aliases.
- #supports_cte?(type = :select) ⇒ Boolean
-
#supports_grouping_sets? ⇒ Boolean
SQLAnywhere supports GROUPING SETS.
- #supports_is_true? ⇒ Boolean
- #supports_join_using? ⇒ Boolean
- #supports_multiple_column_in? ⇒ Boolean
- #supports_where_true? ⇒ Boolean
- #supports_window_clause? ⇒ Boolean
- #supports_window_functions? ⇒ Boolean
-
#with_convert_smallint_to_bool(v) ⇒ Object
Return a cloned dataset with the convert_smallint_to_bool option set.
Methods included from Dataset::ColumnsLimit1
Instance Method Details
#complex_expression_sql_append(sql, op, args) ⇒ Object
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 |
# File 'lib/sequel/adapters/shared/sqlanywhere.rb', line 302 def complex_expression_sql_append(sql, op, args) case op when :'||' super(sql, :+, args) when :<<, :>> complex_expression_emulate_append(sql, op, args) when :ILIKE, :"NOT ILIKE" super(sql, (op == :ILIKE ? :LIKE : :"NOT LIKE"), args) when :extract sql << 'datepart(' literal_append(sql, args[0]) sql << ',' literal_append(sql, args[1]) sql << ')' else super end end |
#constant_sql_append(sql, constant) ⇒ Object
Use today() for CURRENT_DATE and now() for CURRENT_TIMESTAMP and CURRENT_TIME
327 328 329 330 331 332 333 334 335 336 |
# File 'lib/sequel/adapters/shared/sqlanywhere.rb', line 327 def constant_sql_append(sql, constant) case constant when :CURRENT_DATE sql << 'today()' when :CURRENT_TIMESTAMP, :CURRENT_TIME sql << 'now()' else super end end |
#convert_smallint_to_bool ⇒ Object
Whether to convert smallint to boolean arguments for this dataset. Defaults to the IBMDB module setting.
250 251 252 |
# File 'lib/sequel/adapters/shared/sqlanywhere.rb', line 250 def convert_smallint_to_bool opts.has_key?(:convert_smallint_to_bool) ? opts[:convert_smallint_to_bool] : db.convert_smallint_to_bool end |
#cross_apply(table) ⇒ Object
Uses CROSS APPLY to join the given table into the current dataset.
293 294 295 |
# File 'lib/sequel/adapters/shared/sqlanywhere.rb', line 293 def cross_apply(table) join_table(:cross_apply, table) end |
#escape_like(string) ⇒ Object
SqlAnywhere uses \ to escape metacharacters, but a ']' should not be escaped
322 323 324 |
# File 'lib/sequel/adapters/shared/sqlanywhere.rb', line 322 def escape_like(string) string.gsub(/[\\%_\[]/){|m| "\\#{m}"} end |
#into(table) ⇒ Object
Specify a table for a SELECT ... INTO query.
339 340 341 |
# File 'lib/sequel/adapters/shared/sqlanywhere.rb', line 339 def into(table) clone(:into => table) end |
#recursive_cte_requires_column_aliases? ⇒ Boolean
SqlAnywhere requires recursive CTEs to have column aliases.
298 299 300 |
# File 'lib/sequel/adapters/shared/sqlanywhere.rb', line 298 def recursive_cte_requires_column_aliases? true end |
#supports_cte?(type = :select) ⇒ Boolean
259 260 261 |
# File 'lib/sequel/adapters/shared/sqlanywhere.rb', line 259 def supports_cte?(type=:select) type == :select end |
#supports_grouping_sets? ⇒ Boolean
SQLAnywhere supports GROUPING SETS
264 265 266 |
# File 'lib/sequel/adapters/shared/sqlanywhere.rb', line 264 def supports_grouping_sets? true end |
#supports_is_true? ⇒ Boolean
276 277 278 |
# File 'lib/sequel/adapters/shared/sqlanywhere.rb', line 276 def supports_is_true? false end |
#supports_join_using? ⇒ Boolean
280 281 282 |
# File 'lib/sequel/adapters/shared/sqlanywhere.rb', line 280 def supports_join_using? false end |
#supports_multiple_column_in? ⇒ Boolean
268 269 270 |
# File 'lib/sequel/adapters/shared/sqlanywhere.rb', line 268 def supports_multiple_column_in? false end |
#supports_where_true? ⇒ Boolean
272 273 274 |
# File 'lib/sequel/adapters/shared/sqlanywhere.rb', line 272 def supports_where_true? false end |
#supports_window_clause? ⇒ Boolean
284 285 286 |
# File 'lib/sequel/adapters/shared/sqlanywhere.rb', line 284 def supports_window_clause? true end |
#supports_window_functions? ⇒ Boolean
288 289 290 |
# File 'lib/sequel/adapters/shared/sqlanywhere.rb', line 288 def supports_window_functions? true end |
#with_convert_smallint_to_bool(v) ⇒ Object
Return a cloned dataset with the convert_smallint_to_bool option set.
255 256 257 |
# File 'lib/sequel/adapters/shared/sqlanywhere.rb', line 255 def with_convert_smallint_to_bool(v) clone(:convert_smallint_to_bool=>v) end |