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
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:
@@ -31,7 +31,8 @@
|
|||||||
#define MARIADB_STMT_BULK_SUPPORTED(stmt)\
|
#define MARIADB_STMT_BULK_SUPPORTED(stmt)\
|
||||||
((stmt)->mysql && \
|
((stmt)->mysql && \
|
||||||
(!((stmt)->mysql->server_capabilities & CLIENT_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) \
|
#define SET_CLIENT_STMT_ERROR(a, b, c, d) \
|
||||||
{ \
|
{ \
|
||||||
@@ -83,6 +84,12 @@ enum enum_indicator_type
|
|||||||
STMT_INDICATOR_IGNORE=3
|
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
|
typedef enum mysql_stmt_state
|
||||||
{
|
{
|
||||||
MYSQL_STMT_INITTED = 0,
|
MYSQL_STMT_INITTED = 0,
|
||||||
|
@@ -803,9 +803,8 @@ unsigned char* mysql_stmt_execute_generate_bulk_request(MYSQL_STMT *stmt, size_t
|
|||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
0 4 Statement id
|
0 4 Statement id
|
||||||
4 2 Flags (cursor type):
|
4 2 Flags (cursor type):
|
||||||
STMT_BULK_SEND_TYPES = 64
|
STMT_BULK_FLAG_CLIENT_SEND_TYPES = 128
|
||||||
STMT_BULK_RETURN_AUTO_ID = 128
|
STMT_BULK_FLAG_INSERT_ID_REQUEST = 64
|
||||||
6 4 array size
|
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
if (stmt->send_types_to_server):
|
if (stmt->send_types_to_server):
|
||||||
for (i=0; i < param_count; i++)
|
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 */
|
/* todo: request to return auto generated ids */
|
||||||
if (stmt->send_types_to_server)
|
if (stmt->send_types_to_server)
|
||||||
flags|= 0x40;
|
flags|= STMT_BULK_FLAG_CLIENT_SEND_TYPES;
|
||||||
int2store(p, flags);
|
int2store(p, flags);
|
||||||
p++;
|
p+=2;
|
||||||
|
|
||||||
int4store(p, stmt->array_size);
|
|
||||||
p+= 4;
|
|
||||||
|
|
||||||
/* When using mariadb_stmt_execute_direct stmt->paran_count is
|
/* When using mariadb_stmt_execute_direct stmt->paran_count is
|
||||||
not knowm, so we need to assign prebind_params, which was previously
|
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)
|
if (stmt->param_count)
|
||||||
{
|
{
|
||||||
int1store(p, stmt->send_types_to_server);
|
|
||||||
p++;
|
|
||||||
|
|
||||||
free_bytes= length - (p - start);
|
free_bytes= length - (p - start);
|
||||||
|
|
||||||
/* Store type information:
|
/* Store type information:
|
||||||
@@ -2269,7 +2262,8 @@ int STDCALL mariadb_stmt_execute_direct(MYSQL_STMT *stmt,
|
|||||||
{
|
{
|
||||||
MYSQL *mysql= stmt->mysql;
|
MYSQL *mysql= stmt->mysql;
|
||||||
my_bool emulate_cmd= !(!(stmt->mysql->server_capabilities & CLIENT_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)
|
if (!mysql)
|
||||||
{
|
{
|
||||||
|
@@ -37,7 +37,8 @@ char *rand_str(size_t length) {
|
|||||||
static int check_bulk(MYSQL *mysql)
|
static int check_bulk(MYSQL *mysql)
|
||||||
{
|
{
|
||||||
bulk_enabled= (!(mysql->server_capabilities & CLIENT_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 ");
|
diag("bulk %ssupported", bulk_enabled ? "" : "not ");
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@@ -605,7 +606,7 @@ struct my_tests_st my_tests[] = {
|
|||||||
{"bulk2", bulk2, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
{"bulk2", bulk2, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||||
{"bulk3", bulk3, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
{"bulk3", bulk3, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||||
{"bulk4", bulk4, 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}
|
{NULL, NULL, 0, 0, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user