summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlexey Kopytov <Alexey.Kopytov@sun.com>2009-02-19 11:56:16 +0300
committerAlexey Kopytov <Alexey.Kopytov@sun.com>2009-02-19 11:56:16 +0300
commit849859511367aaa4bcda197ec82ec6384bcc73c6 (patch)
tree849605f43f776c0ffa41245ffee1f0ea83afe288 /tests
parent4801079dd214a57c4a29e747a73fa3581c4314b4 (diff)
parent074b4bad3e501dcff8b0eff746d16c048d794a26 (diff)
downloadmariadb-git-849859511367aaa4bcda197ec82ec6384bcc73c6.tar.gz
Automerge.
Diffstat (limited to 'tests')
-rw-r--r--tests/mysql_client_test.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 4f30d43f53f..0d32a7fc4ce 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -17768,6 +17768,69 @@ static void test_bug36326()
#endif
+/**
+ Bug#41078: With CURSOR_TYPE_READ_ONLY mysql_stmt_fetch() returns short
+ string value.
+*/
+
+static void test_bug41078(void)
+{
+ uint rc;
+ MYSQL_STMT *stmt= 0;
+ MYSQL_BIND param, result;
+ ulong cursor_type= CURSOR_TYPE_READ_ONLY;
+ ulong len;
+ char str[64];
+ const char param_str[]= "abcdefghijklmn";
+ my_bool is_null, error;
+
+ DBUG_ENTER("test_bug41078");
+
+ rc= mysql_query(mysql, "SET NAMES UTF8");
+ myquery(rc);
+
+ stmt= mysql_simple_prepare(mysql, "SELECT ?");
+ check_stmt(stmt);
+ verify_param_count(stmt, 1);
+
+ rc= mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, &cursor_type);
+ check_execute(stmt, rc);
+
+ bzero(&param, sizeof(param));
+ param.buffer_type= MYSQL_TYPE_STRING;
+ param.buffer= (void *) param_str;
+ len= sizeof(param_str) - 1;
+ param.length= &len;
+
+ rc= mysql_stmt_bind_param(stmt, &param);
+ check_execute(stmt, rc);
+
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+
+ bzero(&result, sizeof(result));
+ result.buffer_type= MYSQL_TYPE_STRING;
+ result.buffer= str;
+ result.buffer_length= sizeof(str);
+ result.is_null= &is_null;
+ result.length= &len;
+ result.error= &error;
+
+ rc= mysql_stmt_bind_result(stmt, &result);
+ check_execute(stmt, rc);
+
+ rc= mysql_stmt_store_result(stmt);
+ check_execute(stmt, rc);
+
+ rc= mysql_stmt_fetch(stmt);
+ check_execute(stmt, rc);
+
+ DIE_UNLESS(len == sizeof(param_str) - 1 && !strcmp(str, param_str));
+
+ mysql_stmt_close(stmt);
+
+ DBUG_VOID_RETURN;
+}
/*
Read and parse arguments and MySQL options from my.cnf
@@ -18085,6 +18148,7 @@ static struct my_tests_st my_tests[]= {
#ifdef HAVE_QUERY_CACHE
{ "test_bug36326", test_bug36326 },
#endif
+ { "test_bug41078", test_bug41078 },
{ 0, 0 }
};