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

more fixes for 10.2 integration

This commit is contained in:
Georg Richter
2016-02-02 20:09:42 +01:00
parent 4ecc4c0704
commit e138995b87
35 changed files with 192 additions and 213 deletions

View File

@@ -1,37 +1,18 @@
SET(MARIADB_CLIENT_INCLUDES config-win.h SET(MARIADB_CLIENT_INCLUDES
dbug.h ${CMAKE_SOURCE_DIR}/include/mysql_com.h
errmsg.h ${CMAKE_SOURCE_DIR}/include/mysql.h
getopt.h ${CMAKE_SOURCE_DIR}/include/my_stmt.h
hash.h ${CMAKE_SOURCE_DIR}/include/mysql_version.h
ma_common.h ${CMAKE_SOURCE_DIR}/include/my_list.h
ma_pvio.h ${CMAKE_SOURCE_DIR}/include/mariadb_ctype.h)
ma_ssl.h SET(MARIADB_ADDITIONAL_INCLUDES
m_ctype.h
m_string.h
ma_dyncol.h
my_alarm.h
my_base.h
my_config.h.in
my_dir.h
my_global.h
my_list.h
my_net.h
my_no_pthread.h
my_pthread.h
my_stmt.h
my_sys.h
mysql.h
mysql_com.h
mysql_io.h
mysql_mm.h
mysql_priv.h
mysql_version.h
mysql_wireprotocol.h
mysqld_error.h
mysys_err.h
sha1.h
thr_alarm.h
mysql/client_plugin.h
mysql/plugin_auth_common.h
mysql/plugin_auth.h
PARENT_SCOPE) PARENT_SCOPE)
INSTALL(FILES
${CMAKE_BINARY_DIR}/include/mysql_version.h
${MARIADB_CLIENT_INCLUDES}
DESTINATION ${INCLUDE_INSTALL_DIR}/${SUFFIX_INSTALL_DIR})
INSTALL(FILES
${CMAKE_SOURCE_DIR}/include/mysql/client_plugin.h
${CMAKE_SOURCE_DIR}/include/mysql/plugin_auth_common.h
${CMAKE_SOURCE_DIR}/include/mysql/plugin_auth.h
DESTINATION ${INCLUDE_INSTALL_DIR}/${SUFFIX_INSTALL_DIR}/mysql)

View File

@@ -115,7 +115,7 @@ struct st_dynamic_column_value
double double_value; double double_value;
struct { struct {
MYSQL_LEX_STRING value; MYSQL_LEX_STRING value;
CHARSET_INFO *charset; MARIADB_CHARSET_INFO *charset;
} string; } string;
#ifndef LIBMARIADB #ifndef LIBMARIADB
struct { struct {
@@ -225,7 +225,7 @@ void mariadb_dyncol_free(DYNAMIC_COLUMN *str);
/* conversion of values to 3 base types */ /* conversion of values to 3 base types */
enum enum_dyncol_func_result enum enum_dyncol_func_result
mariadb_dyncol_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val, mariadb_dyncol_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val,
CHARSET_INFO *cs, my_bool quote); MARIADB_CHARSET_INFO *cs, my_bool quote);
enum enum_dyncol_func_result enum enum_dyncol_func_result
mariadb_dyncol_val_long(longlong *ll, DYNAMIC_COLUMN_VALUE *val); mariadb_dyncol_val_long(longlong *ll, DYNAMIC_COLUMN_VALUE *val);
enum enum_dyncol_func_result enum enum_dyncol_func_result

View File

