I working with an application that stores the body of an e-mail within the "text" column (which is a binary datatype) of a SQL Server database table.
I'm using Matt's XML::Generator::DBI module and the DBD::ODBC driver to connect to the datasource. According to Matt's documentation he encodes binary data as Base64.
I need to convert this binary date (now Base64) back into the original e-mail message however, I'm not quite sure how to tackle the problem. Can anybody offer any help?
Here's a code sample showing how I connect to the datasource:
The XML output looks as follows:# Instantiate a handle to the database. use DBI; my $dbh = DBI->connect("dbi:ODBC:$opt_hash{dsn}", $opt_hash{user}, $op +t_hash{pass}, {LongTruncOk => 1}) or die "Couldn't open database : '$DBI::errstr'; stopped"; # Instantiate the generator. use XML::Generator::DBI; my $generator = XML::Generator::DBI->new(RowElement => "Message", Hand +ler => $builder, dbh => $dbh); # Obtain a reference to the DOM. my $dom = $generator->execute("exec $opt_hash{sp} \'$opt_dates{start}\ +', \'$opt_dates{end}\'"); # Print the result print $dom->toString;
Thanks, Jay<Message> <ID>157</ID> <createdate>2002-05-21 09:39:16.343</createdate> <Subject>Msg4</Subject> <MessageBody>LCBJIGFtIHN0aWxsIHVuYWJ</MessageBody> </Message>
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |