Given I have to dump a lot amount of inserts in a short period managed to dump all records to a file and then loading them by the load data infile sentence of mysql. This was working fine but now I compress a little more the values into a blob field to make less inserts. The problem is that I cant find a way to dump the blob field into the file so when loading data inserts the correct values. I've tried different ways but no happy ending and want to avoid inserting one by one.
Has anyone knows how to do this properly?
Store the HEX()'d string of your blob data in the file.
For your SQL, use the SET
clause. For example:
LOAD DATA INFILE 'path/to/file.txt'
INTO TABLE mytable
(column1, column2, @hexColumn3)
SET column3=UNHEX(@hexColumn3);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With