Skip to content

Commit b5c1a23

Browse files
committed
Merge branch '3.2' into 3.3
2 parents 493dce6 + 3fe2f50 commit b5c1a23

File tree

10 files changed

+41
-31
lines changed

10 files changed

+41
-31
lines changed

libmariadb/CMakeLists.txt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,7 @@ IF(WITH_MYSQLCOMPAT)
448448
ENDIF()
449449
ENDIF()
450450

451+
create_symlink(libmariadb${CMAKE_STATIC_LIBRARY_SUFFIX} mariadbclient ${INSTALL_LIBDIR})
451452

452453
SET_TARGET_PROPERTIES(libmariadb PROPERTIES VERSION
453454
${CPACK_PACKAGE_VERSION_MAJOR}
@@ -460,10 +461,14 @@ ENDIF()
460461
INSTALL(TARGETS mariadbclient
461462
COMPONENT Development
462463
DESTINATION ${INSTALL_LIBDIR})
463-
INSTALL(TARGETS libmariadb
464-
COMPONENT SharedLibraries
465-
DESTINATION ${INSTALL_LIBDIR})
466-
464+
# in cmake 3.12+ we can use
465+
#INSTALL(TARGETS libmariadb LIBRARY DESTINATION ${INSTALL_LIBDIR}
466+
# COMPONENT SharedLibraries NAMELINK_COMPONENT Development)
467+
# but as long as we build on CentOS 7 with its cmake 2.8.12.2 we have to use
468+
INSTALL(TARGETS libmariadb LIBRARY DESTINATION ${INSTALL_LIBDIR}
469+
COMPONENT SharedLibraries NAMELINK_SKIP)
470+
INSTALL(TARGETS libmariadb LIBRARY DESTINATION ${INSTALL_LIBDIR}
471+
COMPONENT Development NAMELINK_ONLY)
467472

468473
IF(MSVC)
469474
# On Windows, install PDB

libmariadb/mariadb_stmt.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,16 @@ unsigned char* ma_stmt_execute_generate_simple_request(MYSQL_STMT *stmt, size_t
812812
size+= 9; /* max 8 bytes for size */
813813
size+= (size_t)ma_get_length(stmt, i, 0);
814814
break;
815+
case MYSQL_TYPE_TIME:
816+
size+= MAX_TIME_STR_LEN;
817+
break;
818+
case MYSQL_TYPE_DATE:
819+
size+= MAX_DATE_STR_LEN;
820+
break;
821+
case MYSQL_TYPE_DATETIME:
822+
case MYSQL_TYPE_TIMESTAMP:
823+
size+= MAX_DATETIME_STR_LEN;
824+
break;
815825
default:
816826
size+= mysql_ps_fetch_functions[stmt->params[i].buffer_type].pack_len;
817827
break;

mariadb_config/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ ENDIF()
5959
# Installation
6060
#
6161
INSTALL(TARGETS mariadb_config
62-
DESTINATION "bin"
62+
DESTINATION "${INSTALL_BINDIR}"
6363
COMPONENT Development)
6464

6565
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libmariadb.pc

unittest/libmariadb/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ INCLUDE_DIRECTORIES(${CC_SOURCE_DIR}/include
2626
${CC_SOURCE_DIR}/unittest/libmariadb)
2727
ADD_DEFINITIONS(-DLIBMARIADB)
2828

29-
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")
29+
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")
3030
IF(WITH_DYNCOL)
3131
SET(API_TESTS ${API_TESTS} "dyncol")
3232
ENDIF()

unittest/libmariadb/connection.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,7 @@ static int test_get_options(MYSQL *unused __attribute__((unused)))
880880
const char *attr_val[] = {"bar1", "bar2", "bar3"};
881881
char **key, **val;
882882

883-
for (i=0; options_int[i]; i++)
883+
for (i=0; i < (int)(sizeof(options_int)/sizeof(int)); i++)
884884
{
885885
mysql_options(mysql, options_int[i], &intval[0]);
886886
intval[1]= 0;

unittest/libmariadb/misc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ static int test_frm_bug(MYSQL *mysql)
293293
rc= 0;
294294
while (mysql_fetch_row(result))
295295
rc++;
296-
FAIL_UNLESS(rc == 1, "rowcount != 0");
296+
FAIL_UNLESS(rc == 1, "rowcount != 1");
297297

298298
mysql_data_seek(result, 0);
299299

unittest/libmariadb/ps.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,6 @@ static int test_prepare_insert_update(MYSQL *mysql)
139139
rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
140140
check_mysql_rc(rc, mysql);
141141

142-
rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
143-
check_mysql_rc(rc, mysql);
144-
145142
for (cur_query= testcase; *cur_query; cur_query++)
146143
{
147144
char query[MAX_TEST_QUERY_LENGTH];
@@ -183,7 +180,7 @@ static int test_prepare_insert_update(MYSQL *mysql)
183180
static int test_bind_date_conv(MYSQL *mysql, uint row_count)
184181
{
185182
MYSQL_STMT *stmt= 0;
186-
uint rc, i, count= row_count;
183+
uint rc, i, count;
187184
MYSQL_BIND my_bind[4];
188185
my_bool is_null[4]= {0,0,0,0};
189186
MYSQL_TIME tm[4];
@@ -1020,7 +1017,7 @@ static int test_select_show(MYSQL *mysql)
10201017

10211018
strcpy(query, "show columns from test_show");
10221019
stmt= mysql_stmt_init(mysql);
1023-
FAIL_IF(!stmt, mysql_error(mysql));
1020+
FAIL_IF(!stmt, mysql_stmt_error(stmt));
10241021
rc= mysql_stmt_prepare(stmt, SL(query));
10251022
check_stmt_rc(rc, stmt);
10261023

@@ -3004,7 +3001,7 @@ static int test_create_drop(MYSQL *mysql)
30043001
check_stmt_rc(rc, stmt_drop);
30053002

30063003
rc= mysql_stmt_execute(stmt_create_select);
3007-
check_stmt_rc(rc, stmt_create);
3004+
check_stmt_rc(rc, stmt_create_select);
30083005

30093006
rc= mysql_stmt_execute(stmt_select);
30103007
check_stmt_rc(rc, stmt_select);

unittest/libmariadb/ps_bugs.c

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ static int test_bug11037(MYSQL *mysql)
449449

450450
/* expected error */
451451
rc = mysql_stmt_fetch(stmt);
452-
FAIL_UNLESS(rc==1, "Error expedted");
452+
FAIL_UNLESS(rc==1, "Error expected");
453453

454454
rc= mysql_stmt_execute(stmt);
455455
check_stmt_rc(rc, stmt);
@@ -543,7 +543,7 @@ static int test_bug12744(MYSQL *mysql)
543543
check_mysql_rc(rc, mysql);
544544

545545
rc= mysql_stmt_close(stmt);
546-
check_mysql_rc(rc, mysql);
546+
check_stmt_rc(rc, stmt);
547547

548548
return OK;
549549
}
@@ -726,7 +726,7 @@ static int test_bug15518(MYSQL *mysql)
726726
succeeds
727727
*/
728728
rc= mysql_stmt_prepare(stmt, "SHOW STATUS", 12);
729-
FAIL_UNLESS(!rc || mysql_stmt_errno(stmt) || mysql_errno(mysql), "Error expected");
729+
FAIL_UNLESS(!rc || mysql_stmt_errno(stmt) || mysql_errno(mysql), "Error not expected");
730730

731731
rc= mysql_stmt_close(stmt);
732732
check_mysql_rc(rc, mysql);
@@ -789,7 +789,7 @@ static int test_bug15613(MYSQL *mysql)
789789
metadata= mysql_stmt_result_metadata(stmt);
790790
field= mysql_fetch_fields(metadata);
791791
FAIL_UNLESS(field[0].length == 65535, "length != 65535");
792-
FAIL_UNLESS(field[1].length == 255, "length != 244");
792+
FAIL_UNLESS(field[1].length == 255, "length != 255");
793793
FAIL_UNLESS(field[2].length == 16777215, "length != 166777215");
794794
FAIL_UNLESS(field[3].length == 4294967295UL, "length != 4294967295UL");
795795
FAIL_UNLESS(field[4].length == 255, "length != 255");
@@ -4322,7 +4322,7 @@ static int test_conc182(MYSQL *mysql)
43224322
check_stmt_rc(rc, stmt);
43234323

43244324
rc= mysql_stmt_close(stmt);
4325-
check_mysql_rc(rc, mysql);
4325+
check_stmt_rc(rc, stmt);
43264326

43274327
rc= mysql_query(mysql, "SELECT row_count()");
43284328
result= mysql_store_result(mysql);
@@ -4530,8 +4530,8 @@ static int test_conc205(MYSQL *mysql)
45304530
FAIL_IF(length[2] != 4, "Wrong fetched int length");
45314531

45324532
FAIL_IF(strncmp(data, "data2", length[0] + 1) != 0, "Wrong string value");
4533-
FAIL_IF(smint_col != -25734, "Expected 21893");
4534-
FAIL_IF(int_col != -1857802040, "Expected 1718038908");
4533+
FAIL_IF(smint_col != -25734, "Expected -25734");
4534+
FAIL_IF(int_col != -1857802040, "Expected -1857802040");
45354535

45364536
rc= mysql_stmt_fetch(stmt);
45374537
FAIL_IF(rc != MYSQL_NO_DATA, "Expected MYSQL_NO_DATA");
@@ -4840,9 +4840,6 @@ static int test_codbc138(MYSQL *mysql)
48404840
{0,0,0, 838,59,59, 0, 1, MYSQL_TIMESTAMP_TIME},
48414841
},
48424842

4843-
{"SELECT '00:60:00'",
4844-
{0,0,0, 0,0,0, 0,0, MYSQL_TIMESTAMP_ERROR},
4845-
},
48464843
{"SELECT '00:60:00'",
48474844
{0,0,0, 0,0,0, 0,0, MYSQL_TIMESTAMP_ERROR},
48484845
},
@@ -4987,8 +4984,8 @@ static int test_conc_fraction(MYSQL *mysql)
49874984
rc= mysql_stmt_execute(stmt);
49884985
check_stmt_rc(rc, stmt);
49894986

4987+
rc = mysql_stmt_store_result(stmt);
49904988
check_stmt_rc(rc, stmt);
4991-
rc= mysql_stmt_store_result(stmt);
49924989

49934990
memset(bind, 0, sizeof(MYSQL_BIND));
49944991
bind[0].buffer_type= MYSQL_TYPE_DATETIME;
@@ -5004,9 +5001,11 @@ static int test_conc_fraction(MYSQL *mysql)
50045001

50055002
expected= i > 6 ? 123456 : frac * (unsigned int)powl(10, (6 - i));
50065003

5007-
diag("tm.second_part=%ld expected=%ld", tm.second_part, expected);
5008-
FAIL_IF(tm.second_part != expected, "expected fractional part to be 900000");
5009-
5004+
if (tm.second_part != expected)
5005+
{
5006+
diag("Error: tm.second_part=%ld expected=%ld", tm.second_part, expected);
5007+
return FAIL;
5008+
}
50105009
}
50115010
mysql_stmt_close(stmt);
50125011
return OK;

unittest/libmariadb/ps_new.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ static int test_multi_result(MYSQL *mysql)
120120
rc= mysql_stmt_fetch(stmt);
121121
FAIL_IF(mysql_stmt_field_count(stmt) != 2, "expected 2 fields");
122122
FAIL_IF(int_data[0] != 200 || int_data[1] != 300,
123-
"expected 100 200 300");
123+
"expected 200 300");
124124

125125
FAIL_IF(mysql_stmt_next_result(stmt) != 0, "expected more results");
126126
FAIL_IF(mysql_stmt_field_count(stmt) != 0, "expected 0 fields");

unittest/libmariadb/t_conc173.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ static int test_conc_173(MYSQL *unused __attribute__((unused)))
3131
{
3232
MYSQL mysql;
3333
int arg;
34-
int i=0;
3534

36-
for (;;)
35+
for (int i = 0; i < 1000; i++)
3736
{
3837
mysql_init(&mysql);
3938
mysql_options(&mysql, MYSQL_READ_DEFAULT_GROUP, "client");

0 commit comments

Comments
 (0)