Mysql – How thesqldump replaces special characters during dumping records

dumpMySQLmysqldump

i am trying to dump a particular row using java.

So that i retrieve the data by using record sets and i manually written sql script code by appending the dynamic records.

But my problem is i could not write the script for blob data fields.

Because there are some special characters are present inside blob type fields.

i need to know how mysqldump.exe is replacing special characters ?

If i know the detail means i can replace those characters as same as mysqldump process.

Best Answer

There are two ways: string and hexadecimal notation, e.g.:

  • 'abc\' as string will be like this -> 'abc\\', all special characters are escaped
  • 'abc\' as hexadecimal will be like this -> 0x6162635C, you can test it using HEX function - SELECT HEX('abc\\');

You can choose one of those methods. Also, try to play with --hex-blob option and check results.