summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorunknown <konstantin@mysql.com>2004-08-26 22:47:34 +0400
committerunknown <konstantin@mysql.com>2004-08-26 22:47:34 +0400
commitce91cbb8676fd75a2a44ac0db989c6a29f827425 (patch)
tree1de1516ae5d9cf4fed01d62d562f719d9902f173 /tests
parent4b47cc97aaff047f62866f7f3521e618725b2ee6 (diff)
downloadmariadb-git-ce91cbb8676fd75a2a44ac0db989c6a29f827425.tar.gz
A short fix and test case for Bug#5126
"Mediumint and PS problem": just treat mediumint as long. libmysql/libmysql.c: A short fix for bug #5126 "Mediumint and PS problem": just treat mediumint as long, as it's sent just like long. tests/client_test.c: A test case for bug#5126
Diffstat (limited to 'tests')
-rw-r--r--tests/client_test.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/client_test.c b/tests/client_test.c
index 825e866315e..ed186837d28 100644
--- a/tests/client_test.c
+++ b/tests/client_test.c
@@ -10044,6 +10044,53 @@ static void test_bug4030()
}
+static void test_bug5126()
+{
+ MYSQL_STMT *stmt;
+ MYSQL_BIND bind[2];
+ long c1, c2;
+ const char *stmt_text;
+ int rc;
+
+ myheader("test_bug5126");
+
+ stmt_text= "DROP TABLE IF EXISTS t1";
+ rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ myquery(rc);
+
+ stmt_text= "CREATE TABLE t1 (a mediumint, b int)";
+ rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ myquery(rc);
+
+ stmt_text= "INSERT INTO t1 VALUES (8386608, 1)";
+ rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ myquery(rc);
+
+ stmt= mysql_stmt_init(mysql);
+ stmt_text= "SELECT a, b FROM t1";
+ rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ check_execute(stmt, rc);
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+
+ /* Bind output buffers */
+ bzero(bind, sizeof(bind));
+
+ bind[0].buffer_type= MYSQL_TYPE_LONG;
+ bind[0].buffer= &c1;
+ bind[1].buffer_type= MYSQL_TYPE_LONG;
+ bind[1].buffer= &c2;
+
+ mysql_stmt_bind_result(stmt, bind);
+
+ rc= mysql_stmt_fetch(stmt);
+ assert(rc == 0);
+ assert(c1 == 8386608 && c2 == 1);
+ printf("%ld, %ld\n", c1, c2);
+ mysql_stmt_close(stmt);
+}
+
+
/*
Read and parse arguments and MySQL options from my.cnf
*/
@@ -10341,6 +10388,7 @@ int main(int argc, char **argv)
test_bug4236(); /* init -> execute */
test_bug4030(); /* test conversion string -> time types in
libmysql */
+ test_bug5126(); /* support for mediumint type in libmysql */
/*
XXX: PLEASE RUN THIS PROGRAM UNDER VALGRIND AND VERIFY THAT YOUR TEST
DOESN'T CONTAIN WARNINGS/ERRORS BEFORE YOU PUSH.