Home > database >  Urgent for BLOB object storage problem
Urgent for BLOB object storage problem

Time:10-05

Why I speak multimedia data stored in the image in the SQL Server data types, out of time, as long as more than 32765 files are read is not complete, are the most read 32765?
I with two functions are stored and read:
Store code:
Global function blob f_readfile (string strfilename)
Int intfileno//used to store a file handle
Int inttemp//used to cycle count
Int intcount//block number is used for log file
Long lngfilelength//length to hold the file
Blob blobret blobtemp//used for complete and temporary partitioned loading file data
Lngfilelength=filelength (strfilename)//get file size
Intcount=between lngfilelength/32765//file block number in
Intfileno=fileopen (strfilename streammode! , Read! , Shared!//get the file handle
For inttemp=1 to intcount//convert file to type BLOB data
Fileread (intfileno, blobtemp)//file read and write functions in the original concept, can automatically move pointer
Blobret=blobret + blobtemp
Next
Fileclose (intfileno)//release the file resources
Return blobret//return the BLOB data type


Read function code:
Global subroutine f_writefile (blob blobvariable, string strfilename)
Int intcount//block number is used for log file
Int inttemp//used to cycle count
Int intfileno//used to store a file handle
Blob blobtemp
Intcount=between (len (blobvariable)/32765)//get the length of the BLOB data
Intfileno=fileopen (strfilename streammode! The write! , LockWrite! The replace!//get the file handle
For inttemp=1 to intcount//BLOB type data into the file
Blobtemp=blobmid (blobvariable, * (inttemp - 1) + 1327 65 32765)
Filewrite (intfileno blobtemp)
Next
Fileclose (intfileno)//release the file resources

CodePudding user response:

The length of the handle problems
Consult example of pb help

CodePudding user response:

Can say the detailed point
thank you

CodePudding user response:

Reference pb processing 32 k example:
This example reads a file exceeding 32765 bytes. After the script has read the file into the blob tot_b, you can call the SetPicture or String function to make use of the data, depending on the contents of the file:

Integer li_FileNum, loops, I

Long flen, bytes_read new_pos

Blob, b tot_b

//Set a wait cursor

SetPointer (HourGlass!

//Get the file length, and open the file

Flen=FileLength (sle_filename. Text)

Li_FileNum=FileOpen (sle_filename. Text, & amp;

StreamMode! , Read! , LockRead!)

//Determine how many times to call FileRead

IF flen & gt; THEN 32765

IF the Mod (flen, 32765)=0 THEN

Loops=flen/32765

The ELSE

Loops=(flen/32765) + 1

END the IF

The ELSE

Loops=1

END the IF

//Read the file

New_pos=1

FOR I=1 to loops

Bytes_read=FileRead (li_FileNum, b)

Tot_b=tot_b + b

NEXT

FileClose (li_FileNum)

CodePudding user response:

After more than 32 k, must read cycle

CodePudding user response:

Under this folder
C: \ Program Files \ Sybase \ Shared \ original concept
There is a
Pbodbx0. Ini
X corresponding pb version you
Open search
[Microsoft SQL Server]
Modify the
PBMaxBlobSize='32767'
Change of the size you want, save
When released, remember the ini also released,

CodePudding user response:

//try this, change the function code to the following code:


Global subroutine f_writefile (blob blobvariable, string strfilename)
Int intcount//block number is used for log file
Int inttemp//used to cycle count
Int intfileno//used to store a file handle
Blob blobtemp
Long ll_len

//intcount=between (len (blobvariable)/32765)//get the length of the BLOB data

//whether the length is more than 32765 Begin
Ll_len=between (len (blobvariable))
If ll_len & gt; Then 32765
Intcount=(ll_len - 1)/32765 + 1
The else
Intcount=1
End the if
//whether the length is more than 32765 End

Intfileno=fileopen (strfilename streammode! The write! , LockWrite! The replace!//get the file handle
For inttemp=1 to intcount//BLOB type data into the file
Blobtemp=blobmid (blobvariable, * (inttemp - 1) + 1327 65 32765)
Filewrite (intfileno blobtemp)
Next
Fileclose (intfileno)//release the file resources

CodePudding user response:

//try this, change the function code to the following code:


Global subroutine f_writefile (blob blobvariable, string strfilename)
Int intcount//block number is used for log file
Int inttemp//used to cycle count
Int intfileno//used to store a file handle
Blob blobtemp
Long ll_len

//intcount=between (len (blobvariable)/32765)//get the length of the BLOB data

//whether the length is more than 32765 Begin
Ll_len=between (len (blobvariable))
If ll_len & gt; Then 32765
Intcount=(ll_len - 1)/32765 + 1
The else
Intcount=1
End the if
//whether the length is more than 32765 End

Intfileno=fileopen (strfilename streammode! The write! , LockWrite! The replace!//get the file handle
For inttemp=1 to intcount//BLOB type data into the file
Blobtemp=blobmid (blobvariable, * (inttemp - 1) + 1327 65 32765)
Filewrite (intfileno blobtemp)
Next
Fileclose (intfileno)//release the file resources

CodePudding user response:

//try this, change the function code to the following code:


nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related