diff options
author | unknown <davi@endora.local> | 2008-05-05 17:26:43 -0300 |
---|---|---|
committer | unknown <davi@endora.local> | 2008-05-05 17:26:43 -0300 |
commit | d2fb100ca583964079b18fbebd1624eacb4a6403 (patch) | |
tree | fe880eb3de3089b5138809139b952bf84c01dfb2 /client/mysqltest.c | |
parent | ef32ec61de48401a8ef4cff3881250a95e12d56c (diff) | |
parent | 7ecc40cc611ac029892e8f666473b1da9d5e88bd (diff) | |
download | mariadb-git-d2fb100ca583964079b18fbebd1624eacb4a6403.tar.gz |
Merge mysql.com:/Users/davi/mysql/bugs/36031-5.1
into mysql.com:/Users/davi/mysql/mysql-5.1-bugteam
client/mysqltest.c:
Auto merged
Diffstat (limited to 'client/mysqltest.c')
-rw-r--r-- | client/mysqltest.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/client/mysqltest.c b/client/mysqltest.c index 529d58b9194..04e3c234a07 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -5595,7 +5595,7 @@ void fix_win_paths(const char *val, int len) */ void append_field(DYNAMIC_STRING *ds, uint col_idx, MYSQL_FIELD* field, - const char* val, ulonglong len, my_bool is_null) + char* val, ulonglong len, my_bool is_null) { if (col_idx < max_replace_column && replace_column[col_idx]) { @@ -5618,9 +5618,18 @@ void append_field(DYNAMIC_STRING *ds, uint col_idx, MYSQL_FIELD* field, (start[1] == '-' || start[1] == '+') && start[2] == '0') { start+=2; /* Now points at first '0' */ - /* Move all chars after the first '0' one step left */ - memmove(start, start + 1, strlen(start)); - len--; + if (field->flags & ZEROFILL_FLAG) + { + /* Move all chars before the first '0' one step right */ + memmove(val + 1, val, start - val); + *val= '0'; + } + else + { + /* Move all chars after the first '0' one step left */ + memmove(start, start + 1, strlen(start)); + len--; + } } } #endif @@ -5659,7 +5668,7 @@ void append_result(DYNAMIC_STRING *ds, MYSQL_RES *res) lengths = mysql_fetch_lengths(res); for (i = 0; i < num_fields; i++) append_field(ds, i, &fields[i], - (const char*)row[i], lengths[i], !row[i]); + row[i], lengths[i], !row[i]); if (!display_result_vertically) dynstr_append_mem(ds, "\n", 1); } @@ -5708,7 +5717,7 @@ void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT *stmt, while (mysql_stmt_fetch(stmt) == 0) { for (i= 0; i < num_fields; i++) - append_field(ds, i, &fields[i], (const char *) my_bind[i].buffer, + append_field(ds, i, &fields[i], my_bind[i].buffer, *my_bind[i].length, *my_bind[i].is_null); if (!display_result_vertically) dynstr_append_mem(ds, "\n", 1); |