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
Plugin fixes
- include ma_errmsg.h if plugin is built dynamically - trace_example fixes
This commit is contained in:
@@ -373,8 +373,17 @@ ssize_t ma_pvio_write(MARIADB_PVIO *pvio, const uchar *buffer, size_t length)
|
|||||||
if (pvio->methods->write)
|
if (pvio->methods->write)
|
||||||
r= pvio->methods->write(pvio, buffer, length);
|
r= pvio->methods->write(pvio, buffer, length);
|
||||||
end:
|
end:
|
||||||
if (pvio->callback)
|
if (pvio_callback)
|
||||||
pvio->callback(pvio, 0, buffer, r);
|
{
|
||||||
|
void (*callback)(int mode, MYSQL *mysql, const uchar *buffer, size_t length);
|
||||||
|
LIST *p= pvio_callback;
|
||||||
|
while (p)
|
||||||
|
{
|
||||||
|
callback= p->data;
|
||||||
|
callback(1, pvio->mysql, buffer, r);
|
||||||
|
p= p->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
SET(PLUGIN_EXTRA_FILES ${CC_SOURCE_DIR}/libmariadb/ma_errmsg.c)
|
||||||
FILE(GLOB plugin_dirs ${CC_SOURCE_DIR}/plugins/*)
|
FILE(GLOB plugin_dirs ${CC_SOURCE_DIR}/plugins/*)
|
||||||
FOREACH(dir ${plugin_dirs})
|
FOREACH(dir ${plugin_dirs})
|
||||||
IF (EXISTS ${dir}/CMakeLists.txt)
|
IF (EXISTS ${dir}/CMakeLists.txt)
|
||||||
|
@@ -14,7 +14,7 @@ IF(REPLICATION_PLUGIN_TYPE MATCHES "DYNAMIC")
|
|||||||
"FILE_DESCRIPTION:Connection plugin for master/slave environment")
|
"FILE_DESCRIPTION:Connection plugin for master/slave environment")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ADD_DEFINITIONS(-DHAVE_REPLICATION_DYNAMIC=1)
|
ADD_DEFINITIONS(-DHAVE_REPLICATION_DYNAMIC=1)
|
||||||
ADD_LIBRARY(replication MODULE ${replication_RC} replication.c ${EXPORT_FILE})
|
ADD_LIBRARY(replication MODULE ${replication_RC} replication.c ${PLUGIN_EXTRA_FILES} ${EXPORT_FILE})
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
TARGET_LINK_LIBRARIES(replication libmariadb)
|
TARGET_LINK_LIBRARIES(replication libmariadb)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
@@ -30,7 +30,7 @@ IF(AURORA_PLUGIN_TYPE MATCHES "DYNAMIC")
|
|||||||
"FILE_DESCRIPTION:Connection plugin for Amazon AWS Aurora")
|
"FILE_DESCRIPTION:Connection plugin for Amazon AWS Aurora")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ADD_DEFINITIONS(-DHAVE_AURORA_DYNAMIC=1)
|
ADD_DEFINITIONS(-DHAVE_AURORA_DYNAMIC=1)
|
||||||
ADD_LIBRARY(aurora MODULE ${aurora_RC} aurora.c ${EXPORT_FILE})
|
ADD_LIBRARY(aurora MODULE ${aurora_RC} aurora.c ${PLUGIN_EXTRA_FILES} ${EXPORT_FILE})
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
TARGET_LINK_LIBRARIES(aurora libmariadb)
|
TARGET_LINK_LIBRARIES(aurora libmariadb)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
@@ -20,7 +20,7 @@ IF(SOCKET_PLUGIN_TYPE MATCHES "DYNAMIC")
|
|||||||
"FILE_DESCRIPTION:VIO plugin for socket communication")
|
"FILE_DESCRIPTION:VIO plugin for socket communication")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ADD_DEFINITIONS(-DHAVE_SOCKET_DYNAMIC=1)
|
ADD_DEFINITIONS(-DHAVE_SOCKET_DYNAMIC=1)
|
||||||
ADD_LIBRARY(pvio_socket MODULE ${pvio_socket_RC} pvio_socket.c ${EXPORT_FILE})
|
ADD_LIBRARY(pvio_socket MODULE ${pvio_socket_RC} pvio_socket.c ${PLUGIN_EXTRA_FILES} ${EXPORT_FILE})
|
||||||
INSTALL_PLUGIN(pvio_socket ${CC_BINARY_DIR}/plugins/pvio)
|
INSTALL_PLUGIN(pvio_socket ${CC_BINARY_DIR}/plugins/pvio)
|
||||||
SIGN_TARGET(pvio_socket)
|
SIGN_TARGET(pvio_socket)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
@@ -35,7 +35,7 @@ IF(WIN32)
|
|||||||
"FILE_DESCRIPTION:VIO plugin for named pipe communication")
|
"FILE_DESCRIPTION:VIO plugin for named pipe communication")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ADD_DEFINITIONS(-DHAVE_NPIPE_DYNAMIC=1)
|
ADD_DEFINITIONS(-DHAVE_NPIPE_DYNAMIC=1)
|
||||||
ADD_LIBRARY(pvio_npipe MODULE ${pvio_npipe_RC} pvio_npipe.c ${EXPORT_FILE})
|
ADD_LIBRARY(pvio_npipe MODULE ${pvio_npipe_RC} pvio_npipe.c ${PLUGIN_EXTRA_FILES} ${EXPORT_FILE})
|
||||||
INSTALL_PLUGIN(pvio_npipe ${CC_BINARY_DIR}/plugins/pvio)
|
INSTALL_PLUGIN(pvio_npipe ${CC_BINARY_DIR}/plugins/pvio)
|
||||||
SIGN_TARGET(pvio_npipe)
|
SIGN_TARGET(pvio_npipe)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
@@ -48,7 +48,7 @@ IF(WIN32)
|
|||||||
"ORIGINAL_FILE_NAME:pvio_shmem.dll"
|
"ORIGINAL_FILE_NAME:pvio_shmem.dll"
|
||||||
"FILE_DESCRIPTION:VIO plugin for shared memory communication")
|
"FILE_DESCRIPTION:VIO plugin for shared memory communication")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ADD_LIBRARY(pvio_shmem MODULE ${pvio_shmem_RC} pvio_shmem.c ${EXPORT_FILE})
|
ADD_LIBRARY(pvio_shmem MODULE ${pvio_shmem_RC} pvio_shmem.c ${PLUGIN_EXTRA_FILES} ${EXPORT_FILE})
|
||||||
INSTALL_PLUGIN(pvio_shmem ${CC_BINARY_DIR}/plugins/pvio)
|
INSTALL_PLUGIN(pvio_shmem ${CC_BINARY_DIR}/plugins/pvio)
|
||||||
SIGN_TARGET(pvio_shmem)
|
SIGN_TARGET(pvio_shmem)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
@@ -94,6 +94,7 @@ static const char *commands[]= {
|
|||||||
"COM_SET_OPTION",
|
"COM_SET_OPTION",
|
||||||
"COM_STMT_FETCH",
|
"COM_STMT_FETCH",
|
||||||
"COM_DAEMON",
|
"COM_DAEMON",
|
||||||
|
"COM_MULTI",
|
||||||
"COM_END"
|
"COM_END"
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -101,6 +102,7 @@ typedef struct {
|
|||||||
unsigned long thread_id;
|
unsigned long thread_id;
|
||||||
int last_command; /* COM_* values, -1 for handshake */
|
int last_command; /* COM_* values, -1 for handshake */
|
||||||
unsigned int max_packet_size;
|
unsigned int max_packet_size;
|
||||||
|
unsigned int num_commands;
|
||||||
size_t total_size[2];
|
size_t total_size[2];
|
||||||
unsigned int client_flags;
|
unsigned int client_flags;
|
||||||
char *username;
|
char *username;
|
||||||
@@ -111,6 +113,7 @@ typedef struct {
|
|||||||
uchar charset;
|
uchar charset;
|
||||||
void *next;
|
void *next;
|
||||||
int local_infile;
|
int local_infile;
|
||||||
|
unsigned long pkt_length;
|
||||||
} TRACE_INFO;
|
} TRACE_INFO;
|
||||||
|
|
||||||
#define TRACE_STATUS(a) (!a) ? "ok" : "error"
|
#define TRACE_STATUS(a) (!a) ? "ok" : "error"
|
||||||
@@ -121,6 +124,7 @@ static TRACE_INFO *get_trace_info(unsigned long thread_id)
|
|||||||
{
|
{
|
||||||
TRACE_INFO *info= trace_info;
|
TRACE_INFO *info= trace_info;
|
||||||
|
|
||||||
|
/* search connection */
|
||||||
while (info)
|
while (info)
|
||||||
{
|
{
|
||||||
if (info->thread_id == thread_id)
|
if (info->thread_id == thread_id)
|
||||||
@@ -226,8 +230,7 @@ static void trace_set_command(TRACE_INFO *info, char *buffer, size_t size)
|
|||||||
if (info->command)
|
if (info->command)
|
||||||
free(info->command);
|
free(info->command);
|
||||||
|
|
||||||
info->command= (char *)malloc(size);
|
info->command= strndup(buffer, size);
|
||||||
strncpy(info->command, buffer, size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dump_buffer(uchar *buffer, size_t len)
|
void dump_buffer(uchar *buffer, size_t len)
|
||||||
@@ -248,7 +251,7 @@ static void dump_simple(TRACE_INFO *info, my_bool is_error)
|
|||||||
|
|
||||||
static void dump_reference(TRACE_INFO *info, my_bool is_error)
|
static void dump_reference(TRACE_INFO *info, my_bool is_error)
|
||||||
{
|
{
|
||||||
printf("%8lu: %s(%lu) %s\n", info->thread_id, commands[info->last_command], info->refid, TRACE_STATUS(is_error));
|
printf("%8lu: %s(%lu) %s\n", info->thread_id, commands[info->last_command], (long)info->refid, TRACE_STATUS(is_error));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dump_command(TRACE_INFO *info, my_bool is_error)
|
static void dump_command(TRACE_INFO *info, my_bool is_error)
|
||||||
@@ -272,7 +275,6 @@ void trace_callback(int mode, MYSQL *mysql, const uchar *buffer, size_t length)
|
|||||||
unsigned long thread_id= mysql->thread_id;
|
unsigned long thread_id= mysql->thread_id;
|
||||||
TRACE_INFO *info;
|
TRACE_INFO *info;
|
||||||
|
|
||||||
|
|
||||||
/* check if package is server greeting package,
|
/* check if package is server greeting package,
|
||||||
* and set thread_id */
|
* and set thread_id */
|
||||||
if (!thread_id && mode == READ)
|
if (!thread_id && mode == READ)
|
||||||
@@ -343,10 +345,17 @@ void trace_callback(int mode, MYSQL *mysql, const uchar *buffer, size_t length)
|
|||||||
|
|
||||||
if (mode == WRITE)
|
if (mode == WRITE)
|
||||||
{
|
{
|
||||||
|
if (info->pkt_length > 0)
|
||||||
|
{
|
||||||
|
info->pkt_length-= length;
|
||||||
|
return;
|
||||||
|
}
|
||||||
len= uint3korr(p);
|
len= uint3korr(p);
|
||||||
|
info->pkt_length= len + 4 - length;
|
||||||
p+= 4;
|
p+= 4;
|
||||||
info->last_command= *p;
|
info->last_command= *p;
|
||||||
p++;
|
p++;
|
||||||
|
|
||||||
switch (info->last_command) {
|
switch (info->last_command) {
|
||||||
case COM_INIT_DB:
|
case COM_INIT_DB:
|
||||||
case COM_DROP_DB:
|
case COM_DROP_DB:
|
||||||
|
@@ -26,7 +26,7 @@ INCLUDE_DIRECTORIES(${CC_SOURCE_DIR}/include
|
|||||||
${CC_SOURCE_DIR}/unittest/libmariadb)
|
${CC_SOURCE_DIR}/unittest/libmariadb)
|
||||||
ADD_DEFINITIONS(-DLIBMARIADB)
|
ADD_DEFINITIONS(-DLIBMARIADB)
|
||||||
|
|
||||||
SET(API_TESTS "performance" "basic-t" "fetch" "charset" "logs" "cursor" "errors" "view" "ps" "ps_bugs" "sp" "result" "connection" "misc" "ps_new" "sqlite3" "thread" "features-10_2"
|
SET(API_TESTS "performance" "basic-t" "fetch" "charset" "logs" "cursor" "errors" "view" "ps" "ps_bugs" "sp" "result" "connection" "misc" "ps_new" "sqlite3" "thread" "features-10_2" "async_example"
|
||||||
"bulk1" )
|
"bulk1" )
|
||||||
IF(WITH_DYNCOL)
|
IF(WITH_DYNCOL)
|
||||||
SET(API_TESTS ${API_TESTS} "dyncol")
|
SET(API_TESTS ${API_TESTS} "dyncol")
|
||||||
|
@@ -60,6 +60,8 @@ static int bulk1(MYSQL *mysql)
|
|||||||
if (!bulk_enabled)
|
if (!bulk_enabled)
|
||||||
return SKIP;
|
return SKIP;
|
||||||
|
|
||||||
|
rc= mysql_select_db(mysql, "testc");
|
||||||
|
|
||||||
rc= mysql_query(mysql, "DROP TABLE IF EXISTS bulk1");
|
rc= mysql_query(mysql, "DROP TABLE IF EXISTS bulk1");
|
||||||
check_mysql_rc(rc, mysql);
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
|
@@ -139,7 +139,6 @@ static int conc_212(MYSQL *mysql)
|
|||||||
mysql_stmt_store_result(stmt);
|
mysql_stmt_store_result(stmt);
|
||||||
mysql_stmt_free_result(stmt);
|
mysql_stmt_free_result(stmt);
|
||||||
|
|
||||||
sleep(100);
|
|
||||||
rc= mariadb_stmt_execute_direct(stmt, "SELECT 1, 2", -1);
|
rc= mariadb_stmt_execute_direct(stmt, "SELECT 1, 2", -1);
|
||||||
check_stmt_rc(rc, stmt);
|
check_stmt_rc(rc, stmt);
|
||||||
mysql_stmt_store_result(stmt);
|
mysql_stmt_store_result(stmt);
|
||||||
|
Reference in New Issue
Block a user