diff -ru mysql-4.0.21.orig/client/client_priv.h mysql-4.0.21/client/client_priv.h --- mysql-4.0.21.orig/client/client_priv.h 2004-09-07 07:29:40.000000000 +0900 +++ mysql-4.0.21/client/client_priv.h 2004-10-03 21:13:18.000000000 +0900 @@ -38,4 +38,5 @@ OPT_SSL_KEY, OPT_SSL_CERT, OPT_SSL_CA, OPT_SSL_CAPATH, OPT_SSL_CIPHER, OPT_SHUTDOWN_TIMEOUT, OPT_LOCAL_INFILE, OPT_DELETE_MASTER_LOGS, - OPT_PROMPT, OPT_IGN_LINES,OPT_TRANSACTION, OPT_FRM }; + OPT_PROMPT, OPT_IGN_LINES,OPT_TRANSACTION, OPT_FRM + , OPT_HEXBLOB}; diff -ru mysql-4.0.21.orig/client/mysqldump.c mysql-4.0.21/client/mysqldump.c --- mysql-4.0.21.orig/client/mysqldump.c 2004-09-07 07:29:39.000000000 +0900 +++ mysql-4.0.21/client/mysqldump.c 2004-10-03 21:27:21.000000000 +0900 @@ -78,7 +78,7 @@ opt_alldbs=0,opt_create_db=0,opt_first_slave=0, opt_autocommit=0,opt_master_data,opt_disable_keys=0,opt_xml=0, opt_delete_master_logs=0, tty_password=0, - opt_single_transaction=0, opt_comments= 0; + opt_single_transaction=0, opt_comments= 0, opt_hex=0; static ulong opt_max_allowed_packet, opt_net_buffer_length; static MYSQL mysql_connection,*sock=0; static char insert_pat[12 * 1024],*opt_password=0,*current_user=0, @@ -248,6 +248,8 @@ {"comments", 'i', "Write additional information.", (gptr*) &opt_comments, (gptr*) &opt_comments, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, + {"hex-blob", OPT_HEXBLOB, "HEXdump BLOB data. this mode does not work with extended-insert.", + (gptr*) &opt_hex, (gptr*) &opt_hex, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; @@ -1180,6 +1182,22 @@ if (opt_xml) print_quoted_xml(md_result_file, field->name, row[i], lengths[i]); + else if (opt_hex && (field->type == FIELD_TYPE_BLOB + || FIELD_TYPE_LONG_BLOB == field->type + || FIELD_TYPE_MEDIUM_BLOB == field->type + || FIELD_TYPE_TINY_BLOB == field->type + ) + ) + { /* sakaik got this idea. */ + ulong counter; + char xx[4]; + unsigned char *ptr = row[i]; + fputs("0x", md_result_file); + for (counter = 0; counter < lengths[i]; counter++) { + sprintf(xx, "%02X", ptr[counter]); + fputs(xx, md_result_file); + } + } else unescape(md_result_file, row[i], lengths[i]); }