summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 13:39:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 13:39:13 +0000
commit86fbb58c3ac0865482819c10a3e81f2eea001c36 (patch)
tree28c9e526ea739c6f9b89e36115e1e2698bddf981 /tests
parentReleasing progress-linux version 1:10.11.6-2~progress7.99u1. (diff)
downloadmariadb-86fbb58c3ac0865482819c10a3e81f2eea001c36.tar.xz
mariadb-86fbb58c3ac0865482819c10a3e81f2eea001c36.zip
Merging upstream version 1:10.11.7.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/mysql_client_fw.c8
-rw-r--r--tests/mysql_client_test.c40
2 files changed, 48 insertions, 0 deletions
diff --git a/tests/mysql_client_fw.c b/tests/mysql_client_fw.c
index 5c0c7ce2..c9e64678 100644
--- a/tests/mysql_client_fw.c
+++ b/tests/mysql_client_fw.c
@@ -1430,6 +1430,14 @@ int main(int argc, char **argv)
tests_to_run[i]= NULL;
}
+#ifdef _WIN32
+ /* must be the same in C/C and embedded, 1208 on 64bit, 968 on 32bit */
+ compile_time_assert(sizeof(MYSQL) == 60*sizeof(void*)+728);
+#else
+ /* must be the same in C/C and embedded, 1272 on 64bit, 964 on 32bit */
+ compile_time_assert(sizeof(MYSQL) == 77*sizeof(void*)+656);
+#endif
+
if (mysql_server_init(embedded_server_arg_count,
embedded_server_args,
(char**) embedded_server_groups))
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index c0077681..ffc4a19e 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -21961,6 +21961,45 @@ static void test_mdev_30159()
myquery(rc);
}
+/*
+ Check that server_status returned after connecting to server
+ is consistent with the value of autocommit variable.
+*/
+static void test_connect_autocommit()
+{
+ int rc;
+ my_bool autocommit[]= {0, 1};
+ int i;
+ rc= mysql_query(mysql, "SET @save_autocommit=@@global.autocommit");
+ myquery(rc);
+ for (i= 0; i < 2; i++)
+ {
+ MYSQL *con;
+ char query[100];
+ int autocommit_val;
+
+ con= mysql_client_init(NULL);
+ DIE_UNLESS(con);
+ autocommit_val = autocommit[i];
+ snprintf(query, sizeof(query), "SET global autocommit=%d", autocommit_val);
+ rc= mysql_query(mysql, query);
+ myquery(rc);
+
+ if (!(mysql_real_connect(con, opt_host, opt_user, opt_password, current_db,
+ opt_port, opt_unix_socket, 0)))
+ {
+ fprintf(stderr, "Failed to connect to database: Error: %s\n",
+ mysql_error(con));
+ exit(1);
+ }
+ DIE_UNLESS(!!(con->server_status & SERVER_STATUS_AUTOCOMMIT) == autocommit_val);
+ mysql_close(con);
+ }
+ rc= mysql_query(mysql, "SET global autocommit=@save_autocommit");
+ myquery(rc);
+}
+
+
static void test_execute_direct()
{
#ifndef EMBEDDED_LIBRARY
@@ -22485,6 +22524,7 @@ static struct my_tests_st my_tests[]= {
{ "test_mdev18408", test_mdev18408 },
{ "test_mdev20261", test_mdev20261 },
{ "test_mdev_30159", test_mdev_30159 },
+ { "test_connect_autocommit", test_connect_autocommit},
{ "test_execute_direct", test_execute_direct },
{ "test_cache_metadata", test_cache_metadata},
{ "test_mdev_10075", test_mdev_10075},