Re: [CDBI] Working with tables without primary keys?

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

From: Eamon Daly
Subject: Re: [CDBI] Working with tables without primary keys?
Date: 17:10 on 08 Nov 2005
No, I know. The underlying table doesn't have a PK:

CREATE TABLE `action` (
  `person_id` int(11) NOT NULL default '0',
  `action` varchar(100) NOT NULL default '',
  KEY `person_id` (`person_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1

so I was looking for a way to work with it under CDBI. If
there were more columns in the table, I believe I'd have to
add them all as a multi-column PK under CDBI.

____________________________________________________________
Eamon Daly



----- Original Message ----- 
From: "Matt S Trout" <dbix-class@xxxxx.xx.xx>
To: "Eamon Daly" <edaly@xxxxxxxxxxxxx.xxx>
Cc: <classdbi@xxxxx.xxxxxxxxxxxxxxxx.xxx>
Sent: Tuesday, November 08, 2005 11:09 AM
Subject: Re: [CDBI] Working with tables without primary keys?


> On Tue, Nov 08, 2005 at 10:50:43AM -0600, Eamon Daly wrote:
>> I didn't realize that 'All' makes the left-hand item the PK.
>> My hack was to define all columns as the PK, which seems to
>> get me where I want to go. To answer the question "why?",
>> though, I would think this is a pretty common technique:
>> 
>> package Test::Action;
>> __PACKAGE__->columns(Primary => qw/person_id action/);
>> 
>> package Test::Person;
>> __PACKAGE__->columns(All => qw/person_id person_name/);
> 
> That's just a two-column primary key though - not a table without a
> primary key. The fact that you haven't yet required a column on Action
> that isn't part of the PK (e.g. time_happened) doesn't mean you don't
> have one at all.


_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

Re: [CDBI] Working with tables without primary keys?
Perrin Harkins 23:51 on 07 Nov 2005

Re: [CDBI] Working with tables without primary keys?
Perrin Harkins 17:08 on 08 Nov 2005

Re: [CDBI] Working with tables without primary keys?
Eamon Daly 17:10 on 08 Nov 2005

Re: [CDBI] Working with tables without primary keys?
Perrin Harkins 23:49 on 07 Nov 2005

Re: [CDBI] Working with tables without primary keys?
Left to My Own Devices 02:49 on 08 Nov 2005

RE: [CDBI] Working with tables without primary keys?
Mark Schoonover 03:55 on 08 Nov 2005

RE: [CDBI] Working with tables without primary keys?
Left to My Own Devices 03:12 on 08 Nov 2005

RE: [CDBI] Working with tables without primary keys?
Mark Schoonover 13:16 on 08 Nov 2005

Generated at 20:55 on 09 Nov 2005 by mariachi v0.52