Re: [Maypole] Auto Increment Primary Keys (and Documentation)

From: Tony Bowden (tony-maypole at kasei.com)
Date: Thu Jan 27 2005 - 11:53:04 GMT


On Thu, Jan 27, 2005 at 10:57:44AM +0000, Dave Howorth wrote:
> my $brewery = Brewery->create({
> name => 'Anheuser Busch',
> })
>
> my $beer = Beer->create({
> name => 'Budweiser',
> brewery => $brewery,
> style => 'lager',
> });

Of course, in practice, you wouldn't do the second step like that. You'd
use

  my $beer = $brewery->add_to_beers({
    name => 'Budweiser',
    style => 'lager',
  })

But yes, you can just ask a newly created item for its auto-incremented
id.

Tony

_______________________________________________
maypole mailing list
maypole at lists.netthink.co.uk
http://lists.netthink.co.uk/listinfo/maypole



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:57 GMT