OK, I have changed my code a bit, so that it now has
$obj = $c->model( q{MyAppDB::MyTable})->create( {} );
$obj->populate_from_widget($result);
In other words, I have replaced the 'new' in the first line by a 'create'.
The result (as verified by the DBIC trace) is an insert wit
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 Catalyst::Model::GoogleCalendar
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
__PACKAGE
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 Catalyst::Model::GoogleCalendar;
use strict;
use base 'Catalyst::Model';
use Class::C3;
use Net::Google::Calendar;
our $VERSION = '0.1';
sub new {
> "PH" == Paul Henrich <[EMAIL PROTECTED]> writes:
PH> You might check to make sure that you are loading PK::Auto in
PH> MyAppDB::MyTable:
I belive that with a recent DBIx::Class that's not necessary: perldoc
DBIx::Class::PK::Auto indicates that "PK::Auto is now part of Core."
k.
--
k
Never mind re. PK::Auto. If you have the newest DBIx::Class, that
gets automatically loaded. However, you may still need to do
__PACKAGE__->set_primary_key();
On 9 Dec 2007, at 3:19 PM, Paul Henrich wrote:
Hi Martin,
You might check to make sure that you are loading PK::Auto in
MyAppDB::
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...
__PACKAGE__->set_primary_key("my
On 9 Dec 2007, at 18:03, Martin Ellison wrote:
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.
It wont do that - it wil
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 E
On 09/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 an existing object, I want to save its key value somewhere.
> ...I've put in a test, so it only includes the field when I want to d an
> update.
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 u
Yes, I had a form field with the same name as the table key, because, when I
do an update on an existing object, I want to save its key value somewhere.
...I've put in a test, so it only includes the field when I want to d an
update. So now it is formulating the INSERT without the key field, which
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 an
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 newly-generated
14 matches
Mail list logo