Bugs item #22018, was opened at 2008-09-18 22:00
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=7857&aid=22018&group_id=2014
Category: AR-JDBC
Group: None
Status: Closed
Resolution: None
Priority: 3
Submitted By: Nigel Ramsay (nigelramsay)
Assigned to: Nobody (None)
Summary: db:test:clone_structure task sends illegal character to Oracle
Initial Comment:
When running "rake db:test:clone_structure", I get the following error:
ActiveRecord::ActiveRecordError: ORA-00911: invalid character:
INSERT INTO schema_migrations (version) VALUES ('20080915031553');
The illegal character that Oracle is complaining about is the trailing
semi-colon. The log file shows the preceding statements executing successfully.
Note there do not have a tailing semi-colon:
[...snip]
INSERT INTO schema_migrations (version) VALUES ('20080724033916')
INSERT INTO schema_migrations (version) VALUES ('20080901223816')
INSERT INTO schema_migrations (version) VALUES ('20080903231452')
INSERT INTO schema_migrations (version) VALUES ('20080909235955')
ActiveRecord::ActiveRecordError: ORA-00911: invalid character:
INSERT INTO schema_migrations (version) VALUES ('20080915031553');
The bug appears to originate in the "lib/jdbc_adapter/jdbc.rake" file. The
db:test:clone_structure task reads in the development_struture.sql file, and
performs a split(";\n\n"). This results in an array of statements, where each
statement does not have a trailing semi-colon - EXCEPT for the last statement.
So the last statement is executed, including the trailing semi-colon. And this
final statement is the cause of the "ORA-00911: invalid character" error.
This bug can be fixed by ensuring that the final semi-colon is removed before
"execute" is called.
----------------------------------------------------------------------
Comment By: Kurt Werle (kwerle)
Date: 2010-01-12 11:34
Message:
It looks to me like this same problem now exists in the standard databases.rake
file for Oracle:
when "oci", "oracle"
ActiveRecord::Base.establish_connection(:test)
IO.readlines("#{RAILS_ROOT}/db/#{RAILS_ENV}_structure.sql").join.split(";\n\n").each
do |ddl|
ActiveRecord::Base.connection.execute(ddl)
end
(rails 2.3.5)
----------------------------------------------------------------------
Comment By: Nick Sieger (nicksieger)
Date: 2008-09-19 05:34
Message:
Thanks for the report, fixed in trunk.
----------------------------------------------------------------------
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=7857&aid=22018&group_id=2014
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel