人妖在线一区,国产日韩欧美一区二区综合在线,国产啪精品视频网站免费,欧美内射深插日本少妇

新聞動(dòng)態(tài)

在程序中壓縮sql server2000的數(shù)據(jù)庫(kù)備份文件的代碼

發(fā)布日期:2022-02-04 10:58 | 文章來(lái)源:CSDN

數(shù)據(jù)庫(kù)備份文件,在程序中怎樣壓縮啊?
復(fù)制代碼 代碼如下:

procedureTForm1.Button2Click(Sender:TObject);
var
SHExecInfo:SHELLEXECUTEINFO;
begin
SHExecInfo.cbSize:=sizeof(SHELLEXECUTEINFO);
SHExecInfo.fMask:=SEE_MASK_NOCLOSEPROCESS;
SHExecInfo.Wnd:=Handle;
SHExecInfo.lpVerb:=nil;
SHExecInfo.lpFile:='WinRAR.exe';
SHExecInfo.lpParameters:='ae:\qwqw.rare:\qwqw';
SHExecInfo.lpDirectory:=nil;
SHExecInfo.nShow:=SW_SHOW;
SHExecInfo.hInstApp:=Handle;
ShellExecuteEx(@SHExecInfo);
WaitForSingleObject(SHExecInfo.hProcess,INFINITE);
CloseHandle(SHExecInfo.hProcess);
ShellExecute(application.MainForm.Handle,'open','winrar.exe',PChar('ae:\zqzq.rare:\zqzq'),'',SW_show);
ShowMessage('壓縮完畢!');}

這是一段壓縮圖片的代碼,壓縮文件原理相同,只需稍做改動(dòng)即可。
復(fù)制代碼 代碼如下:

var
mss:TMemoryStream;
zip:TDeCompressionStream;
zip1:TCompressionStream;
fs:TFileStream;
fBuf:Array[0..16383]ofByte;
flen:Integer;
//從數(shù)據(jù)庫(kù)中取出圖片
//...寫(xiě)出SQL語(yǔ)句以取得有圖片的記錄,此處從略
mss:=TMemoryStream.Create;
fs:=TFileStream.Create('filename.jpg',fmCreateorfmOpenWrite);
try
TBlobField(Que.FieldByName('pic')).SaveToStream(mss);
zip:=TDeCompressionStream.Create(fs);
try
flen:=zip.Read(fbuf,SizeOf(fBuf));
whileflen>0dobegin
fs.Write(fbuf,flen);
flen:=zip.Read(fbuf,SizeOf(fBuf));
end;
finally
FreeAndNil(zip);
end;
finally
mss.Free;
fs.Free;
end;
//將文件filename.jpg中的圖片保存到數(shù)據(jù)庫(kù)
//...寫(xiě)出SQL語(yǔ)句,打開(kāi)Que,并定位到要保存圖片的記錄,此處從略
fs:=TFileStream.Create('filename.jpg',fmOpenRead);
mss:=TMemoryStream.Create;
try
zip1:=TCompressionStream.Create(clDefault,mss);
try
flen:=fs.Read(fbuf,SizeOf(fBuf));
whileflen>0dobegin
zip1.Write(fbuf,flen);
flen:=fs.Read(fbuf,SizeOf(fBuf));
end;
//保存到數(shù)據(jù)庫(kù)
TBlobField(Que.FieldByName('pic')).LoadFromStream(mss);
Que.UpdateBatch();
//...
finally
zip1.Free;
end;
finally
fs.Free;
mss.Free;
end;

美國(guó)服務(wù)器租用

版權(quán)聲明:本站文章來(lái)源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請(qǐng)保持原文完整并注明來(lái)源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非www.sddonglingsh.com所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來(lái)源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來(lái),僅供學(xué)習(xí)參考,不代表本站立場(chǎng),如有內(nèi)容涉嫌侵權(quán),請(qǐng)聯(lián)系alex-e#qq.com處理。

相關(guān)文章

實(shí)時(shí)開(kāi)通

自選配置、實(shí)時(shí)開(kāi)通

免備案

全球線路精選!

全天候客戶服務(wù)

7x24全年不間斷在線

專屬顧問(wèn)服務(wù)

1對(duì)1客戶咨詢顧問(wèn)

在線
客服

在線客服:7*24小時(shí)在線

客服
熱線

400-630-3752
7*24小時(shí)客服服務(wù)熱線

關(guān)注
微信

關(guān)注官方微信
頂部