Multipart upload and download-Database Operations

Source: Internet
Author: User
The files are stored in the database as binary streams. If the files are large, they must be processed in parts. Otherwise, the speed is very slow.
Ado. Net removed the AppendChunk and getchunk functions in ADO,
Therefore, to upload files to a database in multiple parts or to download files from a database in multiple parts, you must use ADO instead of ADO. Net (at least within my research scope)

The core of multipart upload and download is as follows: Code
Dim FS as new system. Io. filestream (m_filepath, Io. filemode. Open, Io. fileaccess. Read)
Dim RS as ADODB. recordset = new ADODB. recordset
Upload:
For J = 0 to chunknum-1
Dim pchunkbuffer (chunksize-1) as byte
FS. Read (pchunkbuffer, 0, pchunkbuffer. length)
Rs. Fields (wsmanageglobalparam. g_fieldfiledata). AppendChunk (pchunkbuffer)
Pchunkbuffer = nothing
Next
Download:
For J = 0 to chunknum-1
Dim pchunkbuffer (chunksize-1) as byte
Pchunkbuffer = Rs. Fields (wsmanageglobalparam. g_fieldfiledata). getchunk (chunksize)
FS. Write (pchunkbuffer, 0, pchunkbuffer. length)
Pchunkbuffer = nothing
Next

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.