HITESH,
Monday, April 15, 2002, 10:44:45 AM, you wrote:
HP> i had to recently encounter of entering the movie
HP> files in a database using the blob datatype.
HP> the problems i faced are:
HP> 1) while creating the table how do i mention the size
HP> of the blob field. say..
HP> create table test (name varchar(8),movie
HP> blob());
HP> how to mention its size....
Did you read about storage requirements for BLOB types in the MySQL
manual? There are 4 types of BLOB: TINYBLOB, BLOB, MEDIUMBLOB,
LONGBLOB and size of your field depends on which type of BLOB do you
use and size of your data.
Please, check the following link:
http://www.mysql.com/doc/n/o/node_368.html
So, if you decide to use TINYBLOB, for example, you should specify:
CREATE TABLE test(
name VARCHAR(8),
movie TINYBLOB);
HP> 2) i used the following command to insert a file
HP> ,though the query said ok but the select statement
HP> showed a null value.
HP> the command i used is...
HP> update test set
HP> movie=LOAD_FILE("/home/Hitesh/hitesh.txt") where
HP> name="hitesh";
It should work. Is there a row in your table named "hitesh"?
Look at:
mysql> update blobtest set movie=LOAD_FILE("/tmp/blob.txt") where name='vita';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select * from blobtest;
+------+-------------------------------------+
| name | movie |
+------+-------------------------------------+
| vita | This is a test of using BLOB type :)
|
+------+-------------------------------------+
1 row in set (0.00 sec)
HP> 3)what exactly is the max_allowed_packet and how to
HP> increase or decrease it.
It's very well covered in the manual. Please, check it:
http://www.mysql.com/doc/P/a/Packet_too_large.html
If you want to increase max_allowed_packet you should run mysqld with
the -O max_allowed_packet=# option.
HP> 4) how to retrive the file from the database.
Use SELECT statement ...
HP> i did go thru the entire manual but the specific query
HP> eluded me...like i got to know that a file locator is
HP> stored in the database which indirectly connects to
HP> that file and so on.
HP> i would be glad if my query is quickly answered upon..
HP> thanking you in advance.
HP> hitesh
--
For technical support contracts, goto https://order.mysql.com/
This email is sponsored by Ensita.net http://www.ensita.net/
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Victoria Reznichenko
/ /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED]
/_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net
<___/ www.mysql.com
---------------------------------------------------------------------
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