Load data using blob field

Given that I have to dump a large number of attachments in a short period, I deleted all the records in the file and then loaded them with the load data infile mysql sentence. This worked fine, but now I am compressing a bit more values ​​in the blob field to make fewer inserts. The problem is that I cannot find a way to reset the blob field to a file, so the correct values ​​are inserted when loading the data. I tried different ways, but not a happy ending, and I want to not insert one by one.

Does anyone know how to do this correctly?

+4
source share
1 answer

Save the string HEX () 'd of your blob data in a file.

For your SQL, use the SET clause, for example,

LOAD DATA INFILE 'path.txt' INTO TABLE mytable (column1, column2, @ hexColumn3) SET column3 = UNHEX (@ hexColumn3);

+7
source

Source: https://habr.com/ru/post/1344190/


All Articles