[Catalyst] How to insert from form to MySQL with autoincrement primary key?

2007-12-09 Thread Martin Ellison
Sorrry, this is another newbie question. I am using HTML::Widget and DBIx::Class to do simple CRUD on some MySQL tables. I have defined an auto-increment primary key on one of my tables, and I want to use an HTML form to populate and create a new object. I then want to retrieve the

Re: [Catalyst] How to insert from form to MySQL with autoincrement primary key?

2007-12-09 Thread Carl Franks
On 09/12/2007, Martin Ellison [EMAIL PROTECTED] wrote: Sorrry, this is another newbie question. I am using HTML::Widget and DBIx::Class to do simple CRUD on some MySQL tables. I have defined an auto-increment primary key on one of my tables, and I want to use an HTML form to populate and

Re: [Catalyst] How to insert from form to MySQL with autoincrement primary key?

2007-12-09 Thread Martin Ellison
I tried my $newid = $c-model( q{MyAppDB::MyTable} )-result_source-storage-last_insert_id(); and it gave me zero, so I'm not sure how to proceed. On 10/12/2007, Martin Ellison [EMAIL PROTECTED] wrote: Yes, I had a form field with the same name as the table key, because, when I do an update on

Re: [Catalyst] How to insert from form to MySQL with autoincrement primary key?

2007-12-09 Thread Martin Ellison
Yes, I had the DBIC trace going. Basically it did an INSERT (without the key field, correctly), but not a (select of the) LAST_INSERT_ID(), at least, not in the trace. So perhaps it had no way of knowing the new key. On 10/12/2007, Carl Franks [EMAIL PROTECTED] wrote: On 09/12/2007, Martin

Re: [Catalyst] How to insert from form to MySQL with autoincrement primary key?

2007-12-09 Thread Paul Henrich
Hi Martin, You might check to make sure that you are loading PK::Auto in MyAppDB::MyTable: # ... use base 'DBIx::Class'; __PACKAGE__-load_components(PK::Auto, Core); __PACKAGE__-table(mytable); # then make sure you declare the primary key later on...

Re: [Catalyst] Re: How to insert from form to MySQL with autoincrement primary key?

2007-12-09 Thread Martin Ellison
My table class is basically: use base qw/DBIx::Class/; __PACKAGE__-load_components(qw/PK::Auto Core HTMLWidget/); # Set the table name __PACKAGE__-table('mytable'); # Set columns in table __PACKAGE__-add_columns( qw/mytable_id title date/ ); # Set the primary key for the table

Re: [Catalyst] Soundboard: Catalyst::Model::GoogleCalendar

2007-12-09 Thread Ashley Pond V
Right on. I swear I tried a search for it. must have misspelled it. On Dec 9, 2007, at 5:05 PM, Steve Sabljak wrote: Using the existing Google Calendar perl api from CPAN (http://search.cpan.org/~simonw/Net-Google-Calendar-0.8/), would this do the trick? package