将文件插入mysql Blob [英] Insert file into mysql Blob
本文介绍了将文件插入mysql Blob的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试在Blob字段上插入Open Office文档. 为此,我尝试
I try to insert a Open Office document on a blob field. To do this I try
INSERT INTO my_table (stamp, docFile) VALUES (NOW(), LOAD_FILE('/tmp/my_file.odt'));
这在Windows上效果很好,但在Mac OS上,该文件未加载到docFile字段中.
This works well on windows but on Mac Os the file isn't load on docFile field.
有人对此有经验吗?
谢谢
推荐答案
File.separator
是/
或\
,用于将路径拆分到特定文件.例如,在Windows上,它是\
或C:\Documents\Test
.但是在Mac上是/
.
File.separator
is either /
or \
that is used to split up the path to a specific file. For example on Windows it is \
or C:\Documents\Test
. But on Mac it is /
.
因此,使用File.separator
而不是/
或\
,则它对于Mac和Windows均适用.
So use File.separator
instead of /
or \
, then it will work for both Mac and Windows.
您可以更新类型为"blob"的列值
You can Update the column value having type 'blob'
UPDATE `TableName` SET `ColumnName`=LOAD_FILE('FilePath/FileName.bin') WHERE `YourCondition`
// FilePath -> C:/foldername/filename.bin
这篇关于将文件插入mysql Blob的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文