@@ -20,8 +20,8 @@
Notes: my_global.h should be included before ctype.h Notes: my_global.h should be included before ctype.h
*/ */
#ifndef _m_ctype_h #ifndef _mariadb_ctype_h
#define _m_ctype_h #define _mariadb_ctype_h
#include <ctype.h> #include <ctype.h>
@@ -36,7 +36,7 @@ extern "C" {
#define MADB_DEFAULT_COLLATION_NAME "latin1_swedish_ci" #define MADB_DEFAULT_COLLATION_NAME "latin1_swedish_ci"
/* we use the mysqlnd implementation */ /* we use the mysqlnd implementation */
typedef struct charset_info_st typedef struct ma_charset_info_st
{ {
unsigned int nr; /* so far only 1 byte for charset */ unsigned int nr; /* so far only 1 byte for charset */
unsigned int state; unsigned int state;
@@ -49,20 +49,20 @@ typedef struct charset_info_st
unsigned int char_maxlen; unsigned int char_maxlen;
unsigned int (*mb_charlen)(unsigned int c); unsigned int (*mb_charlen)(unsigned int c);
unsigned int (*mb_valid)(const char *start, const char *end); unsigned int (*mb_valid)(const char *start, const char *end);
} CHARSET_INFO; } MARIADB_CHARSET_INFO;
extern const CHARSET_INFO compiled_charsets[]; extern const MARIADB_CHARSET_INFO mariadb_compiled_charsets[];
extern CHARSET_INFO *ma_default_charset_info; extern MARIADB_CHARSET_INFO *ma_default_charset_info;
extern CHARSET_INFO *ma_charset_bin; extern MARIADB_CHARSET_INFO *ma_charset_bin;
extern CHARSET_INFO *ma_charset_latin1; extern MARIADB_CHARSET_INFO *ma_charset_latin1;
extern CHARSET_INFO *ma_charset_utf8_general_ci; extern MARIADB_CHARSET_INFO *ma_charset_utf8_general_ci;
extern CHARSET_INFO *ma_charset_utf16le_general_ci; extern MARIADB_CHARSET_INFO *ma_charset_utf16le_general_ci;
CHARSET_INFO *find_compiled_charset(unsigned int cs_number); MARIADB_CHARSET_INFO *find_compiled_charset(unsigned int cs_number);
CHARSET_INFO *find_compiled_charset_by_name(const char *name); MARIADB_CHARSET_INFO *find_compiled_charset_by_name(const char *name);
size_t mysql_cset_escape_quotes(const CHARSET_INFO *cset, char *newstr, const char *escapestr, size_t escapestr_len); size_t mysql_cset_escape_quotes(const MARIADB_CHARSET_INFO *cset, char *newstr, const char *escapestr, size_t escapestr_len);
size_t mysql_cset_escape_slashes(const CHARSET_INFO *cset, char *newstr, const char *escapestr, size_t escapestr_len); size_t mysql_cset_escape_slashes(const MARIADB_CHARSET_INFO *cset, char *newstr, const char *escapestr, size_t escapestr_len);
char* madb_get_os_character_set(void); char* madb_get_os_character_set(void);
#ifdef _WIN32 #ifdef _WIN32
int madb_get_windows_cp(const char *charset); int madb_get_windows_cp(const char *charset);

View File

@@ -172,7 +172,7 @@ typedef int (*mysql_stmt_fetch_row_func)(MYSQL_STMT *stmt, unsigned char **row)
struct st_mysql_stmt struct st_mysql_stmt
{ {
MEM_ROOT mem_root; MA_MEM_ROOT mem_root;
MYSQL *mysql; MYSQL *mysql;
unsigned long stmt_id; unsigned long stmt_id;
unsigned long flags;/* cursor is set here */ unsigned long flags;/* cursor is set here */

View File

@@ -35,8 +35,8 @@ extern int NEAR my_errno; /* Last error in mysys */
#include <my_pthread.h> #include <my_pthread.h>
#endif #endif
#ifndef _m_ctype_h #ifndef _mariadb_ctype_h
#include <m_ctype.h> /* for CHARSET_INFO */ #include <mariadb_ctype.h> /* for MARIADB_CHARSET_INFO */
#endif #endif
#include <stdarg.h> #include <stdarg.h>
@@ -182,10 +182,10 @@ extern int (*fatal_ma_error_handler_hook)(uint my_err, const char *str,
/* charsets */ /* charsets */
extern uint get_charset_number(const char *cs_name); extern uint get_charset_number(const char *cs_name);
extern const char *get_charset_name(uint cs_number); extern const char *get_charset_name(uint cs_number);
extern CHARSET_INFO *get_charset(uint cs_number, myf flags); extern MARIADB_CHARSET_INFO *get_charset(uint cs_number, myf flags);
extern my_bool set_default_charset(uint cs, myf flags); extern my_bool set_default_charset(uint cs, myf flags);
extern CHARSET_INFO *get_charset_by_name(const char *cs_name); extern MARIADB_CHARSET_INFO *get_charset_by_name(const char *cs_name);
extern CHARSET_INFO *get_charset_by_nr(uint cs_number); extern MARIADB_CHARSET_INFO *get_charset_by_nr(uint cs_number);
extern my_bool set_default_charset_by_name(const char *cs_name, myf flags); extern my_bool set_default_charset_by_name(const char *cs_name, myf flags);
extern void free_charsets(void); extern void free_charsets(void);
extern char *list_charsets(myf want_flags); /* ma_free() this string... */ extern char *list_charsets(myf want_flags); /* ma_free() this string... */
@@ -354,24 +354,24 @@ typedef struct st_changeable_var {
/* structs for ma_alloc_root */ /* structs for ma_alloc_root */
#ifndef ST_USED_MEM_DEFINED #ifndef ST_MA_USED_MEM_DEFINED
#define ST_USED_MEM_DEFINED #define ST_MA_USED_MEM_DEFINED
typedef struct st_used_mem { /* struct for once_alloc */ typedef struct st_ma_used_mem { /* struct for once_alloc */
struct st_used_mem *next; /* Next block in use */ struct st_ma_used_mem *next; /* Next block in use */
size_t left; /* memory left in block */ size_t left; /* memory left in block */
size_t size; /* Size of block */ size_t size; /* Size of block */
} USED_MEM; } MA_USED_MEM;
typedef struct st_mem_root { typedef struct st_ma_mem_root {
USED_MEM *free; MA_USED_MEM *free;
USED_MEM *used; MA_USED_MEM *used;
USED_MEM *pre_alloc; MA_USED_MEM *pre_alloc;
size_t min_malloc; size_t min_malloc;
size_t block_size; size_t block_size;
unsigned int block_num; unsigned int block_num;
unsigned int first_block_usage; unsigned int first_block_usage;
void (*error_handler)(void); void (*error_handler)(void);
} MEM_ROOT; } MA_MEM_ROOT;
#endif #endif
/* Prototypes for mysys and my_func functions */ /* Prototypes for mysys and my_func functions */
@@ -592,11 +592,11 @@ extern void ma_free_lock(unsigned char *ptr,myf flags);
#define ma_free_lock(A,B) ma_free((A),(B)) #define ma_free_lock(A,B) ma_free((A),(B))
#endif #endif
#define ma_alloc_root_inited(A) ((A)->min_malloc != 0) #define ma_alloc_root_inited(A) ((A)->min_malloc != 0)
void ma_init_ma_alloc_root(MEM_ROOT *mem_root, size_t block_size, size_t pre_alloc_size); void ma_init_ma_alloc_root(MA_MEM_ROOT *mem_root, size_t block_size, size_t pre_alloc_size);
gptr ma_alloc_root(MEM_ROOT *mem_root, size_t Size); gptr ma_alloc_root(MA_MEM_ROOT *mem_root, size_t Size);
void ma_free_root(MEM_ROOT *root, myf MyFLAGS); void ma_free_root(MA_MEM_ROOT *root, myf MyFLAGS);
char *ma_strdup_root(MEM_ROOT *root,const char *str); char *ma_strdup_root(MA_MEM_ROOT *root,const char *str);
char *ma_memdup_root(MEM_ROOT *root,const char *str, size_t len); char *ma_memdup_root(MA_MEM_ROOT *root,const char *str, size_t len);
void mariadb_load_defaults(const char *conf_file, const char **groups, void mariadb_load_defaults(const char *conf_file, const char **groups,
int *argc, char ***argv); int *argc, char ***argv);
void ma_free_defaults(char **argv); void ma_free_defaults(char **argv);

View File

@@ -56,26 +56,26 @@ typedef int my_socket;
#include "mysql_com.h" #include "mysql_com.h"
#include "mysql_version.h" #include "mysql_version.h"
#include "my_list.h" #include "my_list.h"
#include "m_ctype.h" #include "mariadb_ctype.h"
#ifndef ST_USED_MEM_DEFINED #ifndef ST_MA_USED_MEM_DEFINED
#define ST_USED_MEM_DEFINED #define ST_MA_USED_MEM_DEFINED
typedef struct st_used_mem { /* struct for once_alloc */ typedef struct st_ma_used_mem { /* struct for once_alloc */
struct st_used_mem *next; /* Next block in use */ struct st_ma_used_mem *next; /* Next block in use */
size_t left; /* memory left in block */ size_t left; /* memory left in block */
size_t size; /* Size of block */ size_t size; /* Size of block */
} USED_MEM; } MA_USED_MEM;
typedef struct st_mem_root { typedef struct st_ma_mem_root {
USED_MEM *free; MA_USED_MEM *free;
USED_MEM *used; MA_USED_MEM *used;
USED_MEM *pre_alloc; MA_USED_MEM *pre_alloc;
size_t min_malloc; size_t min_malloc;
size_t block_size; size_t block_size;
unsigned int block_num; unsigned int block_num;
unsigned int first_block_usage; unsigned int first_block_usage;
void (*error_handler)(void); void (*error_handler)(void);
} MEM_ROOT; } MA_MEM_ROOT;
#endif #endif
extern unsigned int mysql_port; extern unsigned int mysql_port;
@@ -159,7 +159,7 @@ extern unsigned int mariadb_deinitialize_ssl;
my_ulonglong rows; my_ulonglong rows;
unsigned int fields; unsigned int fields;
MYSQL_ROWS *data; MYSQL_ROWS *data;
MEM_ROOT alloc; MA_MEM_ROOT alloc;
} MYSQL_DATA; } MYSQL_DATA;
enum mariadb_com_multi { enum mariadb_com_multi {
@@ -236,7 +236,7 @@ extern unsigned int mariadb_deinitialize_ssl;
MARIADB_CLIENT_VERSION_ID, MARIADB_CLIENT_VERSION_ID,
MARIADB_CONNECTION_ASYNC_TIMEOUT, MARIADB_CONNECTION_ASYNC_TIMEOUT,
MARIADB_CONNECTION_ASYNC_TIMEOUT_MS, MARIADB_CONNECTION_ASYNC_TIMEOUT_MS,
MARIADB_CONNECTION_CHARSET_INFO, MARIADB_CONNECTION_MARIADB_CHARSET_INFO,
MARIADB_CONNECTION_ERROR, MARIADB_CONNECTION_ERROR,
MARIADB_CONNECTION_ERROR_ID, MARIADB_CONNECTION_ERROR_ID,
MARIADB_CONNECTION_HOST, MARIADB_CONNECTION_HOST,
@@ -312,9 +312,9 @@ struct st_mysql_options {
void *unused_0; void *unused_0;
char *host,*user,*passwd,*unix_socket,*server_version,*host_info; char *host,*user,*passwd,*unix_socket,*server_version,*host_info;
char *info,*db; char *info,*db;
const struct charset_info_st *charset; /* character set */ const struct ma_charset_info_st *charset; /* character set */
MYSQL_FIELD *fields; MYSQL_FIELD *fields;
MEM_ROOT field_alloc; MA_MEM_ROOT field_alloc;
my_ulonglong affected_rows; my_ulonglong affected_rows;
my_ulonglong insert_id; /* id if insert on table with NEXTNR */ my_ulonglong insert_id; /* id if insert on table with NEXTNR */
my_ulonglong extra_info; /* Used by mysqlshow */ my_ulonglong extra_info; /* Used by mysqlshow */
@@ -350,7 +350,7 @@ typedef struct st_mysql_res {
MYSQL_FIELD *fields; MYSQL_FIELD *fields;
MYSQL_DATA *data; MYSQL_DATA *data;
MYSQL_ROWS *data_cursor; MYSQL_ROWS *data_cursor;
MEM_ROOT field_alloc; MA_MEM_ROOT field_alloc;
MYSQL_ROW row; /* If unbuffered read */ MYSQL_ROW row; /* If unbuffered read */
MYSQL_ROW current_row; /* buffer to current row */ MYSQL_ROW current_row; /* buffer to current row */
unsigned long *lengths; /* column lengths of current row */ unsigned long *lengths; /* column lengths of current row */
@@ -359,13 +359,13 @@ typedef struct st_mysql_res {
my_bool is_ps; my_bool is_ps;
} MYSQL_RES; } MYSQL_RES;
#ifndef _mysql_time_h_
enum enum_mysql_timestamp_type enum enum_mysql_timestamp_type
{ {
MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1, MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1,
MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2 MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2
}; };
typedef struct st_mysql_time typedef struct st_mysql_time
{ {
unsigned int year, month, day, hour, minute, second; unsigned int year, month, day, hour, minute, second;
@@ -373,6 +373,7 @@ typedef struct st_mysql_time
my_bool neg; my_bool neg;
enum enum_mysql_timestamp_type time_type; enum enum_mysql_timestamp_type time_type;
} MYSQL_TIME; } MYSQL_TIME;
#endif
#define AUTO_SEC_PART_DIGITS 31 #define AUTO_SEC_PART_DIGITS 31
#define SEC_PART_DIGITS 6 #define SEC_PART_DIGITS 6
@@ -516,10 +517,10 @@ const char * STDCALL mysql_get_client_info(void);
unsigned long STDCALL mysql_get_client_version(void); unsigned long STDCALL mysql_get_client_version(void);
my_bool STDCALL mariadb_connection(MYSQL *mysql); my_bool STDCALL mariadb_connection(MYSQL *mysql);
const char * STDCALL mysql_get_server_name(MYSQL *mysql); const char * STDCALL mysql_get_server_name(MYSQL *mysql);
CHARSET_INFO * STDCALL mariadb_get_charset_by_name(const char *csname); MARIADB_CHARSET_INFO * STDCALL mariadb_get_charset_by_name(const char *csname);
CHARSET_INFO * STDCALL mariadb_get_charset_by_nr(unsigned int csnr); MARIADB_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, size_t STDCALL mariadb_convert_string(const char *from, size_t *from_len, MARIADB_CHARSET_INFO *from_cs,
char *to, size_t *to_len, CHARSET_INFO *to_cs, int *errorcode); char *to, size_t *to_len, MARIADB_CHARSET_INFO *to_cs, int *errorcode);
int STDCALL mysql_optionsv(MYSQL *mysql,enum mysql_option option, ...); 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_optionv(MYSQL *mysql, enum mysql_option option, void *arg, ...);
int STDCALL mysql_get_option(MYSQL *mysql, enum mysql_option option, void *arg); int STDCALL mysql_get_option(MYSQL *mysql, enum mysql_option option, void *arg);
@@ -717,9 +718,9 @@ struct st_mariadb_api {
unsigned long (STDCALL *mysql_get_client_version)(void); unsigned long (STDCALL *mysql_get_client_version)(void);
my_bool (STDCALL *mariadb_connection)(MYSQL *mysql); my_bool (STDCALL *mariadb_connection)(MYSQL *mysql);
const char * (STDCALL *mysql_get_server_name)(MYSQL *mysql); const char * (STDCALL *mysql_get_server_name)(MYSQL *mysql);
CHARSET_INFO * (STDCALL *mariadb_get_charset_by_name)(const char *csname); MARIADB_CHARSET_INFO * (STDCALL *mariadb_get_charset_by_name)(const char *csname);
CHARSET_INFO * (STDCALL *mariadb_get_charset_by_nr)(unsigned int csnr); MARIADB_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); size_t (STDCALL *mariadb_convert_string)(const char *from, size_t *from_len, MARIADB_CHARSET_INFO *from_cs, char *to, size_t *to_len, MARIADB_CHARSET_INFO *to_cs, int *errorcode);
int (STDCALL *mysql_optionsv)(MYSQL *mysql,enum mysql_option option, ...); 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_optionv)(MYSQL *mysql, enum mysql_option option, void *arg, ...);
int (STDCALL *mysql_get_option)(MYSQL *mysql, enum mysql_option option, void *arg); int (STDCALL *mysql_get_option)(MYSQL *mysql, enum mysql_option option, void *arg);

View File

@@ -48,6 +48,10 @@
#define MYSQL_SERVICENAME "MySql" #define MYSQL_SERVICENAME "MySql"
#endif /* _WIN32 */ #endif /* _WIN32 */
/* for use in mysql client tools only */
#define MYSQL_AUTODETECT_CHARSET_NAME "auto"
#define BINCMP_FLAG 131072
enum mysql_enum_shutdown_level enum mysql_enum_shutdown_level
{ {
SHUTDOWN_DEFAULT = 0, SHUTDOWN_DEFAULT = 0,

View File

@@ -1,4 +1,4 @@
/* internal functions */ /* internal functions */
MYSQL_DATA *read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields, uint fields); MYSQL_DATA *read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields, uint fields);
void free_rows(MYSQL_DATA *cur); void free_rows(MYSQL_DATA *cur);
MYSQL_FIELD * unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields, my_bool default_value, my_bool long_flag_protocol); MYSQL_FIELD * unpack_fields(MYSQL_DATA *data,MA_MEM_ROOT *alloc,uint fields, my_bool default_value, my_bool long_flag_protocol);

View File

@@ -445,11 +445,4 @@ INSTALL(TARGETS
LIBRARY DESTINATION "${LIB_INSTALL_DIR}/${SUFFIX_INSTALL_DIR}" LIBRARY DESTINATION "${LIB_INSTALL_DIR}/${SUFFIX_INSTALL_DIR}"
ARCHIVE DESTINATION "${LIB_INSTALL_DIR}/${SUFFIX_INSTALL_DIR}") ARCHIVE DESTINATION "${LIB_INSTALL_DIR}/${SUFFIX_INSTALL_DIR}")
INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/include/
DESTINATION ${INCLUDE_INSTALL_DIR}/${SUFFIX_INSTALL_DIR})
INSTALL(FILES
${CMAKE_BINARY_DIR}/include/my_config.h
${CMAKE_BINARY_DIR}/include/mysql_version.h
DESTINATION ${INCLUDE_INSTALL_DIR}/${SUFFIX_INSTALL_DIR})

View File

@@ -17,29 +17,29 @@
#include "mysys_priv.h" #include "mysys_priv.h"
#include "mysys_err.h" #include "mysys_err.h"
#include <m_ctype.h> #include <mariadb_ctype.h>
#include <m_string.h> #include <m_string.h>
#include <my_dir.h> #include <my_dir.h>
CHARSET_INFO *ma_default_charset_info = (CHARSET_INFO *)&compiled_charsets[5]; MARIADB_CHARSET_INFO *ma_default_charset_info = (MARIADB_CHARSET_INFO *)&mariadb_compiled_charsets[5];
CHARSET_INFO *ma_charset_bin= (CHARSET_INFO *)&compiled_charsets[32]; MARIADB_CHARSET_INFO *ma_charset_bin= (MARIADB_CHARSET_INFO *)&mariadb_compiled_charsets[32];
CHARSET_INFO *ma_charset_latin1= (CHARSET_INFO *)&compiled_charsets[5]; MARIADB_CHARSET_INFO *ma_charset_latin1= (MARIADB_CHARSET_INFO *)&mariadb_compiled_charsets[5];
CHARSET_INFO *ma_charset_utf8_general_ci= (CHARSET_INFO *)&compiled_charsets[21]; MARIADB_CHARSET_INFO *ma_charset_utf8_general_ci= (MARIADB_CHARSET_INFO *)&mariadb_compiled_charsets[21];
CHARSET_INFO *ma_charset_utf16le_general_ci= (CHARSET_INFO *)&compiled_charsets[68]; MARIADB_CHARSET_INFO *ma_charset_utf16le_general_ci= (MARIADB_CHARSET_INFO *)&mariadb_compiled_charsets[68];
CHARSET_INFO * STDCALL mysql_get_charset_by_nr(uint cs_number) MARIADB_CHARSET_INFO * STDCALL mysql_get_charset_by_nr(uint cs_number)
{ {
int i= 0; int i= 0;
while (compiled_charsets[i].nr && cs_number != compiled_charsets[i].nr) while (mariadb_compiled_charsets[i].nr && cs_number != mariadb_compiled_charsets[i].nr)
i++; i++;
return (compiled_charsets[i].nr) ? (CHARSET_INFO *)&compiled_charsets[i] : NULL; return (mariadb_compiled_charsets[i].nr) ? (MARIADB_CHARSET_INFO *)&mariadb_compiled_charsets[i] : NULL;
} }
my_bool set_default_charset(uint cs, myf flags) my_bool set_default_charset(uint cs, myf flags)
{ {
CHARSET_INFO *new_charset; MARIADB_CHARSET_INFO *new_charset;
DBUG_ENTER("set_default_charset"); DBUG_ENTER("set_default_charset");
DBUG_PRINT("enter",("character set: %d",(int) cs)); DBUG_PRINT("enter",("character set: %d",(int) cs));
new_charset = mysql_get_charset_by_nr(cs); new_charset = mysql_get_charset_by_nr(cs);
@@ -52,19 +52,19 @@ my_bool set_default_charset(uint cs, myf flags)
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} }
CHARSET_INFO * STDCALL mysql_get_charset_by_name(const char *cs_name) MARIADB_CHARSET_INFO * STDCALL mysql_get_charset_by_name(const char *cs_name)
{ {
int i= 0; int i= 0;
while (compiled_charsets[i].nr && strcmp(cs_name, compiled_charsets[i].csname) != 0) while (mariadb_compiled_charsets[i].nr && strcmp(cs_name, mariadb_compiled_charsets[i].csname) != 0)
i++; i++;
return (compiled_charsets[i].nr) ? (CHARSET_INFO *)&compiled_charsets[i] : NULL; return (mariadb_compiled_charsets[i].nr) ? (MARIADB_CHARSET_INFO *)&mariadb_compiled_charsets[i] : NULL;
} }
my_bool set_default_charset_by_name(const char *cs_name, myf flags) my_bool set_default_charset_by_name(const char *cs_name, myf flags)
{ {
CHARSET_INFO *new_charset; MARIADB_CHARSET_INFO *new_charset;
DBUG_ENTER("set_default_charset_by_name"); DBUG_ENTER("set_default_charset_by_name");
DBUG_PRINT("enter",("character set: %s", cs_name)); DBUG_PRINT("enter",("character set: %s", cs_name));
new_charset = mysql_get_charset_by_name(cs_name); new_charset = mysql_get_charset_by_name(cs_name);

View File

@@ -54,7 +54,7 @@ struct st_client_plugin_int {
}; };
static my_bool initialized= 0; static my_bool initialized= 0;
static MEM_ROOT mem_root; static MA_MEM_ROOT mem_root;
static uint valid_plugins[][2]= { static uint valid_plugins[][2]= {
{MYSQL_CLIENT_AUTHENTICATION_PLUGIN, MYSQL_CLIENT_AUTHENTICATION_PLUGIN_INTERFACE_VERSION}, {MYSQL_CLIENT_AUTHENTICATION_PLUGIN, MYSQL_CLIENT_AUTHENTICATION_PLUGIN_INTERFACE_VERSION},

View File

@@ -39,7 +39,7 @@
#include "mysys_priv.h" #include "mysys_priv.h"
#include "m_string.h" #include "m_string.h"
#include <ctype.h> #include <ctype.h>
#include "m_ctype.h" #include "mariadb_ctype.h"
#include <my_dir.h> #include <my_dir.h>
#include <mysql.h> #include <mysql.h>
#include <mariadb/ma_io.h> #include <mariadb/ma_io.h>
@@ -70,7 +70,7 @@ NullS,
#define windows_ext ".ini" #define windows_ext ".ini"
#endif #endif
static my_bool search_default_file(DYNAMIC_ARRAY *args,MEM_ROOT *alloc, static my_bool search_default_file(DYNAMIC_ARRAY *args,MA_MEM_ROOT *alloc,
const char *dir, const char *config_file, const char *dir, const char *config_file,
const char *ext, TYPELIB *group); const char *ext, TYPELIB *group);
@@ -83,7 +83,7 @@ void mariadb_load_defaults(const char *conf_file, const char **groups,
TYPELIB group; TYPELIB group;
my_bool found_ma_print_defaults=0; my_bool found_ma_print_defaults=0;
uint args_used=0; uint args_used=0;
MEM_ROOT alloc; MA_MEM_ROOT alloc;
char *ptr,**res; char *ptr,**res;
DBUG_ENTER("mariadb_load_defaults"); DBUG_ENTER("mariadb_load_defaults");
@@ -101,7 +101,7 @@ void mariadb_load_defaults(const char *conf_file, const char **groups,
res[i-1]=argv[0][i]; res[i-1]=argv[0][i];
(*argc)--; (*argc)--;
*argv=res; *argv=res;
*(MEM_ROOT*) ptr= alloc; /* Save alloc root for free */ *(MA_MEM_ROOT*) ptr= alloc; /* Save alloc root for free */
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
@@ -194,7 +194,7 @@ void mariadb_load_defaults(const char *conf_file, const char **groups,
(*argc)+=args.elements; (*argc)+=args.elements;
*argv= (char**) res; *argv= (char**) res;
*(MEM_ROOT*) ptr= alloc; /* Save alloc root for free */ *(MA_MEM_ROOT*) ptr= alloc; /* Save alloc root for free */
ma_delete_dynamic(&args); ma_delete_dynamic(&args);
if (found_ma_print_defaults) if (found_ma_print_defaults)
{ {
@@ -216,13 +216,13 @@ void mariadb_load_defaults(const char *conf_file, const char **groups,
void ma_free_defaults(char **argv) void ma_free_defaults(char **argv)
{ {
MEM_ROOT ptr; MA_MEM_ROOT ptr;
memcpy_fixed((char*) &ptr,(char *) argv - sizeof(ptr), sizeof(ptr)); memcpy_fixed((char*) &ptr,(char *) argv - sizeof(ptr), sizeof(ptr));
ma_free_root(&ptr,MYF(0)); ma_free_root(&ptr,MYF(0));
} }
static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc, static my_bool search_default_file(DYNAMIC_ARRAY *args, MA_MEM_ROOT *alloc,
const char *dir, const char *config_file, const char *dir, const char *config_file,
const char *ext, TYPELIB *group) const char *ext, TYPELIB *group)
{ {

View File

@@ -20,7 +20,7 @@
#include <my_sys.h> #include <my_sys.h>
#include "mysql.h" #include "mysql.h"
#include <m_string.h> #include <m_string.h>
#include <m_ctype.h> #include <mariadb_ctype.h>
#include <stdio.h> #include <stdio.h>
#include <memory.h> #include <memory.h>

View File

@@ -27,7 +27,7 @@
#include "mysys_priv.h" #include "mysys_priv.h"
#include <m_string.h> #include <m_string.h>
#include <m_ctype.h> #include <mariadb_ctype.h>
#include "hash.h" #include "hash.h"
#define NO_RECORD ((uint) -1) #define NO_RECORD ((uint) -1)

View File

@@ -26,7 +26,7 @@
#include <my_sys.h> #include <my_sys.h>
#include <mysys_err.h> #include <mysys_err.h>
#include <m_string.h> #include <m_string.h>
#include <m_ctype.h> #include <mariadb_ctype.h>
#include <ma_common.h> #include <ma_common.h>
#include "my_context.h" #include "my_context.h"
#include "mysql.h" #include "mysql.h"
@@ -86,8 +86,8 @@ static void mysql_close_options(MYSQL *mysql);
extern my_bool ma_init_done; extern my_bool ma_init_done;
extern my_bool mysql_ps_subsystem_initialized; extern my_bool mysql_ps_subsystem_initialized;
extern my_bool mysql_handle_local_infile(MYSQL *mysql, const char *filename); extern my_bool mysql_handle_local_infile(MYSQL *mysql, const char *filename);
extern const CHARSET_INFO * mysql_find_charset_nr(uint charsetnr); extern const MARIADB_CHARSET_INFO * mysql_find_charset_nr(uint charsetnr);
extern const CHARSET_INFO * mysql_find_charset_name(const char * const name); extern const MARIADB_CHARSET_INFO * mysql_find_charset_name(const char * const name);
extern int run_plugin_auth(MYSQL *mysql, char *data, uint data_len, extern int run_plugin_auth(MYSQL *mysql, char *data, uint data_len,
const char *data_plugin, const char *db); const char *data_plugin, const char *db);
extern int net_add_multi_command(NET *net, uchar command, const uchar *packet, extern int net_add_multi_command(NET *net, uchar command, const uchar *packet,
@@ -933,7 +933,7 @@ static size_t rset_field_offsets[]= {
}; };
MYSQL_FIELD * MYSQL_FIELD *
unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields, unpack_fields(MYSQL_DATA *data,MA_MEM_ROOT *alloc,uint fields,
my_bool default_value, my_bool long_flag_protocol) my_bool default_value, my_bool long_flag_protocol)
{ {
MYSQL_ROWS *row; MYSQL_ROWS *row;
@@ -1845,7 +1845,7 @@ void ma_invalidate_stmts(MYSQL *mysql, const char *function_name)
my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user, my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
const char *passwd, const char *db) const char *passwd, const char *db)
{ {
const CHARSET_INFO *s_cs= mysql->charset; const MARIADB_CHARSET_INFO *s_cs= mysql->charset;
char *s_user= mysql->user, char *s_user= mysql->user,
*s_passwd= mysql->passwd, *s_passwd= mysql->passwd,
*s_db= mysql->db; *s_db= mysql->db;
@@ -3457,7 +3457,7 @@ void STDCALL mysql_get_character_set_info(MYSQL *mysql, MY_CHARSET_INFO *cs)
int STDCALL mysql_set_character_set(MYSQL *mysql, const char *csname) int STDCALL mysql_set_character_set(MYSQL *mysql, const char *csname)
{ {
const CHARSET_INFO *cs; const MARIADB_CHARSET_INFO *cs;
DBUG_ENTER("mysql_set_character_set"); DBUG_ENTER("mysql_set_character_set");
if (!csname) if (!csname)
@@ -3638,14 +3638,14 @@ mysql_get_socket(MYSQL *mysql)
return mariadb_get_socket(mysql); return mariadb_get_socket(mysql);
} }
CHARSET_INFO * STDCALL mariadb_get_charset_by_name(const char *csname) MARIADB_CHARSET_INFO * STDCALL mariadb_get_charset_by_name(const char *csname)
{ {
return (CHARSET_INFO *)mysql_find_charset_name(csname); return (MARIADB_CHARSET_INFO *)mysql_find_charset_name(csname);
} }
CHARSET_INFO * STDCALL mariadb_get_charset_by_nr(unsigned int csnr) MARIADB_CHARSET_INFO * STDCALL mariadb_get_charset_by_nr(unsigned int csnr)
{ {
return (CHARSET_INFO *)mysql_find_charset_nr(csnr); return (MARIADB_CHARSET_INFO *)mysql_find_charset_nr(csnr);
} }
my_bool STDCALL mariadb_get_infov(MYSQL *mysql, enum mariadb_value value, void *arg, ...) my_bool STDCALL mariadb_get_infov(MYSQL *mysql, enum mariadb_value value, void *arg, ...)
@@ -3746,7 +3746,7 @@ my_bool STDCALL mariadb_get_infov(MYSQL *mysql, enum mariadb_value value, void *
else else
goto error; goto error;
break; break;
case MARIADB_CONNECTION_CHARSET_INFO: case MARIADB_CONNECTION_MARIADB_CHARSET_INFO:
if (mysql) if (mysql)
mariadb_get_charset_info(mysql, (MY_CHARSET_INFO *)arg); mariadb_get_charset_info(mysql, (MY_CHARSET_INFO *)arg);
else else
@@ -3787,7 +3787,7 @@ my_bool STDCALL mariadb_get_infov(MYSQL *mysql, enum mariadb_value value, void *
char *name; char *name;
name= va_arg(ap, char *); name= va_arg(ap, char *);
if (name) if (name)
*((CHARSET_INFO **)arg)= (CHARSET_INFO *)mysql_find_charset_name(name); *((MARIADB_CHARSET_INFO **)arg)= (MARIADB_CHARSET_INFO *)mysql_find_charset_name(name);
else else
goto error; goto error;
} }
@@ -3796,7 +3796,7 @@ my_bool STDCALL mariadb_get_infov(MYSQL *mysql, enum mariadb_value value, void *
{ {
unsigned int nr; unsigned int nr;
nr= va_arg(ap, unsigned int); nr= va_arg(ap, unsigned int);
*((CHARSET_INFO **)arg)= (CHARSET_INFO *)mysql_find_charset_nr(nr); *((MARIADB_CHARSET_INFO **)arg)= (MARIADB_CHARSET_INFO *)mysql_find_charset_nr(nr);
} }
break; break;
case MARIADB_CONNECTION_SSL_CIPHER: case MARIADB_CONNECTION_SSL_CIPHER:

View File

@@ -71,15 +71,15 @@
#ifndef LIBMARIADB #ifndef LIBMARIADB
uint32 copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs, uint32 copy_and_convert(char *to, uint32 to_length, MARIADB_CHARSET_INFO *to_cs,
const char *from, uint32 from_length, const char *from, uint32 from_length,
CHARSET_INFO *from_cs, uint *errors); MARIADB_CHARSET_INFO *from_cs, uint *errors);
#else #else
size_t mariadb_time_to_string(const MYSQL_TIME *tm, char *time_str, size_t len, size_t mariadb_time_to_string(const MYSQL_TIME *tm, char *time_str, size_t len,
unsigned int digits); unsigned int digits);
size_t STDCALL mariadb_convert_string(const char *from, size_t *from_len, CHARSET_INFO *from_cs, size_t STDCALL mariadb_convert_string(const char *from, size_t *from_len, MARIADB_CHARSET_INFO *from_cs,
char *to, size_t *to_len, CHARSET_INFO *to_cs, int *errorcode); char *to, size_t *to_len, MARIADB_CHARSET_INFO *to_cs, int *errorcode);
#endif #endif
/* /*
Flag byte bits Flag byte bits
@@ -1062,7 +1062,7 @@ dynamic_column_double_read(DYNAMIC_COLUMN_VALUE *store_it_here,
static enum enum_dyncol_func_result static enum enum_dyncol_func_result
dynamic_column_string_store(DYNAMIC_COLUMN *str, LEX_STRING *string, dynamic_column_string_store(DYNAMIC_COLUMN *str, LEX_STRING *string,
CHARSET_INFO *charset) MARIADB_CHARSET_INFO *charset)
{ {
enum enum_dyncol_func_result rc; enum enum_dyncol_func_result rc;
#ifdef LIBMARIADB #ifdef LIBMARIADB
@@ -3841,7 +3841,7 @@ end:
enum enum_dyncol_func_result enum enum_dyncol_func_result
mariadb_dyncol_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val, mariadb_dyncol_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val,
CHARSET_INFO *cs, char quote) MARIADB_CHARSET_INFO *cs, char quote)
{ {
char buff[40]; char buff[40];
size_t len; size_t len;

View File

@@ -21,20 +21,20 @@
#include <my_sys.h> #include <my_sys.h>
#include <m_string.h> #include <m_string.h>
void ma_init_ma_alloc_root(MEM_ROOT *mem_root, size_t block_size, size_t pre_alloc_size) void ma_init_ma_alloc_root(MA_MEM_ROOT *mem_root, size_t block_size, size_t pre_alloc_size)
{ {
mem_root->free=mem_root->used=0; mem_root->free=mem_root->used=0;
mem_root->min_malloc=32; mem_root->min_malloc=32;
mem_root->block_size=block_size-MALLOC_OVERHEAD-sizeof(USED_MEM)-8; mem_root->block_size=block_size-MALLOC_OVERHEAD-sizeof(MA_USED_MEM)-8;
mem_root->error_handler=0; mem_root->error_handler=0;
#if !(defined(HAVE_purify) && defined(EXTRA_DEBUG)) #if !(defined(HAVE_purify) && defined(EXTRA_DEBUG))
if (pre_alloc_size) if (pre_alloc_size)
{ {
if ((mem_root->free = mem_root->pre_alloc= if ((mem_root->free = mem_root->pre_alloc=
(USED_MEM*) ma_malloc(pre_alloc_size+ ALIGN_SIZE(sizeof(USED_MEM)), (MA_USED_MEM*) ma_malloc(pre_alloc_size+ ALIGN_SIZE(sizeof(MA_USED_MEM)),
MYF(0)))) MYF(0))))
{ {
mem_root->free->size=pre_alloc_size+ALIGN_SIZE(sizeof(USED_MEM)); mem_root->free->size=pre_alloc_size+ALIGN_SIZE(sizeof(MA_USED_MEM));
mem_root->free->left=pre_alloc_size; mem_root->free->left=pre_alloc_size;
mem_root->free->next=0; mem_root->free->next=0;
} }
@@ -42,13 +42,13 @@ void ma_init_ma_alloc_root(MEM_ROOT *mem_root, size_t block_size, size_t pre_all
#endif #endif
} }
gptr ma_alloc_root(MEM_ROOT *mem_root, size_t Size) gptr ma_alloc_root(MA_MEM_ROOT *mem_root, size_t Size)
{ {
#if defined(HAVE_purify) && defined(EXTRA_DEBUG) #if defined(HAVE_purify) && defined(EXTRA_DEBUG)
reg1 USED_MEM *next; reg1 MA_USED_MEM *next;
Size+=ALIGN_SIZE(sizeof(USED_MEM)); Size+=ALIGN_SIZE(sizeof(MA_USED_MEM));
if (!(next = (USED_MEM*) ma_malloc(Size,MYF(MY_WME)))) if (!(next = (MA_USED_MEM*) ma_malloc(Size,MYF(MY_WME))))
{ {
if (mem_root->error_handler) if (mem_root->error_handler)
(*mem_root->error_handler)(); (*mem_root->error_handler)();
@@ -56,12 +56,12 @@ gptr ma_alloc_root(MEM_ROOT *mem_root, size_t Size)
} }
next->next=mem_root->used; next->next=mem_root->used;
mem_root->used=next; mem_root->used=next;
return (gptr) (((char*) next)+ALIGN_SIZE(sizeof(USED_MEM))); return (gptr) (((char*) next)+ALIGN_SIZE(sizeof(MA_USED_MEM)));
#else #else
size_t get_size,max_left; size_t get_size,max_left;
gptr point; gptr point;
reg1 USED_MEM *next; reg1 MA_USED_MEM *next;
reg2 USED_MEM **prev; reg2 MA_USED_MEM **prev;
Size= ALIGN_SIZE(Size); Size= ALIGN_SIZE(Size);
prev= &mem_root->free; prev= &mem_root->free;
@@ -74,11 +74,11 @@ gptr ma_alloc_root(MEM_ROOT *mem_root, size_t Size)
} }
if (! next) if (! next)
{ /* Time to alloc new block */ { /* Time to alloc new block */
get_size= Size+ALIGN_SIZE(sizeof(USED_MEM)); get_size= Size+ALIGN_SIZE(sizeof(MA_USED_MEM));
if (max_left*4 < mem_root->block_size && get_size < mem_root->block_size) if (max_left*4 < mem_root->block_size && get_size < mem_root->block_size)
get_size=mem_root->block_size; /* Normal alloc */ get_size=mem_root->block_size; /* Normal alloc */
if (!(next = (USED_MEM*) ma_malloc(get_size,MYF(MY_WME | MY_ZEROFILL)))) if (!(next = (MA_USED_MEM*) ma_malloc(get_size,MYF(MY_WME | MY_ZEROFILL))))
{ {
if (mem_root->error_handler) if (mem_root->error_handler)
(*mem_root->error_handler)(); (*mem_root->error_handler)();
@@ -86,7 +86,7 @@ gptr ma_alloc_root(MEM_ROOT *mem_root, size_t Size)
} }
next->next= *prev; next->next= *prev;
next->size= get_size; next->size= get_size;
next->left= get_size-ALIGN_SIZE(sizeof(USED_MEM)); next->left= get_size-ALIGN_SIZE(sizeof(MA_USED_MEM));
*prev=next; *prev=next;
} }
point= (gptr) ((char*) next+ (next->size-next->left)); point= (gptr) ((char*) next+ (next->size-next->left));
@@ -102,9 +102,9 @@ gptr ma_alloc_root(MEM_ROOT *mem_root, size_t Size)
/* deallocate everything used by ma_alloc_root */ /* deallocate everything used by ma_alloc_root */
void ma_free_root(MEM_ROOT *root, myf MyFlags) void ma_free_root(MA_MEM_ROOT *root, myf MyFlags)
{ {
reg1 USED_MEM *next,*old; reg1 MA_USED_MEM *next,*old;
DBUG_ENTER("ma_free_root"); DBUG_ENTER("ma_free_root");
if (!root) if (!root)
@@ -128,14 +128,14 @@ void ma_free_root(MEM_ROOT *root, myf MyFlags)
if (root->pre_alloc) if (root->pre_alloc)
{ {
root->free=root->pre_alloc; root->free=root->pre_alloc;
root->free->left=root->pre_alloc->size-ALIGN_SIZE(sizeof(USED_MEM)); root->free->left=root->pre_alloc->size-ALIGN_SIZE(sizeof(MA_USED_MEM));
root->free->next=0; root->free->next=0;
} }
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
char *ma_strdup_root(MEM_ROOT *root,const char *str) char *ma_strdup_root(MA_MEM_ROOT *root,const char *str)
{ {
size_t len= strlen(str)+1; size_t len= strlen(str)+1;
char *pos; char *pos;
@@ -146,7 +146,7 @@ char *ma_strdup_root(MEM_ROOT *root,const char *str)
} }
char *ma_memdup_root(MEM_ROOT *root, const char *str, size_t len) char *ma_memdup_root(MA_MEM_ROOT *root, const char *str, size_t len)
{ {
char *pos; char *pos;
if ((pos=ma_alloc_root(root,len))) if ((pos=ma_alloc_root(root,len)))

View File

@@ -50,7 +50,7 @@
#include <string.h> #include <string.h>
#endif #endif
#include <my_global.h> #include <my_global.h>
#include <m_ctype.h> #include <mariadb_ctype.h>
#include <m_string.h> #include <m_string.h>
#include <iconv.h> #include <iconv.h>
@@ -494,7 +494,7 @@ mysql_mbcharlen_utf32(unsigned int utf32 __attribute((unused)))
#define UTF8_MB3 "utf8" #define UTF8_MB3 "utf8"
/* {{{ mysql_charsets */ /* {{{ mysql_charsets */
const CHARSET_INFO compiled_charsets[] = const MARIADB_CHARSET_INFO mariadb_compiled_charsets[] =
{ {
{ 1, 1, "big5","big5_chinese_ci", "", 950, "BIG5", 1, 2, mysql_mbcharlen_big5, check_mb_big5}, { 1, 1, "big5","big5_chinese_ci", "", 950, "BIG5", 1, 2, mysql_mbcharlen_big5, check_mb_big5},
{ 3, 1, "dec8", "dec8_swedisch_ci", "", 0, "DEC", 1, 1, NULL, NULL}, { 3, 1, "dec8", "dec8_swedisch_ci", "", 0, "DEC", 1, 1, NULL, NULL},
@@ -668,9 +668,9 @@ const CHARSET_INFO compiled_charsets[] =
/* {{{ mysql_find_charset_nr */ /* {{{ mysql_find_charset_nr */
const CHARSET_INFO * mysql_find_charset_nr(unsigned int charsetnr) const MARIADB_CHARSET_INFO * mysql_find_charset_nr(unsigned int charsetnr)
{ {
const CHARSET_INFO * c = compiled_charsets; const MARIADB_CHARSET_INFO * c = mariadb_compiled_charsets;
DBUG_ENTER("mysql_find_charset_nr"); DBUG_ENTER("mysql_find_charset_nr");
do { do {
@@ -686,9 +686,9 @@ const CHARSET_INFO * mysql_find_charset_nr(unsigned int charsetnr)
/* {{{ mysql_find_charset_name */ /* {{{ mysql_find_charset_name */
CHARSET_INFO * mysql_find_charset_name(const char *name) MARIADB_CHARSET_INFO * mysql_find_charset_name(const char *name)
{ {
CHARSET_INFO *c = (CHARSET_INFO *)compiled_charsets; MARIADB_CHARSET_INFO *c = (MARIADB_CHARSET_INFO *)mariadb_compiled_charsets;
DBUG_ENTER("mysql_find_charset_name"); DBUG_ENTER("mysql_find_charset_name");
do { do {
@@ -704,7 +704,7 @@ CHARSET_INFO * mysql_find_charset_name(const char *name)
/* {{{ mysql_cset_escape_quotes */ /* {{{ mysql_cset_escape_quotes */
size_t mysql_cset_escape_quotes(const CHARSET_INFO *cset, char *newstr, size_t mysql_cset_escape_quotes(const MARIADB_CHARSET_INFO *cset, char *newstr,
const char * escapestr, size_t escapestr_len ) const char * escapestr, size_t escapestr_len )
{ {
const char *newstr_s = newstr; const char *newstr_s = newstr;
@@ -758,7 +758,7 @@ size_t mysql_cset_escape_quotes(const CHARSET_INFO *cset, char *newstr,
/* {{{ mysql_cset_escape_slashes */ /* {{{ mysql_cset_escape_slashes */
size_t mysql_cset_escape_slashes(const CHARSET_INFO * cset, char *newstr, size_t mysql_cset_escape_slashes(const MARIADB_CHARSET_INFO * cset, char *newstr,
const char * escapestr, size_t escapestr_len ) const char * escapestr, size_t escapestr_len )
{ {
const char *newstr_s = newstr; const char *newstr_s = newstr;
@@ -1164,8 +1164,8 @@ static void map_charset_name(const char *cs_name, my_bool target_cs, char *buffe
@return -1 in case of error, bytes used in the "to" buffer, otherwise @return -1 in case of error, bytes used in the "to" buffer, otherwise
*/ */
size_t STDCALL mariadb_convert_string(const char *from, size_t *from_len, CHARSET_INFO *from_cs, size_t STDCALL mariadb_convert_string(const char *from, size_t *from_len, MARIADB_CHARSET_INFO *from_cs,
char *to, size_t *to_len, CHARSET_INFO *to_cs, int *errorcode) char *to, size_t *to_len, MARIADB_CHARSET_INFO *to_cs, int *errorcode)
{ {
iconv_t conv= 0; iconv_t conv= 0;
size_t rc= -1; size_t rc= -1;

View File

@@ -19,7 +19,7 @@
#include "mysys_err.h" #include "mysys_err.h"
#include <m_string.h> #include <m_string.h>
#include <stdarg.h> #include <stdarg.h>
#include <m_ctype.h> #include <mariadb_ctype.h>
/* Define some external variables for error handling */ /* Define some external variables for error handling */

View File

@@ -24,7 +24,7 @@
#include <sys/param.h> #include <sys/param.h>
#endif #endif
#if defined(MSDOS) || defined(_WIN32) #if defined(MSDOS) || defined(_WIN32)
#include <m_ctype.h> #include <mariadb_ctype.h>
#include <dos.h> #include <dos.h>
#include <direct.h> #include <direct.h>
#endif #endif

View File

@@ -18,9 +18,9 @@
#include "mysys_priv.h" #include "mysys_priv.h"
#include "my_static.h" #include "my_static.h"
#include "mysys_err.h" #include "mysys_err.h"
#include "m_ctype.h" #include "mariadb_ctype.h"
#include <m_string.h> #include <m_string.h>
#include <m_ctype.h> #include <mariadb_ctype.h>
#ifdef HAVE_GETRUSAGE #ifdef HAVE_GETRUSAGE
#include <sys/resource.h> #include <sys/resource.h>
/* extern int getrusage(int, struct rusage *); */ /* extern int getrusage(int, struct rusage *); */
@@ -28,7 +28,7 @@
#include <signal.h> #include <signal.h>
#ifdef VMS #ifdef VMS
#include <my_static.c> #include <my_static.c>
#include <m_ctype.h> #include <mariadb_ctype.h>
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
#ifdef _MSC_VER #ifdef _MSC_VER

View File

@@ -32,8 +32,8 @@ gptr my_once_alloc(unsigned int Size, myf MyFlags)
{ {
size_t get_size,max_left; size_t get_size,max_left;
gptr point; gptr point;
reg1 USED_MEM *next; reg1 MA_USED_MEM *next;
reg2 USED_MEM **prev; reg2 MA_USED_MEM **prev;
Size= ALIGN_SIZE(Size); Size= ALIGN_SIZE(Size);
prev= &ma_once_root_block; prev= &ma_once_root_block;
@@ -46,11 +46,11 @@ gptr my_once_alloc(unsigned int Size, myf MyFlags)
} }
if (! next) if (! next)
{ /* Time to alloc new block */ { /* Time to alloc new block */
get_size= Size+ALIGN_SIZE(sizeof(USED_MEM)); get_size= Size+ALIGN_SIZE(sizeof(MA_USED_MEM));
if (max_left*4 < ma_once_extra && get_size < ma_once_extra) if (max_left*4 < ma_once_extra && get_size < ma_once_extra)
get_size=ma_once_extra; /* Normal alloc */ get_size=ma_once_extra; /* Normal alloc */
if ((next = (USED_MEM*) malloc(get_size)) == 0) if ((next = (MA_USED_MEM*) malloc(get_size)) == 0)
{ {
my_errno=errno; my_errno=errno;
if (MyFlags & (MY_FAE+MY_WME)) if (MyFlags & (MY_FAE+MY_WME))
@@ -60,7 +60,7 @@ gptr my_once_alloc(unsigned int Size, myf MyFlags)
DBUG_PRINT("test",("my_once_malloc %u byte malloced",get_size)); DBUG_PRINT("test",("my_once_malloc %u byte malloced",get_size));
next->next= 0; next->next= 0;
next->size= get_size; next->size= get_size;
next->left= get_size-ALIGN_SIZE(sizeof(USED_MEM)); next->left= get_size-ALIGN_SIZE(sizeof(MA_USED_MEM));
*prev=next; *prev=next;
} }
point= (gptr) ((char*) next+ (next->size-next->left)); point= (gptr) ((char*) next+ (next->size-next->left));
@@ -74,7 +74,7 @@ gptr my_once_alloc(unsigned int Size, myf MyFlags)
void my_once_free(void) void my_once_free(void)
{ {
reg1 USED_MEM *next,*old; reg1 MA_USED_MEM *next,*old;
DBUG_ENTER("my_once_free"); DBUG_ENTER("my_once_free");
for (next=ma_once_root_block ; next ; ) for (next=ma_once_root_block ; next ; )

View File

@@ -57,7 +57,7 @@ ulong ma_default_record_cache_size=RECORD_CACHE_SIZE;
const char *ma_soundex_map= "01230120022455012623010202"; const char *ma_soundex_map= "01230120022455012623010202";
/* from ma_malloc */ /* from ma_malloc */
USED_MEM* ma_once_root_block=0; /* pointer to first block */ MA_USED_MEM* ma_once_root_block=0; /* pointer to first block */
uint ma_once_extra=ONCE_ALLOC_INIT; /* Memory to alloc / block */ uint ma_once_extra=ONCE_ALLOC_INIT; /* Memory to alloc / block */
/* from my_tempnam */ /* from my_tempnam */

View File

@@ -54,7 +54,7 @@ extern struct st_remember _ma_sig_remember[MAX_SIGNALS];
extern const char *ma_soundex_map; extern const char *ma_soundex_map;
extern USED_MEM* ma_once_root_block; extern MA_USED_MEM* ma_once_root_block;
extern uint ma_once_extra; extern uint ma_once_extra;
#if !defined(HAVE_TEMPNAM) || defined(HPUX11) #if !defined(HAVE_TEMPNAM) || defined(HPUX11)

View File

@@ -47,7 +47,7 @@
#include <my_sys.h> #include <my_sys.h>
#include <mysys_err.h> #include <mysys_err.h>
#include <m_string.h> #include <m_string.h>
#include <m_ctype.h> #include <mariadb_ctype.h>
#include "mysql.h" #include "mysql.h"
#include "mysql_priv.h" #include "mysql_priv.h"
#include "mysql_version.h" #include "mysql_version.h"
@@ -71,7 +71,7 @@
typedef struct typedef struct
{ {
MEM_ROOT fields_ma_alloc_root; MA_MEM_ROOT fields_ma_alloc_root;
} MADB_STMT_EXTENSION; } MADB_STMT_EXTENSION;
static my_bool is_not_null= 0; static my_bool is_not_null= 0;
@@ -913,7 +913,7 @@ my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
if (stmt->field_count && !stmt->bind) if (stmt->field_count && !stmt->bind)
{ {
MEM_ROOT *fields_ma_alloc_root= MA_MEM_ROOT *fields_ma_alloc_root=
&((MADB_STMT_EXTENSION *)stmt->extension)->fields_ma_alloc_root; &((MADB_STMT_EXTENSION *)stmt->extension)->fields_ma_alloc_root;
// ma_free_root(fields_ma_alloc_root, MYF(0)); // ma_free_root(fields_ma_alloc_root, MYF(0));
if (!(stmt->bind= (MYSQL_BIND *)ma_alloc_root(fields_ma_alloc_root, stmt->field_count * sizeof(MYSQL_BIND)))) if (!(stmt->bind= (MYSQL_BIND *)ma_alloc_root(fields_ma_alloc_root, stmt->field_count * sizeof(MYSQL_BIND))))
@@ -981,7 +981,7 @@ my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
static my_bool net_stmt_close(MYSQL_STMT *stmt, my_bool remove) static my_bool net_stmt_close(MYSQL_STMT *stmt, my_bool remove)
{ {
char stmt_id[STMT_ID_LENGTH]; char stmt_id[STMT_ID_LENGTH];
MEM_ROOT *fields_ma_alloc_root= &((MADB_STMT_EXTENSION *)stmt->extension)->fields_ma_alloc_root; MA_MEM_ROOT *fields_ma_alloc_root= &((MADB_STMT_EXTENSION *)stmt->extension)->fields_ma_alloc_root;
/* clear memory */ /* clear memory */
ma_free_root(&stmt->result.alloc, MYF(0)); /* allocated in mysql_stmt_store_result */ ma_free_root(&stmt->result.alloc, MYF(0)); /* allocated in mysql_stmt_store_result */
@@ -1243,7 +1243,7 @@ my_bool mthd_stmt_get_param_metadata(MYSQL_STMT *stmt)
my_bool mthd_stmt_get_result_metadata(MYSQL_STMT *stmt) my_bool mthd_stmt_get_result_metadata(MYSQL_STMT *stmt)
{ {
MYSQL_DATA *result; MYSQL_DATA *result;
MEM_ROOT *fields_ma_alloc_root= &((MADB_STMT_EXTENSION *)stmt->extension)->fields_ma_alloc_root; MA_MEM_ROOT *fields_ma_alloc_root= &((MADB_STMT_EXTENSION *)stmt->extension)->fields_ma_alloc_root;
DBUG_ENTER("stmt_read_result_metadata"); DBUG_ENTER("stmt_read_result_metadata");
if (!(result= stmt->mysql->methods->db_read_rows(stmt->mysql, (MYSQL_FIELD *)0, 7))) if (!(result= stmt->mysql->methods->db_read_rows(stmt->mysql, (MYSQL_FIELD *)0, 7)))
@@ -1336,7 +1336,7 @@ int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, size_t lengt
/* allocated bind buffer for result */ /* allocated bind buffer for result */
if (stmt->field_count) if (stmt->field_count)
{ {
MEM_ROOT *fields_ma_alloc_root= &((MADB_STMT_EXTENSION *)stmt->extension)->fields_ma_alloc_root; MA_MEM_ROOT *fields_ma_alloc_root= &((MADB_STMT_EXTENSION *)stmt->extension)->fields_ma_alloc_root;
if (!(stmt->bind= (MYSQL_BIND *)ma_alloc_root(fields_ma_alloc_root, stmt->field_count * sizeof(MYSQL_BIND)))) if (!(stmt->bind= (MYSQL_BIND *)ma_alloc_root(fields_ma_alloc_root, stmt->field_count * sizeof(MYSQL_BIND))))
{ {
SET_CLIENT_STMT_ERROR(stmt, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0); SET_CLIENT_STMT_ERROR(stmt, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
@@ -1436,7 +1436,7 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
static int madb_alloc_stmt_fields(MYSQL_STMT *stmt) static int madb_alloc_stmt_fields(MYSQL_STMT *stmt)
{ {
uint i; uint i;
MEM_ROOT *fields_ma_alloc_root= &((MADB_STMT_EXTENSION *)stmt->extension)->fields_ma_alloc_root; MA_MEM_ROOT *fields_ma_alloc_root= &((MADB_STMT_EXTENSION *)stmt->extension)->fields_ma_alloc_root;
DBUG_ENTER("madb_alloc_stmt_fields"); DBUG_ENTER("madb_alloc_stmt_fields");
@@ -1526,7 +1526,7 @@ int stmt_read_execute_response(MYSQL_STMT *stmt)
if (!stmt->field_count || if (!stmt->field_count ||
mysql->server_status & SERVER_MORE_RESULTS_EXIST) /* fix for ps_bug: test_misc */ mysql->server_status & SERVER_MORE_RESULTS_EXIST) /* fix for ps_bug: test_misc */
{ {
MEM_ROOT *fields_ma_alloc_root= MA_MEM_ROOT *fields_ma_alloc_root=
&((MADB_STMT_EXTENSION *)stmt->extension)->fields_ma_alloc_root; &((MADB_STMT_EXTENSION *)stmt->extension)->fields_ma_alloc_root;
uint i; uint i;
@@ -2049,7 +2049,7 @@ int STDCALL mariadb_stmt_execute_direct(MYSQL_STMT *stmt,
/* allocated bind buffer for result */ /* allocated bind buffer for result */
if (stmt->field_count) if (stmt->field_count)
{ {
MEM_ROOT *fields_ma_alloc_root= &((MADB_STMT_EXTENSION *)stmt->extension)->fields_ma_alloc_root; MA_MEM_ROOT *fields_ma_alloc_root= &((MADB_STMT_EXTENSION *)stmt->extension)->fields_ma_alloc_root;
if (!(stmt->bind= (MYSQL_BIND *)ma_alloc_root(fields_ma_alloc_root, stmt->field_count * sizeof(MYSQL_BIND)))) if (!(stmt->bind= (MYSQL_BIND *)ma_alloc_root(fields_ma_alloc_root, stmt->field_count * sizeof(MYSQL_BIND))))
{ {
SET_CLIENT_STMT_ERROR(stmt, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0); SET_CLIENT_STMT_ERROR(stmt, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);

View File

@@ -47,7 +47,7 @@
#include <my_sys.h> #include <my_sys.h>
#include <mysys_err.h> #include <mysys_err.h>
#include <m_string.h> #include <m_string.h>
#include <m_ctype.h> #include <mariadb_ctype.h>
#include "mysql.h" #include "mysql.h"
#define MYSQL_SILENT #define MYSQL_SILENT

View File

@@ -19,7 +19,7 @@
#include "mysys_err.h" #include "mysys_err.h"
#include <m_string.h> #include <m_string.h>
#include <stdarg.h> #include <stdarg.h>
#include <m_ctype.h> #include <mariadb_ctype.h>
int ma_snprintf(char* to, size_t n, const char* fmt, ...) int ma_snprintf(char* to, size_t n, const char* fmt, ...)

View File

@@ -41,7 +41,7 @@
#include <my_global.h> #include <my_global.h>
#include "m_string.h" #include "m_string.h"
#include "m_ctype.h" #include "mariadb_ctype.h"
#include "my_sys.h" /* defines errno */ #include "my_sys.h" /* defines errno */
#include <errno.h> #include <errno.h>

View File

@@ -39,7 +39,7 @@
#define strtoll glob_strtoll /* Fix for True64 */ #define strtoll glob_strtoll /* Fix for True64 */
#include "m_string.h" #include "m_string.h"
#include "m_ctype.h" #include "mariadb_ctype.h"
#include "my_sys.h" /* defines errno */ #include "my_sys.h" /* defines errno */
#include <errno.h> #include <errno.h>

View File

@@ -25,7 +25,7 @@
#define strtoll glob_strtoll /* Fix for True64 */ #define strtoll glob_strtoll /* Fix for True64 */
#include "m_string.h" #include "m_string.h"
#include "m_ctype.h" #include "mariadb_ctype.h"
#include "my_sys.h" /* defines errno */ #include "my_sys.h" /* defines errno */
#include <errno.h> #include <errno.h>

View File

@@ -19,7 +19,7 @@
#include "mysys_priv.h" #include "mysys_priv.h"
#include <m_string.h> #include <m_string.h>
#include <m_ctype.h> #include <mariadb_ctype.h>
/*************************************************************************** /***************************************************************************
** Search after a fieldtype. Endspace in x is not compared. ** Search after a fieldtype. Endspace in x is not compared.

View File

@@ -658,12 +658,12 @@ static int test_bug_54100(MYSQL *mysql)
/* We need this internal function for the test */ /* We need this internal function for the test */
CHARSET_INFO * mysql_find_charset_name(const char *name); MARIADB_CHARSET_INFO * mysql_find_charset_name(const char *name);
static int test_utf16_utf32_noboms(MYSQL *mysql) static int test_utf16_utf32_noboms(MYSQL *mysql)
{ {
char *csname[]= {"utf16", "utf16le", "utf32", "utf8"}; char *csname[]= {"utf16", "utf16le", "utf32", "utf8"};
CHARSET_INFO *csinfo[sizeof(csname)/sizeof(char*)]; MARIADB_CHARSET_INFO *csinfo[sizeof(csname)/sizeof(char*)];
const int UTF8= sizeof(csname)/sizeof(char*) - 1; const int UTF8= sizeof(csname)/sizeof(char*) - 1;

View File

@@ -39,7 +39,7 @@ static int create_dyncol_named(MYSQL *mysql)
vals[i].type= DYN_COL_STRING; vals[i].type= DYN_COL_STRING;
vals[i].x.string.value.str= strval[i]; vals[i].x.string.value.str= strval[i];
vals[i].x.string.value.length= strlen(strval[i]); vals[i].x.string.value.length= strlen(strval[i]);
vals[i].x.string.charset= (CHARSET_INFO *)mysql->charset; vals[i].x.string.charset= (MARIADB_CHARSET_INFO *)mysql->charset;
diag("%s", keys3[i].str); diag("%s", keys3[i].str);
} }
@@ -132,7 +132,7 @@ static int create_dyncol_num(MYSQL *mysql)
vals[i].type= DYN_COL_STRING; vals[i].type= DYN_COL_STRING;
vals[i].x.string.value.str= strval[i]; vals[i].x.string.value.str= strval[i];
vals[i].x.string.value.length= strlen(strval[i]); vals[i].x.string.value.length= strlen(strval[i]);
vals[i].x.string.charset= (CHARSET_INFO *)mysql->charset; vals[i].x.string.charset= (MARIADB_CHARSET_INFO *)mysql->charset;
} }
FAIL_IF(mariadb_dyncol_create_many_num(&dyncol, column_count, keys1, vals, 1) <0, "Error (keys1)"); FAIL_IF(mariadb_dyncol_create_many_num(&dyncol, column_count, keys1, vals, 1) <0, "Error (keys1)");
@@ -176,7 +176,7 @@ static int mdev_x1(MYSQL *mysql)
vals[i].type= DYN_COL_STRING; vals[i].type= DYN_COL_STRING;
vals[i].x.string.value.str= strval[i]; vals[i].x.string.value.str= strval[i];
vals[i].x.string.value.length= strlen(strval[i]); vals[i].x.string.value.length= strlen(strval[i]);
vals[i].x.string.charset= (CHARSET_INFO *)mysql->charset; vals[i].x.string.charset= (MARIADB_CHARSET_INFO *)mysql->charset;
} }
mariadb_dyncol_init(&dynstr); mariadb_dyncol_init(&dynstr);

View File

@@ -1030,7 +1030,7 @@ static int test_get_info(MYSQL *mysql)
char *cval; char *cval;
int rc; int rc;
MY_CHARSET_INFO cs; MY_CHARSET_INFO cs;
CHARSET_INFO *ci; MARIADB_CHARSET_INFO *ci;
char **errors; char **errors;
rc= mariadb_get_infov(mysql, MARIADB_MAX_ALLOWED_PACKET, &sval); rc= mariadb_get_infov(mysql, MARIADB_MAX_ALLOWED_PACKET, &sval);
@@ -1045,7 +1045,7 @@ static int test_get_info(MYSQL *mysql)
rc= mariadb_get_infov(mysql, MARIADB_CONNECTION_SERVER_VERSION_ID, &sval); rc= mariadb_get_infov(mysql, MARIADB_CONNECTION_SERVER_VERSION_ID, &sval);
FAIL_IF(rc, "mysql_get_info failed"); FAIL_IF(rc, "mysql_get_info failed");
diag("server_version_id: %d", sval); diag("server_version_id: %d", sval);
rc= mariadb_get_infov(mysql, MARIADB_CONNECTION_CHARSET_INFO, &cs); rc= mariadb_get_infov(mysql, MARIADB_CONNECTION_MARIADB_CHARSET_INFO, &cs);
FAIL_IF(rc, "mysql_get_info failed"); FAIL_IF(rc, "mysql_get_info failed");
diag("charset name: %s", cs.csname); diag("charset name: %s", cs.csname);
rc= mariadb_get_infov(mysql, MARIADB_CONNECTION_PVIO_TYPE, &ival); rc= mariadb_get_infov(mysql, MARIADB_CONNECTION_PVIO_TYPE, &ival);

View File

@@ -165,7 +165,7 @@ int do_verify_prepare_field(MYSQL_RES *result,
const char *file, int line) const char *file, int line)
{ {
MYSQL_FIELD *field; MYSQL_FIELD *field;
/* CHARSET_INFO *cs; */ /* MARIADB_CHARSET_INFO *cs; */
FAIL_IF(!(field= mysql_fetch_field_direct(result, no)), "FAILED to get result"); FAIL_IF(!(field= mysql_fetch_field_direct(result, no)), "FAILED to get result");
/* cs= mysql_find_charset_nr(field->charsetnr); /* cs= mysql_find_charset_nr(field->charsetnr);