[CDBI] Another DeepAbstractSearch 0.04 bug

"Daniel Williams" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.class-dbi
Message-ID <5B0731A8753509478386ED3D6513B2D153CB75@isp-per-exch01.win2k.iinet.net.au>
Another bug with DeepAbstractSearch:

Sample code:
My @hostnames;
$hostnames[0]='staff-fw1.wa';
$hostnames[1]='staff-fw2.wa';

my @relatedhosts = EventHosts->deep_search_where({
            'faultid.start' => $start,
            'hostname' => [ @hostnames ] });

Will give an error like
EventHosts doesn't contain column 'staff-fw1.wa'
Class::DBI::Plugin::DeepAbstractSearch ,
/usr/local/share/perl/5.8.4/Class/DBI/Plugin/DeepAbstractSearch.pm, 179

Obviously gets confused about the '.' in the hostname. Escaping it
doesn't help.

Daniel

-----Original Message-----
From: classdbi-bounces-Ra3b/[email protected]
[mailto:classdbi-bounces-Ra3b/[email protected]] On Behalf Of Daniel
Williams
Sent: Friday, 28 April 2006 4:26 PM
To: [email protected]; classdbi-uVLvtXkw1RPgjt3iqB9Uk5F3r5kRpbQ7rE5yTffgRl4@public.gmane.org
Subject: [CDBI] DeepAbstractSearch 0.04 Bug?


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 


_______________________________________________
ClassDBI mailing list
ClassDBI-Ra3b/[email protected]
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.