![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi, I'm trying to use MySQL Blob columns to store files (docs,gifs,pdf.....) but I'm getting corrupted files from the DB. the applications runs php, loading file content with addslashes but in order to spot the error i've tried it with mysql only like this: column file is a MEDIUMBLOB INSERT INTO XXXXXX SET file=LOAD_FILE("/tmp/teste.pdf"); and them SELECT file INTO OUTFILE "/tmp/teste_frommysql.pdf" FROM XXXXXX WHERE id=12; and teste_frommysql.pdf cant be loaded ls -l shoes that the sizes are different: 270713 Aug 2 11:28 /tmp/teste.pdf (ORIGINAL) 277405 Aug 10 17:21 /tmp/teste_frommysql.pdf I've made a test with a text file and noticed that the file from MySQL has a added LineBreak at the end.Is thta the problem? how can I fix this? This is my config: Linux 2.6.11-1.1369_FC4 mysql-server-4.1.11-2 mysql-4.1.11-2 cat /etc/my.cnf [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock [mysql.server] user=mysql basedir=/var/lib [safe_mysqld] err-log=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid key_buffer_size=64M table_cache=256 sort_buffer_size=4M read_buffer_size=1M |
#3
| |||
| |||
|
|
Hello. Use DUMPFILE instead of OUTFILE. See: http://dev.mysql.com/doc/mysql/en/select.html jose nuno neto <jose.neto (AT) liber4e (DOT) com> wrote: Hi, I'm trying to use MySQL Blob columns to store files (docs,gifs,pdf.....) but I'm getting corrupted files from the DB. the applications runs php, loading file content with addslashes but in order to spot the error i've tried it with mysql only like this: column file is a MEDIUMBLOB INSERT INTO XXXXXX SET file=LOAD_FILE("/tmp/teste.pdf"); and them SELECT file INTO OUTFILE "/tmp/teste_frommysql.pdf" FROM XXXXXX WHERE id=12; and teste_frommysql.pdf cant be loaded ls -l shoes that the sizes are different: 270713 Aug 2 11:28 /tmp/teste.pdf (ORIGINAL) 277405 Aug 10 17:21 /tmp/teste_frommysql.pdf I've made a test with a text file and noticed that the file from MySQL has a added LineBreak at the end.Is thta the problem? how can I fix this? This is my config: Linux 2.6.11-1.1369_FC4 mysql-server-4.1.11-2 mysql-4.1.11-2 cat /etc/my.cnf [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock [mysql.server] user=mysql basedir=/var/lib [safe_mysqld] err-log=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid key_buffer_size=64M table_cache=256 sort_buffer_size=4M read_buffer_size=1M |
#4
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |