Module Sequel::SqlAnywhere::DatasetMethods
In: lib/sequel/adapters/shared/sqlanywhere.rb

Methods

Public Instance methods

[Source]

     # File lib/sequel/adapters/shared/sqlanywhere.rb, line 288
288:       def complex_expression_sql_append(sql, op, args)
289:         case op
290:         when '||''||'
291:           super(sql, :+, args)
292:         when :<<, :>>
293:           complex_expression_emulate_append(sql, op, args)
294:         when :LIKE, "NOT LIKE""NOT LIKE"
295:           sql << '('
296:           literal_append(sql, args[0])
297:           sql << (op == :LIKE ? ' REGEXP ' : ' NOT REGEXP ')
298:           pattern = String.new
299:           last_c = ''
300:           args[1].each_char do |c|
301:             if  c == '_' and not pattern.end_with?('\\') and last_c != '\\'
302:               pattern << '.'
303:             elsif c == '%' and not pattern.end_with?('\\') and last_c != '\\'
304:               pattern << '.*'
305:             elsif c == '[' and not pattern.end_with?('\\') and last_c != '\\'
306:               pattern << '\['
307:             elsif c == ']' and not pattern.end_with?('\\') and last_c != '\\'
308:               pattern << '\]'
309:             elsif c == '*' and not pattern.end_with?('\\') and last_c != '\\'
310:               pattern << '\*'
311:             elsif c == '?' and not pattern.end_with?('\\') and last_c != '\\'
312:               pattern << '\?'
313:             else
314:               pattern << c
315:             end
316:             if c == '\\' and last_c == '\\'
317:               last_c = ''
318:             else
319:               last_c = c
320:             end
321:           end
322:           literal_append(sql, pattern)
323:           sql << " ESCAPE "
324:           literal_append(sql, "\\")
325:           sql << ')'
326:         when :ILIKE, "NOT ILIKE""NOT ILIKE"
327:           super(sql, (op == :ILIKE ? :LIKE : "NOT LIKE""NOT LIKE"), args)
328:         when :extract
329:           sql << 'datepart('
330:           literal_append(sql, args[0])
331:           sql << ','
332:           literal_append(sql, args[1])
333:           sql << ')'
334:         else
335:           super
336:         end
337:       end

Use today() for CURRENT_DATE and now() for CURRENT_TIMESTAMP and CURRENT_TIME

[Source]

     # File lib/sequel/adapters/shared/sqlanywhere.rb, line 345
345:       def constant_sql_append(sql, constant)
346:         case constant
347:         when :CURRENT_DATE
348:           sql << 'today()'
349:         when :CURRENT_TIMESTAMP, :CURRENT_TIME
350:           sql << 'now()'
351:         else
352:           super
353:         end
354:       end

Whether to convert smallint to boolean arguments for this dataset. Defaults to the IBMDB module setting.

[Source]

     # File lib/sequel/adapters/shared/sqlanywhere.rb, line 240
240:       def convert_smallint_to_bool
241:         opts.has_key?(:convert_smallint_to_bool) ? opts[:convert_smallint_to_bool] : db.convert_smallint_to_bool
242:       end

Uses CROSS APPLY to join the given table into the current dataset.

[Source]

     # File lib/sequel/adapters/shared/sqlanywhere.rb, line 279
279:       def cross_apply(table)
280:         join_table(:cross_apply, table)
281:       end

SqlAnywhere uses \ to escape metacharacters, but a ’]’ should not be escaped

[Source]

     # File lib/sequel/adapters/shared/sqlanywhere.rb, line 340
340:       def escape_like(string)
341:         string.gsub(/[\\%_\[]/){|m| "\\#{m}"}
342:       end

Specify a table for a SELECT … INTO query.

[Source]

     # File lib/sequel/adapters/shared/sqlanywhere.rb, line 357
357:       def into(table)
358:         clone(:into => table)
359:       end

SqlAnywhere requires recursive CTEs to have column aliases.

[Source]

     # File lib/sequel/adapters/shared/sqlanywhere.rb, line 284
284:       def recursive_cte_requires_column_aliases?
285:         true
286:       end

[Source]

     # File lib/sequel/adapters/shared/sqlanywhere.rb, line 249
249:       def supports_cte?(type=:select)
250:         type == :select
251:       end

SQLAnywhere supports GROUPING SETS

[Source]

     # File lib/sequel/adapters/shared/sqlanywhere.rb, line 254
254:       def supports_grouping_sets?
255:         true
256:       end

[Source]

     # File lib/sequel/adapters/shared/sqlanywhere.rb, line 266
266:       def supports_is_true?
267:         false
268:       end

[Source]

     # File lib/sequel/adapters/shared/sqlanywhere.rb, line 270
270:       def supports_join_using?
271:         false
272:       end

[Source]

     # File lib/sequel/adapters/shared/sqlanywhere.rb, line 258
258:       def supports_multiple_column_in?
259:         false
260:       end

[Source]

     # File lib/sequel/adapters/shared/sqlanywhere.rb, line 274
274:       def supports_timestamp_usecs?
275:         false
276:       end

[Source]

     # File lib/sequel/adapters/shared/sqlanywhere.rb, line 262
262:       def supports_where_true?
263:         false
264:       end

Return a cloned dataset with the convert_smallint_to_bool option set.

[Source]

     # File lib/sequel/adapters/shared/sqlanywhere.rb, line 245
245:       def with_convert_smallint_to_bool(v)
246:         clone(:convert_smallint_to_bool=>v)
247:       end

[Validate]