module Sequel::IdentifierMangling::DatabaseMethods

  1. lib/sequel/extensions/identifier_mangling.rb

Attributes

identifier_input_method [R]

The identifier input method to use by default for this database (default: adapter default)

identifier_output_method [R]

The identifier output method to use by default for this database (default: adapter default)

Public Class methods

extended(db)
[show source]
   # File lib/sequel/extensions/identifier_mangling.rb
44 def self.extended(db)
45   db.instance_exec do
46     @identifier_input_method = nil
47     @identifier_output_method = nil
48     @quote_identifiers = nil
49     reset_identifier_mangling
50     extend_datasets(DatasetMethods)
51   end
52 end

Public Instance methods

identifier_input_method=(v)

Set the method to call on identifiers going into the database:

DB[:items] # SELECT * FROM items
DB.identifier_input_method = :upcase
DB[:items] # SELECT * FROM ITEMS
[show source]
   # File lib/sequel/extensions/identifier_mangling.rb
65 def identifier_input_method=(v)
66   reset_default_dataset
67   @identifier_input_method = v
68 end
identifier_output_method=(v)

Set the method to call on identifiers coming from the database:

DB[:items].first # {:id=>1, :name=>'foo'}
DB.identifier_output_method = :upcase
DB[:items].first # {:ID=>1, :NAME=>'foo'}
[show source]
   # File lib/sequel/extensions/identifier_mangling.rb
75 def identifier_output_method=(v)
76   reset_default_dataset
77   @identifier_output_method = v
78 end
quote_identifiers=(v)

Set whether to quote identifiers (columns and tables) for this database:

DB[:items] # SELECT * FROM items
DB.quote_identifiers = true
DB[:items] # SELECT * FROM "items"
[show source]
   # File lib/sequel/extensions/identifier_mangling.rb
85 def quote_identifiers=(v)
86   reset_default_dataset
87   @quote_identifiers = v
88 end
quote_identifiers?()

Returns true if the database quotes identifiers.

[show source]
   # File lib/sequel/extensions/identifier_mangling.rb
91 def quote_identifiers?
92   @quote_identifiers
93 end