can't retrieve unless primary columns....

[prev] [thread] [next] [Date index for 2004/08/30]

From: Michael Jensen
Subject: can't retrieve unless primary columns....
Date: 13:40 on 30 Aug 2004
--Apple-Mail-1--398095411
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	format=flowed

Can't retrieve unless primary columns are defined at 
/home/site/this/that/page.mas line 25


I keep getting this error on my site. I am using Mason, but I don't 
think that has anything to do with it. I get the error, and then reload 
and I still get it. But after 20 seconds or so, I reload and the page 
works just fine. Definitely weird! Can anyone suggest what might be 
going on?

The code the error refers to is:

25	$userID = $1;
26	my $user = Table::Users->retrieve($userID);
27	my $whatyouwant = $user->id;
28	return $whatyouwant;

Usually it is the line after the one referenced, so this points to my 
CDBI stuff. My package for the CDBI for that table looks like this:

package Table::Users;

use base 'My::ClassDBI';

Table::Users->table('users');
Table::Users->columns(Primary => qw/id/);
Table::Users->columns(Others => qw/username password group_id 
create_date edit_date first_name last_name company_id email phone fax 
plan_type plan_limit last_login_date msg_email/);
Table::Users->has_a(group_id=>'Table::Groups');
Table::Users->has_a(company_id=>'Table::Companies');
Table::Users->add_trigger(before_create => sub { $_[0]->set(create_date 
=> $time) });
1;


And in the MySQL database, "id" in the 'users' table is the primary key 
and autoincrementing.

Thanks!!!

-Michael Jensen

--Apple-Mail-1--398095411
Content-Transfer-Encoding: 7bit
Content-Type: text/enriched;
	charset=US-ASCII

<fontfamily><param>Verdana</param><smaller>Can't retrieve unless
primary columns are defined at /home/site/this/that/page.mas line 25



I keep getting this error on my site. I am using Mason, but I don't
think that has anything to do with it. I get the error, and then
reload and I still get it. But after 20 seconds or so, I reload and
the page works just fine. Definitely weird! Can anyone suggest what
might be going on? 


The code the error refers to is:


25	$userID = $1;

26	my $user = Table::Users->retrieve($userID);

27	my $whatyouwant = $user->id;

28	return $whatyouwant;


Usually it is the line after the one referenced, so this points to my
CDBI stuff. My package for the CDBI for that table looks like this:


package Table::Users;


use base 'My::ClassDBI';


Table::Users->table('users');

Table::Users->columns(Primary => qw/id/);

Table::Users->columns(Others => qw/username password group_id
create_date edit_date first_name last_name company_id email phone fax
plan_type plan_limit last_login_date msg_email/);

Table::Users->has_a(group_id=>'Table::Groups');

Table::Users->has_a(company_id=>'Table::Companies');

Table::Users->add_trigger(before_create => sub {
$_[0]->set(create_date => $time) });

1;



And in the MySQL database, "id" in the 'users' table is the primary
key and autoincrementing.


Thanks!!!


-Michael Jensen

</smaller></fontfamily>
--Apple-Mail-1--398095411--


can't retrieve unless primary columns....
Michael Jensen 13:40 on 30 Aug 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52