[Catalyst] Can't get last insert id

JT Justman jt at signless.com
Tue Jul 25 06:47:03 CEST 2006


Ben Hopkins wrote:
>     From: JT Justman < jt at signless.com <mailto:jt at signless.com>>
>     Subject: Re: [Catalyst] Can't get last insert id
>     To: The elegant MVC web framework <catalyst at lists.rawmode.org
>     <mailto:catalyst at lists.rawmode.org>>
>     Message-ID: <44C25F86.1010909 at signless.com
>     <mailto:44C25F86.1010909 at signless.com>>
>     Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
>     <snip>
> 
> 
>     Is your 'id' column set to autoincrement? What does 'describe books' in
>     mysql say?
> 
> 
> 
> It is NOT autoincrement.  The docs didn't say anything about 
> autoincrement, I figured it was a catalyst/DBIC thing to fake 
> autoincrement in case a particular RDBMS didn't support it.
> 
> So, I added it  (AUTO_INCREMENT), and it works -- kindof, but THAT error 
> is gone.  I've found some glaring typos in the tutorial code (like 
> references to Book instead of Books), but this omission is the worst. 
> 
> I'm talking about 
> http://search.cpan.org/~mramberg/Catalyst-Runtime-5.7000/lib/Catalyst/Manual/Tutorial/CatalystBasics.pod 
> <http://search.cpan.org/~mramberg/Catalyst-Runtime-5.7000/lib/Catalyst/Manual/Tutorial/CatalystBasics.pod>
> 
> Thanks for the help.
> 

Well, I am rather new to Catalyst and in fact to DBIx. I'm not sure why 
it would look for a last_insert_id, and I thought it might be because 
your table had it set.

When I did the tutorial, I used sqlite - my first time with it in fact, 
as I usually use MySQL.

IIRC the tutorial used a table 'books' and a class 'Book'. I'm sure if 
you'd refer specifically to any errors the maintainers of the tutorial 
will be thrilled to correct them, and/or throttle you with something icky.

As an aside, replying to digests without changing the subject line is tacky.

JT



More information about the Catalyst mailing list