List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:October 20 1999 6:19pm
Subject:Re: retrieving a BLOB
View as plain text  
>>>>> "Gerrit" == Gerrit Hiddink <hiddinkg@stripped> writes:

Gerrit> sinisa@stripped wrote:
>> > >> mysql> insert into blobs values (1,
> load_file("/tmp/anempeg.mpg"));
>> > >> mysql> select a_blob from blobs where id=1 into outfile
> '/tmp/theempeg.mpg';

>> You can not do it that way.

>> Instead of doing that, you must make a small app that will fetch mpeg
>> into memory and then simply write it in it's binary form on disk.

Gerrit> In that case I'd like to suggest adding a function that does precisely
Gerrit> the opposite of load_file, eg. dump_file, that allows me to load
Gerrit> and dump blobs at will. If MySQL supports loading blobs from file into
Gerrit> a table, then it should also support dumping them from a table back
Gerrit> into a file. Unmodified. A user simply expects these kind of things to
Gerrit> be symmetrical. At least, I did.

Gerrit> The advantage of dumping it into a file is that the blob (typically
Gerrit> large)
Gerrit> can be written in, for example, a WWW server's directory, so that it is
Gerrit> ready to be served on the WWW. If I have to extract it via a client
Gerrit> layer,
Gerrit> then the blob gets copied from the database into a socket, gets copied
Gerrit> from the socket buffer into the client buffer, then into my own buffer,
Gerrit> and then gets copied into a file. That's a lot of copies, reducing
Gerrit> performance dramatically if the blobs are really large.
Gerrit> I've seen other DBMS'es that supported blobs, and I think MySQL is
Gerrit> getting there, slowly. But it still needs some more support for blobs.
Gerrit> That's just my humble opinion.


I shall add this to our TODO.


PS: Sinisa, can you take a look at DUMP_FILE(), while I am away...
retrieving a BLOBGerrit Hiddink19 Oct
  • Re: retrieving a BLOBsinisa19 Oct
  • Re: retrieving a BLOBGerrit Hiddink19 Oct
    • Re: retrieving a BLOBMichael Widenius20 Oct
      • Re: retrieving a BLOBdesenvolvimento5 Apr
    • Re: retrieving a BLOBsinisa20 Oct
  • Re: retrieving a BLOBGerrit Hiddink20 Oct
    • Re: retrieving a BLOBMichael Widenius20 Oct