mrh30 has asked for the wisdom of the Perl Monks concerning the following question:

Hi there, I'm attempting to use Class::DBI with BLOB fields in my MySQL database for the first time with fairly limited success, the limit being that I don't seem to be able to achieve an update to that field. The data to be put into the BLOB field is being correctly read from a CGI file upload field, and is present in a variable right before I make the call to CDBI to do the update, however the data doesn't get as far as the database. It's probably something glaringly obvious that I'm missing to do with the way I've set the CDBI packages up, but any help would be appreciated!
  • Comment on Using BLOB fields with Class::DBI and MySQL

Replies are listed 'Best First'.
Re: Using BLOB fields with Class::DBI and MySQL
by marto (Cardinal) on Jul 25, 2005 at 10:19 UTC
      I didn't bother cluttering up the post with code, as I didn't think it was particularly instructive. But here's a sample: The database setup code:
      package MyDatabase::Candidates; use base 'MyDatabase::DBI'; MyDatabase::Candidates->table('CANDIDATES'); MyDatabase::Candidates->columns( All => qw/CANDIDATEID CV/);
      Then the code that's supposed to be doing the setting:
      my $filehandle = $self->query->upload('cv'); my $cvfile = do { local $/; <$filehandle> }; $candidate->CV($cvfile);
        Try adding this: $candidate->update();