Save binary file from BLOB field with TmySQL

Save binary file from BLOB field with TmySQL

Postby vilian » Tue Jan 12, 2010 1:58 pm

I have a very large file. I need to split this file into several pieces and save in MySQL database.

I'm using fopen / fread to read these parts of the file, but can not save them in a blob field in my database.

As I read the parts of the file to be able to write into the blob?
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Save binary file from BLOB field with TmySQL

Postby Lautaro » Tue Jan 12, 2010 4:04 pm

Hello Vilian,

You can convert the parts in a mime64 format and save this in a varchar field like this
Code: Select all  Expand view

local nhfile
local ctemp

...
...

 do while fread(nhfile,@ctemp,5000) > 0
     xxobj:field := cmimeenc(ctemp)
     ....
     ....
enddo
 


where xxobj is the form with you open the mysql database.

For read only replace cmimeenc with cmimedec.

This working in harbour.

Best Regards,

Lautaro Moreira
Osorno
Chile

PD : Sorry for my bad english :oops:
User avatar
Lautaro
 
Posts: 322
Joined: Fri Oct 07, 2005 2:44 pm
Location: Osorno, Chile

Re: Save binary file from BLOB field with TmySQL

Postby vilian » Tue Jan 12, 2010 11:17 pm

Thanks Lautaro.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: jmartial and 15 guests