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

merge from 3.0.0 fixes

This commit is contained in:
Georg Richter
2015-12-29 21:06:23 +01:00
parent c8648cf4b2
commit a3bb1d2009
50 changed files with 2499 additions and 388 deletions

View File

@@ -215,7 +215,38 @@ extern unsigned int mariadb_deinitialize_ssl;
MARIADB_OPT_SSL_FP_LIST, /* finger print white list for server certificate verification */
MARIADB_OPT_SSL_PASSWORD, /* password for encrypted certificates */
MARIADB_OPT_COM_MULTI,
MARIADB_OPT_CONNECTION_READ_ONLY
MARIADB_OPT_CONNECTION_READ_ONLY,
MYSQL_OPT_CONNECT_ATTRS, /* for mysql_get_optionv */
MARIADB_OPT_USERDATA
};
enum mariadb_value {
MARIADB_CHARSET_ID,
MARIADB_CHARSET_INFO,
MARIADB_CHARSET_NAME,
MARIADB_CLIENT_ERRORS,
MARIADB_CLIENT_VERSION,
MARIADB_CLIENT_VERSION_ID,
MARIADB_CONNECTION_ASYNC_TIMEOUT,
MARIADB_CONNECTION_ASYNC_TIMEOUT_MS,
MARIADB_CONNECTION_HOST,
MARIADB_CONNECTION_INFO,
MARIADB_CONNECTION_PORT,
MARIADB_CONNECTION_PROTOCOL_VERSION_ID,
MARIADB_CONNECTION_PVIO_TYPE,
MARIADB_CONNECTION_SCHEMA,
MARIADB_CONNECTION_SERVER_TYPE,
MARIADB_CONNECTION_SERVER_VERSION,
MARIADB_CONNECTION_SERVER_VERSION_ID,
MARIADB_CONNECTION_SOCKET,
MARIADB_CONNECTION_SSL_CIPHER,
MARIADB_CONNECTION_SSL_VERSION,
MARIADB_CONNECTION_SSL_VERSION_ID,
MARIADB_CONNECTION_TYPE,
MARIADB_CONNECTION_UNIX_SOCKET,
MARIADB_CONNECTION_USER,
MARIADB_MAX_ALLOWED_PACKET,
MARIADB_NET_BUFFER_LENGTH
};
enum mysql_status { MYSQL_STATUS_READY,
@@ -407,12 +438,13 @@ const char * STDCALL mysql_character_set_name(MYSQL *mysql);
void STDCALL mysql_get_character_set_info(MYSQL *mysql, MY_CHARSET_INFO *cs);
int STDCALL mysql_set_character_set(MYSQL *mysql, const char *csname);
my_bool STDCALL mariadb_get_infov(MYSQL *mysql, enum mariadb_value value, void *arg, ...);
my_bool STDCALL mariadb_get_info(MYSQL *mysql, enum mariadb_value value, void *arg);
MYSQL * STDCALL mysql_init(MYSQL *mysql);
int STDCALL mysql_ssl_set(MYSQL *mysql, const char *key,
const char *cert, const char *ca,
const char *capath, const char *cipher);
const char * STDCALL mysql_get_ssl_cipher(MYSQL *mysql);
int STDCALL mysql_ssl_clear(MYSQL *mysql);
MYSQL * STDCALL mysql_connect(MYSQL *mysql, const char *host,
const char *user, const char *passwd);
my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
@@ -471,7 +503,6 @@ unsigned long STDCALL mysql_real_escape_string(MYSQL *mysql,
void STDCALL mysql_debug(const char *debug);
#define mysql_debug_init(A) mysql_debug((A));
void STDCALL mysql_debug_end(void);
void STDCALL myodbc_remove_escape(MYSQL *mysql,char *name);
unsigned int STDCALL mysql_thread_safe(void);
unsigned int STDCALL mysql_warning_count(MYSQL *mysql);
const char * STDCALL mysql_sqlstate(MYSQL *mysql);
@@ -485,16 +516,19 @@ const char * STDCALL mysql_get_client_info(void);
unsigned long STDCALL mysql_get_client_version(void);
my_bool STDCALL mariadb_connection(MYSQL *mysql);
const char * STDCALL mysql_get_server_name(MYSQL *mysql);
CHARSET_INFO * STDCALL mysql_get_charset_by_name(const char *csname);
CHARSET_INFO * STDCALL mysql_get_charset_by_nr(unsigned int csnr);
CHARSET_INFO * STDCALL mariadb_get_charset_by_name(const char *csname);
CHARSET_INFO * STDCALL mariadb_get_charset_by_nr(unsigned int csnr);
size_t STDCALL mariadb_convert_string(const char *from, size_t *from_len, CHARSET_INFO *from_cs,
char *to, size_t *to_len, CHARSET_INFO *to_cs, int *errorcode);
int STDCALL mysql_optionsv(MYSQL *mysql,enum mysql_option option, ...);
int STDCALL mysql_get_optionv(MYSQL *mysql, enum mysql_option option, void *arg, ...);
int STDCALL mysql_get_option(MYSQL *mysql, enum mysql_option option, void *arg);
MYSQL_PARAMETERS *STDCALL mysql_get_parameters(void);
unsigned long STDCALL mysql_hex_string(char *to, const char *from, size_t len);
my_socket STDCALL mysql_get_socket(const MYSQL *mysql);
my_socket STDCALL mysql_get_socket(MYSQL *mysql);
unsigned int STDCALL mysql_get_timeout_value(const MYSQL *mysql);
unsigned int STDCALL mysql_get_timeout_value_ms(const MYSQL *mysql);
my_bool STDCALL mysql_reconnect(MYSQL *mysql);
/* Async API */
int STDCALL mysql_close_start(MYSQL *sock);
@@ -607,6 +641,128 @@ int STDCALL mysql_stmt_send_long_data_cont(my_bool *ret, MYSQL_STMT *stmt,
int status);
/* API function calls (used by dynmic plugins) */
struct st_mariadb_api {
my_ulonglong (STDCALL *mysql_num_rows)(MYSQL_RES *res);
unsigned int (STDCALL *mysql_num_fields)(MYSQL_RES *res);
my_bool (STDCALL *mysql_eof)(MYSQL_RES *res);
MYSQL_FIELD *(STDCALL *mysql_fetch_field_direct)(MYSQL_RES *res, unsigned int fieldnr);
MYSQL_FIELD * (STDCALL *mysql_fetch_fields)(MYSQL_RES *res);
MYSQL_ROWS * (STDCALL *mysql_row_tell)(MYSQL_RES *res);
unsigned int (STDCALL *mysql_field_tell)(MYSQL_RES *res);
unsigned int (STDCALL *mysql_field_count)(MYSQL *mysql);
my_bool (STDCALL *mysql_more_results)(MYSQL *mysql);
int (STDCALL *mysql_next_result)(MYSQL *mysql);
my_ulonglong (STDCALL *mysql_affected_rows)(MYSQL *mysql);
my_bool (STDCALL *mysql_autocommit)(MYSQL *mysql, my_bool mode);
my_bool (STDCALL *mysql_commit)(MYSQL *mysql);
my_bool (STDCALL *mysql_rollback)(MYSQL *mysql);
my_ulonglong (STDCALL *mysql_insert_id)(MYSQL *mysql);
unsigned int (STDCALL *mysql_errno)(MYSQL *mysql);
char * (STDCALL *mysql_error)(MYSQL *mysql);
char * (STDCALL *mysql_info)(MYSQL *mysql);
unsigned long (STDCALL *mysql_thread_id)(MYSQL *mysql);
const char * (STDCALL *mysql_character_set_name)(MYSQL *mysql);
void (STDCALL *mysql_get_character_set_info)(MYSQL *mysql, MY_CHARSET_INFO *cs);
int (STDCALL *mysql_set_character_set)(MYSQL *mysql, const char *csname);
my_bool (STDCALL *mariadb_get_infov)(MYSQL *mysql, enum mariadb_value value, void *arg, ...);
my_bool (STDCALL *mariadb_get_info)(MYSQL *mysql, enum mariadb_value value, void *arg);
MYSQL * (STDCALL *mysql_init)(MYSQL *mysql);
int (STDCALL *mysql_ssl_set)(MYSQL *mysql, const char *key, const char *cert, const char *ca, const char *capath, const char *cipher);
const char * (STDCALL *mysql_get_ssl_cipher)(MYSQL *mysql);
MYSQL * (STDCALL *mysql_connect)(MYSQL *mysql, const char *host, const char *user, const char *passwd);
my_bool (STDCALL *mysql_change_user)(MYSQL *mysql, const char *user, const char *passwd, const char *db);
MYSQL * (STDCALL *mysql_real_connect)(MYSQL *mysql, const char *host, const char *user, const char *passwd, const char *db, unsigned int port, const char *unix_socket, unsigned long clientflag);
void (STDCALL *mysql_close)(MYSQL *sock);
int (STDCALL *mysql_select_db)(MYSQL *mysql, const char *db);
int (STDCALL *mysql_query)(MYSQL *mysql, const char *q);
int (STDCALL *mysql_send_query)(MYSQL *mysql, const char *q, size_t length);
my_bool (STDCALL *mysql_read_query_result)(MYSQL *mysql);
int (STDCALL *mysql_real_query)(MYSQL *mysql, const char *q, size_t length);
int (STDCALL *mysql_create_db)(MYSQL *mysql, const char *DB);
int (STDCALL *mysql_drop_db)(MYSQL *mysql, const char *DB);
int (STDCALL *mysql_shutdown)(MYSQL *mysql, enum mysql_enum_shutdown_level shutdown_level);
int (STDCALL *mysql_dump_debug_info)(MYSQL *mysql);
int (STDCALL *mysql_refresh)(MYSQL *mysql, unsigned int refresh_options);
int (STDCALL *mysql_kill)(MYSQL *mysql,unsigned long pid);
int (STDCALL *mysql_ping)(MYSQL *mysql);
char * (STDCALL *mysql_stat)(MYSQL *mysql);
char * (STDCALL *mysql_get_server_info)(MYSQL *mysql);
unsigned long (STDCALL *mysql_get_server_version)(MYSQL *mysql);
char * (STDCALL *mysql_get_host_info)(MYSQL *mysql);
unsigned int (STDCALL *mysql_get_proto_info)(MYSQL *mysql);
MYSQL_RES * (STDCALL *mysql_list_dbs)(MYSQL *mysql,const char *wild);
MYSQL_RES * (STDCALL *mysql_list_tables)(MYSQL *mysql,const char *wild);
MYSQL_RES * (STDCALL *mysql_list_fields)(MYSQL *mysql, const char *table, const char *wild);
MYSQL_RES * (STDCALL *mysql_list_processes)(MYSQL *mysql);
MYSQL_RES * (STDCALL *mysql_store_result)(MYSQL *mysql);
MYSQL_RES * (STDCALL *mysql_use_result)(MYSQL *mysql);
int (STDCALL *mysql_options)(MYSQL *mysql,enum mysql_option option, const void *arg);
void (STDCALL *mysql_free_result)(MYSQL_RES *result);
void (STDCALL *mysql_data_seek)(MYSQL_RES *result, my_ulonglong offset);
MYSQL_ROW_OFFSET (STDCALL *mysql_row_seek)(MYSQL_RES *result, MYSQL_ROW_OFFSET);
MYSQL_FIELD_OFFSET (STDCALL *mysql_field_seek)(MYSQL_RES *result, MYSQL_FIELD_OFFSET offset);
MYSQL_ROW (STDCALL *mysql_fetch_row)(MYSQL_RES *result);
unsigned long * (STDCALL *mysql_fetch_lengths)(MYSQL_RES *result);
MYSQL_FIELD * (STDCALL *mysql_fetch_field)(MYSQL_RES *result);
unsigned long (STDCALL *mysql_escape_string)(char *to,const char *from, unsigned long from_length);
unsigned long (STDCALL *mysql_real_escape_string)(MYSQL *mysql, char *to,const char *from, unsigned long length);
void (STDCALL *mysql_debug)(const char *debug);
void (STDCALL *mysql_debug_end)(void);
unsigned int (STDCALL *mysql_thread_safe)(void);
unsigned int (STDCALL *mysql_warning_count)(MYSQL *mysql);
const char * (STDCALL *mysql_sqlstate)(MYSQL *mysql);
int (STDCALL *mysql_server_init)(int argc, char **argv, char **groups);
void (STDCALL *mysql_server_end)(void);
void (STDCALL *mysql_thread_end)(void);
my_bool (STDCALL *mysql_thread_init)(void);
int (STDCALL *mysql_set_server_option)(MYSQL *mysql, enum enum_mysql_set_option option);
const char * (STDCALL *mysql_get_client_info)(void);
unsigned long (STDCALL *mysql_get_client_version)(void);
my_bool (STDCALL *mariadb_connection)(MYSQL *mysql);
const char * (STDCALL *mysql_get_server_name)(MYSQL *mysql);
CHARSET_INFO * (STDCALL *mariadb_get_charset_by_name)(const char *csname);
CHARSET_INFO * (STDCALL *mariadb_get_charset_by_nr)(unsigned int csnr);
size_t (STDCALL *mariadb_convert_string)(const char *from, size_t *from_len, CHARSET_INFO *from_cs, char *to, size_t *to_len, CHARSET_INFO *to_cs, int *errorcode);
int (STDCALL *mysql_optionsv)(MYSQL *mysql,enum mysql_option option, ...);
int (STDCALL *mysql_get_optionv)(MYSQL *mysql, enum mysql_option option, void *arg, ...);
int (STDCALL *mysql_get_option)(MYSQL *mysql, enum mysql_option option, void *arg);
MYSQL_PARAMETERS *(STDCALL *mysql_get_parameters)(void);
unsigned long (STDCALL *mysql_hex_string)(char *to, const char *from, size_t len);
my_socket (STDCALL *mysql_get_socket)(MYSQL *mysql);
unsigned int (STDCALL *mysql_get_timeout_value)(const MYSQL *mysql);
unsigned int (STDCALL *mysql_get_timeout_value_ms)(const MYSQL *mysql);
my_bool (STDCALL *mysql_reconnect)(MYSQL *mysql);
MYSQL_STMT * (STDCALL *mysql_stmt_init)(MYSQL *mysql);
int (STDCALL *mysql_stmt_prepare)(MYSQL_STMT *stmt, const char *query, size_t length);
int (STDCALL *mysql_stmt_execute)(MYSQL_STMT *stmt);
int (STDCALL *mysql_stmt_fetch)(MYSQL_STMT *stmt);
int (STDCALL *mysql_stmt_fetch_column)(MYSQL_STMT *stmt, MYSQL_BIND *bind_arg, unsigned int column, unsigned long offset);
int (STDCALL *mysql_stmt_store_result)(MYSQL_STMT *stmt);
unsigned long (STDCALL *mysql_stmt_param_count)(MYSQL_STMT * stmt);
my_bool (STDCALL *mysql_stmt_attr_set)(MYSQL_STMT *stmt, enum enum_stmt_attr_type attr_type, const void *attr);
my_bool (STDCALL *mysql_stmt_attr_get)(MYSQL_STMT *stmt, enum enum_stmt_attr_type attr_type, void *attr);
my_bool (STDCALL *mysql_stmt_bind_param)(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
my_bool (STDCALL *mysql_stmt_bind_result)(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
my_bool (STDCALL *mysql_stmt_close)(MYSQL_STMT * stmt);
my_bool (STDCALL *mysql_stmt_reset)(MYSQL_STMT * stmt);
my_bool (STDCALL *mysql_stmt_free_result)(MYSQL_STMT *stmt);
my_bool (STDCALL *mysql_stmt_send_long_data)(MYSQL_STMT *stmt, unsigned int param_number, const char *data, size_t length);
MYSQL_RES *(STDCALL *mysql_stmt_result_metadata)(MYSQL_STMT *stmt);
MYSQL_RES *(STDCALL *mysql_stmt_param_metadata)(MYSQL_STMT *stmt);
unsigned int (STDCALL *mysql_stmt_errno)(MYSQL_STMT * stmt);
const char *(STDCALL *mysql_stmt_error)(MYSQL_STMT * stmt);
const char *(STDCALL *mysql_stmt_sqlstate)(MYSQL_STMT * stmt);
MYSQL_ROW_OFFSET (STDCALL *mysql_stmt_row_seek)(MYSQL_STMT *stmt, MYSQL_ROW_OFFSET offset);
MYSQL_ROW_OFFSET (STDCALL *mysql_stmt_row_tell)(MYSQL_STMT *stmt);
void (STDCALL *mysql_stmt_data_seek)(MYSQL_STMT *stmt, my_ulonglong offset);
my_ulonglong (STDCALL *mysql_stmt_num_rows)(MYSQL_STMT *stmt);
my_ulonglong (STDCALL *mysql_stmt_affected_rows)(MYSQL_STMT *stmt);
my_ulonglong (STDCALL *mysql_stmt_insert_id)(MYSQL_STMT *stmt);
unsigned int (STDCALL *mysql_stmt_field_count)(MYSQL_STMT *stmt);
int (STDCALL *mysql_stmt_next_result)(MYSQL_STMT *stmt);
my_bool (STDCALL *mysql_stmt_more_results)(MYSQL_STMT *stmt);
};
/* these methods can be overwritten by db plugins */
struct st_mysql_methods {
@@ -630,6 +786,8 @@ struct st_mysql_methods {
int (*db_stmt_fetch_to_bind)(MYSQL_STMT *stmt, unsigned char *row);
void (*db_stmt_flush_unbuffered)(MYSQL_STMT *stmt);
void (*set_error)(MYSQL *mysql, unsigned int error_nr, const char *sqlstate, const char *format, ...);
void (*invalidate_stmts)(MYSQL *mysql, const char *function_name);
struct st_mariadb_api *api;
};
/* synonyms/aliases functions */