Methods
Public Instance
- complex_expression_sql_append
- constant_sql_append
- convert_smallint_to_bool
- cross_apply
- escape_like
- into
- recursive_cte_requires_column_aliases?
- supports_cte?
- supports_grouping_sets?
- supports_is_true?
- supports_join_using?
- supports_multiple_column_in?
- supports_where_true?
- supports_window_clause?
- supports_window_functions?
- with_convert_smallint_to_bool
Included modules
Public Instance methods
complex_expression_sql_append(sql, op, args)
[show source]
# File lib/sequel/adapters/shared/sqlanywhere.rb 302 def complex_expression_sql_append(sql, op, args) 303 case op 304 when :'||' 305 super(sql, :+, args) 306 when :<<, :>> 307 complex_expression_emulate_append(sql, op, args) 308 when :LIKE, :"NOT LIKE" 309 sql << '(' 310 literal_append(sql, args[0]) 311 sql << (op == :LIKE ? ' REGEXP ' : ' NOT REGEXP ') 312 pattern = String.new 313 last_c = '' 314 args[1].each_char do |c| 315 if c == '_' and not pattern.end_with?('\\') and last_c != '\\' 316 pattern << '.' 317 elsif c == '%' and not pattern.end_with?('\\') and last_c != '\\' 318 pattern << '.*' 319 elsif c == '[' and not pattern.end_with?('\\') and last_c != '\\' 320 pattern << '\[' 321 elsif c == ']' and not pattern.end_with?('\\') and last_c != '\\' 322 pattern << '\]' 323 elsif c == '*' and not pattern.end_with?('\\') and last_c != '\\' 324 pattern << '\*' 325 elsif c == '?' and not pattern.end_with?('\\') and last_c != '\\' 326 pattern << '\?' 327 else 328 pattern << c 329 end 330 if c == '\\' and last_c == '\\' 331 last_c = '' 332 else 333 last_c = c 334 end 335 end 336 literal_append(sql, pattern) 337 sql << " ESCAPE " 338 literal_append(sql, "\\") 339 sql << ')' 340 when :ILIKE, :"NOT ILIKE" 341 super(sql, (op == :ILIKE ? :LIKE : :"NOT LIKE"), args) 342 when :extract 343 sql << 'datepart(' 344 literal_append(sql, args[0]) 345 sql << ',' 346 literal_append(sql, args[1]) 347 sql << ')' 348 else 349 super 350 end 351 end
constant_sql_append(sql, constant)
Use today() for CURRENT_DATE and now() for CURRENT_TIMESTAMP and CURRENT_TIME
[show source]
# File lib/sequel/adapters/shared/sqlanywhere.rb 359 def constant_sql_append(sql, constant) 360 case constant 361 when :CURRENT_DATE 362 sql << 'today()' 363 when :CURRENT_TIMESTAMP, :CURRENT_TIME 364 sql << 'now()' 365 else 366 super 367 end 368 end
convert_smallint_to_bool()
Whether to convert smallint to boolean arguments for this dataset. Defaults to the IBMDB
module setting.
[show source]
# File lib/sequel/adapters/shared/sqlanywhere.rb 250 def convert_smallint_to_bool 251 opts.has_key?(:convert_smallint_to_bool) ? opts[:convert_smallint_to_bool] : db.convert_smallint_to_bool 252 end
cross_apply(table)
Uses CROSS APPLY to join the given table into the current dataset.
[show source]
# File lib/sequel/adapters/shared/sqlanywhere.rb 293 def cross_apply(table) 294 join_table(:cross_apply, table) 295 end
escape_like(string)
SqlAnywhere
uses \ to escape metacharacters, but a ‘]’ should not be escaped
[show source]
# File lib/sequel/adapters/shared/sqlanywhere.rb 354 def escape_like(string) 355 string.gsub(/[\\%_\[]/){|m| "\\#{m}"} 356 end
into(table)
Specify a table for a SELECT … INTO query.
[show source]
# File lib/sequel/adapters/shared/sqlanywhere.rb 371 def into(table) 372 clone(:into => table) 373 end
recursive_cte_requires_column_aliases?()
SqlAnywhere
requires recursive CTEs to have column aliases.
[show source]
# File lib/sequel/adapters/shared/sqlanywhere.rb 298 def recursive_cte_requires_column_aliases? 299 true 300 end
supports_cte?(type=:select)
[show source]
# File lib/sequel/adapters/shared/sqlanywhere.rb 259 def supports_cte?(type=:select) 260 type == :select 261 end
supports_grouping_sets?()
SQLAnywhere supports GROUPING SETS
[show source]
# File lib/sequel/adapters/shared/sqlanywhere.rb 264 def supports_grouping_sets? 265 true 266 end
supports_is_true?()
[show source]
# File lib/sequel/adapters/shared/sqlanywhere.rb 276 def supports_is_true? 277 false 278 end
supports_join_using?()
[show source]
# File lib/sequel/adapters/shared/sqlanywhere.rb 280 def supports_join_using? 281 false 282 end
supports_multiple_column_in?()
[show source]
# File lib/sequel/adapters/shared/sqlanywhere.rb 268 def supports_multiple_column_in? 269 false 270 end
supports_where_true?()
[show source]
# File lib/sequel/adapters/shared/sqlanywhere.rb 272 def supports_where_true? 273 false 274 end
supports_window_clause?()
[show source]
# File lib/sequel/adapters/shared/sqlanywhere.rb 284 def supports_window_clause? 285 true 286 end
supports_window_functions?()
[show source]
# File lib/sequel/adapters/shared/sqlanywhere.rb 288 def supports_window_functions? 289 true 290 end
with_convert_smallint_to_bool(v)
Return a cloned dataset with the convert_smallint_to_bool
option set.
[show source]
# File lib/sequel/adapters/shared/sqlanywhere.rb 255 def with_convert_smallint_to_bool(v) 256 clone(:convert_smallint_to_bool=>v) 257 end