knightsc
2007-Nov-12 17:30 UTC
rake test_firebird has queries using = NULL instead of is NULL
I''m trying to run the regresttion test scripts on a firebird database. I''m getting a lot of errors where the query being created is using NULL in the where clause. One specific place that is fails is as follows 1) Error: test_save_on_parent_saves_children(AssociationProxyTest): ActiveRecord::StatementInvalid: FireRuby::FireRubyException: Error preparing a SQL statement. Dynamic SQL Error SQL error code = -104 Token unknown - line 1, char 59 NULL Invalid token SQL Code = -104 Firebird Code = 335544569 : SELECT * FROM audit_logs WHERE (audit_logs.developer_id = NULL) ./../lib/active_record/connection_adapters/abstract_adapter.rb: 128:in `log'' ./../lib/active_record/connection_adapters/firebird_adapter.rb: 382:in `execute'' ./../lib/active_record/connection_adapters/firebird_adapter.rb: 612:in `select'' ./../lib/active_record/connection_adapters/firebird_adapter.rb: 374:in `select_all'' ./../lib/active_record/base.rb:427:in `find_by_sql'' ./../lib/active_record/base.rb:999:in `find_every'' ./../lib/active_record/base.rb:418:in `find'' ./../lib/active_record/associations/has_many_association.rb:91:in `find'' ./../lib/active_record/associations/association_collection.rb: 163:in `find_target'' ./../lib/active_record/associations/has_many_association.rb:121:in `load_target'' ./../lib/active_record/associations/association_proxy.rb:122:in `method_missing'' ./../lib/active_record/associations/has_many_association.rb:98:in `method_missing'' ./../lib/active_record/callbacks.rb:345:in `callback'' ./../lib/active_record/callbacks.rb:335:in `callback'' ./../lib/active_record/callbacks.rb:330:in `each'' ./../lib/active_record/callbacks.rb:330:in `callback'' ./../lib/active_record/callbacks.rb:255:in `create_without_timestamps'' ./../lib/active_record/timestamp.rb:30:in `create'' ./../lib/active_record/base.rb:1793:in `create_or_update_without_callbacks'' ./../lib/active_record/callbacks.rb:242:in `create_or_update'' ./../lib/active_record/base.rb:1549:in `save_without_validation'' ./../lib/active_record/validations.rb:752:in `save_without_transactions'' ./../lib/active_record/transactions.rb:129:in `save'' ./../lib/active_record/connection_adapters/abstract/ database_statements.rb:59:in `transaction'' ./../lib/active_record/transactions.rb:95:in `transaction'' ./../lib/active_record/transactions.rb:121:in `transaction'' ./../lib/active_record/transactions.rb:129:in `save'' ./../lib/active_record/base.rb:451:in `create'' associations_test.rb:110:in `test_save_on_parent_saves_children'' This line in the test is doing something like this developer = Developer.create :name => "Bryan" :salary => 50_000 Firebird uses the prefetch sequence generate stuff and I know that a sequence number has been fetched but for whatever reason in the create when it''s trying to load the associations it''s trying to query = NULL instead of the actually id of the class. Can someone point me in the right direction of something to look at to correct this problem. Thanks, Scott Knight --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
knightsc
2007-Nov-12 21:18 UTC
Re: rake test_firebird has queries using = NULL instead of is NULL
On Nov 12, 12:30 pm, knightsc <knigh...@gmail.com> wrote:> I''m trying to run the regresttion test scripts on a firebird database. > I''m getting a lot of errors where the query being created is using > NULL in the where clause. One specific place that is fails is as > follows > > 1) Error: > test_save_on_parent_saves_children(AssociationProxyTest): > ActiveRecord::StatementInvalid: FireRuby::FireRubyException: Error > preparing a SQL statement. > Dynamic SQL Error > SQL error code = -104 > Token unknown - line 1, char 59 > NULL > Invalid token > SQL Code = -104 > Firebird Code = 335544569 > : SELECT * FROM audit_logs WHERE (audit_logs.developer_id = NULL) > ./../lib/active_record/connection_adapters/abstract_adapter.rb: > 128:in `log'' > ./../lib/active_record/connection_adapters/firebird_adapter.rb: > 382:in `execute'' > ./../lib/active_record/connection_adapters/firebird_adapter.rb: > 612:in `select'' > ./../lib/active_record/connection_adapters/firebird_adapter.rb: > 374:in `select_all'' > ./../lib/active_record/base.rb:427:in `find_by_sql'' > ./../lib/active_record/base.rb:999:in `find_every'' > ./../lib/active_record/base.rb:418:in `find'' > ./../lib/active_record/associations/has_many_association.rb:91:in > `find'' > ./../lib/active_record/associations/association_collection.rb: > 163:in `find_target'' > ./../lib/active_record/associations/has_many_association.rb:121:in > `load_target'' > ./../lib/active_record/associations/association_proxy.rb:122:in > `method_missing'' > ./../lib/active_record/associations/has_many_association.rb:98:in > `method_missing'' > ./../lib/active_record/callbacks.rb:345:in `callback'' > ./../lib/active_record/callbacks.rb:335:in `callback'' > ./../lib/active_record/callbacks.rb:330:in `each'' > ./../lib/active_record/callbacks.rb:330:in `callback'' > ./../lib/active_record/callbacks.rb:255:in > `create_without_timestamps'' > ./../lib/active_record/timestamp.rb:30:in `create'' > ./../lib/active_record/base.rb:1793:in > `create_or_update_without_callbacks'' > ./../lib/active_record/callbacks.rb:242:in `create_or_update'' > ./../lib/active_record/base.rb:1549:in `save_without_validation'' > ./../lib/active_record/validations.rb:752:in > `save_without_transactions'' > ./../lib/active_record/transactions.rb:129:in `save'' > ./../lib/active_record/connection_adapters/abstract/ > database_statements.rb:59:in `transaction'' > ./../lib/active_record/transactions.rb:95:in `transaction'' > ./../lib/active_record/transactions.rb:121:in `transaction'' > ./../lib/active_record/transactions.rb:129:in `save'' > ./../lib/active_record/base.rb:451:in `create'' > associations_test.rb:110:in `test_save_on_parent_saves_children'' > > This line in the test is doing something like this > > developer = Developer.create :name => "Bryan" :salary => 50_000 > > Firebird uses the prefetch sequence generate stuff and I know that a > sequence number has been fetched but for whatever reason in the create > when it''s trying to load the associations it''s trying to query = NULL > instead of the actually id of the class. Can someone point me in the > right direction of something to look at to correct this problem. > > Thanks, > Scott KnightThis seems like the same problem described on http://dev.rubyonrails.org/ticket/8713 but it doesn''t seem to be fixed for firebird. The problem seems to be right before it can send construct_sql to the association it calls .blank? on the association which then causes the proxy to load_target on them which runs the query with = NULL in it -Scott --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---