diff options
author | Vladislav Vaintroub <wlad@mariadb.com> | 2016-08-19 15:46:27 +0000 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2016-08-19 15:46:27 +0000 |
commit | 31a8cf54c8a7913338480a0571feaf32143b5f64 (patch) | |
tree | 8847835f515af17d6c090300b138c31e1226731e /tests | |
parent | 7b89b9f5108c80f4f270da922d7e6c182a663719 (diff) | |
download | mariadb-git-31a8cf54c8a7913338480a0571feaf32143b5f64.tar.gz |
Revert "MDEV-9293 Connector/C integration"
This reverts commit 7b89b9f5108c80f4f270da922d7e6c182a663719.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CMakeLists.txt | 20 | ||||
-rw-r--r-- | tests/mysql_client_fw.c | 7 | ||||
-rw-r--r-- | tests/mysql_client_test.c | 59 | ||||
-rw-r--r-- | tests/nonblock-wrappers.h | 3 |
4 files changed, 34 insertions, 55 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 703efd56d55..f32e0270ce4 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -15,21 +15,16 @@ ADD_DEFINITIONS("-DMYSQL_CLIENT") - -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/client) -INCLUDE_DIRECTORIES(BEFORE ${CONNECTOR_C_INSTALLDIR}/include/mariadb) +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) ADD_EXECUTABLE(mysql_client_test mysql_client_test.c) -SET(CLIENT_LIB ${CONNECTOR_C_LIBS} mysys) - -TARGET_LINK_LIBRARIES(mysql_client_test ${CLIENT_LIB}) -ADD_DEPENDENCIES(mysql_client_test GenError mariadb_connector_c) +TARGET_LINK_LIBRARIES(mysql_client_test mysqlclient) +SET_TARGET_PROPERTIES(mysql_client_test PROPERTIES LINKER_LANGUAGE CXX) IF(WITH_UNIT_TESTS) ADD_EXECUTABLE(bug25714 bug25714.c) - TARGET_LINK_LIBRARIES(bug25714 ${CLIENT_LIB}) - ADD_DEPENDENCIES(bug25714 GenError mariadb_connector_c) + TARGET_LINK_LIBRARIES(bug25714 mysqlclient) + SET_TARGET_PROPERTIES(bug25714 PROPERTIES LINKER_LANGUAGE CXX) ENDIF() INSTALL(TARGETS mysql_client_test DESTINATION ${INSTALL_BINDIR} COMPONENT Test) @@ -39,6 +34,7 @@ FIND_LIBRARY(EVENT_LIBRARY event) MARK_AS_ADVANCED(EVENT_LIBRARY) IF(HAVE_EVENT_H AND EVENT_LIBRARY) ADD_EXECUTABLE(async_queries async_queries.c) - TARGET_LINK_LIBRARIES(async_queries ${CLIENT_LIB} ${EVENT_LIBRARY}) - ADD_DEPENDENCIES(async_queries GenError mariadb_connector_c) + TARGET_LINK_LIBRARIES(async_queries mysqlclient ${EVENT_LIBRARY}) + SET_TARGET_PROPERTIES(async_queries PROPERTIES LINKER_LANGUAGE CXX) + ENDIF() diff --git a/tests/mysql_client_fw.c b/tests/mysql_client_fw.c index 50ecf6c0860..b7211989f1f 100644 --- a/tests/mysql_client_fw.c +++ b/tests/mysql_client_fw.c @@ -21,7 +21,6 @@ #include <my_getopt.h> #include <m_string.h> #include <mysqld_error.h> -#include <mysql_version.h> #include <sql_common.h> #include <mysql/client_plugin.h> @@ -364,7 +363,7 @@ static MYSQL* client_connect(ulong flag, uint protocol, my_bool auto_reconnect) fprintf(stdout, "\n Check the connection options using --help or -?\n"); exit(1); } - mysql_options(mysql, MYSQL_OPT_RECONNECT, &auto_reconnect); + mysql->reconnect= auto_reconnect; if (!opt_silent) fprintf(stdout, "OK"); @@ -1146,7 +1145,7 @@ static my_bool thread_query(const char *query) { MYSQL *l_mysql; my_bool error; - my_bool reconnect= 1; + error= 0; if (!opt_silent) fprintf(stdout, "\n in thread_query(%s)", query); @@ -1163,7 +1162,7 @@ static my_bool thread_query(const char *query) error= 1; goto end; } - mysql_options(l_mysql, MYSQL_OPT_RECONNECT, &reconnect); + l_mysql->reconnect= 1; if (mysql_query(l_mysql, query)) { fprintf(stderr, "Query failed (%s)\n", mysql_error(l_mysql)); diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 76db1f62f85..806924e8e0e 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -34,22 +34,8 @@ #include "mysql_client_fw.c" -static const my_bool my_true= 1; - - /* Query processing */ -static my_bool get_reconnect(MYSQL *mysql) -{ -#ifdef EMBEDDED_LIBRARY - return mysql->reconnect; -#else - my_bool reconnect; - mysql_get_option(mysql, MYSQL_OPT_RECONNECT, &reconnect); - return reconnect; -#endif -} - static void client_query() { int rc; @@ -3137,7 +3123,7 @@ static void test_long_data_str1() int rc, i; char data[255]; long length; - ulong max_blob_length, blob_length= 0, length1; + ulong max_blob_length, blob_length, length1; my_bool true_value; MYSQL_RES *result; MYSQL_BIND my_bind[2]; @@ -4826,7 +4812,7 @@ static void test_stmt_close() myerror("connection failed"); exit(1); } - mysql_options(lmysql, MYSQL_OPT_RECONNECT, &my_true); + lmysql->reconnect= 1; if (!opt_silent) fprintf(stdout, "OK"); @@ -5510,7 +5496,7 @@ DROP TABLE IF EXISTS test_multi_tab"; fprintf(stdout, "\n connection failed(%s)", mysql_error(mysql_local)); exit(1); } - mysql_options(mysql_local, MYSQL_OPT_RECONNECT, &my_true); + mysql_local->reconnect= 1; rc= mysql_query(mysql_local, query); myquery(rc); @@ -5634,7 +5620,7 @@ static void test_prepare_multi_statements() fprintf(stderr, "\n connection failed(%s)", mysql_error(mysql_local)); exit(1); } - mysql_options(mysql_local, MYSQL_OPT_RECONNECT, &my_true); + mysql_local->reconnect= 1; strmov(query, "select 1; select 'another value'"); stmt= mysql_simple_prepare(mysql_local, query); check_stmt_r(stmt); @@ -6350,8 +6336,6 @@ static void test_pure_coverage() rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); -#if 0 - /* MariaDB C/C converts geometry to string */ my_bind[0].buffer_type= MYSQL_TYPE_GEOMETRY; rc= mysql_stmt_bind_result(stmt, my_bind); check_execute_r(stmt, rc); /* unsupported buffer type */ @@ -6362,7 +6346,6 @@ static void test_pure_coverage() rc= mysql_stmt_store_result(stmt); DIE_UNLESS(rc); /* Old error must be reset first */ -#endif mysql_stmt_close(stmt); mysql_query(mysql, "DROP TABLE test_pure"); @@ -7242,7 +7225,7 @@ static void test_prepare_grant() mysql_close(lmysql); exit(1); } - mysql_options(lmysql, MYSQL_OPT_RECONNECT, &my_true); + lmysql->reconnect= 1; if (!opt_silent) fprintf(stdout, "OK"); @@ -7704,7 +7687,7 @@ static void test_drop_temp() mysql_close(lmysql); exit(1); } - mysql_options(lmysql, MYSQL_OPT_RECONNECT, &my_true); + lmysql->reconnect= 1; if (!opt_silent) fprintf(stdout, "OK"); @@ -13419,7 +13402,10 @@ static void test_bug9478() /* Fill in the fetch packet */ int4store(buff, stmt->stmt_id); buff[4]= 1; /* prefetch rows */ - rc= mysql_stmt_fetch(stmt); + rc= ((*mysql->methods->advanced_command)(mysql, COM_STMT_FETCH, + (uchar*) buff, + sizeof(buff), 0,0,1,NULL) || + (*mysql->methods->read_query_result)(mysql)); DIE_UNLESS(rc); if (!opt_silent && i == 0) printf("Got error (as expected): %s\n", mysql_error(mysql)); @@ -15006,7 +14992,7 @@ static void test_bug15510() static void test_opt_reconnect() { MYSQL *lmysql; - + my_bool my_true= TRUE; myheader("test_opt_reconnect"); @@ -15017,8 +15003,8 @@ static void test_opt_reconnect() } if (!opt_silent) - fprintf(stdout, "reconnect before mysql_options: %d\n", get_reconnect(lmysql)); - DIE_UNLESS(get_reconnect(lmysql) == 0); + fprintf(stdout, "reconnect before mysql_options: %d\n", lmysql->reconnect); + DIE_UNLESS(lmysql->reconnect == 0); if (mysql_options(lmysql, MYSQL_OPT_RECONNECT, &my_true)) { @@ -15028,8 +15014,8 @@ static void test_opt_reconnect() /* reconnect should be 1 */ if (!opt_silent) - fprintf(stdout, "reconnect after mysql_options: %d\n", get_reconnect(lmysql)); - DIE_UNLESS(get_reconnect(lmysql) == 1); + fprintf(stdout, "reconnect after mysql_options: %d\n", lmysql->reconnect); + DIE_UNLESS(lmysql->reconnect == 1); if (!(mysql_real_connect(lmysql, opt_host, opt_user, opt_password, current_db, opt_port, @@ -15042,8 +15028,8 @@ static void test_opt_reconnect() /* reconnect should still be 1 */ if (!opt_silent) fprintf(stdout, "reconnect after mysql_real_connect: %d\n", - get_reconnect(lmysql)); - DIE_UNLESS(get_reconnect(lmysql) == 1); + lmysql->reconnect); + DIE_UNLESS(lmysql->reconnect == 1); mysql_close(lmysql); @@ -15054,8 +15040,8 @@ static void test_opt_reconnect() } if (!opt_silent) - fprintf(stdout, "reconnect before mysql_real_connect: %d\n", get_reconnect(lmysql)); - DIE_UNLESS(get_reconnect(lmysql) == 0); + fprintf(stdout, "reconnect before mysql_real_connect: %d\n", lmysql->reconnect); + DIE_UNLESS(lmysql->reconnect == 0); if (!(mysql_real_connect(lmysql, opt_host, opt_user, opt_password, current_db, opt_port, @@ -15068,8 +15054,8 @@ static void test_opt_reconnect() /* reconnect should still be 0 */ if (!opt_silent) fprintf(stdout, "reconnect after mysql_real_connect: %d\n", - get_reconnect(lmysql)); - DIE_UNLESS(get_reconnect(lmysql) == 0); + lmysql->reconnect); + DIE_UNLESS(lmysql->reconnect == 0); mysql_close(lmysql); } @@ -17999,8 +17985,7 @@ static void test_bug43560(void) strncpy(buffer, values[2], BUFSIZE); length= strlen(buffer); rc= mysql_stmt_execute(stmt); - DIE_UNLESS(rc && (mysql_stmt_errno(stmt) == CR_SERVER_LOST || - mysql_stmt_errno(stmt) == CR_SERVER_GONE_ERROR)); + DIE_UNLESS(rc && mysql_stmt_errno(stmt) == CR_SERVER_LOST); opt_drop_db= 0; client_disconnect(conn); diff --git a/tests/nonblock-wrappers.h b/tests/nonblock-wrappers.h index fd50e4e4ee6..d6f42511f3a 100644 --- a/tests/nonblock-wrappers.h +++ b/tests/nonblock-wrappers.h @@ -321,7 +321,6 @@ MK_WRAPPER( mysql, mysql) -#ifdef HAVE_DEPRECATED_ASYNC_API MK_WRAPPER( MYSQL_RES *, mysql_list_dbs, @@ -357,7 +356,6 @@ MK_WRAPPER( (mysql, table, wild), mysql, mysql) -#endif /* HAVE_DEPRECATED_ASYNC_API */ MK_WRAPPER( my_bool, @@ -502,6 +500,7 @@ MK_WRAPPER( #define mysql_list_dbs wrap_mysql_list_dbs #define mysql_list_tables wrap_mysql_list_tables #define mysql_list_processes wrap_mysql_list_processes +#define mysql_list_fields wrap_mysql_list_fields #define mysql_read_query_result wrap_mysql_read_query_result #define mysql_stmt_prepare wrap_mysql_stmt_prepare #define mysql_stmt_execute wrap_mysql_stmt_execute |