mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Oracle: test case for column default parsing. References #2788.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3019 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
d8f5ccab1c
commit
d28e9aef5f
4 changed files with 22 additions and 2 deletions
|
@ -1,10 +1,12 @@
|
||||||
*SVN*
|
*SVN*
|
||||||
|
|
||||||
|
* Oracle: test case for column default parsing. #2788 [Michael Schoen <schoenm@earthlink.net>]
|
||||||
|
|
||||||
* Update documentation for Migrations. #2861 [Tom Werner <tom@cube6media.com>]
|
* Update documentation for Migrations. #2861 [Tom Werner <tom@cube6media.com>]
|
||||||
|
|
||||||
* When AbstractAdapter#log rescues an exception, attempt to detect and reconnect to an inactive database connection. Connection adapter must respond to the active? and reconnect! instance methods. Initial support for PostgreSQL, MySQL, and SQLite. Make certain that all statements which may need reconnection are performed within a logged block: for example, this means no avoiding log(sql, name) { } if @logger.nil? [Jeremy Kemper]
|
* When AbstractAdapter#log rescues an exception, attempt to detect and reconnect to an inactive database connection. Connection adapter must respond to the active? and reconnect! instance methods. Initial support for PostgreSQL, MySQL, and SQLite. Make certain that all statements which may need reconnection are performed within a logged block: for example, this means no avoiding log(sql, name) { } if @logger.nil? [Jeremy Kemper]
|
||||||
|
|
||||||
* Much faster Oracle column reflection. #2848 [Michael Schoen <schoenm@earthlink.net>]
|
* Oracle: Much faster column reflection. #2848 [Michael Schoen <schoenm@earthlink.net>]
|
||||||
|
|
||||||
* Base.reset_sequence_name analogous to reset_table_name (mostly useful for testing). Base.define_attr_method allows nil values. [Jeremy Kemper]
|
* Base.reset_sequence_name analogous to reset_table_name (mostly useful for testing). Base.define_attr_method allows nil values. [Jeremy Kemper]
|
||||||
|
|
||||||
|
|
|
@ -338,7 +338,7 @@ begin
|
||||||
end
|
end
|
||||||
|
|
||||||
select_all(table_cols).map do |row|
|
select_all(table_cols).map do |row|
|
||||||
row['data_default'].gsub!(/^'(.*)'\s*$/, '\1') if row['data_default']
|
row['data_default'].sub!(/^'(.*)'\s*$/, '\1') if row['data_default']
|
||||||
OCIColumn.new(
|
OCIColumn.new(
|
||||||
oci_downcase(row['column_name']),
|
oci_downcase(row['column_name']),
|
||||||
row['data_default'],
|
row['data_default'],
|
||||||
|
|
|
@ -17,6 +17,7 @@ class MasterCreditCard < ActiveRecord::Base; end
|
||||||
class Post < ActiveRecord::Base; end
|
class Post < ActiveRecord::Base; end
|
||||||
class Computer < ActiveRecord::Base; end
|
class Computer < ActiveRecord::Base; end
|
||||||
class NonExistentTable < ActiveRecord::Base; end
|
class NonExistentTable < ActiveRecord::Base; end
|
||||||
|
class TestOCIDefault < ActiveRecord::Base; end
|
||||||
|
|
||||||
class LoosePerson < ActiveRecord::Base
|
class LoosePerson < ActiveRecord::Base
|
||||||
attr_protected :credit_rating, :administrator
|
attr_protected :credit_rating, :administrator
|
||||||
|
@ -470,6 +471,15 @@ class BasicsTest < Test::Unit::TestCase
|
||||||
topic = Topic.find(topic.id)
|
topic = Topic.find(topic.id)
|
||||||
assert topic.approved?
|
assert topic.approved?
|
||||||
assert_nil topic.last_read
|
assert_nil topic.last_read
|
||||||
|
|
||||||
|
# Oracle has some funky default handling, so it requires a bit of
|
||||||
|
# extra testing. See ticket #2788.
|
||||||
|
if current_adapter?(:OCIAdapter)
|
||||||
|
test = TestOCIDefault.new
|
||||||
|
assert_equal "X", test.test_char
|
||||||
|
assert_equal "hello", test.test_string
|
||||||
|
assert_equal 3, test.test_int
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_utc_as_time_zone
|
def test_utc_as_time_zone
|
||||||
|
|
|
@ -261,3 +261,11 @@ create table keyboards (
|
||||||
);
|
);
|
||||||
create sequence keyboards_seq minvalue 10000;
|
create sequence keyboards_seq minvalue 10000;
|
||||||
|
|
||||||
|
create table test_oci_defaults (
|
||||||
|
id integer not null primary key,
|
||||||
|
test_char char(1) default 'X' not null,
|
||||||
|
test_string varchar2(20) default 'hello' not null,
|
||||||
|
test_int integer default 3 not null
|
||||||
|
);
|
||||||
|
create sequence test_oci_defaults_seq minvalue 10000;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue