diff --git a/libmariadb/CMakeLists.txt b/libmariadb/CMakeLists.txt index 2bf85f22..4e46d98c 100644 --- a/libmariadb/CMakeLists.txt +++ b/libmariadb/CMakeLists.txt @@ -448,6 +448,7 @@ IF(WITH_MYSQLCOMPAT) ENDIF() ENDIF() +create_symlink(libmariadb${CMAKE_STATIC_LIBRARY_SUFFIX} mariadbclient ${INSTALL_LIBDIR}) SET_TARGET_PROPERTIES(libmariadb PROPERTIES VERSION ${CPACK_PACKAGE_VERSION_MAJOR} @@ -460,10 +461,14 @@ ENDIF() INSTALL(TARGETS mariadbclient COMPONENT Development DESTINATION ${INSTALL_LIBDIR}) -INSTALL(TARGETS libmariadb - COMPONENT SharedLibraries - DESTINATION ${INSTALL_LIBDIR}) - +# in cmake 3.12+ we can use +#INSTALL(TARGETS libmariadb LIBRARY DESTINATION ${INSTALL_LIBDIR} +# COMPONENT SharedLibraries NAMELINK_COMPONENT Development) +# but as long as we build on CentOS 7 with its cmake 2.8.12.2 we have to use +INSTALL(TARGETS libmariadb LIBRARY DESTINATION ${INSTALL_LIBDIR} + COMPONENT SharedLibraries NAMELINK_SKIP) +INSTALL(TARGETS libmariadb LIBRARY DESTINATION ${INSTALL_LIBDIR} + COMPONENT Development NAMELINK_ONLY) IF(MSVC) # On Windows, install PDB diff --git a/libmariadb/mariadb_stmt.c b/libmariadb/mariadb_stmt.c index 516b8016..2cd4a701 100644 --- a/libmariadb/mariadb_stmt.c +++ b/libmariadb/mariadb_stmt.c @@ -812,6 +812,16 @@ unsigned char* ma_stmt_execute_generate_simple_request(MYSQL_STMT *stmt, size_t size+= 9; /* max 8 bytes for size */ size+= (size_t)ma_get_length(stmt, i, 0); break; + case MYSQL_TYPE_TIME: + size+= MAX_TIME_STR_LEN; + break; + case MYSQL_TYPE_DATE: + size+= MAX_DATE_STR_LEN; + break; + case MYSQL_TYPE_DATETIME: + case MYSQL_TYPE_TIMESTAMP: + size+= MAX_DATETIME_STR_LEN; + break; default: size+= mysql_ps_fetch_functions[stmt->params[i].buffer_type].pack_len; break; diff --git a/mariadb_config/CMakeLists.txt b/mariadb_config/CMakeLists.txt index 5bbf36b0..0a32343d 100644 --- a/mariadb_config/CMakeLists.txt +++ b/mariadb_config/CMakeLists.txt @@ -59,7 +59,7 @@ ENDIF() # Installation # INSTALL(TARGETS mariadb_config - DESTINATION "bin" + DESTINATION "${INSTALL_BINDIR}" COMPONENT Development) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libmariadb.pc diff --git a/unittest/libmariadb/CMakeLists.txt b/unittest/libmariadb/CMakeLists.txt index b4cd9366..de0b3d9d 100644 --- a/unittest/libmariadb/CMakeLists.txt +++ b/unittest/libmariadb/CMakeLists.txt @@ -26,7 +26,7 @@ INCLUDE_DIRECTORIES(${CC_SOURCE_DIR}/include ${CC_SOURCE_DIR}/unittest/libmariadb) ADD_DEFINITIONS(-DLIBMARIADB) -SET(API_TESTS "conc336" "bulk1" "performance" "basic-t" "fetch" "charset" "logs" "cursor" "errors" "view" "ps" "ps_bugs" "sp" "result" "connection" "misc" "ps_new" "thread" "features-10_2" "bulk1") +SET(API_TESTS "conc336" "bulk1" "performance" "basic-t" "fetch" "charset" "logs" "cursor" "errors" "view" "ps" "ps_bugs" "sp" "result" "connection" "misc" "ps_new" "thread" "features-10_2") IF(WITH_DYNCOL) SET(API_TESTS ${API_TESTS} "dyncol") ENDIF() diff --git a/unittest/libmariadb/connection.c b/unittest/libmariadb/connection.c index 696f072b..b52fec3b 100644 --- a/unittest/libmariadb/connection.c +++ b/unittest/libmariadb/connection.c @@ -880,7 +880,7 @@ static int test_get_options(MYSQL *unused __attribute__((unused))) const char *attr_val[] = {"bar1", "bar2", "bar3"}; char **key, **val; - for (i=0; options_int[i]; i++) + for (i=0; i < (int)(sizeof(options_int)/sizeof(int)); i++) { mysql_options(mysql, options_int[i], &intval[0]); intval[1]= 0; diff --git a/unittest/libmariadb/misc.c b/unittest/libmariadb/misc.c index d50db915..4b5c2297 100644 --- a/unittest/libmariadb/misc.c +++ b/unittest/libmariadb/misc.c @@ -293,7 +293,7 @@ static int test_frm_bug(MYSQL *mysql) rc= 0; while (mysql_fetch_row(result)) rc++; - FAIL_UNLESS(rc == 1, "rowcount != 0"); + FAIL_UNLESS(rc == 1, "rowcount != 1"); mysql_data_seek(result, 0); diff --git a/unittest/libmariadb/ps.c b/unittest/libmariadb/ps.c index da815fdb..cea4af1f 100644 --- a/unittest/libmariadb/ps.c +++ b/unittest/libmariadb/ps.c @@ -139,9 +139,6 @@ static int test_prepare_insert_update(MYSQL *mysql) rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1"); check_mysql_rc(rc, mysql); - rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1"); - check_mysql_rc(rc, mysql); - for (cur_query= testcase; *cur_query; cur_query++) { char query[MAX_TEST_QUERY_LENGTH]; @@ -183,7 +180,7 @@ static int test_prepare_insert_update(MYSQL *mysql) static int test_bind_date_conv(MYSQL *mysql, uint row_count) { MYSQL_STMT *stmt= 0; - uint rc, i, count= row_count; + uint rc, i, count; MYSQL_BIND my_bind[4]; my_bool is_null[4]= {0,0,0,0}; MYSQL_TIME tm[4]; @@ -1020,7 +1017,7 @@ static int test_select_show(MYSQL *mysql) strcpy(query, "show columns from test_show"); stmt= mysql_stmt_init(mysql); - FAIL_IF(!stmt, mysql_error(mysql)); + FAIL_IF(!stmt, mysql_stmt_error(stmt)); rc= mysql_stmt_prepare(stmt, SL(query)); check_stmt_rc(rc, stmt); @@ -3004,7 +3001,7 @@ static int test_create_drop(MYSQL *mysql) check_stmt_rc(rc, stmt_drop); rc= mysql_stmt_execute(stmt_create_select); - check_stmt_rc(rc, stmt_create); + check_stmt_rc(rc, stmt_create_select); rc= mysql_stmt_execute(stmt_select); check_stmt_rc(rc, stmt_select); diff --git a/unittest/libmariadb/ps_bugs.c b/unittest/libmariadb/ps_bugs.c index 13135b13..95ff3e2d 100644 --- a/unittest/libmariadb/ps_bugs.c +++ b/unittest/libmariadb/ps_bugs.c @@ -449,7 +449,7 @@ static int test_bug11037(MYSQL *mysql) /* expected error */ rc = mysql_stmt_fetch(stmt); - FAIL_UNLESS(rc==1, "Error expedted"); + FAIL_UNLESS(rc==1, "Error expected"); rc= mysql_stmt_execute(stmt); check_stmt_rc(rc, stmt); @@ -543,7 +543,7 @@ static int test_bug12744(MYSQL *mysql) check_mysql_rc(rc, mysql); rc= mysql_stmt_close(stmt); - check_mysql_rc(rc, mysql); + check_stmt_rc(rc, stmt); return OK; } @@ -726,7 +726,7 @@ static int test_bug15518(MYSQL *mysql) succeeds */ rc= mysql_stmt_prepare(stmt, "SHOW STATUS", 12); - FAIL_UNLESS(!rc || mysql_stmt_errno(stmt) || mysql_errno(mysql), "Error expected"); + FAIL_UNLESS(!rc || mysql_stmt_errno(stmt) || mysql_errno(mysql), "Error not expected"); rc= mysql_stmt_close(stmt); check_mysql_rc(rc, mysql); @@ -789,7 +789,7 @@ static int test_bug15613(MYSQL *mysql) metadata= mysql_stmt_result_metadata(stmt); field= mysql_fetch_fields(metadata); FAIL_UNLESS(field[0].length == 65535, "length != 65535"); - FAIL_UNLESS(field[1].length == 255, "length != 244"); + FAIL_UNLESS(field[1].length == 255, "length != 255"); FAIL_UNLESS(field[2].length == 16777215, "length != 166777215"); FAIL_UNLESS(field[3].length == 4294967295UL, "length != 4294967295UL"); FAIL_UNLESS(field[4].length == 255, "length != 255"); @@ -4322,7 +4322,7 @@ static int test_conc182(MYSQL *mysql) check_stmt_rc(rc, stmt); rc= mysql_stmt_close(stmt); - check_mysql_rc(rc, mysql); + check_stmt_rc(rc, stmt); rc= mysql_query(mysql, "SELECT row_count()"); result= mysql_store_result(mysql); @@ -4530,8 +4530,8 @@ static int test_conc205(MYSQL *mysql) FAIL_IF(length[2] != 4, "Wrong fetched int length"); FAIL_IF(strncmp(data, "data2", length[0] + 1) != 0, "Wrong string value"); - FAIL_IF(smint_col != -25734, "Expected 21893"); - FAIL_IF(int_col != -1857802040, "Expected 1718038908"); + FAIL_IF(smint_col != -25734, "Expected -25734"); + FAIL_IF(int_col != -1857802040, "Expected -1857802040"); rc= mysql_stmt_fetch(stmt); FAIL_IF(rc != MYSQL_NO_DATA, "Expected MYSQL_NO_DATA"); @@ -4840,9 +4840,6 @@ static int test_codbc138(MYSQL *mysql) {0,0,0, 838,59,59, 0, 1, MYSQL_TIMESTAMP_TIME}, }, - {"SELECT '00:60:00'", - {0,0,0, 0,0,0, 0,0, MYSQL_TIMESTAMP_ERROR}, - }, {"SELECT '00:60:00'", {0,0,0, 0,0,0, 0,0, MYSQL_TIMESTAMP_ERROR}, }, @@ -4987,8 +4984,8 @@ static int test_conc_fraction(MYSQL *mysql) rc= mysql_stmt_execute(stmt); check_stmt_rc(rc, stmt); + rc = mysql_stmt_store_result(stmt); check_stmt_rc(rc, stmt); - rc= mysql_stmt_store_result(stmt); memset(bind, 0, sizeof(MYSQL_BIND)); bind[0].buffer_type= MYSQL_TYPE_DATETIME; @@ -5004,9 +5001,11 @@ static int test_conc_fraction(MYSQL *mysql) expected= i > 6 ? 123456 : frac * (unsigned int)powl(10, (6 - i)); - diag("tm.second_part=%ld expected=%ld", tm.second_part, expected); - FAIL_IF(tm.second_part != expected, "expected fractional part to be 900000"); - + if (tm.second_part != expected) + { + diag("Error: tm.second_part=%ld expected=%ld", tm.second_part, expected); + return FAIL; + } } mysql_stmt_close(stmt); return OK; diff --git a/unittest/libmariadb/ps_new.c b/unittest/libmariadb/ps_new.c index 9b89d6f9..f9bd9ad0 100644 --- a/unittest/libmariadb/ps_new.c +++ b/unittest/libmariadb/ps_new.c @@ -120,7 +120,7 @@ static int test_multi_result(MYSQL *mysql) rc= mysql_stmt_fetch(stmt); FAIL_IF(mysql_stmt_field_count(stmt) != 2, "expected 2 fields"); FAIL_IF(int_data[0] != 200 || int_data[1] != 300, - "expected 100 200 300"); + "expected 200 300"); FAIL_IF(mysql_stmt_next_result(stmt) != 0, "expected more results"); FAIL_IF(mysql_stmt_field_count(stmt) != 0, "expected 0 fields"); diff --git a/unittest/libmariadb/t_conc173.c b/unittest/libmariadb/t_conc173.c index 97d05d47..24c64e20 100644 --- a/unittest/libmariadb/t_conc173.c +++ b/unittest/libmariadb/t_conc173.c @@ -31,9 +31,8 @@ static int test_conc_173(MYSQL *unused __attribute__((unused))) { MYSQL mysql; int arg; - int i=0; - for (;;) + for (int i = 0; i < 1000; i++) { mysql_init(&mysql); mysql_options(&mysql, MYSQL_READ_DEFAULT_GROUP, "client");