Marc blob - mysql

2007-09-20 Thread Jacobien Stols
Hi
I'm dumping the whole marc record in one column, in a mysql database. I
created a table with a blob column. But, when a singe quote ' appears
somewhere in a record, the record can't be loaded into the mysql. I
receive a syntax error. Does anyone know of a solution? 

Jacobien Stols
Developer
Systems Development
Sabinet Online
http://www.sabinet.co.za
tel: (012) 643 9525 




This transmission is for the intended addressee only and is confidential
information. If you have received this transmission in error, please
delete it and notify the sender. The contents of this e-mail are the
opinion of the writer only and are not endorsed by Sabinet Online
Limited unless expressly stated otherwise.



Re: Marc blob - mysql

2007-09-20 Thread Ed Summers
What's the exact error message?

//Ed


Re: Marc blob - mysql

2007-09-20 Thread Leif Andersson
Jacobien,

Try this:

my $blob = $record->as_usmarc();
$blob= $dbh->quote($blob);

And load $blob as you did before.

Leif
==
Leif Andersson, Systems Librarian
Stockholm University Library
SE-106 91 Stockholm
SWEDEN


RE: Marc blob - mysql

2007-09-20 Thread Jacobien Stols
The error message is:

DBD::mysql::st execute failed: You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the
right syntax to use near 's principles and practice of medicine.  a616
DAY MEDbcfkmnpqxNz1100 ' at line 1 at ./blob2.pl line 146.

When I do the following, there is no error:

 my @fields = $record->field('300');
  foreach my $field (@fields) {

   my $desc = $field->subfield('a');
   $desc =~s/\'/\'\'/;

   my $new_field = MARC::Field->new('245','','',a=>$desc);
   $field->replace_with($new_field);
  }

But this solution is not so clean, because, I don't know beforehand in
which marc tags I will find the single quote (').

Jacobien 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ed
Summers
Sent: 20 September 2007 03:27 PM
To: Jacobien Stols
Cc: perl4lib@perl.org
Subject: Re: Marc blob - mysql

What's the exact error message?

//Ed


This transmission is for the intended addressee only and is confidential
information. If you have received this transmission in error, please
delete it and notify the sender. The contents of this e-mail are the
opinion of the writer only and are not endorsed by Sabinet Online
Limited unless expressly stated otherwise.