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
Merge branch '3.2' into 3.3
This commit is contained in:
@@ -168,6 +168,26 @@ ELSE()
|
||||
SET(MARIADB_CLIENT_VERSION_PATCH "5")
|
||||
SET(MARIADB_CLIENT_VERSION_EXTRA "")
|
||||
ENDIF()
|
||||
|
||||
IF(WIN32)
|
||||
# version in resource files need to be consistent
|
||||
# with server's , so that MSI minor upgrade work.
|
||||
# if this is not a subproject build, C/C version is used.
|
||||
FOREACH(v MAJOR MINOR PATCH TINY)
|
||||
IF(DEFINED ${v}_VERSION)
|
||||
SET(${v}_FILE_VERSION "${${v}_VERSION}")
|
||||
ELSEIF(DEFINED CPACK_PACKAGE_VERSION_${v})
|
||||
SET(${v}_FILE_VERSION "${CPACK_PACKAGE_VERSION_${v}}")
|
||||
ELSE()
|
||||
SET(${v}_FILE_VERSION "0")
|
||||
ENDIF()
|
||||
IF(NOT ${v}_FILE_VERSION MATCHES "^[0-9]+$")
|
||||
MESSAGE(FATAL_ERROR
|
||||
"${v}_FILE_VERSION is not numeric - '${${v}_FILE_VERSION}'")
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
|
||||
SET(MARIADB_CLIENT_VERSION "${MARIADB_CLIENT_VERSION_MAJOR}.${MARIADB_CLIENT_VERSION_MINOR}.${MARIADB_CLIENT_VERSION_PATCH}${MARIADB_CLIENT_VERSION_EXTRA}")
|
||||
SET(MARIADB_BASE_VERSION "mariadb-${MARIADB_CLIENT_VERSION_MAJOR}.${MARIADB_CLIENT_VERSION_MINOR}")
|
||||
MATH(EXPR MARIADB_VERSION_ID "${MARIADB_CLIENT_VERSION_MAJOR} * 10000 +
|
||||
|
@@ -35,17 +35,6 @@ MACRO(SET_VERSION_INFO)
|
||||
STRING(REPLACE "FILE_DESCRIPTION:" "" FILE_DESCRIPTION ${PROPERTY})
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
# Connector can be packaged with server, so set the "file version"
|
||||
# to the server version
|
||||
# In this case, numeric file version should be consistent with server
|
||||
# Only this way MSI minor upgrade can work.
|
||||
# The product version string will still refer to Connectors own version
|
||||
IF((NOT DEFINED MAJOR_VERSION) OR (NOT DEFINED MINOR_VERSION) OR (NOT DEFINED PATCH_VERSION) OR (NOT DEFINED TINY_VERSION))
|
||||
SET(MAJOR_VERSION ${CPACK_PACKAGE_VERSION_MAJOR})
|
||||
SET(MINOR_VERSION ${CPACK_PACKAGE_VERSION_MINOR})
|
||||
SET(PATCH_VERSION ${CPACK_PACKAGE_VERSION_PATCH})
|
||||
SET(TINY_VERSION ${FILE_VERSION})
|
||||
ENDIF()
|
||||
CONFIGURE_FILE(${CC_SOURCE_DIR}/win/resource.rc.in
|
||||
${CC_BINARY_DIR}/win/${TARGET}.rc)
|
||||
SET(${TARGET}_RC ${CC_BINARY_DIR}/win/${TARGET}.rc)
|
||||
|
@@ -31,7 +31,7 @@
|
||||
|
||||
#define NAME_CHAR_LEN 64
|
||||
#define NAME_LEN 256 /* Field/table name length */
|
||||
#define HOSTNAME_LENGTH 60
|
||||
#define HOSTNAME_LENGTH 255
|
||||
#define SYSTEM_MB_MAX_CHAR_LENGTH 4
|
||||
#define USERNAME_CHAR_LENGTH 128
|
||||
#define USERNAME_LENGTH (USERNAME_CHAR_LENGTH * SYSTEM_MB_MAX_CHAR_LENGTH)
|
||||
|
@@ -315,6 +315,9 @@ ELSE()
|
||||
IF(NOT CMAKE_SYSTEM_NAME MATCHES AIX)
|
||||
ADD_DEFINITIONS(-DLIBICONV_PLUG)
|
||||
ENDIF()
|
||||
IF(APPLE)
|
||||
ADD_DEFINITIONS(-Wno-deprecated-declarations)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(ZLIB_FOUND AND WITH_EXTERNAL_ZLIB)
|
||||
|
@@ -330,6 +330,7 @@ struct st_mysql_client_plugin * STDCALL
|
||||
mysql_client_register_plugin(MYSQL *mysql,
|
||||
struct st_mysql_client_plugin *plugin)
|
||||
{
|
||||
struct st_mysql_client_plugin *found_plugin= NULL;
|
||||
va_list unused;
|
||||
LINT_INIT_STRUCT(unused);
|
||||
|
||||
@@ -339,18 +340,11 @@ mysql_client_register_plugin(MYSQL *mysql,
|
||||
pthread_mutex_lock(&LOCK_load_client_plugin);
|
||||
|
||||
/* make sure the plugin wasn't loaded meanwhile */
|
||||
if (find_plugin(plugin->name, plugin->type))
|
||||
{
|
||||
my_set_error(mysql, CR_AUTH_PLUGIN_CANNOT_LOAD,
|
||||
SQLSTATE_UNKNOWN, ER(CR_AUTH_PLUGIN_CANNOT_LOAD),
|
||||
plugin->name, "it is already loaded");
|
||||
plugin= NULL;
|
||||
}
|
||||
else
|
||||
plugin= add_plugin(mysql, plugin, 0, 0, unused);
|
||||
if (!(found_plugin= find_plugin(plugin->name, plugin->type)))
|
||||
found_plugin= add_plugin(mysql, plugin, 0, 0, unused);
|
||||
|
||||
pthread_mutex_unlock(&LOCK_load_client_plugin);
|
||||
return plugin;
|
||||
return found_plugin;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1240,11 +1240,11 @@ void mysql_init_ps_subsystem(void)
|
||||
|
||||
mysql_ps_fetch_functions[MYSQL_TYPE_TINY].func = ps_fetch_int8;
|
||||
mysql_ps_fetch_functions[MYSQL_TYPE_TINY].pack_len = 1;
|
||||
mysql_ps_fetch_functions[MYSQL_TYPE_TINY].max_len = 3;
|
||||
mysql_ps_fetch_functions[MYSQL_TYPE_TINY].max_len = 4;
|
||||
|
||||
mysql_ps_fetch_functions[MYSQL_TYPE_SHORT].func = ps_fetch_int16;
|
||||
mysql_ps_fetch_functions[MYSQL_TYPE_SHORT].pack_len = 2;
|
||||
mysql_ps_fetch_functions[MYSQL_TYPE_SHORT].max_len = 5;
|
||||
mysql_ps_fetch_functions[MYSQL_TYPE_SHORT].max_len = 6;
|
||||
|
||||
mysql_ps_fetch_functions[MYSQL_TYPE_YEAR].func = ps_fetch_int16;
|
||||
mysql_ps_fetch_functions[MYSQL_TYPE_YEAR].pack_len = 2;
|
||||
@@ -1256,7 +1256,7 @@ void mysql_init_ps_subsystem(void)
|
||||
|
||||
mysql_ps_fetch_functions[MYSQL_TYPE_LONG].func = ps_fetch_int32;
|
||||
mysql_ps_fetch_functions[MYSQL_TYPE_LONG].pack_len = 4;
|
||||
mysql_ps_fetch_functions[MYSQL_TYPE_LONG].max_len = 10;
|
||||
mysql_ps_fetch_functions[MYSQL_TYPE_LONG].max_len = 11;
|
||||
|
||||
mysql_ps_fetch_functions[MYSQL_TYPE_LONGLONG].func = ps_fetch_int64;
|
||||
mysql_ps_fetch_functions[MYSQL_TYPE_LONGLONG].pack_len= 8;
|
||||
|
@@ -4179,7 +4179,7 @@ my_bool mariadb_get_infov(MYSQL *mysql, enum mariadb_value value, void *arg, ...
|
||||
*((char **)arg)= (char *)ma_pvio_tls_cipher(mysql->net.pvio->ctls);
|
||||
else
|
||||
#endif
|
||||
goto error;
|
||||
*((char **)arg)= NULL;
|
||||
break;
|
||||
case MARIADB_CLIENT_ERRORS:
|
||||
*((char ***)arg)= (char **)client_errors;
|
||||
|
@@ -252,13 +252,24 @@ int mthd_stmt_read_all_rows(MYSQL_STMT *stmt)
|
||||
{
|
||||
if (stmt->fields[i].flags & ZEROFILL_FLAG)
|
||||
{
|
||||
size_t len= MAX(stmt->fields[i].length, mysql_ps_fetch_functions[stmt->fields[i].type].max_len);
|
||||
/* The -1 is because a ZEROFILL:ed field is always unsigned */
|
||||
size_t len= MAX(stmt->fields[i].length, mysql_ps_fetch_functions[stmt->fields[i].type].max_len-1);
|
||||
if (len > stmt->fields[i].max_length)
|
||||
stmt->fields[i].max_length= (unsigned long)len;
|
||||
}
|
||||
else if (!stmt->fields[i].max_length)
|
||||
{
|
||||
stmt->fields[i].max_length= mysql_ps_fetch_functions[stmt->fields[i].type].max_len;
|
||||
if (stmt->fields[i].flags & UNSIGNED_FLAG &&
|
||||
stmt->fields[i].type != MYSQL_TYPE_INT24 &&
|
||||
stmt->fields[i].type != MYSQL_TYPE_LONGLONG)
|
||||
{
|
||||
/*
|
||||
Unsigned integers has one character less than signed integers
|
||||
as '-' is counted as part of max_length
|
||||
*/
|
||||
stmt->fields[i].max_length--;
|
||||
}
|
||||
}
|
||||
cp+= mysql_ps_fetch_functions[stmt->fields[i].type].pack_len;
|
||||
}
|
||||
@@ -798,7 +809,7 @@ unsigned char* ma_stmt_execute_generate_simple_request(MYSQL_STMT *stmt, size_t
|
||||
case MYSQL_TYPE_ENUM:
|
||||
case MYSQL_TYPE_BIT:
|
||||
case MYSQL_TYPE_SET:
|
||||
size+= 5; /* max 8 bytes for size */
|
||||
size+= 9; /* max 8 bytes for size */
|
||||
size+= (size_t)ma_get_length(stmt, i, 0);
|
||||
break;
|
||||
default:
|
||||
@@ -1634,6 +1645,7 @@ my_bool mthd_stmt_read_prepare_response(MYSQL_STMT *stmt)
|
||||
if (stmt->prebind_params != stmt->param_count)
|
||||
{
|
||||
SET_CLIENT_STMT_ERROR(stmt, CR_INVALID_PARAMETER_NO, SQLSTATE_UNKNOWN, 0);
|
||||
stmt->param_count= stmt->prebind_params;
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
@@ -1920,6 +1932,13 @@ int mthd_stmt_read_execute_response(MYSQL_STMT *stmt)
|
||||
{
|
||||
SET_CLIENT_STMT_ERROR(stmt, mysql->net.last_errno, mysql->net.sqlstate,
|
||||
mysql->net.last_error);
|
||||
/* if mariadb_stmt_execute_direct was used, we need to send the number
|
||||
of parameters to the specified prebinded value to prevent possible
|
||||
memory overrun */
|
||||
if (stmt->prebind_params)
|
||||
{
|
||||
stmt->param_count= stmt->prebind_params;
|
||||
}
|
||||
stmt->state= MYSQL_STMT_PREPARED;
|
||||
return(1);
|
||||
}
|
||||
@@ -1994,7 +2013,8 @@ int mthd_stmt_read_execute_response(MYSQL_STMT *stmt)
|
||||
/* Only cursor read */
|
||||
stmt->default_rset_handler = _mysql_stmt_use_result;
|
||||
|
||||
} else if (stmt->flags & CURSOR_TYPE_READ_ONLY)
|
||||
} else if (stmt->flags & CURSOR_TYPE_READ_ONLY &&
|
||||
!(stmt->upsert_status.server_status & SERVER_MORE_RESULTS_EXIST))
|
||||
{
|
||||
/*
|
||||
We have asked for CURSOR but got no cursor, because the condition
|
||||
|
@@ -85,6 +85,7 @@ static int native_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
|
||||
if (mysql && mysql->passwd[0])
|
||||
{
|
||||
char scrambled[SCRAMBLE_LENGTH + 1];
|
||||
memset(scrambled, 0, SCRAMBLE_LENGTH + 1);
|
||||
ma_scramble_41((uchar *)scrambled, (char*)pkt, mysql->passwd);
|
||||
if (vio->write_packet(vio, (uchar*)scrambled, SCRAMBLE_LENGTH))
|
||||
return CR_ERROR;
|
||||
|
@@ -37,7 +37,7 @@ static int test_async(MYSQL *mysql)
|
||||
if (type > MARIADB_CONNECTION_TCP)
|
||||
{
|
||||
skip_async= 1;
|
||||
diag("Asnyc IO not supported");
|
||||
diag("Async IO not supported");
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
@@ -925,7 +925,7 @@ static int bulk_null_null(MYSQL *mysql)
|
||||
rc= mysql_stmt_prepare(stmt, "INSERT INTO bulk_null VALUES (?,?,?,?,?)", -1);
|
||||
check_stmt_rc(rc, stmt);
|
||||
|
||||
memset(bind, 0, sizeof(MYSQL_BIND)*2);
|
||||
memset(bind, 0, sizeof(MYSQL_BIND)*5);
|
||||
|
||||
rc= mysql_stmt_attr_set(stmt, STMT_ATTR_ARRAY_SIZE, &array_size);
|
||||
check_stmt_rc(rc, stmt);
|
||||
@@ -1011,6 +1011,7 @@ static int test_mdev16593(MYSQL *mysql)
|
||||
diag("waiting for server fix");
|
||||
return SKIP;
|
||||
|
||||
memset(&bind, 0, 2 * sizeof(MYSQL_BIND));
|
||||
for (i=0; i < 3; i++)
|
||||
{
|
||||
MYSQL_RES *res;
|
||||
@@ -1018,8 +1019,6 @@ static int test_mdev16593(MYSQL *mysql)
|
||||
MYSQL_STMT *stmt= mysql_stmt_init(mysql);
|
||||
rc= mysql_query(mysql, "CREATE OR REPLACE TABLE t1 (a int not null auto_increment primary key, b int)");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
memset(&bind, 0, sizeof(MYSQL_BIND));
|
||||
switch (i) {
|
||||
case 0:
|
||||
bind[0].buffer_type= MYSQL_TYPE_LONG;
|
||||
|
@@ -1064,6 +1064,10 @@ static int test_read_timeout(MYSQL *unused __attribute__((unused)))
|
||||
return OK;
|
||||
}
|
||||
|
||||
#ifndef __has_feature
|
||||
# define __has_feature(x) 0
|
||||
#endif
|
||||
#if !__has_feature(memory_sanitizer)
|
||||
#ifdef HAVE_REMOTEIO
|
||||
void *remote_plugin;
|
||||
static int test_remote1(MYSQL *mysql)
|
||||
@@ -1131,6 +1135,7 @@ static int test_remote2(MYSQL *my)
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
static int test_mdev12965(MYSQL *unused __attribute__((unused)))
|
||||
@@ -1499,6 +1504,7 @@ static int test_sslenforce(MYSQL *unused __attribute__((unused)))
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !__has_feature(memory_sanitizer)
|
||||
static int test_conc457(MYSQL *mysql)
|
||||
{
|
||||
MYSQL_RES *result;
|
||||
@@ -1511,6 +1517,7 @@ static int test_conc457(MYSQL *mysql)
|
||||
mysql_free_result(result);
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int test_conc458(MYSQL *my __attribute__((unused)))
|
||||
{
|
||||
@@ -1618,7 +1625,9 @@ struct my_tests_st my_tests[] = {
|
||||
{"test_ext_field_attr", test_ext_field_attr, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
{"test_conc533", test_conc533, TEST_CONNECTION_NEW, 0, NULL, NULL},
|
||||
{"test_conc458", test_conc458, TEST_CONNECTION_NONE, 0, NULL, NULL},
|
||||
#if !__has_feature(memory_sanitizer)
|
||||
{"test_conc457", test_conc457, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
#endif
|
||||
{"test_conc384", test_conc384, TEST_CONNECTION_NONE, 0, NULL, NULL},
|
||||
#ifndef _WIN32
|
||||
{"test_mdev12965", test_mdev12965, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
@@ -1629,9 +1638,11 @@ struct my_tests_st my_tests[] = {
|
||||
{"test_server_status", test_server_status, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
{"test_read_timeout", test_read_timeout, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
{"test_zerofill", test_zerofill, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
#if !__has_feature(memory_sanitizer)
|
||||
#ifdef HAVE_REMOTEIO
|
||||
{"test_remote1", test_remote1, TEST_CONNECTION_NEW, 0, NULL, NULL},
|
||||
{"test_remote2", test_remote2, TEST_CONNECTION_NEW, 0, NULL, NULL},
|
||||
#endif
|
||||
#endif
|
||||
{"test_get_info", test_get_info, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
{"test_conc117", test_conc117, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
|
@@ -5384,8 +5384,177 @@ static int test_conc525(MYSQL *mysql)
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int test_conc566(MYSQL *mysql)
|
||||
{
|
||||
int rc;
|
||||
MYSQL_STMT *stmt = mysql_stmt_init(mysql);
|
||||
unsigned long cursor = CURSOR_TYPE_READ_ONLY;
|
||||
const char* query= "call sp()";
|
||||
|
||||
rc= mysql_query(mysql,"drop procedure if exists sp");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
rc= mysql_query(mysql,"create procedure sp() select 1");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
rc= mysql_stmt_prepare(stmt,query,-1);
|
||||
check_stmt_rc(rc, stmt);
|
||||
|
||||
rc= mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, &cursor);
|
||||
check_stmt_rc(rc, stmt);
|
||||
|
||||
rc= mysql_stmt_execute(stmt);
|
||||
check_stmt_rc(rc, stmt);
|
||||
|
||||
mysql_stmt_close(stmt);
|
||||
|
||||
rc= mysql_query(mysql,"drop procedure sp");
|
||||
check_mysql_rc(rc, mysql);
|
||||
return OK;
|
||||
}
|
||||
|
||||
#define MDEV19838_MAX_PARAM_COUNT 32
|
||||
#define MDEV19838_FIELDS_COUNT 17
|
||||
|
||||
static int test_mdev19838(MYSQL *mysql)
|
||||
{
|
||||
int rc;
|
||||
MYSQL_BIND bind[MDEV19838_MAX_PARAM_COUNT];
|
||||
unsigned int i, paramCount = 1;
|
||||
char charvalue[] = "012345678901234567890123456789012345";
|
||||
MYSQL_STMT *stmt;
|
||||
|
||||
rc = mysql_query(mysql, "CREATE temporary TABLE mdev19838("
|
||||
"f1 char(36),"
|
||||
"f2 char(36),"
|
||||
"f3 char(36),"
|
||||
"f4 char(36),"
|
||||
"f5 char(36),"
|
||||
"f6 char(36),"
|
||||
"f7 char(36),"
|
||||
"f8 char(36),"
|
||||
"f9 char(36),"
|
||||
"f10 char(36),"
|
||||
"f11 char(36),"
|
||||
"f12 char(36),"
|
||||
"f13 char(36),"
|
||||
"f14 char(36),"
|
||||
"f15 char(36),"
|
||||
"f16 char(36),"
|
||||
"f17 char(36)"
|
||||
")");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
stmt = mysql_stmt_init(mysql);
|
||||
|
||||
memset(bind, 0, sizeof(bind));
|
||||
|
||||
for (i = 0; i < MDEV19838_MAX_PARAM_COUNT; ++i)
|
||||
{
|
||||
bind[i].buffer = charvalue;
|
||||
bind[i].buffer_type = MYSQL_TYPE_STRING;
|
||||
bind[i].buffer_length = sizeof charvalue;
|
||||
bind[i].length = &bind[i].length_value;
|
||||
bind[i].length_value = bind[i].buffer_length - 1;
|
||||
}
|
||||
|
||||
for (paramCount = 1; paramCount < MDEV19838_FIELDS_COUNT; ++paramCount)
|
||||
{
|
||||
mysql_stmt_attr_set(stmt, STMT_ATTR_PREBIND_PARAMS, ¶mCount);
|
||||
|
||||
rc = mysql_stmt_bind_param(stmt, bind);
|
||||
check_stmt_rc(rc, stmt);
|
||||
|
||||
rc = mariadb_stmt_execute_direct(stmt, "INSERT INTO mdev19838"
|
||||
"(f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17)"
|
||||
" VALUES "
|
||||
"(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", -1);
|
||||
|
||||
/* Expecting an error */
|
||||
FAIL_UNLESS(rc != 0, "rc!=0");
|
||||
|
||||
mysql_stmt_close(stmt);
|
||||
stmt = mysql_stmt_init(mysql);
|
||||
}
|
||||
|
||||
paramCount = 0;
|
||||
mysql_stmt_attr_set(stmt, STMT_ATTR_PREBIND_PARAMS, ¶mCount);
|
||||
rc = mariadb_stmt_execute_direct(stmt, "INSERT INTO mdev19838(f1)"
|
||||
" VALUES (?)", -1);
|
||||
/* Expecting an error */
|
||||
FAIL_UNLESS(rc != 0, "rc!=0");
|
||||
mysql_stmt_close(stmt);
|
||||
|
||||
stmt = mysql_stmt_init(mysql);
|
||||
/* Correct number of parameters */
|
||||
paramCount = MDEV19838_FIELDS_COUNT;
|
||||
mysql_stmt_attr_set(stmt, STMT_ATTR_PREBIND_PARAMS, ¶mCount);
|
||||
mysql_stmt_bind_param(stmt, bind);
|
||||
|
||||
rc = mariadb_stmt_execute_direct(stmt, "INSERT INTO mdev19838"
|
||||
"(f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17)"
|
||||
" VALUES "
|
||||
"(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", -1);
|
||||
check_stmt_rc(rc, stmt);
|
||||
|
||||
/* MYSQL_TYPE_TINY = 1. This parameter byte can be read as "parameters send" flag byte.
|
||||
Checking that wrong packet is still detected */
|
||||
bind[0].buffer_type = MYSQL_TYPE_TINY;
|
||||
bind[0].length_value = 1;
|
||||
bind[0].buffer_length = 1;
|
||||
|
||||
for (paramCount = 8; paramCount > 0; --paramCount)
|
||||
{
|
||||
mysql_stmt_close(stmt);
|
||||
stmt = mysql_stmt_init(mysql);
|
||||
|
||||
mysql_stmt_attr_set(stmt, STMT_ATTR_PREBIND_PARAMS, ¶mCount);
|
||||
|
||||
rc = mysql_stmt_bind_param(stmt, bind);
|
||||
|
||||
rc = mariadb_stmt_execute_direct(stmt, "INSERT INTO mdev19838"
|
||||
"(f1, f2, f3, f4, f5, f6, f7, f8, f9)"
|
||||
" VALUES "
|
||||
"(?, ?, ?, ?, ?, ?, ?, ?, ?)", -1);
|
||||
|
||||
/* Expecting an error */
|
||||
FAIL_UNLESS(rc != 0, "rc");
|
||||
}
|
||||
|
||||
/* Test of query w/out parameters, with parameter sent and not sent */
|
||||
for (paramCount = MDEV19838_MAX_PARAM_COUNT; paramCount != (unsigned int)-1; --paramCount)
|
||||
{
|
||||
mysql_stmt_close(stmt);
|
||||
stmt = mysql_stmt_init(mysql);
|
||||
|
||||
mysql_stmt_attr_set(stmt, STMT_ATTR_PREBIND_PARAMS, ¶mCount);
|
||||
|
||||
if (paramCount > 0)
|
||||
{
|
||||
rc = mysql_stmt_bind_param(stmt, bind);
|
||||
check_stmt_rc(rc, stmt);
|
||||
}
|
||||
|
||||
rc = mariadb_stmt_execute_direct(stmt, "INSERT INTO mdev19838"
|
||||
"(f1)"
|
||||
" VALUES "
|
||||
"(0x1111111111111111)", -1);
|
||||
|
||||
/*
|
||||
We allow junk at the end of the packet in case of
|
||||
no parameters. So it will succeed.
|
||||
*/
|
||||
FAIL_UNLESS(rc == 0, "");
|
||||
}
|
||||
|
||||
mysql_stmt_close(stmt);
|
||||
return OK;
|
||||
}
|
||||
|
||||
struct my_tests_st my_tests[] = {
|
||||
{"test_mdev19838", test_mdev19838, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
{"test_conc525", test_conc525, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
{"test_conc566", test_conc566, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
{"test_conc512", test_conc512, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
{"test_conc504", test_conc504, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
{"test_returning", test_returning, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
|
@@ -206,7 +206,7 @@ static int test_view_2where(MYSQL *mysql)
|
||||
" AENAME,T0001.DEPENDVARS AS DEPENDVARS,T0001.INACTIVE AS "
|
||||
" INACTIVE from LTDX T0001 where (T0001.SRTF2 = 0)");
|
||||
check_mysql_rc(rc, mysql);
|
||||
memset(my_bind, '\0', sizeof(MYSQL_BIND));
|
||||
memset(my_bind, '\0', 8 * sizeof(MYSQL_BIND));
|
||||
for (i=0; i < 8; i++) {
|
||||
strcpy(params[i], "1");
|
||||
my_bind[i].buffer_type = MYSQL_TYPE_VAR_STRING;
|
||||
@@ -257,7 +257,7 @@ static int test_view_star(MYSQL *mysql)
|
||||
check_mysql_rc(rc, mysql);
|
||||
rc= mysql_query(mysql, "CREATE VIEW vt1 AS SELECT a FROM t1");
|
||||
check_mysql_rc(rc, mysql);
|
||||
memset(my_bind, '\0', sizeof(MYSQL_BIND));
|
||||
memset(my_bind, '\0', 8 * sizeof(MYSQL_BIND));
|
||||
for (i= 0; i < 2; i++) {
|
||||
sprintf((char *)¶ms[i], "%d", i);
|
||||
my_bind[i].buffer_type = MYSQL_TYPE_VAR_STRING;
|
||||
@@ -438,7 +438,7 @@ static int test_view_insert_fields(MYSQL *mysql)
|
||||
memset(my_bind, '\0', sizeof(my_bind));
|
||||
for (i= 0; i < 11; i++)
|
||||
{
|
||||
l[i]= 20;
|
||||
l[i]= 2;
|
||||
my_bind[i].buffer_type= MYSQL_TYPE_STRING;
|
||||
my_bind[i].is_null= 0;
|
||||
my_bind[i].buffer= (char *)&parm[i];
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#include "winver.h"
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION @MAJOR_VERSION@,@MINOR_VERSION@,@PATCH_VERSION@,@TINY_VERSION@
|
||||
PRODUCTVERSION @MAJOR_VERSION@,@MINOR_VERSION@,@PATCH_VERSION@,@TINY_VERSION@
|
||||
FILEVERSION @MAJOR_FILE_VERSION@,@MINOR_FILE_VERSION@,@PATCH_FILE_VERSION@,@TINY_FILE_VERSION@
|
||||
PRODUCTVERSION @MAJOR_FILE_VERSION@,@MINOR_FILE_VERSION@,@PATCH_FILE_VERSION@,@TINY_FILE_VERSION@
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
Reference in New Issue
Block a user