LindaLiner
Programmer
Hi, there,
I am using PerlBI to talk with SQL server. I want to get the varbinary data from database and saved as .wav file. I couldn't find useful information about handling binary data in Perl. And my code doesn't work.
Can somebody help me out?
Thank in advance!
Below is my code:
++++++++++++++++++++++++++++
$query = "select Audio_Data from English_English where Audio_Name = 'ENG_2.WAV'";
$sth = $dbh->prepare($query) or die "prepare failed\n";
$sth->execute() or die "unable to execute query $query error $DI::errstr";
my $out_audio = "ENG_2.wav";
open(OUTF, ">$out_audio") or die "Can't open $out_audio\n";
binmode(OUTF);
while(@first = $sth->fetchrow_array) {
foreach $field(@first) {
printf OUTF $field;
}
}
close(OUTF);
$sth->finish() or die "unable to finish query -- error $DI::errstr";
$dbh->disconnect;
I am using PerlBI to talk with SQL server. I want to get the varbinary data from database and saved as .wav file. I couldn't find useful information about handling binary data in Perl. And my code doesn't work.
Can somebody help me out?
Thank in advance!
Below is my code:
++++++++++++++++++++++++++++
$query = "select Audio_Data from English_English where Audio_Name = 'ENG_2.WAV'";
$sth = $dbh->prepare($query) or die "prepare failed\n";
$sth->execute() or die "unable to execute query $query error $DI::errstr";
my $out_audio = "ENG_2.wav";
open(OUTF, ">$out_audio") or die "Can't open $out_audio\n";
binmode(OUTF);
while(@first = $sth->fetchrow_array) {
foreach $field(@first) {
printf OUTF $field;
}
}
close(OUTF);
$sth->finish() or die "unable to finish query -- error $DI::errstr";
$dbh->disconnect;