Bug 674433
| Summary: | rhubarb should raise a user-friendly error message when creating a table with no declared columns | ||
|---|---|---|---|
| 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 with no declared columns.
C: Although creating persisting classes that have no persisting data members is an unlikely use case, users who attempted to do so would be met with a confusing error message because certain internal data structures were only created when a column was declared.
F: The rhubarb library now ensures that necessary initialization steps take place even if no columns are declared.
R: It is now possible to declare persisting classes with no persisting columns.
Summary: It is now possible to use the rhubarb library to create persisting classes with no declared columns.
|
Story Points: | --- |
| Clone Of: | Environment: | ||
| Last Closed: | 2011-06-23 15:42:28 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:08:35 UTC
Fixed in master, packaged soon.
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 with no declared columns.
C: Although creating persisting classes that have no persisting data members is an unlikely use case, users who attempted to do so would be met with a confusing error message because certain internal data structures were only created when a column was declared.
F: The rhubarb library now ensures that necessary initialization steps take place even if no columns are declared.
R: It is now possible to declare persisting classes with no persisting columns.
Summary: It is now possible to use the rhubarb library to create persisting classes with no declared columns.
What are the exact steps to reproduce this issue in console, please? Here's part of an irb transcript with the old behavior:
irb(main):016:0> require 'rhubarb/rhubarb'
=> true
irb(main):017:0> class Blah
irb(main):018:1> include ::Rhubarb::Persisting
irb(main):019:1> end
=> Blah
irb(main):020:0> ::Rhubarb::Persistence::open(":memory:")
=> #<SQLite3::Database:0x7fb2586db9f8 @translator=nil, @statement_factory=SQLite3::Statement, @type_translation=true, @results_as_hash=true, @driver=#<SQLite3::Driver::Native::Driver:0x7fb2586db8b8 @callback_data={}, @trace={}, @busy_handler={}, @authorizer={}>, @transaction_active=false, @closed=false, @handle=#<SWIG::TYPE_p_sqlite3:0x7fb2586ae160>>
irb(main):021:0> Blah.create_table
NameError: undefined local variable or method `columns' for Blah:Class
from /usr/lib/ruby/site_ruby/1.8/rhubarb/classmixins.rb:254:in `table_decl'
from /usr/lib/ruby/site_ruby/1.8/rhubarb/classmixins.rb:261:in `create_table'
from (irb):21
from /usr/lib/ruby/1.8/set.rb:272
You can just paste the following in to irb to reproduce the issue:
---snip---
require 'rhubarb/rhubarb'
class Blah; include ::Rhubarb::Persisting; end
::Rhubarb::Persistence::open(":memory:")
Blah.create_table
---snip---
Reproduced on x86_64/RHEL5 with ruby-rhubarb-0.2.7
# irb
irb(main):001:0> require 'rhubarb/rhubarb'
=> true
irb(main):002:0> class Blah; include ::Rhubarb::Persisting; end
=> Blah
irb(main):003:0> ::Rhubarb::Persistence::open(":memory:")
=> #<SQLite3::Database:0x2b516184d950 @driver=#<SQLite3::Driver::Native::Driver:0x2b516184d810 @trace={}, @busy_handler={}, @authorizer={}, @callback_data={}>, @transaction_active=false, @closed=false, @handle=#<SWIG::TYPE_p_sqlite3:0x2b516183e0e0>, @translator=nil, @statement_factory=SQLite3::Statement, @type_translation=true, @results_as_hash=true>
irb(main):004:0> Blah.create_table
NameError: undefined local variable or method `columns' for Blah:Class
from /usr/lib/ruby/site_ruby/1.8/rhubarb/classmixins.rb:254:in `table_decl'
from /usr/lib/ruby/site_ruby/1.8/rhubarb/classmixins.rb:261:in `create_table'
from (irb):4
Retested over all supported platforms x86,x86_64/RHEL5,RHEL6 with ruby-rhubarb-0.3.0-2:
# irb
irb(main):001:0> require 'rhubarb/rhubarb'
=> true
irb(main):002:0> class Blah; include ::Rhubarb::Persisting; end
=> Blah
irb(main):003:0> ::Rhubarb::Persistence::open(":memory:")
=> #<SQLite3::Database:0xb7d29cc4 @driver=#<SQLite3::Driver::Native::Driver:0xb7d29c24 @callback_data={}, @trace={}, @busy_handler={}, @authorizer={}>, @transaction_active=false, @closed=false, @handle=#<SWIG::TYPE_p_sqlite3:0xb7d220b4>, @translator=nil, @statement_factory=SQLite3::Statement, @type_translation=true, @results_as_hash=true>
irb(main):004:0> Blah.create_table
=> []
irb(main):005:0>
>>> 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 |