[CDBI] Another DeepAbstractSearch 0.04 bug
Daniel Williams
danielw at staff.iinet.net.au
Wed May 3 03:06:03 BST 2006
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 at lists.digitalcraftsmen.net
[mailto:classdbi-bounces at lists.digitalcraftsmen.net] On Behalf Of Daniel
Williams
Sent: Friday, 28 April 2006 4:26 PM
To: sriha at cpan.org; classdbi at svr02.digitalcraftsmen.net
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 at lists.digitalcraftsmen.net
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi
More information about the ClassDBI
mailing list