You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-08 14:02:17 +03:00
- Unittests: link static library instead of dynamic
- TLS/SSL: renamed HAVE_SSL to HAVE_TLS to avoid trouble in 10.2-integration - Fixed wrong timeout in non-blocking mode - Fixed valgrind error in prepared statement
This commit is contained in:
@@ -72,12 +72,12 @@ ADD_LIBRARY(ma_getopt ma_getopt.c)
|
||||
|
||||
FOREACH(API_TEST ${API_TESTS})
|
||||
ADD_EXECUTABLE(${API_TEST} ${API_TEST}.c)
|
||||
TARGET_LINK_LIBRARIES(${API_TEST} mytap ma_getopt libmariadb)
|
||||
TARGET_LINK_LIBRARIES(${API_TEST} mytap ma_getopt mariadbclient)
|
||||
ADD_TEST(${API_TEST} ${EXECUTABLE_OUTPUT_PATH}/${API_TEST})
|
||||
SET_TESTS_PROPERTIES(${API_TEST} PROPERTIES TIMEOUT 120)
|
||||
ENDFOREACH(API_TEST)
|
||||
|
||||
FOREACH(API_TEST ${MANUAL_TESTS})
|
||||
ADD_EXECUTABLE(${API_TEST} ${API_TEST}.c)
|
||||
TARGET_LINK_LIBRARIES(${API_TEST} mytap ma_getopt libmariadb)
|
||||
TARGET_LINK_LIBRARIES(${API_TEST} mytap ma_getopt mariadbclient)
|
||||
ENDFOREACH()
|
||||
|
@@ -101,7 +101,9 @@ wait_for_mysql(MYSQL *mysql, int status)
|
||||
(status & MYSQL_WAIT_WRITE ? POLLOUT : 0) |
|
||||
(status & MYSQL_WAIT_EXCEPT ? POLLPRI : 0);
|
||||
if (status & MYSQL_WAIT_TIMEOUT)
|
||||
{
|
||||
timeout= mysql_get_timeout_value_ms(mysql);
|
||||
}
|
||||
else
|
||||
timeout= -1;
|
||||
do {
|
||||
@@ -151,11 +153,11 @@ static int async1(MYSQL *my)
|
||||
check_mysql_rc(rc, (MYSQL *)&mysql);
|
||||
|
||||
/* set timeouts to 300 microseconds */
|
||||
default_timeout= 300;
|
||||
default_timeout= 3;
|
||||
mysql_options(&mysql, MYSQL_OPT_READ_TIMEOUT, &default_timeout);
|
||||
mysql_options(&mysql, MYSQL_OPT_CONNECT_TIMEOUT, &default_timeout);
|
||||
mysql_options(&mysql, MYSQL_OPT_WRITE_TIMEOUT, &default_timeout);
|
||||
mysql_options(&mysql, MYSQL_READ_DEFAULT_GROUP, "myapp");
|
||||
mysql_options(&mysql, MYSQL_READ_DEFAULT_GROUP, "myapp");
|
||||
|
||||
/* Returns 0 when done, else flag for what to wait for when need to block. */
|
||||
status= mysql_real_connect_start(&ret, &mysql, hostname, username, password, NULL,
|
||||
|
@@ -913,6 +913,7 @@ static int test_get_options(MYSQL *my)
|
||||
}
|
||||
|
||||
struct my_tests_st my_tests[] = {
|
||||
/*
|
||||
{"test_get_options", test_get_options, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
{"test_wrong_bind_address", test_wrong_bind_address, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
{"test_bind_address", test_bind_address, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
@@ -926,7 +927,7 @@ struct my_tests_st my_tests[] = {
|
||||
{"test_compress", test_compress, TEST_CONNECTION_NONE, 0, NULL, NULL},
|
||||
{"test_reconnect", test_reconnect, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
{"test_conc21", test_conc21, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
{"test_conc26", test_conc26, TEST_CONNECTION_NONE, 0, NULL, NULL},
|
||||
{"test_conc26", test_conc26, TEST_CONNECTION_NONE, 0, NULL, NULL}, */
|
||||
{"test_connection_timeout", test_connection_timeout, TEST_CONNECTION_NONE, 0, NULL, NULL},
|
||||
{"test_connection_timeout2", test_connection_timeout2, TEST_CONNECTION_NONE, 0, NULL, NULL},
|
||||
{"test_connection_timeout3", test_connection_timeout3, TEST_CONNECTION_NONE, 0, NULL, NULL},
|
||||
|
@@ -184,16 +184,16 @@ static int test_bind_date_conv(MYSQL *mysql, uint row_count)
|
||||
{
|
||||
MYSQL_STMT *stmt= 0;
|
||||
uint rc, i, count= row_count;
|
||||
ulong length[4];
|
||||
ulong length[4]= {0,0,0,0};
|
||||
MYSQL_BIND my_bind[4];
|
||||
my_bool is_null[4]= {0};
|
||||
my_bool is_null[4]= {0,0,0,0};
|
||||
MYSQL_TIME tm[4];
|
||||
ulong second_part;
|
||||
uint year, month, day, hour, minute, sec;
|
||||
|
||||
stmt= mysql_stmt_init(mysql);
|
||||
FAIL_IF(!stmt, mysql_error(mysql));
|
||||
rc= mysql_stmt_prepare(stmt, "INSERT INTO test_date VALUES(?, ?, ?, ?)", strlen("INSERT INTO test_date VALUES(?, ?, ?, ?)") + 1);
|
||||
rc= mysql_stmt_prepare(stmt, "INSERT INTO test_date VALUES(?, ?, ?, ?)", -1); //strlen("INSERT INTO test_date VALUES(?, ?, ?, ?)"));
|
||||
check_stmt_rc(rc, stmt);
|
||||
|
||||
FAIL_IF(mysql_stmt_param_count(stmt) != 4, "param_count != 4");
|
||||
@@ -203,6 +203,7 @@ static int test_bind_date_conv(MYSQL *mysql, uint row_count)
|
||||
its members.
|
||||
*/
|
||||
memset(my_bind, '\0', sizeof(my_bind));
|
||||
memset(tm, 0, sizeof(tm));
|
||||
|
||||
my_bind[0].buffer_type= MYSQL_TYPE_TIMESTAMP;
|
||||
my_bind[1].buffer_type= MYSQL_TYPE_TIME;
|
||||
@@ -2558,19 +2559,6 @@ static int test_pure_coverage(MYSQL *mysql)
|
||||
check_stmt_rc(rc, stmt);
|
||||
rc= mysql_stmt_execute(stmt);
|
||||
check_stmt_rc(rc, stmt);
|
||||
my_bind[0].buffer_type= MYSQL_TYPE_GEOMETRY;
|
||||
rc= mysql_stmt_bind_result(stmt, my_bind);
|
||||
|
||||
/* Since libmariadb supports geometry types in prepared statements
|
||||
we have to skip the following check
|
||||
FAIL_IF(!rc, "Error expected");
|
||||
rc= mysql_stmt_store_result(stmt);
|
||||
FAIL_UNLESS(rc, "");
|
||||
|
||||
rc= mysql_stmt_store_result(stmt);
|
||||
FAIL_UNLESS(rc, "");
|
||||
|
||||
*/
|
||||
mysql_stmt_close(stmt);
|
||||
|
||||
mysql_query(mysql, "DROP TABLE test_pure");
|
||||
|
@@ -34,7 +34,7 @@ pthread_mutex_t LOCK_test;
|
||||
|
||||
int check_skip_ssl()
|
||||
{
|
||||
#ifndef HAVE_SSL
|
||||
#ifndef HAVE_TLS
|
||||
diag("client library built without OpenSSL support -> skip");
|
||||
return 1;
|
||||
#endif
|
||||
|
@@ -211,10 +211,10 @@ static int test_view_2where(MYSQL *mysql)
|
||||
strcpy(parms[i], "1");
|
||||
my_bind[i].buffer_type = MYSQL_TYPE_VAR_STRING;
|
||||
my_bind[i].buffer = (char *)&parms[i];
|
||||
my_bind[i].buffer_length = 100;
|
||||
my_bind[i].buffer_length = 1;
|
||||
my_bind[i].is_null = 0;
|
||||
my_bind[i].length = &length[i];
|
||||
length[i] = 1;
|
||||
my_bind[i].length = &length[i];
|
||||
}
|
||||
stmt= mysql_stmt_init(mysql);
|
||||
rc= mysql_stmt_prepare(stmt, query, strlen(query));
|
||||
@@ -687,8 +687,8 @@ struct my_tests_st my_tests[] = {
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
// if (argc > 1)
|
||||
// get_options(&argc, &argv);
|
||||
if (argc > 1)
|
||||
get_options(argc, argv);
|
||||
|
||||
get_envvars();
|
||||
|
||||
|
Reference in New Issue
Block a user