[Dbix-class] DBIx::Class::Resultset - DBI Exception near PATH
Zbigniew Lukasiak
zzbbyy at gmail.com
Tue Feb 17 13:13:05 GMT 2009
On Tue, Feb 17, 2009 at 2:00 PM, Dermot <paikkos at googlemail.com> wrote:
> Hi,
>
> I have a hashref like so:
>
> {
> 'file' => 'cheese-biscuits_cutout_12-10-08_1.jpg',
> 'path' => '/data/scanning/fast_track/ydm/12-10-08_1.jpg',
> 'user_reference' => '12-10-08_1',
> 'keywords' => 'Cheese biscuits, biscuits, biscuit, stack,
> baked goods, cut out, white',
> 'caption' => 'Cheese biscuits',
> 'title' => 'Cheese biscuits'
> },
>
>
> That I am trying to INSERT with find_or_create like this
>
> my $row = $schema->resultset('MetaData')->find_or_create({
> id => undef,
> title => $hashref->{'title'},
> keywords => $hashref->{'keywords'},
> caption => $hashref->{'caption'},,
> users_reference => $hashref->{'users_reference'},
> file => [ { path => $hashref->{'path'} } ], # has_one
> });
I don't know about the error you are getting now - but 'id => undef'
is also not quite correct here - because create will then try to
create a NULL id (which is presumably your primary key) - and this
will fail on many databases.
By the way this is why I wrote
http://search.cpan.org/~zby/DBIx-Class-ResultSet-RecursiveUpdate-v0.002/
- you might like to try it out I've released it just yesterday. It is
still experimental though.
--
Zbigniew Lukasiak
http://brudnopis.blogspot.com/
http://perlalchemy.blogspot.com/
More information about the DBIx-Class
mailing list