还是存在服务器保险点,记录下,主要就是从t_attachment表抓 已成为2进制的附件,数据库为mysql
#!/usr/bin/perl -w
use strict;
use warnings;
use DBI;
use File::Basename;
use File::Spec;
use Encode;
use Encode::CN;
my $database="MMMMMM";
my $host="xx.xx.xx.xx";
my $port =3306;
my $pmsfprojno="PMSF0000879";
my $dsn = "DBI:mysql:database=$database;host=$host;port=$port";
my $dbh =DBI->connect($dsn ,"root",'');
my $drh = DBI->install_driver("mysql");
$dbh->do("set names utf8;") ;
my $sth =$dbh->prepare("select f_file_name,f_content from t_attachment where hs_foreign_oid = ( select hs_uuid from t_usr_pmsf where hs_serial_no='$pmsfprojno' ) and t_attachment.hs_is_deleted=0 ");
$sth->execute;
while (my $ref = $sth->fetchrow_hashref()) {
my $filename =basename $ref->{'f_file_name'} ;
$filename =qq(C:\\$filename );
$filename= encode("gbk", decode("utf8", $filename));
my $filecontent = $ref->{'f_content'} ;
open OUTF, ">$filename" ;
binmode(OUTF);
print OUTF $filecontent ;
close(OUTF);
}
$sth->finish;
$dbh->disconnect();