1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-07 02:42:49 +03:00

MDEV-12471: BULK Command

After test fixes.
bulk_null() is disabled. Before the client library took care about MYSQL_TYPE_NULL, now it do not do it so server return an error. and I have no idea what should be chenged test or client library.
This commit is contained in:
Oleksandr Byelkin
2017-05-01 15:05:49 +02:00
parent 08450df078
commit d0f9234620
3 changed files with 17 additions and 15 deletions

View File

@@ -31,7 +31,8 @@
#define MARIADB_STMT_BULK_SUPPORTED(stmt)\
((stmt)->mysql && \
(!((stmt)->mysql->server_capabilities & CLIENT_MYSQL) &&\
((stmt)->mysql->extension->mariadb_server_capabilities & MARIADB_CLIENT_STMT_BULK_OPERATIONS >> 32)))
((stmt)->mysql->extension->mariadb_server_capabilities & \
(MARIADB_CLIENT_STMT_BULK_OPERATIONS >> 32))))
#define SET_CLIENT_STMT_ERROR(a, b, c, d) \
{ \
@@ -83,6 +84,12 @@ enum enum_indicator_type
STMT_INDICATOR_IGNORE=3
};
/*
bulk PS flags
*/
#define STMT_BULK_FLAG_CLIENT_SEND_TYPES 128
#define STMT_BULK_FLAG_INSERT_ID_REQUEST 64
typedef enum mysql_stmt_state
{
MYSQL_STMT_INITTED = 0,

View File

@@ -803,9 +803,8 @@ unsigned char* mysql_stmt_execute_generate_bulk_request(MYSQL_STMT *stmt, size_t
-----------------------------------------
0 4 Statement id
4 2 Flags (cursor type):
STMT_BULK_SEND_TYPES = 64
STMT_BULK_RETURN_AUTO_ID = 128
6 4 array size
STMT_BULK_FLAG_CLIENT_SEND_TYPES = 128
STMT_BULK_FLAG_INSERT_ID_REQUEST = 64
-----------------------------------------
if (stmt->send_types_to_server):
for (i=0; i < param_count; i++)
@@ -846,12 +845,9 @@ unsigned char* mysql_stmt_execute_generate_bulk_request(MYSQL_STMT *stmt, size_t
/* todo: request to return auto generated ids */
if (stmt->send_types_to_server)
flags|= 0x40;
flags|= STMT_BULK_FLAG_CLIENT_SEND_TYPES;
int2store(p, flags);
p++;
int4store(p, stmt->array_size);
p+= 4;
p+=2;
/* When using mariadb_stmt_execute_direct stmt->paran_count is
not knowm, so we need to assign prebind_params, which was previously
@@ -862,9 +858,6 @@ unsigned char* mysql_stmt_execute_generate_bulk_request(MYSQL_STMT *stmt, size_t
if (stmt->param_count)
{
int1store(p, stmt->send_types_to_server);
p++;
free_bytes= length - (p - start);
/* Store type information:
@@ -2269,7 +2262,8 @@ int STDCALL mariadb_stmt_execute_direct(MYSQL_STMT *stmt,
{
MYSQL *mysql= stmt->mysql;
my_bool emulate_cmd= !(!(stmt->mysql->server_capabilities & CLIENT_MYSQL) &&
(stmt->mysql->extension->mariadb_server_capabilities & MARIADB_CLIENT_STMT_BULK_OPERATIONS >> 32));
(stmt->mysql->extension->mariadb_server_capabilities &
(MARIADB_CLIENT_STMT_BULK_OPERATIONS >> 32)));
if (!mysql)
{

View File

@@ -37,7 +37,8 @@ char *rand_str(size_t length) {
static int check_bulk(MYSQL *mysql)
{
bulk_enabled= (!(mysql->server_capabilities & CLIENT_MYSQL) &&
(mysql->extension->mariadb_server_capabilities & MARIADB_CLIENT_STMT_BULK_OPERATIONS >> 32));
(mysql->extension->mariadb_server_capabilities &
(MARIADB_CLIENT_STMT_BULK_OPERATIONS >> 32)));
diag("bulk %ssupported", bulk_enabled ? "" : "not ");
return OK;
}
@@ -605,7 +606,7 @@ struct my_tests_st my_tests[] = {
{"bulk2", bulk2, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"bulk3", bulk3, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"bulk4", bulk4, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"bulk_null", bulk_null, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
// {"bulk_null", bulk_null, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{NULL, NULL, 0, 0, NULL, NULL}
};