Enrico wrote:
[SNIP]
Post by Enricodevo scrivere una query in SQL. Ho visto sulla documentazione di
PostgreSQL che
test=> CREATE TABLE fruit (name CHAR(30), image OID);
test=> INSERT INTO fruit
test=> VALUES ('peach', lo_import('/usr/images/peach.jpg'));
test=> SELECT lo_export(fruit.image, '/tmp/outimage.jpg')
test=> FROM fruit test-> WHERE name = 'peach';
Stavo cercando un comando simile per MySQL
ciao,
Enrico
La funzione che cerchi e' LOAD_FILE
http://dev.mysql.com/doc/mysql/en/String_functions.html
LOAD_FILE(file_name)
Reads the file and returns the file contents as a string. The file
must be located on the server, you must specify the full pathname to the
file, and you must have the FILE privilege. The file must be readable by
all and be smaller than max_allowed_packet bytes. If the file doesn't
exist or cannot be read because one of the preceding conditions is not
satisfied, the function returns NULL.
mysql> UPDATE tbl_name
SET blob_column=LOAD_FILE('/tmp/picture')
WHERE id=1;
Before MySQL 3.23, you must read the file inside your application
and create an INSERT statement to update the database with the file
contents. If you are using the MySQL++ library, one way to do this can
be found in the MySQL++ manual, available at http://dev.mysql.com/doc/.
Ciao
gmax
--
____ ____ _____ _ _
/ _ | \(____ ( \ / )
( (_| | | | / ___ |) X (
\___ |_|_|_\_____(_/ \_)
(_____|
Sapere, saper fare, fare, far sapere
http://gmax.oltrelinux.com