Sha256: b132a013f4f2f4209308578c7a4a0697c4336e840c42dfcec89a4ba40f7f8de6
Contents?: true
Size: 863 Bytes
Versions: 12
Compression:
Stored size: 863 Bytes
Contents
# The from_block extension changes Database#from so that blocks given # to it are treated as virtual rows applying to the FROM clause, # instead of virtual rows applying to the WHERE clause. This will # probably be made the default in the next major version of Sequel. # # This makes it easier to use table returning functions: # # DB.from{table_function(1)} # # SELECT * FROM table_function(1) # # To load the extension into the database: # # DB.extension :from_block module Sequel module Database::FromBlock # If a block is given, make it affect the FROM clause: # DB.from{table_function(1)} # # SELECT * FROM table_function(1) def from(*args, &block) if block @default_dataset.from(*args, &block) else super end end end Database.register_extension(:from_block, Database::FromBlock) end
Version data entries
12 entries across 12 versions & 1 rubygems