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 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. So now it is formulating the INSERT without the key field, which > is > > good. However $obj->id is returning zero, implying that the model is not > > being updated after the insert. > > > > So now I am trying to work out how to get the last insert id. I think if > I > > can retrieve the relevant DBIx::Schema I should be able to use > > $schema->storage->last_input_id, but I'm still trying to > > find out how to get to the schema. > > > > As to the latest in Catalyst modules, I was using what the documentation > > recommended. I don't want to rewrite everything in another module now. > > That's fair enough, as long as you know it's not being maintained by > anyone. > > Did you turn on DBIC's tracing to see exactly what's going on in the SQL? > $obj->id() should work fine, without having to use last_insert_id. > > Carl > > _______________________________________________ > List: [email protected] > Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst > Searchable archive: > http://www.mail-archive.com/[EMAIL PROTECTED]/ > Dev site: http://dev.catalyst.perl.org/ > -- Regards, Martin ([EMAIL PROTECTED]) IT: http://methodsupport.com Personal: http://thereisnoend.org
_______________________________________________ List: [email protected] Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
