Re: segmentation fault
[prev]
[thread]
[next]
[Date index for 2004/06/14]
Colm--
Ok, it was a problem with my definitions. Just the same, it would be
good to know how to trap for this kind of error to avoid seg faults.
Also, advice on the correct way to do implement my schema in Class::DBI
would be much appreceiated.
Here's my test db structure:
the "employees" table:
mysql> describe dbixtest1
-> ;
+---------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+----------------+
| id | mediumint(9) | | PRI | NULL | auto_increment |
| name | varchar(80) | YES | | NULL | |
| manager | mediumint(9) | YES | | NULL | |
| dept | mediumint(9) | YES | | NULL | |
+---------+--------------+------+-----+---------+----------------+
the departments table:
mysql> describe dbixtest2;
+-------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+--------------+------+-----+---------+----------------+
| id | mediumint(9) | | PRI | NULL | auto_increment |
| name | varchar(80) | YES | | NULL | |
+-------+--------------+------+-----+---------+----------------+
And my code:
package MyTest::Employee;
BEGIN { unshift @INC, '/home/step2/dev/classdbi'; }
use base 'MyTest::DBI';
use strict;
MyTest::Employee->table('dbixtest1');
MyTest::Employee->columns(Primary => 'id');
MyTest::Employee->columns(All => qw/id name manager dept/);
#MyTest::Employee->has_a(id => 'MyTest::Employee');
MyTest::Employee->has_a(dept => 'MyTest::Department');
The idea is that an employee has a manager, which refers to another
employee's id. what would be the correct way to describe this?
when i commented out the above line you see commented out, i was able to
use Object->search. sorry if this is a lame post, i am new to all this.
also, as asked, i am using DBI 1.42 and DBD::mysql 2.9003.
thanks
steve
On Mon, 2004-06-14 at 13:41, colm-cdbi@xxxxxxxxx.xx.xx wrote:
> On Mon, Jun 14, 2004 at 08:48:05PM +0100, step2@xxxxxxxxxxxxxxxx.xxx wrote:
> > hello list--
> >
> > i have done some googling for Class::DBI causing seg faults, but I didn't find much, so i consider myself authorized to post. i have Class::DBI 0.96 installed on a redhat 7.3 system with perl 5.8.1. i can provide more config info if necessary.
> >
> > i set up some packages based on the directions and was able to successfully insert a row into my MySql database (4.0.18). but when i try to use Object->search, my perl script crashed with a "Segmentation Fault" but does not produce a core file for me to look at or any other intersting errors.
> >
> > i really want to use Class::DBI for my mod_perl app. what other information do i need to provide/look for to solve this mystery?
>
> Please send us a self contained script that demonstrates the problem.
>
> Have you tried using DBI directly to see if you have a general problem
> there? What versions of DBI and DBD::mysql do you have?
>
> Colm