diff options
author | Ramil Kalimullin <ramil@mysql.com> | 2009-02-26 16:14:33 +0400 |
---|---|---|
committer | Ramil Kalimullin <ramil@mysql.com> | 2009-02-26 16:14:33 +0400 |
commit | 3a29b7afaa40e40d33a3448dc07700f8ea3e5dca (patch) | |
tree | a04236518f50d9fb95b4f8fe1f0bcbb58f5f128f /tests | |
parent | 40d4b5778519d552dd94a922397209b97587fe90 (diff) | |
parent | ce78a8bd50f39472df7efa6194f48080a32b8878 (diff) | |
download | mariadb-git-3a29b7afaa40e40d33a3448dc07700f8ea3e5dca.tar.gz |
Auto-merge
Diffstat (limited to 'tests')
-rw-r--r-- | tests/mysql_client_test.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 0d32a7fc4ce..cd40c409234 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -723,6 +723,7 @@ static void do_verify_prepare_field(MYSQL_RES *result, { MYSQL_FIELD *field; CHARSET_INFO *cs; + ulonglong expected_field_length; if (!(field= mysql_fetch_field_direct(result, no))) { @@ -731,6 +732,8 @@ static void do_verify_prepare_field(MYSQL_RES *result, } cs= get_charset(field->charsetnr, 0); DIE_UNLESS(cs); + if ((expected_field_length= length * cs->mbmaxlen) > UINT_MAX32) + expected_field_length= UINT_MAX32; if (!opt_silent) { fprintf(stdout, "\n field[%d]:", no); @@ -745,8 +748,8 @@ static void do_verify_prepare_field(MYSQL_RES *result, fprintf(stdout, "\n org_table:`%s`\t(expected: `%s`)", field->org_table, org_table); fprintf(stdout, "\n database :`%s`\t(expected: `%s`)", field->db, db); - fprintf(stdout, "\n length :`%lu`\t(expected: `%lu`)", - field->length, length * cs->mbmaxlen); + fprintf(stdout, "\n length :`%lu`\t(expected: `%llu`)", + field->length, expected_field_length); fprintf(stdout, "\n maxlength:`%ld`", field->max_length); fprintf(stdout, "\n charsetnr:`%d`", field->charsetnr); fprintf(stdout, "\n default :`%s`\t(expected: `%s`)", @@ -782,11 +785,11 @@ static void do_verify_prepare_field(MYSQL_RES *result, as utf8. Field length is calculated as number of characters * maximum number of bytes a character can occupy. */ - if (length && field->length != length * cs->mbmaxlen) + if (length && (field->length != expected_field_length)) { - fprintf(stderr, "Expected field length: %d, got length: %d\n", - (int) (length * cs->mbmaxlen), (int) field->length); - DIE_UNLESS(field->length == length * cs->mbmaxlen); + fprintf(stderr, "Expected field length: %llu, got length: %lu\n", + expected_field_length, field->length); + DIE_UNLESS(field->length == expected_field_length); } if (def) DIE_UNLESS(strcmp(field->def, def) == 0); |