[Dbix-class] DBIx::Class::Resultset - DBI Exception near PATH

Dermot paikkos at googlemail.com
Tue Feb 17 13:00:04 GMT 2009


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
  });


But I get the error:

    !! ERROR: 1 'near "PATH": syntax error(1) at dbdimp.c line 271' (err#0)
    <- prepare_cached('SELECT me.id, me.photog_id, me.path,
me.file_data_id FROM files me WHERE ( ( ( ( me.id PATH ? ) ) ) )',
HASH(0x93c0310), ...)= undef at DBI.pm line 1188
    -> HandleError on DBI::db=HASH(0x92ba9d8) via CODE(0x92ba9cc) (undef)
       ERROR: 1 'near "PATH": syntax error(1) at dbdimp.c line 271' (err#0)
    <- FETCH('Active')= 1 at DBI.pm line 710
    !! ERROR: 1 CLEARED by call to _not_impl method
Driver does not implement the ping method.
    <- ping= '0 but true' at DBI.pm line 710
DBIx::Class::ResultSet::find_or_create(): DBI Exception:
DBD::SQLite::db prepare_cached failed: near "PATH": syntax error(1) at
dbdimp.c line 271 [for Statement "SELECT me.id, me.photog_id, me.path,
me.file_data_id FROM files me WHERE ( ( ( ( me.id PATH ? ) ) ) )"] at
script/import.pl line 87
    <- disconnect_all= '' at DBI.pm line 718


My Schema looks like this:
__PACKAGE__->table("meta_data");
__PACKAGE__->add_columns(
  "id",
  { data_type => "INTEGER", is_nullable => 0, size => undef },
  "photog_id",
  { data_type => "INTEGER", is_nullable => 0, size => undef },
  "file_id",
  { data_type => "INTEGER", is_nullable => 0, size => undef },
  "title",
  { data_type => "TEXT", is_nullable => 0, size => undef },
  "caption",
  { data_type => "TEXT", is_nullable => 0, size => undef },
  "keywords",
  { data_type => "TEXT", is_nullable => 0, size => undef },
  "date_entered",
  { data_type => "CURRENT_TIMESTAMP", is_nullable => 0, size => undef },
);
__PACKAGE__->set_primary_key("id");
__PACKAGE__->has_one('file' => 'MyApp::Schema::Files', 'meta_data_id' );


Is /path/i a reserved word or am I doing some wrong?

Thanx,
Dp.



More information about the DBIx-Class mailing list