Thomas Spahni wrote:

> On Mon, 26 Aug 2002, Donald J Miller wrote:
>
> > Hello everyone,
> >
> > I am trying to create a mysql table to hold either the entire contents
> > of text or WordPerfect files.  I've read about BLOB or TEXT type columns
> > so I've tried creating a table such as:
> >
> > CREATE TABLE filetest(fileid int(5) not null, file BLOB null);
>
> so far, so good ... it will not store more than 65535 bytes in file
>
> > I 've created the table and have used LOAD DATA in order to populate the
> > database however I get numerous errors.
>
> WORD documents are binary files. Using LOAD DATA you have to escape them
> properly. Have a look at the LOAD_FILE(file_name) function instead.
>
> > Can someone shed some light as to how to do this correctly?  What
> > would be the proper query to retrieve this file out of mysql?
>
> SELECT file FROM filetest WHERE fileid = 12345;
>
> Regards,
> Thomas
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Donald,
I'd recommend just storing the filename (and possibly path) and using  an
application to fetch the file from the OS filesystem. There are several reasons.
1. Your database files become too large to effectivly manage (try backing up a 5
GB table every night).
2. Storing files on the OS filesystem allows you to backup only files that have
changed.
3. If you store the files in MySQL and you later decide to switch DB software,
you'll pull your hair out!
4. You can archive the files that don't change on CD.

walt


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to