Home > database >  Consult everybody pb, to extract files from the database directly save to a local desktop have what
Consult everybody pb, to extract files from the database directly save to a local desktop have what

Time:09-25

Consult everybody pb, to extract files from the database directly save to a local desktop have what good method

CodePudding user response:

Server: updateblob
Client: selectblob

What other is readfile writefile blob data compression,
Small file or so to deal with,

CodePudding user response:

You write backwards, is fileread filewrite

CodePudding user response:

The fruit have enough energy or a special file processing, such as using FTP server storage file is better, use database storage file is not the best choice,

CodePudding user response:

refer to the second floor dawugui response:
you write backwards, is fileread filewrite


The tortoise brother man,,,

CodePudding user response:

Now do the client update, is now doing selectblob, updateblob

CodePudding user response:

Retrieved from the database file (blob) with selectblob statements, will remove the blob of archived for disk file can write a function with similar to the following statement:
//argument as_path for file name
//argument b_file for Blob taken from the database,
//call the method li_ret=uf_blob_file (as_path b_file)

Long li_filenum, ll_ret


Li_FileNum=FileOpen (as_path StreamMode! The Write! , LockReadWrite! The Replace!

If li_filenum & lt; 1 then
Messagebox (' mistakes', 'write to the file' + as_path + 'error! ', stopsign!)
Fileclose (li_filenum)
return -1;
End the if

Ll_ret=FileWriteEx (li_FileNum b_file)

Fileclose (li_filenum)

Return ll_ret
Remember the file name and path need to fill in, extensions can't make a mistake, or save the file may not be able to read,
Need to input the file name and path: GetFileSaveName (),

Specific writing process:

GetFileSaveName (' select storage file path and file name, ls_path, ls_filename, extension, filtering)

Selectblob blob column names into: lb_blob from table name...

Li_ret=uf_blob_file (ls_path lb_blob)

If li_ret=0 then
Messagebox (', 'success')
The else
Messagebox (', 'failure')
End the if

FileWriteEx in the above function () is a function PB11, PB9 may have to write the following:

Ll_len=len (b_file)

//if the file is larger than 32765, judge need how much time to read
IF ll_len & gt; THEN 32765
IF the Mod (ll_len, 32765)=0 THEN
Loops=ll_len/32765
The ELSE
Loops=(ll_len/32765) + 1
END the IF
The else
Loops=1
End the if
L_cur_js=1

I=1
The do while i<=loops

The yield ()

B_temp=blobmid b_file l_cur_js, (32765)

FileWrite (li_FileNum b_temp)

L_js -=l_cur_js
L_cur_js +=32765
L_js +=l_cur_js

I++
Loop

  • Related