Loading client/client_priv.h +1 −1 Original line number Diff line number Diff line Loading @@ -45,5 +45,5 @@ enum options_client OPT_COMPATIBLE, OPT_RECONNECT, OPT_DELIMITER, OPT_SECURE_AUTH, OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET, OPT_CREATE_OPTIONS, OPT_START_POSITION, OPT_STOP_POSITION, OPT_START_DATETIME, OPT_STOP_DATETIME, OPT_SIGINT_IGNORE OPT_SIGINT_IGNORE, OPT_HEXBLOB }; client/mysqldump.c +52 −9 Original line number Diff line number Diff line Loading @@ -81,7 +81,8 @@ static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick= 1, extended_insert= 1, opt_alldbs=0,opt_create_db=0,opt_first_slave=0,opt_set_charset, opt_autocommit=0,opt_master_data,opt_disable_keys=1,opt_xml=0, opt_delete_master_logs=0, tty_password=0, opt_single_transaction=0, opt_comments= 0, opt_compact= 0; opt_single_transaction=0, opt_comments= 0, opt_compact= 0, opt_hex_blob=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, Loading Loading @@ -316,6 +317,8 @@ static struct my_option my_long_options[] = {"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, "Dump BLOBs in HEX. this mode does not work with extended-insert", (gptr*) &opt_hex_blob, (gptr*) &opt_hex_blob, 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} }; Loading Loading @@ -1507,6 +1510,7 @@ static void dumpTable(uint numFields, char *table) for (i = 0; i < mysql_num_fields(res); i++) { int is_blob; if (!(field = mysql_fetch_field(res))) { sprintf(query,"%s: Not enough fields from table %s! Aborting.\n", Loading @@ -1515,6 +1519,17 @@ static void dumpTable(uint numFields, char *table) error= EX_CONSCHECK; goto err; } /* 63 is my_charset_bin. If charsetnr is not 63, we have not a BLOB but a TEXT column. we'll dump it in hex only BLOB columns. */ is_blob= (opt_hex_blob && field->charsetnr == 63 && (field->type == FIELD_TYPE_BLOB || field->type == FIELD_TYPE_LONG_BLOB || field->type == FIELD_TYPE_MEDIUM_BLOB || field->type == FIELD_TYPE_TINY_BLOB)) ? 1 : 0; if (extended_insert) { ulong length = lengths[i]; Loading @@ -1535,13 +1550,29 @@ static void dumpTable(uint numFields, char *table) error= EX_EOM; goto err; } if (opt_hex_blob && is_blob) { ulong counter; unsigned char *ptr= row[i]; dynstr_append(&extended_row, "0x"); for (counter = 0; counter < lengths[i]; counter++) { char xx[3]; sprintf(xx, "%02X", ptr[counter]); dynstr_append(&extended_row, xx); } } else { dynstr_append(&extended_row,"'"); extended_row.length += mysql_real_escape_string(&mysql_connection, &extended_row.str[extended_row.length],row[i],length); &extended_row.str[extended_row.length], row[i],length); extended_row.str[extended_row.length]='\0'; dynstr_append(&extended_row,"'"); } } else { /* change any strings ("inf", "-inf", "nan") into NULL */ Loading Loading @@ -1591,6 +1622,18 @@ static void dumpTable(uint numFields, char *table) print_quoted_xml(md_result_file, row[i], lengths[i]); fputs("</field>\n", md_result_file); } else if (opt_hex_blob && is_blob) { /* 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]); } Loading innobase/dict/dict0dict.c +36 −23 Original line number Diff line number Diff line Loading @@ -53,6 +53,30 @@ rw_lock_t dict_operation_lock; /* table create, drop, etc. reserve /* Identifies generated InnoDB foreign key names */ static char dict_ibfk[] = "_ibfk_"; /********************************************************************** Compares NUL-terminated UTF-8 strings case insensitively. NOTE: the prototype of this function is copied from ha_innodb.cc! If you change this function, you MUST change also the prototype here! */ extern int innobase_strcasecmp( /*================*/ /* out: 0 if a=b, <0 if a<b, >1 if a>b */ const char* a, /* in: first string to compare */ const char* b); /* in: second string to compare */ /********************************************************************** Makes all characters in a NUL-terminated UTF-8 string lower case. NOTE: the prototype of this function is copied from ha_innodb.cc! If you change this function, you MUST change also the prototype here! */ extern void innobase_casedn_str( /*================*/ char* a); /* in/out: string to put in lower case */ /************************************************************************** Adds a column to the data dictionary hash table. */ static Loading Loading @@ -2066,7 +2090,7 @@ dict_foreign_find_index( break; } if (0 != ut_cmp_in_lower_case(columns[i], if (0 != innobase_strcasecmp(columns[i], col_name)) { break; } Loading Loading @@ -2436,7 +2460,7 @@ dict_scan_col( col = dict_table_get_nth_col(table, i); if (0 == ut_cmp_in_lower_case(col->name, *name)) { if (0 == innobase_strcasecmp(col->name, *name)) { /* Found */ *success = TRUE; Loading Loading @@ -2528,30 +2552,19 @@ dict_scan_table_name( table_name_len = strlen(table_name); /* Copy database_name, '/', table_name, '\0' */ ref = mem_heap_alloc(heap, database_name_len + table_name_len + 2); #ifdef __WIN__ ut_cpy_in_lower_case(ref, database_name, database_name_len); #else if (srv_lower_case_table_names) { ut_cpy_in_lower_case(ref, database_name, database_name_len); } else { memcpy(ref, database_name, database_name_len); } #endif (ref)[database_name_len] = '/'; #ifdef __WIN__ ut_cpy_in_lower_case(ref + database_name_len + 1, table_name, table_name_len + 1); #else ref[database_name_len] = '/'; memcpy(ref + database_name_len + 1, table_name, table_name_len + 1); #ifndef __WIN__ if (srv_lower_case_table_names) { ut_cpy_in_lower_case(ref + database_name_len + 1, table_name, table_name_len + 1); } else { strcpy(ref + database_name_len + 1, table_name); #endif /* !__WIN__ */ /* The table name is always put to lower case on Windows. */ innobase_casedn_str(ref); #ifndef __WIN__ } #endif #endif /* !__WIN__ */ *success = TRUE; *ref_name = ref; Loading innobase/include/ut0byte.h +0 −19 Original line number Diff line number Diff line Loading @@ -229,25 +229,6 @@ ut_bit_set_nth( ulint a, /* in: ulint */ ulint n, /* in: nth bit requested */ ibool val); /* in: value for the bit to set */ /**************************************************************** Copies a string to a memory location, setting characters to lower case. */ void ut_cpy_in_lower_case( /*=================*/ char* dest, /* in: destination */ const char* source, /* in: source */ ulint len); /* in: string length */ /**************************************************************** Compares two strings when converted to lower case. */ int ut_cmp_in_lower_case( /*=================*/ /* out: -1, 0, 1 if str1 < str2, str1 == str2, str1 > str2, respectively */ const char* str1, /* in: string1 */ const char* str2); /* in: string2 */ #ifndef UNIV_NONINL #include "ut0byte.ic" Loading innobase/os/os0file.c +5 −0 Original line number Diff line number Diff line Loading @@ -2010,6 +2010,11 @@ os_file_read( return(TRUE); } fprintf(stderr, "InnoDB: Error: tried to read %lu bytes at offset %lu %lu.\n" "InnoDB: Was only able to read %ld.\n", (ulong)n, (ulong)offset_high, (ulong)offset, (long)ret); #endif #ifdef __WIN__ error_handling: Loading Loading
client/client_priv.h +1 −1 Original line number Diff line number Diff line Loading @@ -45,5 +45,5 @@ enum options_client OPT_COMPATIBLE, OPT_RECONNECT, OPT_DELIMITER, OPT_SECURE_AUTH, OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET, OPT_CREATE_OPTIONS, OPT_START_POSITION, OPT_STOP_POSITION, OPT_START_DATETIME, OPT_STOP_DATETIME, OPT_SIGINT_IGNORE OPT_SIGINT_IGNORE, OPT_HEXBLOB };
client/mysqldump.c +52 −9 Original line number Diff line number Diff line Loading @@ -81,7 +81,8 @@ static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick= 1, extended_insert= 1, opt_alldbs=0,opt_create_db=0,opt_first_slave=0,opt_set_charset, opt_autocommit=0,opt_master_data,opt_disable_keys=1,opt_xml=0, opt_delete_master_logs=0, tty_password=0, opt_single_transaction=0, opt_comments= 0, opt_compact= 0; opt_single_transaction=0, opt_comments= 0, opt_compact= 0, opt_hex_blob=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, Loading Loading @@ -316,6 +317,8 @@ static struct my_option my_long_options[] = {"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, "Dump BLOBs in HEX. this mode does not work with extended-insert", (gptr*) &opt_hex_blob, (gptr*) &opt_hex_blob, 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} }; Loading Loading @@ -1507,6 +1510,7 @@ static void dumpTable(uint numFields, char *table) for (i = 0; i < mysql_num_fields(res); i++) { int is_blob; if (!(field = mysql_fetch_field(res))) { sprintf(query,"%s: Not enough fields from table %s! Aborting.\n", Loading @@ -1515,6 +1519,17 @@ static void dumpTable(uint numFields, char *table) error= EX_CONSCHECK; goto err; } /* 63 is my_charset_bin. If charsetnr is not 63, we have not a BLOB but a TEXT column. we'll dump it in hex only BLOB columns. */ is_blob= (opt_hex_blob && field->charsetnr == 63 && (field->type == FIELD_TYPE_BLOB || field->type == FIELD_TYPE_LONG_BLOB || field->type == FIELD_TYPE_MEDIUM_BLOB || field->type == FIELD_TYPE_TINY_BLOB)) ? 1 : 0; if (extended_insert) { ulong length = lengths[i]; Loading @@ -1535,13 +1550,29 @@ static void dumpTable(uint numFields, char *table) error= EX_EOM; goto err; } if (opt_hex_blob && is_blob) { ulong counter; unsigned char *ptr= row[i]; dynstr_append(&extended_row, "0x"); for (counter = 0; counter < lengths[i]; counter++) { char xx[3]; sprintf(xx, "%02X", ptr[counter]); dynstr_append(&extended_row, xx); } } else { dynstr_append(&extended_row,"'"); extended_row.length += mysql_real_escape_string(&mysql_connection, &extended_row.str[extended_row.length],row[i],length); &extended_row.str[extended_row.length], row[i],length); extended_row.str[extended_row.length]='\0'; dynstr_append(&extended_row,"'"); } } else { /* change any strings ("inf", "-inf", "nan") into NULL */ Loading Loading @@ -1591,6 +1622,18 @@ static void dumpTable(uint numFields, char *table) print_quoted_xml(md_result_file, row[i], lengths[i]); fputs("</field>\n", md_result_file); } else if (opt_hex_blob && is_blob) { /* 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]); } Loading
innobase/dict/dict0dict.c +36 −23 Original line number Diff line number Diff line Loading @@ -53,6 +53,30 @@ rw_lock_t dict_operation_lock; /* table create, drop, etc. reserve /* Identifies generated InnoDB foreign key names */ static char dict_ibfk[] = "_ibfk_"; /********************************************************************** Compares NUL-terminated UTF-8 strings case insensitively. NOTE: the prototype of this function is copied from ha_innodb.cc! If you change this function, you MUST change also the prototype here! */ extern int innobase_strcasecmp( /*================*/ /* out: 0 if a=b, <0 if a<b, >1 if a>b */ const char* a, /* in: first string to compare */ const char* b); /* in: second string to compare */ /********************************************************************** Makes all characters in a NUL-terminated UTF-8 string lower case. NOTE: the prototype of this function is copied from ha_innodb.cc! If you change this function, you MUST change also the prototype here! */ extern void innobase_casedn_str( /*================*/ char* a); /* in/out: string to put in lower case */ /************************************************************************** Adds a column to the data dictionary hash table. */ static Loading Loading @@ -2066,7 +2090,7 @@ dict_foreign_find_index( break; } if (0 != ut_cmp_in_lower_case(columns[i], if (0 != innobase_strcasecmp(columns[i], col_name)) { break; } Loading Loading @@ -2436,7 +2460,7 @@ dict_scan_col( col = dict_table_get_nth_col(table, i); if (0 == ut_cmp_in_lower_case(col->name, *name)) { if (0 == innobase_strcasecmp(col->name, *name)) { /* Found */ *success = TRUE; Loading Loading @@ -2528,30 +2552,19 @@ dict_scan_table_name( table_name_len = strlen(table_name); /* Copy database_name, '/', table_name, '\0' */ ref = mem_heap_alloc(heap, database_name_len + table_name_len + 2); #ifdef __WIN__ ut_cpy_in_lower_case(ref, database_name, database_name_len); #else if (srv_lower_case_table_names) { ut_cpy_in_lower_case(ref, database_name, database_name_len); } else { memcpy(ref, database_name, database_name_len); } #endif (ref)[database_name_len] = '/'; #ifdef __WIN__ ut_cpy_in_lower_case(ref + database_name_len + 1, table_name, table_name_len + 1); #else ref[database_name_len] = '/'; memcpy(ref + database_name_len + 1, table_name, table_name_len + 1); #ifndef __WIN__ if (srv_lower_case_table_names) { ut_cpy_in_lower_case(ref + database_name_len + 1, table_name, table_name_len + 1); } else { strcpy(ref + database_name_len + 1, table_name); #endif /* !__WIN__ */ /* The table name is always put to lower case on Windows. */ innobase_casedn_str(ref); #ifndef __WIN__ } #endif #endif /* !__WIN__ */ *success = TRUE; *ref_name = ref; Loading
innobase/include/ut0byte.h +0 −19 Original line number Diff line number Diff line Loading @@ -229,25 +229,6 @@ ut_bit_set_nth( ulint a, /* in: ulint */ ulint n, /* in: nth bit requested */ ibool val); /* in: value for the bit to set */ /**************************************************************** Copies a string to a memory location, setting characters to lower case. */ void ut_cpy_in_lower_case( /*=================*/ char* dest, /* in: destination */ const char* source, /* in: source */ ulint len); /* in: string length */ /**************************************************************** Compares two strings when converted to lower case. */ int ut_cmp_in_lower_case( /*=================*/ /* out: -1, 0, 1 if str1 < str2, str1 == str2, str1 > str2, respectively */ const char* str1, /* in: string1 */ const char* str2); /* in: string2 */ #ifndef UNIV_NONINL #include "ut0byte.ic" Loading
innobase/os/os0file.c +5 −0 Original line number Diff line number Diff line Loading @@ -2010,6 +2010,11 @@ os_file_read( return(TRUE); } fprintf(stderr, "InnoDB: Error: tried to read %lu bytes at offset %lu %lu.\n" "InnoDB: Was only able to read %ld.\n", (ulong)n, (ulong)offset_high, (ulong)offset, (long)ret); #endif #ifdef __WIN__ error_handling: Loading