Bug 674432
Summary: | rhubarb should work with classes named after sql reserved words | ||
---|---|---|---|
Product: | Red Hat Enterprise MRG | Reporter: | Robert Rati <rrati> |
Component: | ruby-rhubarb | Assignee: | Will Benton <willb> |
Status: | CLOSED ERRATA | QA Contact: | Tomas Rusnak <trusnak> |
Severity: | low | Docs Contact: | |
Priority: | low | ||
Version: | 1.3 | CC: | iboverma, matt, mkudlej, trusnak |
Target Milestone: | 2.0 | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | rhubarb-0.3.0-1 | Doc Type: | Bug Fix |
Doc Text: |
C: The rhubarb library previously did not allow users to create persisting classes named after SQL reserved words.
C: This required users to specify an alternate table name with the declare_table_name option.
F: Rhubarb now quotes table names in all generated SQL code.
R: It is now possible to declare persisting classes named after SQL reserved words, like "Group" or "Order".
Summary: It is now possible to use the rhubarb library to create persisting classes that share names with SQL reserved words.
|
Story Points: | --- |
Clone Of: | Environment: | ||
Last Closed: | 2011-06-23 15:42:25 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | |||
Bug Blocks: | 693778 |
Description
Robert Rati
2011-02-01 21:06:09 UTC
Fixed in master. Technical note added. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. New Contents: C: The rhubarb library previously did not allow users to create persisting classes named after SQL reserved words. C: This required users to specify an alternate table name with the declare_table_name option. F: Rhubarb now quotes table names in all generated SQL code. R: It is now possible to declare persisting classes named after SQL reserved words, like "Group" or "Order". Summary: It is now possible to use the rhubarb library to create persisting classes that share names with SQL reserved words. Reproduced on x86_64/RHEL5 with ruby-rhubarb-0.2.7-1: #!/bin/ruby require 'rhubarb/rhubarb' class Create include Rhubarb::Persisting declare_column :name, :string end class Group include Rhubarb::Persisting declare_column :other, :int, references(Create, :on_delete=>:cascade) end class Order include Rhubarb::Persisting declare_column :group, :int end Rhubarb::Persistence::open(":memory:", :default, true) [Create, Group, Order].each do |klass| klass.create_table end /usr/lib/ruby/site_ruby/1.8/sqlite3/errors.rb:62:in `check': near "create": syntax error (SQLite3::SQLException) from /usr/lib/ruby/site_ruby/1.8/sqlite3/statement.rb:39:in `initialize' from /usr/lib/ruby/site_ruby/1.8/sqlite3/database.rb:154:in `new' from /usr/lib/ruby/site_ruby/1.8/sqlite3/database.rb:154:in `prepare' from /usr/lib/ruby/site_ruby/1.8/sqlite3/database.rb:181:in `execute' from /usr/lib/ruby/site_ruby/1.8/rhubarb/classmixins.rb:261:in `create_table' from test.rb:22 from test.rb:21:in `each' from test.rb:21 Retested over all supported platforms x86,x86_64/RHEL5,RHEL6 with:
ruby-rhubarb-0.3.0-2
require 'rhubarb/rhubarb'
true
class Create
include Rhubarb::Persisting
declare_column :name, :string
end
#<Proc:0x00002b2796a1abd8@/usr/lib/ruby/site_ruby/1.8/rhubarb/classmixins.rb:181>
class Group
include Rhubarb::Persisting
declare_column :other, :int, references(Create, :on_delete=>:cascade)
end
[#<Proc:0x00002b2796a0fd50@/usr/lib/ruby/site_ruby/1.8/rhubarb/classmixins.rb:214>]
class Order
include Rhubarb::Persisting
declare_column :group, :int
end
#<Proc:0x00002b2796a1abd8@/usr/lib/ruby/site_ruby/1.8/rhubarb/classmixins.rb:181>
Rhubarb::Persistence::open(":memory:", :default, true)
#<SQLite3::Database:0x2b2796d9c108 @driver=#<SQLite3::Driver::Native::Driver:0x2b2796d9bfa0 @busy_handler={}, @authorizer={}, @callback_data={}, @trace={}>, @transaction_active=false, @closed=false, @handle=#<SWIG::TYPE_p_sqlite3:0x2b2796d62750>, @translator=nil, @statement_factory=SQLite3::Statement, @type_translation=true, @results_as_hash=true>
[Create, Group, Order].each do |klass|
klass.create_table
end
[Create, Group, Order]
Classes names can be same as SQL reserved words.
>>> VERIFIED
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHEA-2011-0889.html |