Module: Sequel::SQL::SubscriptMethods

Included in:
ComplexExpression, GenericExpression, StringAgg, Symbol
Defined in:
lib/sequel/sql.rb

Overview

This module includes the sql_subscript method, representing SQL array accesses.

Instance Method Summary collapse

Instance Method Details

#sql_subscript(*sub) ⇒ Object

Return a Subscript with the given arguments, representing an SQL array access.

Sequel[:array].sql_subscript(1) # array[1]
Sequel[:array].sql_subscript(1, 2) # array[1, 2]
Sequel[:array].sql_subscript([1, 2]) # array[1, 2]
Sequel[:array].sql_subscript(1..2) # array[1:2]
Sequel[:array].sql_subscript(1...3) # array[1:2]

966
967
968
# File 'lib/sequel/sql.rb', line 966

def sql_subscript(*sub)
  Subscript.new(self, sub.flatten)
end