Re: uninitialized PK when inserting row into SQLite?
[prev]
[thread]
[next]
[Date index for 2004/10/14]
> I'm getting the exception trace (printed below) which appears to me to
> be caused by an uninitialized primary key passed to execute by
> Class::DBI::_insert_row(). The code continues and everything seems to
> work correctly. However, this 21 line strict warning is a little
> disturbing, and the screen I/O slows down my program.
>
> If I put a breakpoint on this line:
> Class::DBI::_insert_row(/Library/Perl/5.8.4/Class/DBI.pm:636):
> 636: $sth->execute(values %$data);
>
> I see that %$data contains:
> DB<38> x %$data
> 0 'zmessage'
> 1 Model::Message=HASH(0x1a0d318)
> 'z_pk' => 2
> 2 'z_pk'
> 3 undef
> 4 'zlanguage'
> 5 1
> 6 'zname'
> 7 'MS-DOS'
>
> 'z_pk" is the table's primary key.
It would have been useful if you had included the relevant CDBI classes, but
it looks like you're inflating z_pk using a has_a() relationship to
Model::Message? If so, the docs specifically state that you should not
inflate your primary key in that fashion.
|
(message missing)
|