Methods

Class Index [+]

Quicksearch

Sequel::QueryLiterals

The QueryLiterals module can be used to make select, group, and order methods operate similar to the filter methods if the first argument is a plain string, treating it like a literal string, with any remaining arguments treated as placeholder values.

This adds such support to the following methods: select, select_append, select_group, select_more, group, group_and_count, order, order_append, and order_more.

Note that if you pass a block to these methods, it will use the default implementation without the special literal handling.

Private Instance Methods

query_literal(args) click to toggle source

If the first argument is a plain string, return a literal string if there are no additional args or a placeholder literal string with the remaining args. Otherwise, return nil.

    # File lib/sequel/extensions/query_literals.rb, line 66
66:     def query_literal(args)
67:       case (s = args[0])
68:       when LiteralString, SQL::Blob
69:         nil
70:       when String
71:         if args.length == 1
72:           LiteralString.new(s)
73:         else
74:           SQL::PlaceholderLiteralString.new(s, args[1..1])
75:         end
76:       end
77:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.