Hi Aaron,

I'm not sure if this will solve your quoting problems, but instead of rawdata() 
you could trying using the encode() method to serialize a record object
for insertion into a database field. You can then use decode() to get the 
record object back:

use MARC::File::USMARC;

# Serialize the current record
my $serialized = $record->MARC::File::USMARC::encode();
# De-serialize it into a MARC object
my $newrecord = MARC::File::USMARC::decode($serialized);
print $newrecord->title() . "\n";



Mark



On Sun, Jan 01, 2006 at 07:47:49PM -0600, Aaron Huber wrote:
> Hi All,
> 
> I am trying to clean up a raw MARC record for insertion in a MySQL
> database.  Here is my code:
> 
> $rec = $rec->rawdata();
> $rec = $dbh->quote($rec);
> 
> I get the following error back:
> 
> 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 '02852cam  2200325Ia
> 45e0001000800000005001700008008004100025010 at ./zlite.pl line 73,
> <STDIN> line 3.
> 
> I am assuming that MySQL doesn't like the way my MARC record is
> formatted for insertion.  I've already used the quote(); function.  I
> would appreciate any help with this matter.
> 
> Thanks,
> Aaron

Reply via email to