You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-07 02:42:49 +03:00
more fixes
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
# CMakeLists.txt
|
||||
|
||||
|
||||
# This is the LGPL libmariadb project.
|
||||
PROJECT(mariadb-connector-c C)
|
||||
|
||||
@@ -76,7 +77,7 @@ ENDIF()
|
||||
SET(PROTOCOL_VERSION 10) # we adapted new password option from PHP's mysqlnd !
|
||||
SET(MYSQL_CLIENT_VERSION_MAJOR "5")
|
||||
SET(MYSQL_CLIENT_VERSION_MINOR "5")
|
||||
SET(MYSQL_CLIENT_VERSION_PATCH "1")
|
||||
SET(MYSQL_CLIENT_VERSION_PATCH "2")
|
||||
SET(MYSQL_CLIENT_VERSION "${MYSQL_CLIENT_VERSION_MAJOR}.${MYSQL_CLIENT_VERSION_MINOR}.${MYSQL_CLIENT_VERSION_PATCH}")
|
||||
MATH(EXPR MYSQL_VERSION_ID "${MYSQL_CLIENT_VERSION_MAJOR} * 10000 +
|
||||
${MYSQL_CLIENT_VERSION_MINOR} * 100 +
|
||||
@@ -88,13 +89,10 @@ IF(NOT MYSQL_UNIX_ADDR)
|
||||
SET(MYSQL_UNIX_ADDR "/tmp/mysql.sock")
|
||||
ENDIF()
|
||||
|
||||
FIND_PACKAGE(CURL)
|
||||
IF(CURL_FOUND)
|
||||
ADD_DEFINITIONS(-DHAVE_CURL=1)
|
||||
ENDIF()
|
||||
|
||||
INCLUDE("${CMAKE_SOURCE_DIR}/cmake/install.cmake")
|
||||
|
||||
# todo: we don't character sets in share - all is compiled in
|
||||
SET(SHAREDIR "share")
|
||||
SET(DEFAULT_CHARSET_HOME "${CMAKE_INSTALL_PREFIX}")
|
||||
SET(PLUGINDIR "${CMAKE_INSTALL_PREFIX}/lib/plugin")
|
||||
|
||||
@@ -109,29 +107,22 @@ ENDIF()
|
||||
|
||||
|
||||
IF(UNIX)
|
||||
SEARCH_LIBRARY(DEFAULT_LIB inet_ntoa "c")
|
||||
# IF(NOT DEFAULT_LIB)
|
||||
SEARCH_LIBRARY(LIBNSL inet_ntoa "nsl_r;nsl")
|
||||
# ENDIF()
|
||||
SEARCH_LIBRARY(DEFAULT_LIB bind "c")
|
||||
IF(NOT DEFAULT_LIB)
|
||||
SEARCH_LIBRARY(LIBBIND bind "bind;socket")
|
||||
ENDIF()
|
||||
SEARCH_LIBRARY(DEFAULT_LIB setsockopt "c")
|
||||
IF(NOT DEFAULT_LIB)
|
||||
SEARCH_LIBRARY(LIBSOCKET setsockopt "socket")
|
||||
ENDIF()
|
||||
SEARCH_LIBRARY(LIBDL dlopen "dl")
|
||||
SEARCH_LIBRARY(LIBM floor m)
|
||||
# SEARCH_LIBRARY(LIBICONV iconv iconv)
|
||||
SEARCH_LIBRARY(LIBPTHREAD pthread_getspecific "pthread;pthreads")
|
||||
SET(EXTRA_LIBS "${LIBNSL}" "${LIBBIND}" "${LIBSOCKET}" "${LIBDL}" "${LIBM}" "${LIBPTHREAD}")
|
||||
SET(EXTRA_LIBS "${LIBNSL}" "${LIBBIND}" "${LIBSOCKET}")
|
||||
FIND_PACKAGE(Threads)
|
||||
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${LIBNSL} ${LIBBIND} ${LIBICONV}
|
||||
${LIBSOCKET} ${LIBDL} ${LIBM} ${LIBPTHREAD})
|
||||
#remove possible dups from required libraries
|
||||
LIST(LENGTH SYS_LIBS rllength)
|
||||
LIST(LENGTH CMAKE_REQUIRED_LIBRARIES rllength)
|
||||
IF(${rllength} GREATER 0)
|
||||
LIST(REMOVE_DUPLICATES SYS_LIBS)
|
||||
LIST(REMOVE_DUPLICATES CMAKE_REQUIRED_LIBRARIES)
|
||||
ENDIF()
|
||||
SET(CMAKE_REQUIRED_LIBRARIES ${SYS_LIBS})
|
||||
ENDIF()
|
||||
|
||||
|
||||
@@ -189,6 +180,8 @@ IF(WIN32)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
|
||||
|
||||
IF(WITH_SQLITE)
|
||||
ADD_DEFINITIONS(-DHAVE_SQLITE)
|
||||
ENDIF()
|
||||
|
@@ -77,7 +77,7 @@ struct st_mysql_client_plugin
|
||||
struct st_mysql;
|
||||
|
||||
/********* database api plugin specific declarations **********/
|
||||
typedef struct st_mariadb_client_plugin_DB
|
||||
struct st_mariadb_client_plugin_DB
|
||||
{
|
||||
MYSQL_CLIENT_PLUGIN_HEADER
|
||||
/* functions */
|
||||
|
@@ -8,7 +8,6 @@ ADD_DEFINITIONS(-D LIBMARIADB)
|
||||
ADD_DEFINITIONS(-D THREAD)
|
||||
|
||||
SET(EXPORT_SYMBOLS
|
||||
client_errors
|
||||
load_defaults
|
||||
ma_cio_register_callback
|
||||
mariadb_connection
|
||||
@@ -249,8 +248,6 @@ bmove.c
|
||||
bmove_upp.c
|
||||
my_charset.c
|
||||
hash.c
|
||||
ma_cio.c
|
||||
ma_ssl.c
|
||||
net.c
|
||||
charset.c
|
||||
ma_time.c
|
||||
@@ -267,7 +264,8 @@ libmariadb.c
|
||||
list.c
|
||||
llstr.c
|
||||
longlong2str.c
|
||||
ma_io.c
|
||||
ma_cio.c
|
||||
ma_ssl.c
|
||||
mf_dirname.c
|
||||
mf_fn_ext.c
|
||||
mf_format.c
|
||||
@@ -324,7 +322,7 @@ my_stmt.c
|
||||
my_loaddata.c
|
||||
my_stmt_codec.c
|
||||
client_plugin.c
|
||||
# built in plugins
|
||||
ma_io.c
|
||||
${CMAKE_SOURCE_DIR}/plugins/builtin/my_auth.c
|
||||
${CMAKE_SOURCE_DIR}/plugins/builtin/cio_socket.c
|
||||
)
|
||||
|
@@ -132,16 +132,14 @@ static struct st_mysql_client_plugin *find_plugin(const char *name, int type)
|
||||
if (type < 0 || type >= MYSQL_CLIENT_MAX_PLUGINS)
|
||||
return 0;
|
||||
|
||||
if (!name)
|
||||
return plugin_list[type]->plugin;
|
||||
|
||||
for (p= plugin_list[type]; p; p= p->next)
|
||||
{
|
||||
if (name)
|
||||
{
|
||||
if (strcmp(p->plugin->name, name) == 0)
|
||||
return p->plugin;
|
||||
}
|
||||
else if (p->plugin->type == type)
|
||||
return p->plugin;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -410,7 +408,7 @@ mysql_load_plugin_v(MYSQL *mysql, const char *name, int type,
|
||||
}
|
||||
|
||||
|
||||
if (!(sym= (int *)dlsym(dlhandle, plugin_declarations_sym)))
|
||||
if (!(sym= dlsym(dlhandle, plugin_declarations_sym)))
|
||||
{
|
||||
errmsg= "not a plugin";
|
||||
(void)dlclose(dlhandle);
|
||||
@@ -463,7 +461,6 @@ mysql_load_plugin(MYSQL *mysql, const char *name, int type, int argc, ...)
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
/* see <mysql/client_plugin.h> for a full description */
|
||||
struct st_mysql_client_plugin * STDCALL
|
||||
mysql_client_find_plugin(MYSQL *mysql, const char *name, int type)
|
||||
@@ -483,7 +480,6 @@ mysql_client_find_plugin(MYSQL *mysql, const char *name, int type)
|
||||
return p;
|
||||
|
||||
/* not found, load it */
|
||||
if (name)
|
||||
return mysql_load_plugin(mysql, name, type, 0);
|
||||
}
|
||||
|
||||
|
@@ -1811,7 +1811,7 @@ static int DoTrace(CODE_STATE *cs)
|
||||
case INCLUDE: return DO_TRACE;
|
||||
case MATCHED|SUBDIR:
|
||||
case NOT_MATCHED|SUBDIR:
|
||||
case MATCHED: return framep_trace_flag(cs, cs->framep) ?
|
||||
case MATCHED: return (framep_trace_flag(cs, cs->framep)) ?
|
||||
DO_TRACE : DONT_TRACE;
|
||||
case EXCLUDE:
|
||||
case NOT_MATCHED: return DONT_TRACE;
|
||||
|
@@ -544,21 +544,6 @@ mysql_debug(const char *debug __attribute__((unused)))
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
** Close the server connection if we get a SIGPIPE
|
||||
ARGSUSED
|
||||
**************************************************************************/
|
||||
|
||||
static sig_handler
|
||||
pipe_sig_handler(int sig __attribute__((unused)))
|
||||
{
|
||||
DBUG_PRINT("info",("Hit by signal %d",sig));
|
||||
#ifdef DONT_REMEMBER_SIGNAL
|
||||
(void) signal(SIGPIPE,pipe_sig_handler);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
** Shut down connection
|
||||
**************************************************************************/
|
||||
@@ -1142,10 +1127,6 @@ mysql_init(MYSQL *mysql)
|
||||
mysql->charset= default_charset_info;
|
||||
strmov(mysql->net.sqlstate, "00000");
|
||||
mysql->net.last_error[0]= mysql->net.last_errno= 0;
|
||||
#if defined(SIGPIPE) && defined(THREAD) && !defined(_WIN32)
|
||||
if (!((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE))
|
||||
(void) signal(SIGPIPE,pipe_sig_handler);
|
||||
#endif
|
||||
|
||||
/*
|
||||
Only enable LOAD DATA INFILE by default if configured with
|
||||
@@ -1685,13 +1666,13 @@ static my_bool mysql_reconnect(MYSQL *mysql)
|
||||
tmp_mysql.options.my_cnf_group= tmp_mysql.options.my_cnf_file= NULL;
|
||||
|
||||
/* make sure that we reconnect with the same character set */
|
||||
/* if (!tmp_mysql.options.charset_name ||
|
||||
if (!tmp_mysql.options.charset_name ||
|
||||
strcmp(tmp_mysql.options.charset_name, mysql->charset->csname))
|
||||
{
|
||||
my_free(tmp_mysql.options.charset_name);
|
||||
tmp_mysql.options.charset_name= my_strdup(mysql->charset->csname, MYF(MY_WME));
|
||||
}
|
||||
*/
|
||||
|
||||
tmp_mysql.reconnect= mysql->reconnect;
|
||||
if (!mysql_real_connect(&tmp_mysql,mysql->host,mysql->user,mysql->passwd,
|
||||
mysql->db, mysql->port, mysql->unix_socket,
|
||||
|
@@ -35,7 +35,7 @@
|
||||
#include <my_global.h>
|
||||
#include <my_sys.h>
|
||||
#include <ma_common.h>
|
||||
#include <ma_secure.h>
|
||||
//#include <ma_secure.h>
|
||||
#include <errmsg.h>
|
||||
#include <ma_cio.h>
|
||||
#include <ma_ssl.h>
|
||||
|
@@ -52,6 +52,7 @@ mysql_declare_client_plugin(TRACE)
|
||||
"LGPL",
|
||||
&trace_init,
|
||||
&trace_deinit,
|
||||
NULL
|
||||
mysql_end_client_plugin;
|
||||
|
||||
static char *commands[]= {
|
||||
|
Binary file not shown.
@@ -62,7 +62,7 @@ ENDIF()
|
||||
|
||||
FOREACH(API_TEST ${API_TESTS})
|
||||
ADD_EXECUTABLE(${API_TEST} ${API_TEST}.c)
|
||||
TARGET_LINK_LIBRARIES(${API_TEST} mytap libmariadb )
|
||||
TARGET_LINK_LIBRARIES(${API_TEST} mytap mariadbclient )
|
||||
ADD_TEST(${API_TEST} ${EXECUTABLE_OUTPUT_PATH}/${API_TEST})
|
||||
SET_TESTS_PROPERTIES(${API_TEST} PROPERTIES TIMEOUT 120)
|
||||
ENDFOREACH(API_TEST)
|
||||
|
@@ -61,6 +61,7 @@ static int test_conc75(MYSQL *my)
|
||||
rc= mysql_query(mysql, "load data local infile './nonexistingfile.csv' into table a (`a`)");
|
||||
FAIL_IF(!test(mysql->options.client_flag | CLIENT_LOCAL_FILES), "client_flags not correct");
|
||||
FAIL_IF(thread_id == mysql_thread_id(mysql), "new thread id expected");
|
||||
diag("cs: %s", mysql->charset->csname);
|
||||
FAIL_IF(strcmp(mysql->charset->csname, "utf8"), "wrong character set");
|
||||
}
|
||||
mysql_close(mysql);
|
||||
|
Reference in New Issue
Block a user