summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-05-04 15:02:38 +0300
committerunknown <monty@mysql.com>2004-05-04 15:02:38 +0300
commit29c07902342865761a554d8150d35f52e9548c2e (patch)
tree05ce49a5f256144b2831c0deca15ee425d42d9b6 /tests
parentb8dc907ad1254920484236b5d597fa0a1b663896 (diff)
downloadmariadb-git-29c07902342865761a554d8150d35f52e9548c2e.tar.gz
Fix to handle unsigned data in prepared statements (Bug #3447)
Fixed security problem that password was temporarly reset when someone changed GRANT for a user. (Bug #3404) Fixed problem with PROCEDURE analyse() and impossible WHERE (Bug #2238) Don't auto-repair tables in mysqlcheck if table type doesn't support 'check' command. Docs/mysqld_error.txt: Updated error values client/mysqlcheck.c: Don't cause auto-repair on 'note' (Tables that doesn't support 'check') libmysql/libmysql.c: Fix to handle unsigned data in prepared statements (Bug #3447) mysql-test/r/analyse.result: Test of analyze + impossible where (Bug #2238) mysql-test/r/bdb.result: Update results mysql-test/r/ctype_ujis.result: Update results mysql-test/r/isam.result: Update results mysql-test/r/repair.result: Update results mysql-test/t/analyse.test: Test of analyze + impossible where (Bug #2238) mysql-test/t/ctype_ujis.test: Added test for LIKE (Bug #3438) sql/sql_acl.cc: Fixed security problem that password was temporarly reset when someone changed GRANT for a user. (Bug #3404) sql/sql_select.cc: Fixed problem with PROCEDURE analyse() and impossible WHERE (Bug #2238) sql/sql_table.cc: Changed 'error' to 'note' when table doesn't support admin command. sql/sql_update.cc: Indentaion cleanup tests/client_test.c: Added test for handling unsigned/signed strings with prepared statements
Diffstat (limited to 'tests')
-rw-r--r--tests/client_test.c33
1 files changed, 28 insertions, 5 deletions
diff --git a/tests/client_test.c b/tests/client_test.c
index 8aaa9983bc9..0e1dde81c1c 100644
--- a/tests/client_test.c
+++ b/tests/client_test.c
@@ -9182,8 +9182,7 @@ static void test_bug3035()
{
MYSQL_STMT *stmt;
int rc;
-
- MYSQL_BIND bind_array[8];
+ MYSQL_BIND bind_array[12];
int8 int8_val;
uint8 uint8_val;
int16 int16_val;
@@ -9192,6 +9191,8 @@ static void test_bug3035()
uint32 uint32_val;
longlong int64_val;
ulonglong uint64_val;
+ double double_val, udouble_val;
+ char longlong_as_string[22],ulonglong_as_string[22];
/* mins and maxes */
const int8 int8_min= -128;
@@ -9210,11 +9211,11 @@ static void test_bug3035()
const uint32 uint32_max= 4294967295U;
/* it might not work okay everyplace */
- const longlong int64_max= 9223372036854775807LL;
+ const longlong int64_max= LL(9223372036854775807);
const longlong int64_min= -int64_max - 1;
const ulonglong uint64_min= 0U;
- const ulonglong uint64_max= 18446744073709551615ULL;
+ const ulonglong uint64_max= ULL(18446744073709551615);
const char *stmt_text;
@@ -9296,7 +9297,7 @@ static void test_bug3035()
mysql_stmt_execute(stmt);
check_execute(stmt, rc);
- stmt_text= "SELECT i8, ui8, i16, ui16, i32, ui32, i64, ui64 "
+ stmt_text= "SELECT i8, ui8, i16, ui16, i32, ui32, i64, ui64, ui64, cast(ui64 as signed),ui64, cast(ui64 as signed)"
"FROM t1 ORDER BY id ASC";
mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
@@ -9305,6 +9306,20 @@ static void test_bug3035()
mysql_stmt_execute(stmt);
check_execute(stmt, rc);
+ bind_array[8].buffer_type= MYSQL_TYPE_DOUBLE;
+ bind_array[8].buffer= (char*) &udouble_val;
+
+ bind_array[9].buffer_type= MYSQL_TYPE_DOUBLE;
+ bind_array[9].buffer= (char*) &double_val;
+
+ bind_array[10].buffer_type= MYSQL_TYPE_STRING;
+ bind_array[10].buffer= (char*) &ulonglong_as_string;
+ bind_array[10].buffer_length= sizeof(ulonglong_as_string);
+
+ bind_array[11].buffer_type= MYSQL_TYPE_STRING;
+ bind_array[11].buffer= (char*) &longlong_as_string;
+ bind_array[11].buffer_length= sizeof(longlong_as_string);
+
mysql_stmt_bind_result(stmt, bind_array);
rc= mysql_stmt_fetch(stmt);
@@ -9318,6 +9333,10 @@ static void test_bug3035()
assert(uint32_val == uint32_min);
assert(int64_val == int64_min);
assert(uint64_val == uint64_min);
+ assert(double_val == (longlong) uint64_min);
+ assert(udouble_val == ulonglong2double(uint64_val));
+ assert(!strcmp(longlong_as_string, "0"));
+ assert(!strcmp(ulonglong_as_string, "0"));
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
@@ -9330,6 +9349,10 @@ static void test_bug3035()
assert(uint32_val == uint32_max);
assert(int64_val == int64_max);
assert(uint64_val == uint64_max);
+ assert(double_val == (longlong) uint64_val);
+ assert(udouble_val == ulonglong2double(uint64_val));
+ assert(!strcmp(longlong_as_string, "-1"));
+ assert(!strcmp(ulonglong_as_string, "18446744073709551615"));
rc= mysql_stmt_fetch(stmt);
assert(rc == MYSQL_NO_DATA);