Module: OracleEnhancedAdapterPlusXmltype

Defined in:
lib/oracle_enhanced_plus_xmltype/oracle_enhanced_adapter_with_xmltype.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.included(receiver) ⇒ Object



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/oracle_enhanced_plus_xmltype/oracle_enhanced_adapter_with_xmltype.rb', line 79

def self.included(receiver)
  receiver.extend         ClassMethods
  receiver.send :include, InstanceMethods
  receiver.class_eval do
    self.send :remove_const, "NATIVE_DATABASE_TYPES"
    self.send :remove_const, "NATIVE_DATABASE_TYPES_BOOLEAN_STRINGS"
    self.const_set("NATIVE_DATABASE_TYPES", {
      :primary_key => "NUMBER(38) NOT NULL PRIMARY KEY",
      :string      => { :name => "VARCHAR2", :limit => 255 },
      :text        => { :name => "CLOB" },
      :xmltype     => { :name => "XMLTYPE" },
      :integer     => { :name => "NUMBER", :limit => 38 },
      :float       => { :name => "NUMBER" },
      :decimal     => { :name => "DECIMAL" },
      :datetime    => { :name => "DATE" },
      # changed to native TIMESTAMP type
      # :timestamp   => { :name => "DATE" },
      :timestamp   => { :name => "TIMESTAMP" },
      :time        => { :name => "DATE" },
      :date        => { :name => "DATE" },
      :binary      => { :name => "BLOB" },
      :boolean     => { :name => "NUMBER", :limit => 1 },
      :raw         => { :name => "RAW", :limit => 2000 }
    }
    )
    self.const_set("NATIVE_DATABASE_TYPES_BOOLEAN_STRINGS", self.const_get("NATIVE_DATABASE_TYPES").dup.merge(
    :boolean     => { :name => "VARCHAR2", :limit => 1 }
    ))
  end
end