HasMany Error Cascading Delete

[prev] [thread] [next] [Date index for 2005/01/11]

From: Daniel Wijnands
Subject: HasMany Error Cascading Delete
Date: 07:51 on 11 Jan 2005
Hi ,

I habe a strange problem when i try to do a cascading delete.
I have the following 2 tables :

mysql> show fields from group_2;
+----------------+------------------+------+-----+---------+----------------+
| Field          | Type             | Null | Key | Default | 
Extra          |
+----------------+------------------+------+-----+---------+----------------+
| grpId          | int(10) unsigned |      | PRI | NULL    | 
auto_increment |
| grpName        | varchar(30)      | YES  |     | NULL    
|                |
| grpDescription | text             | YES  |     | NULL    
|                |
+----------------+------------------+------+-----+---------+----------------+
3 rows in set (0.00 sec)


 2 package Database::Group;
      3 use base 'Database::DBI';
      4 use strict;
      5
      6 __PACKAGE__->set_up_table("group_2");
      7 
__PACKAGE__->has_many(modulemoderules=>['Database::ModuleModeRule'=>'grpId']);
      8
      9


mysql> show fields from modulemoderule;
+----------+----------------------+------+-----+---------+----------------+
| Field    | Type                 | Null | Key | Default | Extra          |
+----------+----------------------+------+-----+---------+----------------+
| mmrId    | int(10) unsigned     |      | PRI | NULL    | auto_increment |
| momId    | int(10) unsigned     |      |     | 0       |                |
| grpId    | int(10) unsigned     |      |     | 0       |                |
| usrId    | int(10) unsigned     |      |     | 0       |                |
| mmrLevel | enum('group','user') | YES  |     | NULL    |                |
| mmrValue | int(10) unsigned     | YES  |     | NULL    |                |
+----------+----------------------+------+-----+---------+----------------+
6 rows in set (0.00 sec)


  2 package Database::ModuleModeRule;
      3 use base 'Database::DBI';
      4 use strict;
      5
      6 __PACKAGE__->set_up_table("modulemoderule");
      7 __PACKAGE__->has_a(momId => 'Database::ModuleMode');
      8


And the following script :

 1 #!/usr/local/bin/perl
      2
      3 use strict;
      4 use lib 'Core';
      5 use Data::Dumper;
      6 use Database::Group;
      7
      8 my $Group = Database::Group->retrieve(11);
      9 $Group->delete();
     10


I get the following error

daniel@ios:/usr/data/www/cms.ios/HTML$ ./test.pl
group is not a column of Database::ModuleModeRule at 
/usr/local/lib/perl5/site_perl/5.8.5/Class/DBI/Relationship/HasMany.pm 
line 61g error :

Anybody an idea ?

Kind regards Daniel

HasMany Error Cascading Delete
Daniel Wijnands 07:51 on 11 Jan 2005

Generated at 12:15 on 16 Jan 2005 by mariachi v0.52