summaryrefslogtreecommitdiff
path: root/tests/mysql_client_test.c
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2019-02-03 18:41:18 -0800
committerIgor Babaev <igor@askmonty.org>2019-02-03 18:41:18 -0800
commit37deed3f37561f264f65e162146bbc2ad35fb1a2 (patch)
treec1cfb6c0995bfcc4ac3fb335f518a8b404413e32 /tests/mysql_client_test.c
parent658128af43b4d7c6db445164f8ed25ed4d1e3109 (diff)
parent5b996782be6b752ce50a0ecaa222b0688aa9e75d (diff)
downloadmariadb-git-37deed3f37561f264f65e162146bbc2ad35fb1a2.tar.gz
Merge branch '10.4' into bb-10.4-mdev16188
Diffstat (limited to 'tests/mysql_client_test.c')
-rw-r--r--tests/mysql_client_test.c62
1 files changed, 61 insertions, 1 deletions
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 90c8b503a05..2d238d84d54 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -20305,8 +20305,67 @@ static void test_bulk_autoinc()
myquery(rc);
}
-#endif
+static void test_bulk_delete()
+{
+ int rc;
+ MYSQL_STMT *stmt;
+ MYSQL_BIND bind[1];
+ MYSQL_ROW row;
+ char indicator[]= {0, 0, 0};
+ my_bool error[1];
+ int i, id[]= {1, 2, 4}, count= sizeof(id)/sizeof(id[0]);
+ MYSQL_RES *result;
+
+ rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
+ myquery(rc);
+ rc= mysql_query(mysql, "CREATE TABLE t1 (id int not null primary key)");
+ myquery(rc);
+ rc= mysql_query(mysql, "INSERT INTO t1 VALUES (1),(2),(3),(4)");
+ myquery(rc);
+ verify_affected_rows(4);
+
+ stmt= mysql_stmt_init(mysql);
+ rc= mysql_stmt_prepare(stmt, "DELETE FROM t1 where id=?", -1);
+ check_execute(stmt, rc);
+
+ memset(bind, 0, sizeof(bind));
+ bind[0].buffer_type = MYSQL_TYPE_LONG;
+ bind[0].buffer = (void *)id;
+ bind[0].buffer_length = 0;
+ bind[0].is_null = NULL;
+ bind[0].length = NULL;
+ bind[0].error = error;
+ bind[0].u.indicator= indicator;
+ mysql_stmt_attr_set(stmt, STMT_ATTR_ARRAY_SIZE, (void*)&count);
+ rc= mysql_stmt_bind_param(stmt, bind);
+ check_execute(stmt, rc);
+
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+ verify_affected_rows(3);
+
+ mysql_stmt_close(stmt);
+
+ rc= mysql_query(mysql, "SELECT id FROM t1");
+ myquery(rc);
+
+ result= mysql_store_result(mysql);
+ mytest(result);
+
+ i= 0;
+ while ((row= mysql_fetch_row(result)))
+ {
+ i++;
+ DIE_IF(atoi(row[0]) != 3);
+ }
+ DIE_IF(i != 1);
+
+ rc= mysql_query(mysql, "DROP TABLE t1");
+ myquery(rc);
+}
+
+#endif
static void print_metadata(MYSQL_RES *rs_metadata, int num_fields)
{
@@ -20915,6 +20974,7 @@ static struct my_tests_st my_tests[]= {
#ifndef EMBEDDED_LIBRARY
{ "test_proxy_header", test_proxy_header},
{ "test_bulk_autoinc", test_bulk_autoinc},
+ { "test_bulk_delete", test_bulk_delete },
#endif
{ "test_explain_meta", test_explain_meta },
{ 0, 0 }