BÀI 9: Xử lý các đối tượng lưu trữ thông tin với số lượng lớn

  • Published on
    17-Dec-2014

  • View
    462

  • Download
    2

Embed Size (px)

DESCRIPTION

Binary Large Objects v Character Large Objects l g? Qu trnh c Large Objects t Database Qu trnh ghi Large Objects xung Database

Transcript

<ul><li> 1. 11 HC LP TRNH WEB T C BN N NNG CAO HocLapTrinhWeb.COM </li> <li> 2. 22 HC LP TRNH WEB T C BN N NNG CAO HocLapTrinhWeb.COM X l cc i tng lu tr thng tin vi s lng ln 1. Binary Large Objects v Character Large Objects l g? 2. Qu trnh c Large Objects t Database 3. Qu trnh ghi Large Objects xung Database </li> <li> 3. 33 HC LP TRNH WEB T C BN N NNG CAO HocLapTrinhWeb.COM 1. Binary Large Objects v Character Large Objects l g? Binary Large Objects (BLOBs) Character Large Objects (CLOBs) Kiu d liu Large Value </li> <li> 4. 44 HC LP TRNH WEB T C BN N NNG CAO HocLapTrinhWeb.COM Binary Large ObjectsBinary Large Objects BLOBs l cc i tng ln di dng nh phn, c th c lu tr trong CSDL BLOBs c th cha hnh nh, bng tnh, video clips v cc tp tin thi hnh Trong SQL Server 2000, kiu image c s dng lu tr BLOB. </li> <li> 5. 55 HC LP TRNH WEB T C BN N NNG CAO HocLapTrinhWeb.COM Character Large Objects CLOBs l cc i tng ln di dng k t, c th c lu tr trong CSDL CLOBs c th cha gi tr dng vn bn nh : thng tin c th trong vn bn c phn bit bng du phy, hoc ti liu XML SQL Server 2000 dng kiu text v ntext lu tr CLOB. </li> <li> 6. 66 HC LP TRNH WEB T C BN N NNG CAO HocLapTrinhWeb.COM Kiu d liu Large Value Large Value Data Types (LVDT) l kiu c th lu tr gi tr trn 8000bytes (8k) L khi nim mi trong SQL Server 2005, thay th kiu LOB Cc kiu tng ng vi SQL Server 2000: image = varbinary(MAX) text = varchar(MAX) ntext = nvarchar(MAX) </li> <li> 7. 77 HC LP TRNH WEB T C BN N NNG CAO HocLapTrinhWeb.COM Minh ha kiuMinh ha kiu Large Value Xem kiu d liu ca field LargePhoto trong table Production.ProductPhoto CSDL AdventureWorks </li> <li> 8. 88 HC LP TRNH WEB T C BN N NNG CAO HocLapTrinhWeb.COM 2. Qu trnh c Large Objects t Database c tun t LOB Value t Database c LOB hoc LDT Value trong SQL Server 2005 </li> <li> 9. 99 HC LP TRNH WEB T C BN N NNG CAO HocLapTrinhWeb.COM c tun t LOB Value t Database Cc bc thc hin: To i tng Command To i tng DataReader bng cch s dng phng thc ExecuteReader v xc nh tham s l CommandBehavior.SequentialAccess S dng phng thc GetBytes c d liu BLOB Hoc Phng thc GetChars c d liu CLOB </li> <li> 10. 1010 HC LP TRNH WEB T C BN N NNG CAO HocLapTrinhWeb.COM Minh ha c tun t LOB Value tMinh ha c tun t LOB Value t DatabaseDatabase S dng bng Production.ProductPhoto, c field LargePhoto To Command v lu ni dung vo DataReader Dng GetBytes c d liu ct LargePhoto Xut ni dung ca ct ny ra mn hnh </li> <li> 11. 1111 HC LP TRNH WEB T C BN N NNG CAO HocLapTrinhWeb.COM c LOB hoc LDT Value trong SQL Server 2005 S dng phng thc GetSqlBytes c d liu BLOB hoc varbinary(MAX) Phng thc GetSqlChars c d liu CLOB hoc varchar(MAX) </li> <li> 12. 1212 HC LP TRNH WEB T C BN N NNG CAO HocLapTrinhWeb.COM Minh ha c LOB Value -Minh ha c LOB Value - GetSqlBytesGetSqlBytes Khai bo mng byte tr gi tr c c ca field LargePhoto To Connection v Command, lu ni dung vo DataReader Dng GetSqlBytes c d liu ct LargePhoto Xut ni dung ca ct ny ra tp tin hnh nh </li> <li> 13. 1313 HC LP TRNH WEB T C BN N NNG CAO HocLapTrinhWeb.COM 3. Qu trnh ghi Large Objects vo Database Ghi Large Objects vo Database </li> <li> 14. 1414 HC LP TRNH WEB T C BN N NNG CAO HocLapTrinhWeb.COM Ghi Large Objects vo Database Cc bc thc hin To Command vi cu lnh thch hp (Insert/Update) Truyn tham s c kiu BLOB/CLOB Tnh ton gi tr cho tham s c kiu BLOB/CLOB Thi hnh cu lnh ca Command </li> <li> 15. 1515 HC LP TRNH WEB T C BN N NNG CAO HocLapTrinhWeb.COM Minh ha ghi Large Objects voMinh ha ghi Large Objects vo DatabaseDatabase Cp nht field LargePhoto trong bng Production.ProductPhoto, gi tr l mt tp tin hnh nh c sn To Command, c cu lnh Update cha 1 tham s, tham s c kiu l VarBinary M tp tin hnh nh, c gi tr vo mng byte Thi hnh Command vi gi tr ca tham s l mng byte </li> <li> 16. 1616 HC LP TRNH WEB T C BN N NNG CAO HocLapTrinhWeb.COM Bi thc hnh c BLOB v ghi ra tp tin dng hnh nh </li> </ul>