Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: using blobs...



 LOAD_FILE() should work. Note that it doesn't seem to support relative 
paths. ALso note that if you display the row, it will vomit the raw file 
contents all over your tty, triggering much weirdness as your tty 
misinterprets much of it as terminal control characters. 


    mysql> insert into foo (blob_col) values ( LOAD_FILE('/tmp/foo.doc') ); 

    mysql> update foo set blob_col = LOAD_FILE('/tmp/foo.doc') where id = 1; 



On Mon, Apr 21, 2008 at 12:47 PM, Stephen Adler <[hidden email]> wrote: 
> Hi Blu! (Happy Boston Marathon day...) 
> 
>  I'm spending the day playing around with a DB schema in which I want to 
> store word document files in blob fields in one of my tables. I want to test 
> my db schema by issuing sql command at the mysql prompt. So the question I 
> have, is how can I insert a .doc file into my database using the mysql 
> command line interface? I've spotted a bunch of visual basic, C# and php 
> examples of how to stuff a bunch of bits into the blob field, but they all 
> seem to involve defining some large array in which the whole file was read 
> into, then passing the pointer to the array in the values part of the insert 
> statement. Does this mean that I have to write code in order to stuff bits 
> into the field? 
> 
>  Thanks in advance... 
> 
>  Cheers. Steve. 
> 
> 
> 
> 
>  -- 
>  This message has been scanned for viruses and 
>  dangerous content by MailScanner, and is 
>  believed to be clean. 
> 
>  _______________________________________________ 
>  Discuss mailing list 
>  [hidden email] 
>  http://lists.blu.org/mailman/listinfo/discuss
> 


BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org