diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index 680e983b..ca2a2942 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -4,8 +4,10 @@ SET(MARIADB_CLIENT_INCLUDES config-win.h getopt.h global.h hash.h + ma_common.h m_ctype.h m_string.h + ma_dyncol.h ma_secure.h my_alarm.h my_base.h diff --git a/include/ma_common.h b/include/ma_common.h new file mode 100644 index 00000000..37b77447 --- /dev/null +++ b/include/ma_common.h @@ -0,0 +1,52 @@ +/* Copyright (C) 2013 by MontyProgram AB + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA */ + +/* defines for the libmariadb library */ + +#ifndef _ma_common_h +#define _ma_common_h + +#include +#include + + +typedef struct st_mariadb_db_driver +{ + struct st_mariadb_client_plugin_DB *plugin; + char *name; + void *buffer; +} MARIADB_DB_DRIVER; + +struct st_mysql_options_extention { + char *plugin_dir; + char *default_auth; + char *ssl_crl; + char *ssl_crlpath; + char *server_public_key_path; + HASH connect_attrs; + size_t connect_attrs_len; + void (*report_progress)(const MYSQL *mysql, + unsigned int stage, + unsigned int max_stage, + double progress, + const char *proc_info, + unsigned int proc_info_length); + MARIADB_DB_DRIVER *db_driver; +}; + + +#endif diff --git a/include/ma_dyncol.h b/include/ma_dyncol.h index a6ba4fd2..c1eb71c6 100644 --- a/include/ma_dyncol.h +++ b/include/ma_dyncol.h @@ -29,12 +29,31 @@ #ifndef ma_dyncol_h #define ma_dyncol_h +#ifdef __cplusplus +extern "C" { +#endif + #ifndef LIBMARIADB #include #include #endif #include +#ifndef _my_sys_h +typedef struct st_dynamic_string +{ + char *str; + size_t length,max_length,alloc_increment; +} DYNAMIC_STRING; +#endif + +struct st_mysql_lex_string +{ + char *str; + size_t length; +}; +typedef struct st_mysql_lex_string MYSQL_LEX_STRING; +typedef struct st_mysql_lex_string LEX_STRING; /* Limits of implementation */ @@ -218,4 +237,8 @@ mariadb_dyncol_column_count(DYNAMIC_COLUMN *str, uint *column_count); */ void mariadb_dyncol_prepare_decimal(DYNAMIC_COLUMN_VALUE *value); + +#ifdef __cplusplus +} +#endif #endif diff --git a/include/my_global.h b/include/my_global.h index 9aa43949..06d62758 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -330,14 +330,6 @@ typedef unsigned short ushort; #define ASCII_BITS_USED 8 /* Bit char used */ #define NEAR_F /* No near function handling */ -struct st_mysql_lex_string -{ - char *str; - size_t length; -}; -typedef struct st_mysql_lex_string LEX_STRING; -typedef struct st_mysql_lex_string MYSQL_LEX_STRING; - /* Some types that is different between systems */ typedef int File; /* File descriptor */ @@ -650,6 +642,7 @@ typedef long long int longlong; typedef unsigned long ulonglong; /* ulong or unsigned long long */ typedef long longlong; #endif +#define longlong_defined #endif #ifndef MIN diff --git a/include/mysql.h b/include/mysql.h index 75e9062d..f3dc3d41 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -53,13 +53,10 @@ typedef int my_socket; #endif #endif #endif -#include "my_global.h" #include "mysql_com.h" #include "mysql_version.h" #include "my_list.h" #include "m_ctype.h" -#include "my_sys.h" -#include "hash.h" #ifndef ST_USED_MEM_DEFINED #define ST_USED_MEM_DEFINED @@ -81,8 +78,8 @@ typedef int my_socket; } MEM_ROOT; #endif - extern unsigned int mysql_port; - extern char *mysql_unix_port; +extern unsigned int mysql_port; +extern char *mysql_unix_port; #define IS_PRI_KEY(n) ((n) & PRI_KEY_FLAG) #define IS_NOT_NULL(n) ((n) & NOT_NULL_FLAG) @@ -128,6 +125,16 @@ typedef int my_socket; typedef unsigned long long my_ulonglong; #endif +#ifndef longlong_defined +#if defined(HAVE_LONG_LONG) && SIZEOF_LONG != 8 +typedef long long int longlong; +#else +typedef long longlong; +#endif +#define longlong_defined +#endif + + #define SET_CLIENT_ERROR(a, b, c, d) \ { \ @@ -221,7 +228,9 @@ typedef int my_socket; MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY }; - struct st_mysql_options { +struct st_mysql_options_extention; + +struct st_mysql_options { unsigned int connect_timeout, read_timeout, write_timeout; unsigned int port, protocol; unsigned long client_flag; @@ -249,14 +258,7 @@ typedef int my_socket; int (*local_infile_error)(void *, char *, unsigned int); void *local_infile_userdata; struct st_mysql_options_extention *extension; - }; - - typedef struct st_mariadb_db_driver - { - struct st_mariadb_client_plugin_DB *plugin; - char *name; - void *buffer; - } MARIADB_DB_DRIVER; +}; typedef struct st_mysql { NET net; /* Communication parameters */ @@ -294,23 +296,6 @@ typedef int my_socket; void *extension; } MYSQL; -struct st_mysql_options_extention { - char *plugin_dir; - char *default_auth; - char *ssl_crl; - char *ssl_crlpath; - char *server_public_key_path; - HASH connect_attrs; - size_t connect_attrs_len; - void (*report_progress)(const MYSQL *mysql, - unsigned int stage, - unsigned int max_stage, - double progress, - const char *proc_info, - unsigned int proc_info_length); - MARIADB_DB_DRIVER *db_driver; -}; - typedef struct st_mysql_res { my_ulonglong row_count; unsigned int field_count, current_field; diff --git a/libmariadb/client_plugin.c b/libmariadb/client_plugin.c index 84d93eda..b1dc6ad0 100644 --- a/libmariadb/client_plugin.c +++ b/libmariadb/client_plugin.c @@ -35,8 +35,8 @@ #endif #include -#include "mysql.h" #include +#include #include #ifdef THREAD #include diff --git a/libmariadb/dbug.c b/libmariadb/dbug.c index ee24749f..0fbac387 100644 --- a/libmariadb/dbug.c +++ b/libmariadb/dbug.c @@ -101,6 +101,7 @@ #include #endif +extern int my_snprintf(char* to, size_t n, const char* fmt, ...); char _dig_vec_upper[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; diff --git a/libmariadb/libmariadb.c b/libmariadb/libmariadb.c index 034c3f12..6a6832b9 100644 --- a/libmariadb/libmariadb.c +++ b/libmariadb/libmariadb.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "mysql.h" #include "mysql_version.h" #include "mysqld_error.h" @@ -864,7 +865,7 @@ static void options_add_initcommand(struct st_mysql_options *options, my_init_dynamic_array(options->init_command, sizeof(char*), 5, 5); } - if (insert_dynamic(options->init_command, (uchar*)&insert)) + if (insert_dynamic(options->init_command, (gptr)&insert)) my_free(insert, MYF(MY_ALLOW_ZERO_PTR)); } @@ -1396,7 +1397,7 @@ uchar *ma_send_connect_attr(MYSQL *mysql, uchar *buffer) if (mysql->options.extension && hash_inited(&mysql->options.extension->connect_attrs)) { - int i; + uint i; for (i=0; i < mysql->options.extension->connect_attrs.records; i++) { size_t len; @@ -1435,8 +1436,8 @@ ma_set_connect_attrs(MYSQL *mysql) mysql_options(mysql, MYSQL_OPT_CONNECT_ATTR_DELETE, "_pid") + mysql_options(mysql, MYSQL_OPT_CONNECT_ATTR_DELETE, "_platform"); - rc+= mysql_options4(mysql, MYSQL_OPT_CONNECT_ATTR_ADD, "_client_name", "libmariadb"); - + mysql_options4(mysql, MYSQL_OPT_CONNECT_ATTR_ADD, "_client_version", MARIADB_PACKAGE_VERSION); + rc+= mysql_options4(mysql, MYSQL_OPT_CONNECT_ATTR_ADD, "_client_name", "libmariadb") + + mysql_options4(mysql, MYSQL_OPT_CONNECT_ATTR_ADD, "_client_version", MARIADB_PACKAGE_VERSION) + mysql_options4(mysql, MYSQL_OPT_CONNECT_ATTR_ADD, "_os", MARIADB_SYSTEM_TYPE); #ifdef _WIN32 @@ -1756,7 +1757,7 @@ MYSQL *mthd_my_real_connect(MYSQL *mysql, const char *host, const char *user, goto error; } - DBUG_DUMP("packet",(char*) net->read_pos,10); + DBUG_DUMP("packet",net->read_pos,10); DBUG_PRINT("info",("mysql protocol version %d, server=%d", PROTOCOL_VERSION, mysql->protocol_version)); if (mysql->protocol_version < PROTOCOL_VERSION) @@ -2771,15 +2772,15 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg) mysql->options.client_flag&= ~CLIENT_LOCAL_FILES; break; case MYSQL_INIT_COMMAND: - options_add_initcommand(&mysql->options, arg); + options_add_initcommand(&mysql->options, (char *)arg); break; case MYSQL_READ_DEFAULT_FILE: my_free(mysql->options.my_cnf_file,MYF(MY_ALLOW_ZERO_PTR)); - mysql->options.my_cnf_file=my_strdup(arg,MYF(MY_WME)); + mysql->options.my_cnf_file=my_strdup((char *)arg,MYF(MY_WME)); break; case MYSQL_READ_DEFAULT_GROUP: my_free(mysql->options.my_cnf_group,MYF(MY_ALLOW_ZERO_PTR)); - mysql->options.my_cnf_group=my_strdup(arg,MYF(MY_WME)); + mysql->options.my_cnf_group=my_strdup((char *)arg,MYF(MY_WME)); break; case MYSQL_SET_CHARSET_DIR: /* not supported in this version. Since all character sets @@ -2787,7 +2788,7 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg) break; case MYSQL_SET_CHARSET_NAME: my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR)); - mysql->options.charset_name=my_strdup(arg,MYF(MY_WME)); + mysql->options.charset_name=my_strdup((char *)arg,MYF(MY_WME)); break; case MYSQL_OPT_RECONNECT: mysql->reconnect= *(uint *)arg; @@ -2856,23 +2857,23 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg) break; case MYSQL_OPT_SSL_KEY: my_free(mysql->options.ssl_key, MYF(MY_ALLOW_ZERO_PTR)); - mysql->options.ssl_key=my_strdup(arg,MYF(MY_WME)); + mysql->options.ssl_key=my_strdup((char *)arg,MYF(MY_WME)); break; case MYSQL_OPT_SSL_CERT: my_free(mysql->options.ssl_cert, MYF(MY_ALLOW_ZERO_PTR)); - mysql->options.ssl_cert=my_strdup(arg,MYF(MY_WME)); + mysql->options.ssl_cert=my_strdup((char *)arg,MYF(MY_WME)); break; case MYSQL_OPT_SSL_CA: my_free(mysql->options.ssl_ca, MYF(MY_ALLOW_ZERO_PTR)); - mysql->options.ssl_ca=my_strdup(arg,MYF(MY_WME)); + mysql->options.ssl_ca=my_strdup((char *)arg,MYF(MY_WME)); break; case MYSQL_OPT_SSL_CAPATH: my_free(mysql->options.ssl_capath, MYF(MY_ALLOW_ZERO_PTR)); - mysql->options.ssl_capath=my_strdup(arg,MYF(MY_WME)); + mysql->options.ssl_capath=my_strdup((char *)arg,MYF(MY_WME)); break; case MYSQL_OPT_SSL_CIPHER: my_free(mysql->options.ssl_cipher, MYF(MY_ALLOW_ZERO_PTR)); - mysql->options.ssl_cipher=my_strdup(arg,MYF(MY_WME)); + mysql->options.ssl_cipher=my_strdup((char *)arg,MYF(MY_WME)); break; case MYSQL_OPT_SSL_CRL: OPT_SET_EXTENDED_VALUE(&mysql->options, ssl_crl, (char *)arg, 1); @@ -2885,8 +2886,8 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg) uchar *p; CHECK_OPT_EXTENSION_SET(&mysql->options); if (hash_inited(&mysql->options.extension->connect_attrs) && - (p= hash_search(&mysql->options.extension->connect_attrs, arg, - arg ? strlen(arg) : 0))) + (p= (uchar *)hash_search(&mysql->options.extension->connect_attrs, (uchar *)arg, + arg ? strlen((char *)arg) : 0))) { size_t key_len= *(size_t *)p; mysql->options.extension->connect_attrs_len-= key_len; @@ -2932,7 +2933,7 @@ uchar *ma_get_hash_key(const uchar *hash_entry, void ma_hash_free(void *p) { - my_free(p, MYF(MYF_ALLOW_ZERO_PTR)); + my_free((gptr)p, MYF(MYF_ALLOW_ZERO_PTR)); } int STDCALL mysql_options4(MYSQL *mysql,enum mysql_option option, @@ -2945,8 +2946,8 @@ int STDCALL mysql_options4(MYSQL *mysql,enum mysql_option option, case MYSQL_OPT_CONNECT_ATTR_ADD: { uchar *buffer; - size_t key_len= arg1 ? strlen(arg1) : 0, - value_len= arg2 ? strlen(arg2) : 0; + size_t key_len= arg1 ? strlen((char *)arg1) : 0, + value_len= arg2 ? strlen((char *)arg2) : 0; size_t storage_len= key_len + value_len + get_store_length(key_len) + get_store_length(value_len); @@ -2983,7 +2984,7 @@ int STDCALL mysql_options4(MYSQL *mysql,enum mysql_option option, if (hash_insert(&mysql->options.extension->connect_attrs, buffer)) { - my_free(buffer, MYF(0)); + my_free((gptr)buffer, MYF(0)); SET_CLIENT_ERROR(mysql, CR_INVALID_PARAMETER_NO, unknown_sqlstate, 0); DBUG_RETURN(1); } diff --git a/libmariadb/ma_dyncol.c b/libmariadb/ma_dyncol.c index 0108c65a..386e7915 100644 --- a/libmariadb/ma_dyncol.c +++ b/libmariadb/ma_dyncol.c @@ -64,6 +64,7 @@ #include "mysys_priv.h" #include #include +#include #include #include diff --git a/libmariadb/ma_secure.c b/libmariadb/ma_secure.c index 23da4ea3..a893786a 100644 --- a/libmariadb/ma_secure.c +++ b/libmariadb/ma_secure.c @@ -21,6 +21,7 @@ #include #include +#include #include #include #include diff --git a/libmariadb/my_auth.c b/libmariadb/my_auth.c index 88ea0a5c..264ac30d 100644 --- a/libmariadb/my_auth.c +++ b/libmariadb/my_auth.c @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include #include #ifdef HAVE_OPENSSL diff --git a/libmariadb/my_charset.c b/libmariadb/my_charset.c index e9f840ef..7fd6cbc8 100644 --- a/libmariadb/my_charset.c +++ b/libmariadb/my_charset.c @@ -54,6 +54,7 @@ #include +extern int my_snprintf(char* to, size_t n, const char* fmt, ...); /* +----------------------------------------------------------------------+ | PHP Version 5 | @@ -515,7 +516,7 @@ const CHARSET_INFO compiled_charsets[] = { 28, 1, "gbk", "gbk_chinese_ci", "", "GBK", 1, 2, mysql_mbcharlen_gbk, check_mb_gbk}, { 30, 1, "latin5", "latin5_turkish_ci", "", "LATIN5", 1, 1, NULL, NULL}, { 32, 1, "armscii8", "armscii8_general_ci", "", "ARMSCII-8", 1, 1, NULL, NULL}, - { 33, 1, UTF8_MB3, UTF8_MB3"_general_ci", "UTF-8 Unicode", "UTF8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, + { 33, 1, UTF8_MB3, UTF8_MB3"_general_ci", "UTF-8 Unicode", "UTF-8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, { 35, 1, "ucs2", "ucs2_general_ci", "UCS-2 Unicode", "UCS-2BE", 2, 2, mysql_mbcharlen_ucs2, check_mb_ucs2}, { 36, 1, "cp866", "cp866_general_ci", "", "CP866", 1, 1, NULL, NULL}, { 37, 1, "keybcs2", "keybcs2_general_ci", "", "", 1, 1, NULL, NULL}, @@ -545,8 +546,8 @@ const CHARSET_INFO compiled_charsets[] = { 42, 1, "latin7", "latin7_general_cs", "", "LATIN7", 1, 1, NULL, NULL}, { 43, 1, "macce", "macce_bin", "", "MACINTOSH", 1, 1, NULL, NULL}, { 44, 1, "cp1250", "cp1250_croatian_ci", "", "CP1250", 1, 1, NULL, NULL}, - { 45, 1, UTF8_MB4, UTF8_MB4"_general_ci", "UTF-8 Unicode", "UTF8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, - { 46, 1, UTF8_MB4, UTF8_MB4"_bin", "UTF-8 Unicode", "UTF8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, + { 45, 1, UTF8_MB4, UTF8_MB4"_general_ci", "UTF-8 Unicode", "UTF-8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, + { 46, 1, UTF8_MB4, UTF8_MB4"_bin", "UTF-8 Unicode", "UTF-8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, { 47, 1, "latin1", "latin1_bin", "", "LATIN1", 1, 1, NULL, NULL}, { 48, 1, "latin1", "latin1_general_ci", "", "LATIN1", 1, 1, NULL, NULL}, { 49, 1, "latin1", "latin1_general_cs", "", "LATIN1", 1, 1, NULL, NULL}, @@ -581,7 +582,7 @@ const CHARSET_INFO compiled_charsets[] = { 81, 1, "cp852", "cp852_bin", "", "CP852", 1, 1, NULL, NULL}, { 82, 1, "swe7", "swe7_bin", "", "", 1, 1, NULL, NULL}, { 93, 1, "geostd8", "geostd8_bin", "", "GEORGIAN-PS", 1, 1, NULL, NULL}, - { 83, 1, UTF8_MB3, UTF8_MB3"_bin", "UTF-8 Unicode", "UTF8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, + { 83, 1, UTF8_MB3, UTF8_MB3"_bin", "UTF-8 Unicode", "UTF-8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, { 84, 1, "big5", "big5_bin", "", "BIG5", 1, 2, mysql_mbcharlen_big5, check_mb_big5}, { 85, 1, "euckr", "euckr_bin", "", "EUCKR", 1, 2, mysql_mbcharlen_euckr, check_mb_euckr}, { 86, 1, "gb2312", "gb2312_bin", "", "GB2312", 1, 2, mysql_mbcharlen_gb2312, check_mb_gb2312}, @@ -616,50 +617,50 @@ const CHARSET_INFO compiled_charsets[] = { 147, 1, "ucs2", "ucs2_sinhala_ci", "", "UCS2-BE", 2, 2, mysql_mbcharlen_ucs2, check_mb_ucs2}, { 149, 1, "ucs2", "ucs2_croatian_ci", "", "UCS2-BE", 2, 2, mysql_mbcharlen_ucs2, check_mb_ucs2}, /* MDB */ - { 192, 1, UTF8_MB3, UTF8_MB3"_general_ci", "", "UTF8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, - { 193, 1, UTF8_MB3, UTF8_MB3"_icelandic_ci", "", "UTF8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, - { 194, 1, UTF8_MB3, UTF8_MB3"_latvian_ci", "", "UTF8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, - { 195, 1, UTF8_MB3, UTF8_MB3"_romanian_ci", "", "UTF8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, - { 196, 1, UTF8_MB3, UTF8_MB3"_slovenian_ci", "", "UTF8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, - { 197, 1, UTF8_MB3, UTF8_MB3"_polish_ci", "", "UTF8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, - { 198, 1, UTF8_MB3, UTF8_MB3"_estonian_ci", "", "UTF8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, - { 119, 1, UTF8_MB3, UTF8_MB3"_spanish_ci", "", "UTF8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, - { 200, 1, UTF8_MB3, UTF8_MB3"_swedish_ci", "", "UTF8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, - { 201, 1, UTF8_MB3, UTF8_MB3"_turkish_ci", "", "UTF8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, - { 202, 1, UTF8_MB3, UTF8_MB3"_czech_ci", "", "UTF8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, - { 203, 1, UTF8_MB3, UTF8_MB3"_danish_ci", "", "UTF8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid }, - { 204, 1, UTF8_MB3, UTF8_MB3"_lithunian_ci", "", "UTF8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid }, - { 205, 1, UTF8_MB3, UTF8_MB3"_slovak_ci", "", "UTF8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, - { 206, 1, UTF8_MB3, UTF8_MB3"_spanish2_ci", "", "UTF8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, - { 207, 1, UTF8_MB3, UTF8_MB3"_roman_ci", "", "UTF8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, - { 208, 1, UTF8_MB3, UTF8_MB3"_persian_ci", "", "UTF8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, - { 209, 1, UTF8_MB3, UTF8_MB3"_esperanto_ci", "", "UTF8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, - { 210, 1, UTF8_MB3, UTF8_MB3"_hungarian_ci", "", "UTF8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, - { 211, 1, UTF8_MB3, UTF8_MB3"_sinhala_ci", "", "UTF8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, - { 213, 1, UTF8_MB3, UTF8_MB3"_croatian_ci", "", "UTF8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, /*MDB*/ + { 192, 1, UTF8_MB3, UTF8_MB3"_general_ci", "", "UTF-8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, + { 193, 1, UTF8_MB3, UTF8_MB3"_icelandic_ci", "", "UTF-8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, + { 194, 1, UTF8_MB3, UTF8_MB3"_latvian_ci", "", "UTF-8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, + { 195, 1, UTF8_MB3, UTF8_MB3"_romanian_ci", "", "UTF-8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, + { 196, 1, UTF8_MB3, UTF8_MB3"_slovenian_ci", "", "UTF-8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, + { 197, 1, UTF8_MB3, UTF8_MB3"_polish_ci", "", "UTF-8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, + { 198, 1, UTF8_MB3, UTF8_MB3"_estonian_ci", "", "UTF-8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, + { 119, 1, UTF8_MB3, UTF8_MB3"_spanish_ci", "", "UTF-8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, + { 200, 1, UTF8_MB3, UTF8_MB3"_swedish_ci", "", "UTF-8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, + { 201, 1, UTF8_MB3, UTF8_MB3"_turkish_ci", "", "UTF-8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, + { 202, 1, UTF8_MB3, UTF8_MB3"_czech_ci", "", "UTF-8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, + { 203, 1, UTF8_MB3, UTF8_MB3"_danish_ci", "", "UTF-8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid }, + { 204, 1, UTF8_MB3, UTF8_MB3"_lithunian_ci", "", "UTF-8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid }, + { 205, 1, UTF8_MB3, UTF8_MB3"_slovak_ci", "", "UTF-8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, + { 206, 1, UTF8_MB3, UTF8_MB3"_spanish2_ci", "", "UTF-8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, + { 207, 1, UTF8_MB3, UTF8_MB3"_roman_ci", "", "UTF-8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, + { 208, 1, UTF8_MB3, UTF8_MB3"_persian_ci", "", "UTF-8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, + { 209, 1, UTF8_MB3, UTF8_MB3"_esperanto_ci", "", "UTF-8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, + { 210, 1, UTF8_MB3, UTF8_MB3"_hungarian_ci", "", "UTF-8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, + { 211, 1, UTF8_MB3, UTF8_MB3"_sinhala_ci", "", "UTF-8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, + { 213, 1, UTF8_MB3, UTF8_MB3"_croatian_ci", "", "UTF-8", 1, 3, mysql_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, /*MDB*/ - { 224, 1, UTF8_MB4, UTF8_MB4"_unicode_ci", "", "UTF8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, - { 225, 1, UTF8_MB4, UTF8_MB4"_icelandic_ci", "", "UTF8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, - { 226, 1, UTF8_MB4, UTF8_MB4"_latvian_ci", "", "UTF8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, - { 227, 1, UTF8_MB4, UTF8_MB4"_romanian_ci", "", "UTF8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, - { 228, 1, UTF8_MB4, UTF8_MB4"_slovenian_ci", "", "UTF8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, - { 229, 1, UTF8_MB4, UTF8_MB4"_polish_ci", "", "UTF8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, - { 230, 1, UTF8_MB4, UTF8_MB4"_estonian_ci", "", "UTF8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, - { 231, 1, UTF8_MB4, UTF8_MB4"_spanish_ci", "", "UTF8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, - { 232, 1, UTF8_MB4, UTF8_MB4"_swedish_ci", "", "UTF8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, - { 233, 1, UTF8_MB4, UTF8_MB4"_turkish_ci", "", "UTF8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, - { 234, 1, UTF8_MB4, UTF8_MB4"_czech_ci", "", "UTF8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, - { 235, 1, UTF8_MB4, UTF8_MB4"_danish_ci", "", "UTF8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, - { 236, 1, UTF8_MB4, UTF8_MB4"_lithuanian_ci", "", "UTF8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, - { 237, 1, UTF8_MB4, UTF8_MB4"_slovak_ci", "", "UTF8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, - { 238, 1, UTF8_MB4, UTF8_MB4"_spanish2_ci", "", "UTF8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, - { 239, 1, UTF8_MB4, UTF8_MB4"_roman_ci", "", "UTF8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, - { 240, 1, UTF8_MB4, UTF8_MB4"_persian_ci", "", "UTF8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, - { 241, 1, UTF8_MB4, UTF8_MB4"_esperanto_ci", "", "UTF8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, - { 242, 1, UTF8_MB4, UTF8_MB4"_hungarian_ci", "", "UTF8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, - { 243, 1, UTF8_MB4, UTF8_MB4"_sinhala_ci", "", "UTF8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, + { 224, 1, UTF8_MB4, UTF8_MB4"_unicode_ci", "", "UTF-8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, + { 225, 1, UTF8_MB4, UTF8_MB4"_icelandic_ci", "", "UTF-8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, + { 226, 1, UTF8_MB4, UTF8_MB4"_latvian_ci", "", "UTF-8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, + { 227, 1, UTF8_MB4, UTF8_MB4"_romanian_ci", "", "UTF-8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, + { 228, 1, UTF8_MB4, UTF8_MB4"_slovenian_ci", "", "UTF-8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, + { 229, 1, UTF8_MB4, UTF8_MB4"_polish_ci", "", "UTF-8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, + { 230, 1, UTF8_MB4, UTF8_MB4"_estonian_ci", "", "UTF-8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, + { 231, 1, UTF8_MB4, UTF8_MB4"_spanish_ci", "", "UTF-8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, + { 232, 1, UTF8_MB4, UTF8_MB4"_swedish_ci", "", "UTF-8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, + { 233, 1, UTF8_MB4, UTF8_MB4"_turkish_ci", "", "UTF-8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, + { 234, 1, UTF8_MB4, UTF8_MB4"_czech_ci", "", "UTF-8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, + { 235, 1, UTF8_MB4, UTF8_MB4"_danish_ci", "", "UTF-8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, + { 236, 1, UTF8_MB4, UTF8_MB4"_lithuanian_ci", "", "UTF-8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, + { 237, 1, UTF8_MB4, UTF8_MB4"_slovak_ci", "", "UTF-8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, + { 238, 1, UTF8_MB4, UTF8_MB4"_spanish2_ci", "", "UTF-8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, + { 239, 1, UTF8_MB4, UTF8_MB4"_roman_ci", "", "UTF-8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, + { 240, 1, UTF8_MB4, UTF8_MB4"_persian_ci", "", "UTF-8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, + { 241, 1, UTF8_MB4, UTF8_MB4"_esperanto_ci", "", "UTF-8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, + { 242, 1, UTF8_MB4, UTF8_MB4"_hungarian_ci", "", "UTF-8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, + { 243, 1, UTF8_MB4, UTF8_MB4"_sinhala_ci", "", "UTF-8", 1, 4, mysql_mbcharlen_utf8, check_mb_utf8_valid}, - { 254, 1, UTF8_MB3, UTF8_MB3"_general_cs", "", "UTF8", 1, 3, mysql_mbcharlen_utf8, check_mb_utf8_valid}, + { 254, 1, UTF8_MB3, UTF8_MB3"_general_cs", "", "UTF-8", 1, 3, mysql_mbcharlen_utf8, check_mb_utf8_valid}, { 0, 0, NULL, NULL, NULL, NULL, 0, 0, NULL, NULL} }; /* }}} */ @@ -1069,8 +1070,8 @@ struct st_madb_os_charset MADB_OS_CHARSET[]= {"gb2312", "GB2312", "gb2312", "GB2312", MADB_CS_EXACT}, {"gbk", "GBK", "gbk", "GBK", MADB_CS_EXACT}, {"georgianps", "Georgian", "geostd8", "GEORGIAN-PS", MADB_CS_EXACT}, - {"utf8", "UTF8", "utf8", "UTF8", MADB_CS_EXACT}, - {"utf-8", "UTF8", "utf8", "UTF8", MADB_CS_EXACT}, + {"utf8", "UTF8", "utf8", "UTF-8", MADB_CS_EXACT}, + {"utf-8", "UTF8", "utf8", "UTF-8", MADB_CS_EXACT}, #endif {NULL, NULL, NULL, NULL, 0} }; diff --git a/unittest/libmariadb/basic-t.c b/unittest/libmariadb/basic-t.c index 4565e493..014c8680 100644 --- a/unittest/libmariadb/basic-t.c +++ b/unittest/libmariadb/basic-t.c @@ -28,6 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc., */ #include "my_test.h" +#include "ma_common.h" static int basic_connect(MYSQL *mysql) { diff --git a/unittest/libmariadb/dyncol.c b/unittest/libmariadb/dyncol.c index 45b65a6a..adea40bf 100644 --- a/unittest/libmariadb/dyncol.c +++ b/unittest/libmariadb/dyncol.c @@ -104,7 +104,7 @@ static int mdev_4994(MYSQL *mysql) int rc; - val.type= MYSQL_TYPE_NULL; + val.type= DYN_COL_NULL; mariadb_dyncol_init(&dyncol); rc= mariadb_dyncol_create_many_num(&dyncol, 1, &key, &val, 0); diff --git a/unittest/libmariadb/misc.c b/unittest/libmariadb/misc.c index 41a0d5dc..408c5be3 100644 --- a/unittest/libmariadb/misc.c +++ b/unittest/libmariadb/misc.c @@ -22,6 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "my_test.h" +#include "ma_common.h" /* Bug#28075 "COM_DEBUG crashes mysqld" diff --git a/unittest/libmariadb/ps.c b/unittest/libmariadb/ps.c index dcb6e089..5f8173a5 100644 --- a/unittest/libmariadb/ps.c +++ b/unittest/libmariadb/ps.c @@ -113,7 +113,7 @@ static int test_bind_date_conv(MYSQL *mysql, uint row_count) my_bind[0].buffer_type= MYSQL_TYPE_TIMESTAMP; my_bind[1].buffer_type= MYSQL_TYPE_TIME; my_bind[2].buffer_type= MYSQL_TYPE_DATETIME; - my_bind[3].buffer_type= MYSQL_TYPE_DATE; + my_bind[3].buffer_type= MYSQL_TYPE_DATETIME; for (i= 0; i < (int) array_elements(my_bind); i++) { @@ -196,7 +196,6 @@ static int test_bind_date_conv(MYSQL *mysql, uint row_count) FAIL_UNLESS(tm[i].year == 0 || tm[i].year == year+count, "wrong value for year"); FAIL_UNLESS(tm[i].month == 0 || tm[i].month == month+count, "wrong value for month"); FAIL_UNLESS(tm[i].day == 0 || tm[i].day == day+count, "wrong value for day"); - FAIL_UNLESS(tm[i].hour == 0 || tm[i].hour == hour+count, "wrong value for hour"); FAIL_UNLESS(tm[i].minute == 0 || tm[i].minute == minute+count, "wrong value for minute"); FAIL_UNLESS(tm[i].second == 0 || tm[i].second == sec+count, "wrong value for second"); diff --git a/unittest/libmariadb/ssl.c b/unittest/libmariadb/ssl.c index f2193bb2..10a44283 100644 --- a/unittest/libmariadb/ssl.c +++ b/unittest/libmariadb/ssl.c @@ -141,8 +141,8 @@ static int test_multi_ssl_connections(MYSQL *unused) mysql_close(my); - FAIL_IF(new_connections - old_connections < 50, "new_connections should be at least old_connections + 50"); diag("%d SSL connections processed", new_connections - old_connections); + FAIL_IF(new_connections - old_connections < 50, "new_connections should be at least old_connections + 50"); return OK; } diff --git a/unittest/libmariadb/thread.c b/unittest/libmariadb/thread.c index bea33b03..89c52075 100644 --- a/unittest/libmariadb/thread.c +++ b/unittest/libmariadb/thread.c @@ -45,7 +45,7 @@ int thread_conc27(void); DWORD WINAPI thread_conc27(void); #endif -#define THREAD_NUM 1800 +#define THREAD_NUM 100 /* run this test as root and increase the number of handles (ulimit -n) */ static int test_conc_27(MYSQL *mysql)