module Sequel::ConstantSqlOverride::DatabaseMethods

  1. lib/sequel/extensions/constant_sql_override.rb

Methods

Public Class

  1. extended

Public Instance

  1. freeze
  2. set_constant_sql

Public Class methods

extended(db)

Create the initial empty hash of constant sql overrides.

[show source]
   # File lib/sequel/extensions/constant_sql_override.rb
30 def self.extended(db)
31   db.instance_exec do
32     @constant_sqls ||= {}
33     extend_datasets(DatasetMethods)
34   end
35 end

Public Instance methods

freeze()

Freeze the constant_sqls hash to prevent adding new overrides.

[show source]
   # File lib/sequel/extensions/constant_sql_override.rb
46 def freeze
47   @constant_sqls.freeze
48   super
49 end
set_constant_sql(constant, override)

Set the SQL to use for the given Sequel::SQL::Constant

[show source]
   # File lib/sequel/extensions/constant_sql_override.rb
41 def set_constant_sql(constant, override)
42   @constant_sqls[constant.constant] = override
43 end