summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-11-08 17:53:32 +0200
committerunknown <monty@mysql.com>2004-11-08 17:53:32 +0200
commit47a5ac0e30599ea287fd206d4d21b7c304fd8c80 (patch)
tree8b26ea79c2cf98b50f42ec02a9c92e62c98f6276 /client
parent87abc13d6fcca99cccfdc76782cbbd0b880fa9bf (diff)
parent8793e2197aeab3a2d434a180f804f295de3a3cce (diff)
downloadmariadb-git-47a5ac0e30599ea287fd206d4d21b7c304fd8c80.tar.gz
Merge with 4.1 to get new thd->mem_root handling
BitKeeper/etc/ignore: auto-union client/mysqldump.c: Auto merged client/mysqltest.c: Auto merged innobase/include/row0mysql.h: Auto merged libmysql/libmysql.c: Auto merged mysql-test/r/ctype_ucs.result: Auto merged mysql-test/r/fulltext.result: Auto merged mysql-test/r/func_in.result: Auto merged mysql-test/r/ps.result: Auto merged mysql-test/r/ps_2myisam.result: Auto merged mysql-test/r/ps_3innodb.result: Auto merged mysql-test/r/ps_4heap.result: Auto merged mysql-test/r/ps_5merge.result: Auto merged mysql-test/r/ps_6bdb.result: Auto merged mysql-test/r/type_float.result: Auto merged mysql-test/r/user_var.result: Auto merged mysql-test/t/innodb.test: Auto merged mysql-test/t/user_var.test: Auto merged mysql-test/t/variables.test: Auto merged sql/ha_berkeley.cc: Auto merged sql/ha_innodb.cc: Auto merged sql/ha_innodb.h: Auto merged sql/ha_ndbcluster.h: Auto merged sql/item.cc: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_func.cc: Auto merged sql/item_sum.cc: Auto merged sql/item_timefunc.cc: Auto merged sql/log_event.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/repl_failsafe.cc: Auto merged sql/set_var.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_db.cc: Auto merged sql/sql_error.cc: Auto merged sql/sql_help.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_select.h: Auto merged sql/sql_yacc.yy: Auto merged
Diffstat (limited to 'client')
-rw-r--r--client/mysqladmin.c2
-rw-r--r--client/mysqldump.c29
-rw-r--r--client/mysqltest.c6
3 files changed, 20 insertions, 17 deletions
diff --git a/client/mysqladmin.c b/client/mysqladmin.c
index bccbf29ef83..6258b9685a5 100644
--- a/client/mysqladmin.c
+++ b/client/mysqladmin.c
@@ -108,7 +108,7 @@ static const char *command_names[]= {
};
static TYPELIB command_typelib=
-{ array_elements(command_names)-1,"commands", command_names};
+{ array_elements(command_names)-1,"commands", command_names, NULL};
static struct my_option my_long_options[] =
{
diff --git a/client/mysqldump.c b/client/mysqldump.c
index af271343ab9..2defee27c7e 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -126,7 +126,7 @@ const char *compatible_mode_names[]=
(1<<10) /* ANSI */\
)
TYPELIB compatible_mode_typelib= {array_elements(compatible_mode_names) - 1,
- "", compatible_mode_names};
+ "", compatible_mode_names, NULL};
static struct my_option my_long_options[] =
@@ -319,7 +319,7 @@ 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",
+ {"hex-blob", OPT_HEXBLOB, "Dump BLOBs in HEX.",
(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}
};
@@ -1543,10 +1543,12 @@ static void dumpTable(uint numFields, char *table)
/*
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.
+ we'll dump in hex only BLOB columns.
*/
is_blob= (opt_hex_blob && field->charsetnr == 63 &&
- (field->type == FIELD_TYPE_BLOB ||
+ (field->type == FIELD_TYPE_STRING ||
+ field->type == FIELD_TYPE_VAR_STRING ||
+ 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;
@@ -1564,6 +1566,13 @@ static void dumpTable(uint numFields, char *table)
{
if (!IS_NUM_FIELD(field))
{
+ /*
+ "length * 2 + 2" is OK for both HEX and non-HEX modes:
+ - In HEX mode we need exactly 2 bytes per character
+ plus 2 bytes for '0x' prefix.
+ - In non-HEX mode we need up to 2 bytes per character,
+ plus 2 bytes for leading and trailing '\'' characters.
+ */
if (dynstr_realloc(&extended_row,length * 2+2))
{
fputs("Aborting dump (out of memory)",stderr);
@@ -1572,15 +1581,11 @@ static void dumpTable(uint numFields, char *table)
}
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);
- }
+ extended_row.length+= mysql_hex_string(extended_row.str +
+ extended_row.length,
+ row[i], length);
+ extended_row.str[extended_row.length]= '\0';
}
else
{
diff --git a/client/mysqltest.c b/client/mysqltest.c
index 8e89352c8e8..ee28ca00a31 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -951,7 +951,6 @@ static void do_exec(struct st_query* q)
while (fgets(buf, sizeof(buf), res_file))
replace_dynstr_append_mem(ds, buf, strlen(buf));
}
-
error= pclose(res_file);
if (error != 0)
@@ -4520,8 +4519,7 @@ static void get_replace_column(struct st_query *q)
my_free(start, MYF(0));
}
-#ifdef __NETWARE__
-
+#if defined(__NETWARE__) || defined(__WIN__)
/*
Substitute environment variables with text.
@@ -4617,4 +4615,4 @@ FILE *my_popen(const char *cmd, const char *mode __attribute__((unused)))
return res_file;
}
-#endif /* __NETWARE__ */
+#endif /* __NETWARE__ or __WIN__*/