[Catalyst] Trouble inserting data after migrate database from SQLite to My SQL

Jordi Amorós jamoros at etsetb.upc.edu
Tue Nov 10 15:45:45 GMT 2009


>         
>         
> 
> This is a DBIC question, as such the answer is clearly found in the
> DBIC manual:
> http://search.cpan.org/~ribasushi/DBIx-Class-0.08112/lib/DBIx/Class/ResultSet.pm#find_or_new
> 
> To summarize, ->new or ->find_or_new will not create a record in the
> database (and as such, no id is available).  If you want to create a
> record, triggering the auto_increment, then you must use create or a
> subsequent ->insert after a ->new call.
> 
> 
> Also of note, DBIx::Class has its own mailing list that you should
> consider subscribing to.
> 
> Thanks,
> -Jay
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/

First of all, my apologies I've changed the subject of my previous
message and due to that, now it's not placed where it have to be. 

With your permission (I wish), I copy & paste my answer to Steve:

"> Is your 'id' set to auto-increment???  
Yes, it is.

> What data type is it?  I usually 
> set the 'id' to auto-increment, and set it as an integer.  
I also do it.

> I would also 
> recommend using DBIC_TRACE=1 from the command line if possible to get
a 
> better description of the actual problem.

> Steve
> 

Thank you, very much. DBIC_TRACE=1 have provided me the following error:
"No _dbh_last_insert_id() method found in DBIx::Class::Storage::DBI.
Since the method of obtaining the autoincrement id of the last insert
operation varies greatly between different databases, this method must
be individually implemented for every storage class."

I've made a quick search, and I've found:
http://rt.cpan.org/Public/Bug/Display.html?id=40265#txn-566706

I've upgraded my version of DBIx::Class and it's all working again. 

Cheers

Jordi"

You're right Jay, it was a DBIx::Class issue. Thank you, for answering.

Jordi









More information about the Catalyst mailing list