[CDBI] DeepAbstractSearch 0.04 Bug?

Daniel Williams danielw at staff.iinet.net.au
Fri Apr 28 09:25:41 BST 2006


Hi,

I am using DeepAbstractSearch with Class::DBI and I believe I have come
across a bug. When doing a deep search on a column that shares a
relationship with another column

########################################################################
#######
package ChimeFault::MaintVersion;
use base 'ChimeFault::DBI';
ChimeFault::MaintVersion->table('MaintVersion');
ChimeFault::MaintVersion->columns(Primary => qw/mvoid/ ) ;
ChimeFault::MaintVersion->columns(Essential => qw/maintoid attempt
version created_on engapproval opsapproval active notes gmapproval/ );
ChimeFault::MaintVersion->has_a( maintoid => 'ChimeFault::Maint');
ChimeFault::MaintVersion->has_a( engapproval =>
'ChimeFault::MaintApproval');
ChimeFault::MaintVersion->has_a( gmapproval =>
'ChimeFault::MaintApproval');
ChimeFault::MaintVersion->has_a( opsapproval =>
'ChimeFault::MaintApproval');

package ChimeFault::Maint;
use base 'ChimeFault::DBI';
ChimeFault::Maint->columns(Primary => qw/oid/ ) ;
ChimeFault::Maint->columns(Essential => qw/created author title
objectives comments cust_impact eventleveloid activityminutes
rollbackminutes cooldownminutes maintstatus esc_contact rb_contact
impacttypeoid eventid outside_of_policy defperformer/ );
ChimeFault::Maint->has_a( eventid => 'ChimeFault::Event');

package ChimeFault::MaintApproval;
use base 'ChimeFault::DBI';
ChimeFault::MaintApproval->table('MaintApproval');
ChimeFault::MaintApproval->columns(Primary => qw/aoid/ ) ;
ChimeFault::MaintApproval->columns(Essential => qw/approved approved_on
approved_by comment/ );



In my code I execute:

Use ChimeFault;

    my @vers = ChimeFault::MaintVersion->deep_search_where({
     'active' => 1,
     'gmapproval.approved' => 1,
     'attempt' => { '!=' => undef },
     'maintoid.eventid.status' => 'Active',
   });



The SQL it Executes:

SELECT DISTINCT t_MaintVersion.mvoid, t_MaintVersion.maintoid,
t_MaintVersion.attempt, t_MaintVersion.version,
t_MaintVersion.created_on, t_MaintVersion.engapproval,
t_MaintVersion.opsapproval, t_MaintVersion.active, t_MaintVersion.notes,
t_MaintVersion.gmapproval

FROM MaintVersion AS t_MaintVersion, Maint AS t_MaintVersion_maintoid,
Event AS t_MaintVersion_maintoid_eventid, MaintApproval AS
t_MaintVersion_gmapproval

WHERE  t_MaintVersion.maintoid = t_MaintVersion_maintoid.oid  AND
t_MaintVersion_maintoid.eventid =
t_MaintVersion_maintoid_eventid.faultid  AND  t_MaintVersion.opsapproval
= t_MaintVersion_gmapproval.aoid  AND ( t_MaintVersion.active = '1' AND
t_MaintVersion.attempt IS NOT NULL AND
t_MaintVersion_gmapproval.approved = '1' AND
t_MaintVersion_maintoid_eventid.status = 'Active' )


This is the part that is strange is:
t_MaintVersion.opsapproval = t_MaintVersion_gmapproval.aoid  
It should be
t_MaintVersion.gmapproval = t_MaintVersion_gmapproval.aoid  




Daniel 





More information about the ClassDBI mailing list