saberma-activerecord-oracle_enhanced-adapter-nvarchar2 1.2.1 → 1.2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -276,13 +276,13 @@ module ActiveRecord
|
|
276
276
|
name =~ /(^|_)id$/i
|
277
277
|
end
|
278
278
|
|
279
|
-
# RSI: set to true if CHAR(1),
|
279
|
+
# RSI: set to true if CHAR(1), NVARCHAR2(1) columns or NVARCHAR2 columns with FLAG or YN at the end of their name
|
280
280
|
# should be emulated as booleans
|
281
281
|
@@emulate_booleans_from_strings = false
|
282
282
|
cattr_accessor :emulate_booleans_from_strings
|
283
283
|
def self.is_boolean_column?(name, field_type, table_name = nil)
|
284
|
-
return true if ["CHAR(1)","
|
285
|
-
field_type =~ /^
|
284
|
+
return true if ["CHAR(1)","NVARCHAR2(1)"].include?(field_type)
|
285
|
+
field_type =~ /^NVARCHAR2/ && (name =~ /_flag$/i || name =~ /_yn$/i)
|
286
286
|
end
|
287
287
|
def self.boolean_to_string(bool)
|
288
288
|
bool ? "Y" : "N"
|
@@ -303,7 +303,7 @@ module ActiveRecord
|
|
303
303
|
def native_database_types #:nodoc:
|
304
304
|
{
|
305
305
|
:primary_key => "NUMBER(38) NOT NULL PRIMARY KEY",
|
306
|
-
:string => { :name => "
|
306
|
+
:string => { :name => "NVARCHAR2", :limit => 255 },
|
307
307
|
:text => { :name => "CLOB" },
|
308
308
|
:integer => { :name => "NUMBER", :limit => 38 },
|
309
309
|
:float => { :name => "NUMBER" },
|
@@ -315,9 +315,9 @@ module ActiveRecord
|
|
315
315
|
:time => { :name => "DATE" },
|
316
316
|
:date => { :name => "DATE" },
|
317
317
|
:binary => { :name => "BLOB" },
|
318
|
-
# RSI: if emulate_booleans_from_strings then store booleans in
|
318
|
+
# RSI: if emulate_booleans_from_strings then store booleans in NVARCHAR2
|
319
319
|
:boolean => emulate_booleans_from_strings ?
|
320
|
-
{ :name => "
|
320
|
+
{ :name => "NVARCHAR2", :limit => 1 } : { :name => "NUMBER", :limit => 1 }
|
321
321
|
}
|
322
322
|
end
|
323
323
|
|
@@ -651,7 +651,7 @@ module ActiveRecord
|
|
651
651
|
select column_name as name, data_type as sql_type, data_default, nullable,
|
652
652
|
decode(data_type, 'NUMBER', data_precision,
|
653
653
|
'FLOAT', data_precision,
|
654
|
-
'
|
654
|
+
'NVARCHAR2', data_length,
|
655
655
|
'CHAR', data_length,
|
656
656
|
null) as limit,
|
657
657
|
decode(data_type, 'NUMBER', data_scale, null) as scale
|
data/oracle-enhanced.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{activerecord-oracle_enhanced-adapter-nvarchar2}
|
5
|
-
s.version = "1.2.1"
|
5
|
+
s.version = "1.2.1.1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Raimonds Simanovskis"]
|