diff --git a/include/CCustomComboBox.h b/include/CCustomComboBox.h index 6f73f48..f780742 100644 --- a/include/CCustomComboBox.h +++ b/include/CCustomComboBox.h @@ -79,6 +79,9 @@ lparam: Not Used //Custom ComboBox class registered for Community and Connection Manager #define CUSTOMCOMBOBOX1 L"CustomComboBox1" +//Add extra space for combobox for better view +#define COMBOWIDTHMARGIN 50 + /*! \struct connectionlist \brief @@ -98,8 +101,11 @@ typedef struct connectionlist // Custom Combo Box Class class CCustomComboBox { + + private: + //Holds the list of connection CONNLIST *m_connectionlist; diff --git a/include/Global.h b/include/Global.h index ac399db..654d163 100644 --- a/include/Global.h +++ b/include/Global.h @@ -433,6 +433,7 @@ struct ConnectionInfo wyString m_clicert; wyString m_cacert; wyString m_cipher; + wyBool m_no_ca; //Flag for not giving CA certificate while connecting through SSL wyString m_sqlmode; wyString m_initcommand; diff --git a/include/ImportFromSQL.h b/include/ImportFromSQL.h index 1b53ce3..39eaea7 100644 --- a/include/ImportFromSQL.h +++ b/include/ImportFromSQL.h @@ -52,9 +52,11 @@ typedef enum __import_errors */ #define MAX_QUERY_LEN 1024 +#define ER_SQL_SYNTAX 1064 #define ER_EMPTY_QUERY 1065 + /* callback function to display any GUI related stuff. this is always called when we are reading a file */ diff --git a/include/MySQLVersionHelper.h b/include/MySQLVersionHelper.h index 58936ce..4bfa7b3 100644 --- a/include/MySQLVersionHelper.h +++ b/include/MySQLVersionHelper.h @@ -212,6 +212,15 @@ void SetCharacterSet(Tunnel *tunnel, MYSQL * mysql, wyChar * charset); */ wyBool IsMySQL80011(Tunnel * tunnel, PMYSQL mysql); +/// Checks the server version is greater than or equal to 8.0.0 +/** +@param tunnel: IN tunnel pointer +@param mysql: IN PMYSQL value +@returns wyBool, wyTrue if it is SUCCESS, else wyFalse +*/ +/*For Bug issue 2250*/ +wyBool IsMySQL800(PMYSQL mysql); + /// Checks the server version isis MariaDB 10.2.0 or higher /** @param tunnel: IN tunnel pointer diff --git a/include/Version.h b/include/Version.h index 20895e2..5f027d0 100644 --- a/include/Version.h +++ b/include/Version.h @@ -1,6 +1,6 @@ #define MAJOR_VERSION_INT 13 #define MINOR_VERSION_INT 1 -#define UPDATE_VERSION_INT 6 -#define RELEASE_VERSION_INT 0 +#define UPDATE_VERSION_INT 7 +#define RELEASE_VERSION_INT 0 #define EXTRAINFO "" diff --git a/include/mysql/config.h b/include/mysql/config.h new file mode 100644 index 0000000..761a226 --- /dev/null +++ b/include/mysql/config.h @@ -0,0 +1,142 @@ + +/* + * Include file constants (processed in LibmysqlIncludeFiles.txt 1 + */ +#define HAVE_OPENSSL_APPLINK_C 1 +/* #undef HAVE_ALLOCA_H */ +/* #undef HAVE_BIGENDIAN */ +#define HAVE_SETLOCALE 1 +/* #undef HAVE_NL_LANGINFO */ +/* #undef HAVE_DLFCN_H */ +#define HAVE_FCNTL_H 1 +#define HAVE_FLOAT_H 1 +#define HAVE_LIMITS_H 1 +/* #undef HAVE_PWD_H */ +/* #undef HAVE_SELECT_H */ +#define HAVE_STDDEF_H 1 +/* #undef HAVE_STDINT_H */ +#define HAVE_STDLIB_H 1 +#define HAVE_STRING_H 1 +/* #undef HAVE_SYS_IOCTL_H */ +/* #undef HAVE_SYS_SELECT_H */ +/* #undef HAVE_SYS_SOCKET_H */ +/* #undef HAVE_SYS_STREAM_H */ +#define HAVE_SYS_TYPES_H 1 +/* #undef HAVE_SYS_UN_H */ +/* #undef HAVE_UNISTD_H */ +/* #undef HAVE_UCONTEXT_H */ + +/* + * function definitions - processed in LibmysqlFunctions.txt + */ + +/* #undef HAVE_DLERROR */ +/* #undef HAVE_DLOPEN */ +/* #undef HAVE_GETPWUID */ +#define HAVE_MEMCPY 1 +/* #undef HAVE_POLL */ +/* #undef HAVE_STRTOK_R */ +#define HAVE_STRTOL 1 +/* #undef HAVE_STRTOLL */ +#define HAVE_STRTOUL 1 +/* #undef HAVE_STRTOULL */ +#define HAVE_TELL 1 +/* #undef HAVE_THR_SETCONCURRENCY */ +/* #undef HAVE_THR_YIELD */ +/* #undef HAVE_VASPRINTF */ +#define HAVE_VSNPRINTF 1 +/* #undef HAVE_CUSERID */ + +/* + * types and sizes + */ + + +#define SIZEOF_CHARP 8 +#if defined(SIZEOF_CHARP) +# define HAVE_CHARP 1 +#endif + + +#define SIZEOF_INT 4 +#if defined(SIZEOF_INT) +# define HAVE_INT 1 +#endif + +#define SIZEOF_LONG 4 +#if defined(SIZEOF_LONG) +# define HAVE_LONG 1 +#endif + +#define SIZEOF_LONG_LONG 8 +#if defined(SIZEOF_LONG_LONG) +# define HAVE_LONG_LONG 1 +#endif + + +#define SIZEOF_SIZE_T 8 +#if defined(SIZEOF_SIZE_T) +# define HAVE_SIZE_T 1 +#endif + + +/* #undef SIZEOF_UINT */ +#if defined(SIZEOF_UINT) +# define HAVE_UINT 1 +#endif + +/* #undef SIZEOF_ULONG */ +#if defined(SIZEOF_ULONG) +# define HAVE_ULONG 1 +#endif + +/* #undef SIZEOF_INT8 */ +#if defined(SIZEOF_INT8) +# define HAVE_INT8 1 +#endif +/* #undef SIZEOF_UINT8 */ +#if defined(SIZEOF_UINT8) +# define HAVE_UINT8 1 +#endif + +/* #undef SIZEOF_INT16 */ +#if defined(SIZEOF_INT16) +# define HAVE_INT16 1 +#endif +/* #undef SIZEOF_UINT16 */ +#if defined(SIZEOF_UINT16) +# define HAVE_UINT16 1 +#endif + +/* #undef SIZEOF_INT32 */ +#if defined(SIZEOF_INT32) +# define HAVE_INT32 1 +#endif +/* #undef SIZEOF_UINT32 */ +#if defined(SIZEOF_UINT32) +# define HAVE_UINT32 1 +#endif + +/* #undef SIZEOF_INT64 */ +#if defined(SIZEOF_INT64) +# define HAVE_INT64 1 +#endif +/* #undef SIZEOF_UINT64 */ +#if defined(SIZEOF_UINT64) +# define HAVE_UINT64 1 +#endif + +/* #undef SIZEOF_SOCKLEN_T */ +#if defined(SIZEOF_SOCKLEN_T) +# define HAVE_SOCKLEN_T 1 +#endif + +#define SOCKET_SIZE_TYPE int + +#define LOCAL_INFILE_MODE_OFF 0 +#define LOCAL_INFILE_MODE_ON 1 +#define LOCAL_INFILE_MODE_AUTO 2 +#define ENABLED_LOCAL_INFILE LOCAL_INFILE_MODE_AUTO + +#define MARIADB_DEFAULT_CHARSET "latin1" + diff --git a/include/mysql/errmsg.h b/include/mysql/errmsg.h index 481b0a6..7ca3238 100644 --- a/include/mysql/errmsg.h +++ b/include/mysql/errmsg.h @@ -100,7 +100,8 @@ extern const char *mariadb_client_errors[]; /* Error messages */ #define CR_FILE_READ 5005 #define CR_BULK_WITHOUT_PARAMETERS 5006 #define CR_INVALID_STMT 5007 +#define CR_VERSION_MISMATCH 5008 /* Always last, if you add new error codes please update the value for CR_MARIADB_LAST_ERROR */ -#define CR_MARIADB_LAST_ERROR CR_INVALID_STMT +#define CR_MARIADB_LAST_ERROR CR_VERSION_MISMATCH #endif diff --git a/include/mysql/ma_common.h b/include/mysql/ma_common.h index b0229a2..123a510 100644 --- a/include/mysql/ma_common.h +++ b/include/mysql/ma_common.h @@ -78,6 +78,7 @@ struct st_mysql_options_extension { char *server_public_key; char *proxy_header; size_t proxy_header_len; + int (*io_wait)(my_socket handle, my_bool is_read, int timeout); }; typedef struct st_connection_handler @@ -90,6 +91,7 @@ typedef struct st_connection_handler struct st_mariadb_net_extension { enum enum_multi_status multi_status; + int extended_errno; }; struct st_mariadb_session_state @@ -111,3 +113,9 @@ struct st_mariadb_extension { (a)->options.extension->key : 0 #endif + + +typedef struct st_mariadb_field_extension +{ + MARIADB_CONST_STRING metadata[MARIADB_FIELD_ATTR_LAST+1]; /* 10.5 */ +} MA_FIELD_EXTENSION; diff --git a/include/mysql/ma_config.h b/include/mysql/ma_config.h new file mode 100644 index 0000000..761a226 --- /dev/null +++ b/include/mysql/ma_config.h @@ -0,0 +1,142 @@ + +/* + * Include file constants (processed in LibmysqlIncludeFiles.txt 1 + */ +#define HAVE_OPENSSL_APPLINK_C 1 +/* #undef HAVE_ALLOCA_H */ +/* #undef HAVE_BIGENDIAN */ +#define HAVE_SETLOCALE 1 +/* #undef HAVE_NL_LANGINFO */ +/* #undef HAVE_DLFCN_H */ +#define HAVE_FCNTL_H 1 +#define HAVE_FLOAT_H 1 +#define HAVE_LIMITS_H 1 +/* #undef HAVE_PWD_H */ +/* #undef HAVE_SELECT_H */ +#define HAVE_STDDEF_H 1 +/* #undef HAVE_STDINT_H */ +#define HAVE_STDLIB_H 1 +#define HAVE_STRING_H 1 +/* #undef HAVE_SYS_IOCTL_H */ +/* #undef HAVE_SYS_SELECT_H */ +/* #undef HAVE_SYS_SOCKET_H */ +/* #undef HAVE_SYS_STREAM_H */ +#define HAVE_SYS_TYPES_H 1 +/* #undef HAVE_SYS_UN_H */ +/* #undef HAVE_UNISTD_H */ +/* #undef HAVE_UCONTEXT_H */ + +/* + * function definitions - processed in LibmysqlFunctions.txt + */ + +/* #undef HAVE_DLERROR */ +/* #undef HAVE_DLOPEN */ +/* #undef HAVE_GETPWUID */ +#define HAVE_MEMCPY 1 +/* #undef HAVE_POLL */ +/* #undef HAVE_STRTOK_R */ +#define HAVE_STRTOL 1 +/* #undef HAVE_STRTOLL */ +#define HAVE_STRTOUL 1 +/* #undef HAVE_STRTOULL */ +#define HAVE_TELL 1 +/* #undef HAVE_THR_SETCONCURRENCY */ +/* #undef HAVE_THR_YIELD */ +/* #undef HAVE_VASPRINTF */ +#define HAVE_VSNPRINTF 1 +/* #undef HAVE_CUSERID */ + +/* + * types and sizes + */ + + +#define SIZEOF_CHARP 8 +#if defined(SIZEOF_CHARP) +# define HAVE_CHARP 1 +#endif + + +#define SIZEOF_INT 4 +#if defined(SIZEOF_INT) +# define HAVE_INT 1 +#endif + +#define SIZEOF_LONG 4 +#if defined(SIZEOF_LONG) +# define HAVE_LONG 1 +#endif + +#define SIZEOF_LONG_LONG 8 +#if defined(SIZEOF_LONG_LONG) +# define HAVE_LONG_LONG 1 +#endif + + +#define SIZEOF_SIZE_T 8 +#if defined(SIZEOF_SIZE_T) +# define HAVE_SIZE_T 1 +#endif + + +/* #undef SIZEOF_UINT */ +#if defined(SIZEOF_UINT) +# define HAVE_UINT 1 +#endif + +/* #undef SIZEOF_ULONG */ +#if defined(SIZEOF_ULONG) +# define HAVE_ULONG 1 +#endif + +/* #undef SIZEOF_INT8 */ +#if defined(SIZEOF_INT8) +# define HAVE_INT8 1 +#endif +/* #undef SIZEOF_UINT8 */ +#if defined(SIZEOF_UINT8) +# define HAVE_UINT8 1 +#endif + +/* #undef SIZEOF_INT16 */ +#if defined(SIZEOF_INT16) +# define HAVE_INT16 1 +#endif +/* #undef SIZEOF_UINT16 */ +#if defined(SIZEOF_UINT16) +# define HAVE_UINT16 1 +#endif + +/* #undef SIZEOF_INT32 */ +#if defined(SIZEOF_INT32) +# define HAVE_INT32 1 +#endif +/* #undef SIZEOF_UINT32 */ +#if defined(SIZEOF_UINT32) +# define HAVE_UINT32 1 +#endif + +/* #undef SIZEOF_INT64 */ +#if defined(SIZEOF_INT64) +# define HAVE_INT64 1 +#endif +/* #undef SIZEOF_UINT64 */ +#if defined(SIZEOF_UINT64) +# define HAVE_UINT64 1 +#endif + +/* #undef SIZEOF_SOCKLEN_T */ +#if defined(SIZEOF_SOCKLEN_T) +# define HAVE_SOCKLEN_T 1 +#endif + +#define SOCKET_SIZE_TYPE int + +#define LOCAL_INFILE_MODE_OFF 0 +#define LOCAL_INFILE_MODE_ON 1 +#define LOCAL_INFILE_MODE_AUTO 2 +#define ENABLED_LOCAL_INFILE LOCAL_INFILE_MODE_AUTO + +#define MARIADB_DEFAULT_CHARSET "latin1" + diff --git a/include/mysql/ma_config.h.in b/include/mysql/ma_config.h.in index 8f12ee6..1e57257 100644 --- a/include/mysql/ma_config.h.in +++ b/include/mysql/ma_config.h.in @@ -2,6 +2,7 @@ /* * Include file constants (processed in LibmysqlIncludeFiles.txt 1 */ +#cmakedefine HAVE_OPENSSL_APPLINK_C 1 #cmakedefine HAVE_ALLOCA_H 1 #cmakedefine HAVE_BIGENDIAN 1 #cmakedefine HAVE_SETLOCALE 1 @@ -44,6 +45,7 @@ #cmakedefine HAVE_THR_YIELD 1 #cmakedefine HAVE_VASPRINTF 1 #cmakedefine HAVE_VSNPRINTF 1 +#cmakedefine HAVE_CUSERID 1 /* * types and sizes diff --git a/include/mysql/ma_crypt.h b/include/mysql/ma_crypt.h index 18fcd6c..182fa21 100644 --- a/include/mysql/ma_crypt.h +++ b/include/mysql/ma_crypt.h @@ -44,14 +44,7 @@ #define MA_MAX_HASH_SIZE 64 /** \typedef MRL hash context */ -#if defined(HAVE_OPENSSL) -typedef void MA_HASH_CTX; -#elif defined(HAVE_GNUTLS) -typedef struct { - void *ctx; - const struct nettle_hash *hash; -} MA_HASH_CTX; -#elif defined(HAVE_SCHANNEL) +#if defined(WIN32) #include #include typedef struct { @@ -61,6 +54,13 @@ typedef struct { PBYTE hashObject; DWORD digest_len; } MA_HASH_CTX; +#elif defined(HAVE_OPENSSL) +typedef void MA_HASH_CTX; +#elif defined(HAVE_GNUTLS) +typedef struct { + void *ctx; + const struct nettle_hash *hash; +} MA_HASH_CTX; #endif /** diff --git a/include/mysql/ma_global.h b/include/mysql/ma_global.h index d1fec39..0b93f7f 100644 --- a/include/mysql/ma_global.h +++ b/include/mysql/ma_global.h @@ -1096,6 +1096,12 @@ typedef unsigned long long intptr; #define IF_WIN(A,B) B #endif +#if defined(SOLARIS) || defined(__sun) +#define IF_SOLARIS(A,B) A +#else +#define IF_SOLARIS(A,B) B +#endif + #ifndef RTLD_NOW #define RTLD_NOW 1 #endif diff --git a/include/mysql/ma_priv.h b/include/mysql/ma_priv.h new file mode 100644 index 0000000..1ab8311 --- /dev/null +++ b/include/mysql/ma_priv.h @@ -0,0 +1,50 @@ +/**************************************************************************** + Copyright (C) 2020 MariaDB Corporation + + 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 see + or write to the Free Software Foundation, Inc., + 51 Franklin St., Fifth Floor, Boston, MA 02110, USA + + Part of this code includes code from the PHP project which + is freely available from http://www.php.net + *****************************************************************************/ +#ifndef MA_PRIV_H +#define MA_PRIV_H + +void free_rows(MYSQL_DATA *cur); +int ma_multi_command(MYSQL *mysql, enum enum_multi_status status); +MYSQL_FIELD * unpack_fields(const MYSQL *mysql, MYSQL_DATA *data, + MA_MEM_ROOT *alloc,uint fields, + my_bool default_value); + +static inline my_bool ma_has_extended_type_info(const MYSQL *mysql) +{ + return ((mysql->extension->mariadb_server_capabilities) & + (MARIADB_CLIENT_EXTENDED_METADATA >> 32)) != 0; +} + +static inline uint ma_extended_type_info_rows(const MYSQL *mysql) +{ + return ma_has_extended_type_info(mysql) ? 1 : 0; +} + +static inline uint ma_result_set_rows(const MYSQL *mysql) +{ + return ma_has_extended_type_info(mysql) ? 9 : 8; +} + +MA_FIELD_EXTENSION *ma_field_extension_deep_dup(MA_MEM_ROOT *memroot, + const MA_FIELD_EXTENSION *from); + +#endif diff --git a/include/mysql/mariadb_com.h b/include/mysql/mariadb_com.h index 9a5da28..c63e5b0 100644 --- a/include/mysql/mariadb_com.h +++ b/include/mysql/mariadb_com.h @@ -170,13 +170,16 @@ enum enum_server_command #define MARIADB_CLIENT_PROGRESS (1ULL << 32) #define MARIADB_CLIENT_COM_MULTI (1ULL << 33) #define MARIADB_CLIENT_STMT_BULK_OPERATIONS (1ULL << 34) +/* support of extended data type/format information, since 10.5.0 */ +#define MARIADB_CLIENT_EXTENDED_METADATA (1ULL << 35) #define IS_MARIADB_EXTENDED_SERVER(mysql)\ !(mysql->server_capabilities & CLIENT_MYSQL) #define MARIADB_CLIENT_SUPPORTED_FLAGS (MARIADB_CLIENT_PROGRESS |\ MARIADB_CLIENT_COM_MULTI |\ - MARIADB_CLIENT_STMT_BULK_OPERATIONS) + MARIADB_CLIENT_STMT_BULK_OPERATIONS|\ + MARIADB_CLIENT_EXTENDED_METADATA) #define CLIENT_SUPPORTED_FLAGS (CLIENT_MYSQL |\ CLIENT_FOUND_ROWS |\ diff --git a/include/mysql/mariadb_rpl.h b/include/mysql/mariadb_rpl.h new file mode 100644 index 0000000..315543f --- /dev/null +++ b/include/mysql/mariadb_rpl.h @@ -0,0 +1,305 @@ +/* Copyright (C) 2018 MariaDB Corporation 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., 51 Franklin Street, Fifth Floor, Boston, + MA 02111-1301, USA */ +#ifndef _mariadb_rpl_h_ +#define _mariadb_rpl_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define MARIADB_RPL_VERSION 0x0001 +#define MARIADB_RPL_REQUIRED_VERSION 0x0001 + +/* Protocol flags */ +#define MARIADB_RPL_BINLOG_DUMP_NON_BLOCK 1 +#define MARIADB_RPL_BINLOG_SEND_ANNOTATE_ROWS 2 +#define MARIADB_RPL_IGNORE_HEARTBEAT (1 << 17) + +#define EVENT_HEADER_OFS 20 + +#define FL_GROUP_COMMIT_ID 2 +#define FL_STMT_END 1 + +#define LOG_EVENT_ARTIFICIAL_F 0x20 + + +/* Options */ +enum mariadb_rpl_option { + MARIADB_RPL_FILENAME, /* Filename and length */ + MARIADB_RPL_START, /* Start position */ + MARIADB_RPL_SERVER_ID, /* Server ID */ + MARIADB_RPL_FLAGS, /* Protocol flags */ + MARIADB_RPL_GTID_CALLBACK, /* GTID callback function */ + MARIADB_RPL_GTID_DATA, /* GTID data */ + MARIADB_RPL_BUFFER +}; + +/* Event types: From MariaDB Server sql/log_event.h */ +enum mariadb_rpl_event { + UNKNOWN_EVENT= 0, + START_EVENT_V3= 1, + QUERY_EVENT= 2, + STOP_EVENT= 3, + ROTATE_EVENT= 4, + INTVAR_EVENT= 5, + LOAD_EVENT= 6, + SLAVE_EVENT= 7, + CREATE_FILE_EVENT= 8, + APPEND_BLOCK_EVENT= 9, + EXEC_LOAD_EVENT= 10, + DELETE_FILE_EVENT= 11, + NEW_LOAD_EVENT= 12, + RAND_EVENT= 13, + USER_VAR_EVENT= 14, + FORMAT_DESCRIPTION_EVENT= 15, + XID_EVENT= 16, + BEGIN_LOAD_QUERY_EVENT= 17, + EXECUTE_LOAD_QUERY_EVENT= 18, + TABLE_MAP_EVENT = 19, + + PRE_GA_WRITE_ROWS_EVENT = 20, /* deprecated */ + PRE_GA_UPDATE_ROWS_EVENT = 21, /* deprecated */ + PRE_GA_DELETE_ROWS_EVENT = 22, /* deprecated */ + + WRITE_ROWS_EVENT_V1 = 23, + UPDATE_ROWS_EVENT_V1 = 24, + DELETE_ROWS_EVENT_V1 = 25, + INCIDENT_EVENT= 26, + HEARTBEAT_LOG_EVENT= 27, + IGNORABLE_LOG_EVENT= 28, + ROWS_QUERY_LOG_EVENT= 29, + WRITE_ROWS_EVENT = 30, + UPDATE_ROWS_EVENT = 31, + DELETE_ROWS_EVENT = 32, + GTID_LOG_EVENT= 33, + ANONYMOUS_GTID_LOG_EVENT= 34, + PREVIOUS_GTIDS_LOG_EVENT= 35, + TRANSACTION_CONTEXT_EVENT= 36, + VIEW_CHANGE_EVENT= 37, + XA_PREPARE_LOG_EVENT= 38, + + /* + Add new events here - right above this comment! + Existing events (except ENUM_END_EVENT) should never change their numbers + */ + + /* New MySQL/Sun events are to be added right above this comment */ + MYSQL_EVENTS_END, + + MARIA_EVENTS_BEGIN= 160, + ANNOTATE_ROWS_EVENT= 160, + BINLOG_CHECKPOINT_EVENT= 161, + GTID_EVENT= 162, + GTID_LIST_EVENT= 163, + START_ENCRYPTION_EVENT= 164, + QUERY_COMPRESSED_EVENT = 165, + WRITE_ROWS_COMPRESSED_EVENT_V1 = 166, + UPDATE_ROWS_COMPRESSED_EVENT_V1 = 167, + DELETE_ROWS_COMPRESSED_EVENT_V1 = 168, + WRITE_ROWS_COMPRESSED_EVENT = 169, + UPDATE_ROWS_COMPRESSED_EVENT = 170, + DELETE_ROWS_COMPRESSED_EVENT = 171, + + /* Add new MariaDB events here - right above this comment! */ + + ENUM_END_EVENT /* end marker */ +}; + +typedef struct { + char *str; + size_t length; +} MARIADB_STRING; + +enum mariadb_row_event_type { + WRITE_ROWS= 0, + UPDATE_ROWS= 1, + DELETE_ROWS= 2 +}; + +/* Global transaction id */ +typedef struct st_mariadb_gtid { + unsigned int domain_id; + unsigned int server_id; + unsigned long long sequence_nr; +} MARIADB_GTID; + +/* Generic replication handle */ +typedef struct st_mariadb_rpl { + unsigned int version; + MYSQL *mysql; + char *filename; + uint32_t filename_length; + unsigned char *buffer; + unsigned long buffer_size; + uint32_t server_id; + unsigned long start_position; + uint32_t flags; + uint8_t fd_header_len; /* header len from last format description event */ + uint8_t use_checksum; +} MARIADB_RPL; + +/* Event header */ +struct st_mariadb_rpl_rotate_event { + unsigned long long position; + MARIADB_STRING filename; +}; + +struct st_mariadb_rpl_query_event { + uint32_t thread_id; + uint32_t seconds; + MARIADB_STRING database; + uint32_t errornr; + MARIADB_STRING status; + MARIADB_STRING statement; +}; + +struct st_mariadb_rpl_gtid_list_event { + uint32_t gtid_cnt; + MARIADB_GTID *gtid; +}; + +struct st_mariadb_rpl_format_description_event +{ + uint16_t format; + char *server_version; + uint32_t timestamp; + uint8_t header_len; +}; + +struct st_mariadb_rpl_checkpoint_event { + MARIADB_STRING filename; +}; + +struct st_mariadb_rpl_xid_event { + uint64_t transaction_nr; +}; + +struct st_mariadb_rpl_gtid_event { + uint64_t sequence_nr; + uint32_t domain_id; + uint8_t flags; + uint64_t commit_id; +}; + +struct st_mariadb_rpl_annotate_rows_event { + MARIADB_STRING statement; +}; + +struct st_mariadb_rpl_table_map_event { + unsigned long long table_id; + MARIADB_STRING database; + MARIADB_STRING table; + unsigned int column_count; + MARIADB_STRING column_types; + MARIADB_STRING metadata; + char *null_indicator; +}; + +struct st_mariadb_rpl_rand_event { + unsigned long long first_seed; + unsigned long long second_seed; +}; + +struct st_mariadb_rpl_encryption_event { + char scheme; + unsigned int key_version; + char *nonce; +}; + +struct st_mariadb_rpl_intvar_event { + char type; + unsigned long long value; +}; + +struct st_mariadb_rpl_uservar_event { + MARIADB_STRING name; + uint8_t is_null; + uint8_t type; + uint32_t charset_nr; + MARIADB_STRING value; + uint8_t flags; +}; + +struct st_mariadb_rpl_rows_event { + enum mariadb_row_event_type type; + uint64_t table_id; + uint16_t flags; + uint32_t column_count; + char *column_bitmap; + char *column_update_bitmap; + size_t row_data_size; + void *row_data; +}; + +struct st_mariadb_rpl_heartbeat_event { + uint32_t timestamp; + uint32_t next_position; + uint8_t type; + uint16_t flags; +}; + +typedef struct st_mariadb_rpl_event +{ + /* common header */ + MA_MEM_ROOT memroot; + unsigned int checksum; + char ok; + enum mariadb_rpl_event event_type; + unsigned int timestamp; + unsigned int server_id; + unsigned int event_length; + unsigned int next_event_pos; + unsigned short flags; + /****************/ + union { + struct st_mariadb_rpl_rotate_event rotate; + struct st_mariadb_rpl_query_event query; + struct st_mariadb_rpl_format_description_event format_description; + struct st_mariadb_rpl_gtid_list_event gtid_list; + struct st_mariadb_rpl_checkpoint_event checkpoint; + struct st_mariadb_rpl_xid_event xid; + struct st_mariadb_rpl_gtid_event gtid; + struct st_mariadb_rpl_annotate_rows_event annotate_rows; + struct st_mariadb_rpl_table_map_event table_map; + struct st_mariadb_rpl_rand_event rand; + struct st_mariadb_rpl_encryption_event encryption; + struct st_mariadb_rpl_intvar_event intvar; + struct st_mariadb_rpl_uservar_event uservar; + struct st_mariadb_rpl_rows_event rows; + struct st_mariadb_rpl_heartbeat_event heartbeat; + } event; +} MARIADB_RPL_EVENT; + +#define mariadb_rpl_init(a) mariadb_rpl_init_ex((a), MARIADB_RPL_VERSION) + +/* Function prototypes */ +MARIADB_RPL * STDCALL mariadb_rpl_init_ex(MYSQL *mysql, unsigned int version); + +int mariadb_rpl_optionsv(MARIADB_RPL *rpl, enum mariadb_rpl_option, ...); +int mariadb_rpl_get_optionsv(MARIADB_RPL *rpl, enum mariadb_rpl_option, ...); + +int STDCALL mariadb_rpl_open(MARIADB_RPL *rpl); +void STDCALL mariadb_rpl_close(MARIADB_RPL *rpl); +MARIADB_RPL_EVENT * STDCALL mariadb_rpl_fetch(MARIADB_RPL *rpl, MARIADB_RPL_EVENT *event); +void STDCALL mariadb_free_rpl_event(MARIADB_RPL_EVENT *event); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/mysql/mariadb_stmt.h b/include/mysql/mariadb_stmt.h index 40063bc..0aa1436 100644 --- a/include/mysql/mariadb_stmt.h +++ b/include/mysql/mariadb_stmt.h @@ -38,7 +38,9 @@ { \ (a)->last_errno= (b);\ strncpy((a)->sqlstate, (c), SQLSTATE_LENGTH);\ - strncpy((a)->last_error, (d) ? (d) : ER((b)), MYSQL_ERRMSG_SIZE - 1);\ + (a)->sqlstate[SQLSTATE_LENGTH]= 0;\ + strncpy((a)->last_error, (d) ? (d) : ER((b)), MYSQL_ERRMSG_SIZE);\ + (a)->last_error[MYSQL_ERRMSG_SIZE - 1]= 0;\ } #define CLEAR_CLIENT_STMT_ERROR(a) \ @@ -62,10 +64,15 @@ enum enum_stmt_attr_type STMT_ATTR_UPDATE_MAX_LENGTH, STMT_ATTR_CURSOR_TYPE, STMT_ATTR_PREFETCH_ROWS, + + /* MariaDB only */ STMT_ATTR_PREBIND_PARAMS=200, STMT_ATTR_ARRAY_SIZE, STMT_ATTR_ROW_SIZE, - STMT_ATTR_STATE + STMT_ATTR_STATE, + STMT_ATTR_CB_USER_DATA, + STMT_ATTR_CB_PARAM, + STMT_ATTR_CB_RESULT }; enum enum_cursor_type @@ -195,6 +202,8 @@ struct st_mysqlnd_stmt_methods }; typedef int (*mysql_stmt_fetch_row_func)(MYSQL_STMT *stmt, unsigned char **row); +typedef void (*ps_result_callback)(void *data, unsigned int column, unsigned char **row); +typedef my_bool *(*ps_param_callback)(void *data, MYSQL_BIND *bind, unsigned int row_nr); struct st_mysql_stmt { @@ -234,6 +243,9 @@ struct st_mysql_stmt unsigned int array_size; size_t row_size; unsigned int prebind_params; + void *user_data; + ps_result_callback result_callback; + ps_param_callback param_callback; }; typedef void (*ps_field_fetch_func)(MYSQL_BIND *r_param, const MYSQL_FIELD * field, unsigned char **row); @@ -283,3 +295,4 @@ 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); int STDCALL mariadb_stmt_execute_direct(MYSQL_STMT *stmt, const char *stmt_str, size_t length); +MYSQL_FIELD * STDCALL mariadb_stmt_fetch_fields(MYSQL_STMT *stmt); diff --git a/include/mysql/mariadb_version.h b/include/mysql/mariadb_version.h index be36917..7e59525 100644 --- a/include/mysql/mariadb_version.h +++ b/include/mysql/mariadb_version.h @@ -10,19 +10,21 @@ #include #else #define PROTOCOL_VERSION 10 -#define MARIADB_CLIENT_VERSION_STR "10.3.6" -#define MARIADB_BASE_VERSION "mariadb-10.3" -#define MARIADB_VERSION_ID 100306 -#define MYSQL_VERSION_ID 100306 +#define MARIADB_CLIENT_VERSION_STR "10.4.3" +#define MARIADB_BASE_VERSION "mariadb-10.4" +#define MARIADB_VERSION_ID 100403 #define MARIADB_PORT 3306 #define MARIADB_UNIX_ADDR "/tmp/mysql.sock" -#define MYSQL_CONFIG_NAME "my" -#define MARIADB_PACKAGE_VERSION "3.0.8" -#define MARIADB_PACKAGE_VERSION_ID 30008 +#define MYSQL_CONFIG_NAME "my" +#define MYSQL_VERSION_ID 100403 +#define MYSQL_SERVER_VERSION "10.4.3-MariaDB" + +#define MARIADB_PACKAGE_VERSION "3.1.8" +#define MARIADB_PACKAGE_VERSION_ID 30108 #define MARIADB_SYSTEM_TYPE "Windows" #define MARIADB_MACHINE_TYPE "AMD64" -#define MARIADB_PLUGINDIR "lib/mariadb/plugin" +#define MARIADB_PLUGINDIR "C:/Program Files/mariadb-connector-c/lib/mariadb/plugin" /* mysqld compile time options */ #ifndef MYSQL_CHARSET diff --git a/include/mysql/mariadb_version.h.in b/include/mysql/mariadb_version.h.in index bab58ce..f45e22d 100644 --- a/include/mysql/mariadb_version.h.in +++ b/include/mysql/mariadb_version.h.in @@ -24,7 +24,7 @@ #define MARIADB_PACKAGE_VERSION_ID @MARIADB_PACKAGE_VERSION_ID@ #define MARIADB_SYSTEM_TYPE "@CMAKE_SYSTEM_NAME@" #define MARIADB_MACHINE_TYPE "@CMAKE_SYSTEM_PROCESSOR@" -#define MARIADB_PLUGINDIR "@PLUGINDIR@" +#define MARIADB_PLUGINDIR "@CMAKE_INSTALL_PREFIX@/@INSTALL_PLUGINDIR@" /* mysqld compile time options */ #ifndef MYSQL_CHARSET diff --git a/include/mysql/mysql.h b/include/mysql/mysql.h index 08525e8..a160de0 100644 --- a/include/mysql/mysql.h +++ b/include/mysql/mysql.h @@ -61,6 +61,14 @@ typedef int my_socket; #include "ma_list.h" #include "mariadb_ctype.h" + +typedef struct st_ma_const_string +{ + const char *str; + size_t length; +} MARIADB_CONST_STRING; + + #ifndef ST_MA_USED_MEM_DEFINED #define ST_MA_USED_MEM_DEFINED typedef struct st_ma_used_mem { /* struct for once_alloc */ @@ -125,7 +133,9 @@ extern unsigned int mariadb_deinitialize_ssl; { \ (a)->net.last_errno= (b);\ strncpy((a)->net.sqlstate, (c), SQLSTATE_LENGTH);\ + (a)->net.sqlstate[SQLSTATE_LENGTH]= 0;\ strncpy((a)->net.last_error, (d) ? (d) : ER((b)), MYSQL_ERRMSG_SIZE - 1);\ + (a)->net.last_error[MYSQL_ERRMSG_SIZE - 1]= 0;\ } /* For mysql_async.c */ @@ -138,6 +148,7 @@ extern const char *SQLSTATE_UNKNOWN; (a)->net.last_errno= 0;\ strcpy((a)->net.sqlstate, "00000");\ (a)->net.last_error[0]= '\0';\ + (a)->net.extension->extended_errno= 0;\ } #define MYSQL_COUNT_ERROR (~(unsigned long long) 0) @@ -233,7 +244,8 @@ extern const char *SQLSTATE_UNKNOWN; MARIADB_OPT_MULTI_RESULTS, MARIADB_OPT_MULTI_STATEMENTS, MARIADB_OPT_INTERACTIVE, - MARIADB_OPT_PROXY_HEADER + MARIADB_OPT_PROXY_HEADER, + MARIADB_OPT_IO_WAIT }; enum mariadb_value { @@ -379,6 +391,20 @@ typedef struct void *extension; } MYSQL_PARAMETERS; + +enum mariadb_field_attr_t +{ + MARIADB_FIELD_ATTR_DATA_TYPE_NAME= 0, + MARIADB_FIELD_ATTR_FORMAT_NAME= 1 +}; + +#define MARIADB_FIELD_ATTR_LAST MARIADB_FIELD_ATTR_FORMAT_NAME + + +int STDCALL mariadb_field_attr(MARIADB_CONST_STRING *attr, + const MYSQL_FIELD *field, + enum mariadb_field_attr_t type); + #ifndef _mysql_time_h_ enum enum_mysql_timestamp_type { diff --git a/include/mysql/mysqld_error.h b/include/mysql/mysqld_error.h index cc8c76d..6a42ffc 100644 --- a/include/mysql/mysqld_error.h +++ b/include/mysql/mysqld_error.h @@ -180,7 +180,7 @@ #define ER_REQUIRES_PRIMARY_KEY 1173 #define ER_NO_RAID_COMPILED 1174 #define ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE 1175 -#define ER_KEY_DOES_NOT_EXITS 1176 +#define ER_KEY_DOES_NOT_EXISTS 1176 #define ER_CHECK_NO_SUCH_TABLE 1177 #define ER_CHECK_NOT_IMPLEMENTED 1178 #define ER_CANT_DO_THIS_DURING_AN_TRANSACTION 1179 diff --git a/lib/win32/debug/auth_gssapi_client.dll b/lib/win32/debug/auth_gssapi_client.dll index 5cd21b4..8efcd67 100644 Binary files a/lib/win32/debug/auth_gssapi_client.dll and b/lib/win32/debug/auth_gssapi_client.dll differ diff --git a/lib/win32/debug/auth_gssapi_client.lib b/lib/win32/debug/auth_gssapi_client.lib index 0241019..8ce6064 100644 Binary files a/lib/win32/debug/auth_gssapi_client.lib and b/lib/win32/debug/auth_gssapi_client.lib differ diff --git a/lib/win32/debug/dialog.dll b/lib/win32/debug/dialog.dll index 005aa54..112b2ae 100644 Binary files a/lib/win32/debug/dialog.dll and b/lib/win32/debug/dialog.dll differ diff --git a/lib/win32/debug/dialog.lib b/lib/win32/debug/dialog.lib index 0e3c215..a3d49e3 100644 Binary files a/lib/win32/debug/dialog.lib and b/lib/win32/debug/dialog.lib differ diff --git a/lib/win32/debug/mariadbclient.lib b/lib/win32/debug/mariadbclient.lib index d66495c..a9c93ad 100644 Binary files a/lib/win32/debug/mariadbclient.lib and b/lib/win32/debug/mariadbclient.lib differ diff --git a/lib/win32/debug/mysql_clear_password.dll b/lib/win32/debug/mysql_clear_password.dll index 574e21e..20bf75d 100644 Binary files a/lib/win32/debug/mysql_clear_password.dll and b/lib/win32/debug/mysql_clear_password.dll differ diff --git a/lib/win32/debug/mysql_clear_password.lib b/lib/win32/debug/mysql_clear_password.lib index 4900262..78149cc 100644 Binary files a/lib/win32/debug/mysql_clear_password.lib and b/lib/win32/debug/mysql_clear_password.lib differ diff --git a/lib/win32/release/auth_gssapi_client.dll b/lib/win32/release/auth_gssapi_client.dll index bd8ba63..2d33174 100644 Binary files a/lib/win32/release/auth_gssapi_client.dll and b/lib/win32/release/auth_gssapi_client.dll differ diff --git a/lib/win32/release/auth_gssapi_client.lib b/lib/win32/release/auth_gssapi_client.lib index 4a82243..d60f123 100644 Binary files a/lib/win32/release/auth_gssapi_client.lib and b/lib/win32/release/auth_gssapi_client.lib differ diff --git a/lib/win32/release/dialog.dll b/lib/win32/release/dialog.dll index 66b0684..8bf0e92 100644 Binary files a/lib/win32/release/dialog.dll and b/lib/win32/release/dialog.dll differ diff --git a/lib/win32/release/dialog.lib b/lib/win32/release/dialog.lib index db31892..1cffc7b 100644 Binary files a/lib/win32/release/dialog.lib and b/lib/win32/release/dialog.lib differ diff --git a/lib/win32/release/mariadbclient.lib b/lib/win32/release/mariadbclient.lib index c89416b..b991f2c 100644 Binary files a/lib/win32/release/mariadbclient.lib and b/lib/win32/release/mariadbclient.lib differ diff --git a/lib/win32/release/mysql_clear_password.dll b/lib/win32/release/mysql_clear_password.dll index 393c4cd..a174880 100644 Binary files a/lib/win32/release/mysql_clear_password.dll and b/lib/win32/release/mysql_clear_password.dll differ diff --git a/lib/win32/release/mysql_clear_password.lib b/lib/win32/release/mysql_clear_password.lib index af23c50..2a6e1ff 100644 Binary files a/lib/win32/release/mysql_clear_password.lib and b/lib/win32/release/mysql_clear_password.lib differ diff --git a/lib/x64/debug/auth_gssapi_client.dll b/lib/x64/debug/auth_gssapi_client.dll index fdbc8a1..8efcd67 100644 Binary files a/lib/x64/debug/auth_gssapi_client.dll and b/lib/x64/debug/auth_gssapi_client.dll differ diff --git a/lib/x64/debug/auth_gssapi_client.lib b/lib/x64/debug/auth_gssapi_client.lib index cc5cc4f..8ce6064 100644 Binary files a/lib/x64/debug/auth_gssapi_client.lib and b/lib/x64/debug/auth_gssapi_client.lib differ diff --git a/lib/x64/debug/dialog.dll b/lib/x64/debug/dialog.dll index bc0446e..112b2ae 100644 Binary files a/lib/x64/debug/dialog.dll and b/lib/x64/debug/dialog.dll differ diff --git a/lib/x64/debug/dialog.lib b/lib/x64/debug/dialog.lib index 0f10860..a3d49e3 100644 Binary files a/lib/x64/debug/dialog.lib and b/lib/x64/debug/dialog.lib differ diff --git a/lib/x64/debug/mariadbclient.lib b/lib/x64/debug/mariadbclient.lib index 49c14c2..a9c93ad 100644 Binary files a/lib/x64/debug/mariadbclient.lib and b/lib/x64/debug/mariadbclient.lib differ diff --git a/lib/x64/debug/mysql_clear_password.dll b/lib/x64/debug/mysql_clear_password.dll index 1c2a288..20bf75d 100644 Binary files a/lib/x64/debug/mysql_clear_password.dll and b/lib/x64/debug/mysql_clear_password.dll differ diff --git a/lib/x64/debug/mysql_clear_password.lib b/lib/x64/debug/mysql_clear_password.lib index 6d3b886..78149cc 100644 Binary files a/lib/x64/debug/mysql_clear_password.lib and b/lib/x64/debug/mysql_clear_password.lib differ diff --git a/lib/x64/linux/caching_sha2_password.so b/lib/x64/linux/caching_sha2_password.so index c17af88..bcad934 100644 Binary files a/lib/x64/linux/caching_sha2_password.so and b/lib/x64/linux/caching_sha2_password.so differ diff --git a/lib/x64/linux/sha256_password.so b/lib/x64/linux/sha256_password.so index 5b2e8ba..ea3c629 100644 Binary files a/lib/x64/linux/sha256_password.so and b/lib/x64/linux/sha256_password.so differ diff --git a/lib/x64/release/auth_gssapi_client.dll b/lib/x64/release/auth_gssapi_client.dll index e9d0077..2d33174 100644 Binary files a/lib/x64/release/auth_gssapi_client.dll and b/lib/x64/release/auth_gssapi_client.dll differ diff --git a/lib/x64/release/auth_gssapi_client.lib b/lib/x64/release/auth_gssapi_client.lib index 0c377bf..d60f123 100644 Binary files a/lib/x64/release/auth_gssapi_client.lib and b/lib/x64/release/auth_gssapi_client.lib differ diff --git a/lib/x64/release/dialog.dll b/lib/x64/release/dialog.dll index 5f94477..8bf0e92 100644 Binary files a/lib/x64/release/dialog.dll and b/lib/x64/release/dialog.dll differ diff --git a/lib/x64/release/dialog.lib b/lib/x64/release/dialog.lib index f6ccc34..1cffc7b 100644 Binary files a/lib/x64/release/dialog.lib and b/lib/x64/release/dialog.lib differ diff --git a/lib/x64/release/mariadbclient.lib b/lib/x64/release/mariadbclient.lib index 1c843da..b991f2c 100644 Binary files a/lib/x64/release/mariadbclient.lib and b/lib/x64/release/mariadbclient.lib differ diff --git a/lib/x64/release/mysql_clear_password.dll b/lib/x64/release/mysql_clear_password.dll index 707d9cd..a174880 100644 Binary files a/lib/x64/release/mysql_clear_password.dll and b/lib/x64/release/mysql_clear_password.dll differ diff --git a/lib/x64/release/mysql_clear_password.lib b/lib/x64/release/mysql_clear_password.lib index c4fd376..2a6e1ff 100644 Binary files a/lib/x64/release/mysql_clear_password.lib and b/lib/x64/release/mysql_clear_password.lib differ diff --git a/src/CCustomComboBox.cpp b/src/CCustomComboBox.cpp index fab5a9d..5c05812 100644 --- a/src/CCustomComboBox.cpp +++ b/src/CCustomComboBox.cpp @@ -408,6 +408,9 @@ CCustomComboBox::OnHandleEditChange(){ m_connectionlist[i].m_dropdown=wyFalse; } } + + wyInt32 width = SetComboWidth(m_hwndCombo); + SendMessage(m_hwndCombo, CB_SETDROPPEDWIDTH, width + COMBOWIDTHMARGIN, 0); } @@ -421,6 +424,10 @@ CCustomComboBox::OnHandleEditChange(){ if(m_connectionlist[i].m_dropdown == wyFalse) { index=SendMessage(m_hwndCombo, CB_ADDSTRING, 0,(LPARAM)m_connectionlist[i].m_connectionname.GetAsWideChar()); + + wyInt32 width = SetComboWidth(m_hwndCombo); + SendMessage(m_hwndCombo, CB_SETDROPPEDWIDTH, width + COMBOWIDTHMARGIN, 0); + VERIFY(SendMessage(m_hwndCombo, CB_SETITEMDATA, index, (LPARAM)m_connectionlist[i].m_itemvalue.GetAsInt32())); m_connectionlist[i].m_dropdown=wyTrue; } diff --git a/src/ConnectionBase.cpp b/src/ConnectionBase.cpp index 6794a70..9c07f84 100644 --- a/src/ConnectionBase.cpp +++ b/src/ConnectionBase.cpp @@ -461,6 +461,9 @@ ConnectionBase::InitConnDialog(HWND hdlg, HWND combo, wyBool toadd, wyBool selec tempconsecname = strtok(NULL, seps); } + width = SetComboWidth(hwndcombo); + SendMessage(hwndcombo, CB_SETDROPPEDWIDTH, width + COMBOWIDTHMARGIN, 0); + if(toadd) { SendMessage(hwndcombo, CB_INSERTSTRING, (WPARAM)0, (LPARAM)(DEFAULT_CONN)); @@ -483,11 +486,11 @@ ConnectionBase::InitConnDialog(HWND hdlg, HWND combo, wyBool toadd, wyBool selec SendMessage(hwndcombo, CB_SETCURSEL, index, 0); /*width = SetComboWidth(hwndcombo); - SendMessage(hwndcombo, CB_SETDROPPEDWIDTH, width+50, 0); //width + 50 means width of the text + width of the scroll bar*/ + SendMessage(hwndcombo, CB_SETDROPPEDWIDTH, width+COMBOWIDTHMARGIN, 0); //width + 50 means width of the text + width of the scroll bar*/ HWND actualcombo = (HWND)SendMessage(hwndcombo, CCBM_GETCOMBOHWND, 0, 0); width = SetComboWidth(actualcombo); - SendMessage(actualcombo, CB_SETDROPPEDWIDTH, width + 50, 0); + SendMessage(actualcombo, CB_SETDROPPEDWIDTH, width + COMBOWIDTHMARGIN, 0); return; } @@ -748,6 +751,9 @@ ConnectionBase::NewConnection(HWND hdlg) WriteDefValues(hdlg); index = SendMessage(hwndcombo, CB_ADDSTRING, -1,(LPARAM)pconn.m_connname); + wyInt32 width = SetComboWidth(hwndcombo); + SendMessage(hwndcombo, CB_SETDROPPEDWIDTH, width + COMBOWIDTHMARGIN, 0); + SendMessage(hwndcombo, CB_SETITEMDATA, index, concount+1); //populate color array for connection combo @@ -854,6 +860,9 @@ ConnectionBase::CloneConnection(HWND hdlg) conn.Sprintf("Connection %u", concount + 1); index = SendMessage(hwndcombo, CB_ADDSTRING, -1,(LPARAM)pconn.m_connname); + wyInt32 width = SetComboWidth(hwndcombo); + SendMessage(hwndcombo, CB_SETDROPPEDWIDTH, width + COMBOWIDTHMARGIN, 0); + SendMessage(hwndcombo, CB_SETITEMDATA, index, concount+1); //populate color array for connection combo diff --git a/src/CopyDatabase.cpp b/src/CopyDatabase.cpp index 7b65925..7a8c219 100644 --- a/src/CopyDatabase.cpp +++ b/src/CopyDatabase.cpp @@ -26,6 +26,7 @@ #include "SQLMaker.h" #include "GUIHelper.h" #include "DBListBuilder.h" +#include "CCustomComboBox.h" #define COPIED_STOREDPGRMS_MANUALADJUST _(L"One or more stored programs or views were copied.\ \r\nThey may contain SQL-referencing the database name and will need to be adjusted manually.") @@ -812,7 +813,7 @@ void } wyInt32 width = SetComboWidth(m_hwndcombodb); - SendMessage(m_hwndcombodb, CB_SETDROPPEDWIDTH, width + 50, 0); + SendMessage(m_hwndcombodb, CB_SETDROPPEDWIDTH, width + COMBOWIDTHMARGIN, 0); } @@ -1098,10 +1099,10 @@ CopyDatabase::AddInitData() // set the width of the combos wyInt32 width = SetComboWidth(GetDlgItem(m_hwnddlg, IDC_SOURCEDB)); - SendMessage(GetDlgItem(m_hwnddlg, IDC_SOURCEDB), CB_SETDROPPEDWIDTH, width + 50, 0); + SendMessage(GetDlgItem(m_hwnddlg, IDC_SOURCEDB), CB_SETDROPPEDWIDTH, width + COMBOWIDTHMARGIN, 0); width = SetComboWidth(GetDlgItem(m_hwnddlg, IDC_SOURCEDB2)); - SendMessage(GetDlgItem(m_hwnddlg, IDC_SOURCEDB2), CB_SETDROPPEDWIDTH, width + 50, 0); + SendMessage(GetDlgItem(m_hwnddlg, IDC_SOURCEDB2), CB_SETDROPPEDWIDTH, width + COMBOWIDTHMARGIN, 0); return wyTrue; @@ -3147,11 +3148,11 @@ CopyDatabase::ExportActualData(wyChar * table,wyBool *isvirtual) { //In HTTP, if don't break into chunks is checked or chunk size is zero or chunk size is > 1000 , then we will use the chunk size as 1000 //otherwise , means if chunksize is <1000, that size will use. - if(chunklimit > MAX_ROW_LIMIT || ischunkinsert == wyFalse || chunklimit == 0) + if(chunklimit > MAX_ROW_LIMIT || ischunkinsert == wyFalse || chunklimit <= 0) chunklimit = MAX_ROW_LIMIT; } else { - if(ischunkinsert == wyTrue && chunklimit == 0) + if(ischunkinsert == wyTrue && chunklimit <= 0) chunklimit = MAX_ROW_LIMIT; } diff --git a/src/ImportFromSQL.cpp b/src/ImportFromSQL.cpp index 14867f2..00af2f0 100644 --- a/src/ImportFromSQL.cpp +++ b/src/ImportFromSQL.cpp @@ -191,7 +191,7 @@ wyBool ImportFromSQL::OnError(const wyChar * errmsg) { wyString timeString; - + m_errno = m_tunnel->mysql_errno(m_mysql); m_error = m_tunnel->mysql_error(m_mysql); @@ -234,16 +234,40 @@ ImportFromSQL::MySQLConnect() //Session wait_timeout(to avoid of server gone away) m_tunnel->mysql_options(m_mysql, MYSQL_INIT_COMMAND, "/*!40101 set @@session.wait_timeout=28800 */"); + //If CA-cert is not provided then m_no_ca = TRUE + if (wnd->m_conninfo.m_cacert.Compare("") == 0) + { + wnd->m_conninfo.m_no_ca = wyTrue; + } + else + { + wnd->m_conninfo.m_no_ca = wyFalse; + } /// Set up source SSL if(wnd->m_conninfo.m_issslchecked == wyTrue) { - if(wnd->m_conninfo.m_issslauthchecked == wyTrue) + /*If we provide all Cert and Keys*/ + if(wnd->m_conninfo.m_issslauthchecked == wyTrue && wnd->m_conninfo.m_no_ca == wyFalse) { mysql_ssl_set(m_mysql, wnd->m_conninfo.m_clikey.GetString(), wnd->m_conninfo.m_clicert.GetString(), wnd->m_conninfo.m_cacert.GetString(), NULL, wnd->m_conninfo.m_cipher.GetLength() ? wnd->m_conninfo.m_cipher.GetString() : NULL); } - else + /*If we select Use Authentication and do not provide CA-cert, but we need to give Client-cert, and Client-key*/ + else if (wnd->m_conninfo.m_issslauthchecked == wyTrue && wnd->m_conninfo.m_no_ca == wyTrue) + { + mysql_ssl_set(m_mysql, wnd->m_conninfo.m_clikey.GetString(), wnd->m_conninfo.m_clicert.GetString(), + NULL, NULL, + wnd->m_conninfo.m_cipher.GetLength() ? wnd->m_conninfo.m_cipher.GetString() : NULL); + + } + /*If we don't select Use Authentication and do not provide CA-cert, Client-cert, and Client-key*/ + else if (wnd->m_conninfo.m_issslauthchecked == wyFalse && wnd->m_conninfo.m_no_ca == wyTrue) + { + mysql_ssl_set(m_mysql, NULL, NULL, NULL, + NULL, wnd->m_conninfo.m_cipher.GetLength() ? wnd->m_conninfo.m_cipher.GetString() : NULL); + } + else /*If we don't select Use Authentication and provide CA-cert*/ { mysql_ssl_set(m_mysql, NULL, NULL, wnd->m_conninfo.m_cacert.GetString(), NULL, wnd->m_conninfo.m_cipher.GetLength() ? wnd->m_conninfo.m_cipher.GetString() : NULL); @@ -364,8 +388,8 @@ ImportFromSQL::DoImport(wyBool * stopquery, wyBool isfkchkhttp) wyChar deli[12] = {0}; wyBool test; SQLTokenizer *tok; - - + + m_bytesread = 0; m_numquery = 0; @@ -389,7 +413,15 @@ ImportFromSQL::DoImport(wyBool * stopquery, wyBool isfkchkhttp) if(m_tunnel->IsTunnel() == wyFalse) continue; } - query.SetAs(str); + if (isdeli && strcmp(deli, ";;") == 0) + { + // we've problem in dealing with DELIMITER ;; + // replace it with DELIMITER || + query.SetAs("DELIMITER ||"); + strcpy_s(deli, sizeof(wyChar) * 3, "||"); + } + else + query.SetAs(str); test = ExecuteQuery(query, len, true, isfkchkhttp); if(!test && !m_abort_on_error)//checking if there is an error then setting the errorfree flag off. @@ -430,10 +462,13 @@ ImportFromSQL::DoImport(wyBool * stopquery, wyBool isfkchkhttp) MYSQL_RES *res; qret = HandleMySQLRealQuery(m_tunnel, m_mysql, NULL, 0, wyTrue, wyTrue, wyTrue); - + res = m_tunnel->mysql_store_result(m_mysql, wyTrue); + + auto e = m_tunnel->mysql_errno(m_mysql); /* we specifically ignore empty queries */ - if(res == NULL && m_mysql->affected_rows == -1 && m_tunnel->mysql_errno(m_mysql) != ER_EMPTY_QUERY) + + if(res == NULL && m_mysql->affected_rows == -1 && e != ER_EMPTY_QUERY) { delete tok; return OnError(_("Unable to get resultset")); diff --git a/src/MDIWindow.cpp b/src/MDIWindow.cpp index 902a310..b173e11 100644 --- a/src/MDIWindow.cpp +++ b/src/MDIWindow.cpp @@ -1926,15 +1926,40 @@ MDIWindow::StopQuery() #ifndef COMMUNITY + //If CA-cert is not provided then m_no_ca = TRUE + if (m_conninfo.m_cacert.Compare("") == 0) + { + m_conninfo.m_no_ca = wyTrue; + } + else + { + m_conninfo.m_no_ca = wyFalse; + } + if(m_conninfo.m_issslchecked == wyTrue) { - if(m_conninfo.m_issslauthchecked == wyTrue) + /*If we provide all Cert and Keys*/ + if(m_conninfo.m_issslauthchecked == wyTrue && m_conninfo.m_no_ca == wyFalse) { mysql_ssl_set(mysql, m_conninfo.m_clikey.GetString(), m_conninfo.m_clicert.GetString(), m_conninfo.m_cacert.GetString(), NULL, m_conninfo.m_cipher.GetLength() ? m_conninfo.m_cipher.GetString() : NULL); } - else + /*If we select Use Authentication and do not provide CA-cert, but we need to give Client-cert, and Client-key*/ + else if (m_conninfo.m_issslauthchecked == wyTrue && m_conninfo.m_no_ca == wyTrue) + { + mysql_ssl_set(mysql, m_conninfo.m_clikey.GetString(), m_conninfo.m_clicert.GetString(), + NULL, NULL, + m_conninfo.m_cipher.GetLength() ? m_conninfo.m_cipher.GetString() : NULL); + + } + /*If we don't select Use Authentication and do not provide CA-cert, Client-cert, and Client-key*/ + else if (m_conninfo.m_issslauthchecked == wyFalse && m_conninfo.m_no_ca == wyTrue) + { + mysql_ssl_set(mysql, NULL, NULL, NULL, + NULL, m_conninfo.m_cipher.GetLength() ? m_conninfo.m_cipher.GetString() : NULL); + } + else /*If we don't select Use Authentication and provide CA-cert*/ { mysql_ssl_set(mysql, NULL, NULL, m_conninfo.m_cacert.GetString(), NULL, m_conninfo.m_cipher.GetLength() ? m_conninfo.m_cipher.GetString() : NULL); diff --git a/src/MySQLVersionHelper.cpp b/src/MySQLVersionHelper.cpp index 60cf9dd..d05819e 100644 --- a/src/MySQLVersionHelper.cpp +++ b/src/MySQLVersionHelper.cpp @@ -79,21 +79,21 @@ wyInt32 GetVersionNo(Tunnel * tunnel, PMYSQL mysql) if(major) { majorver = atoi(major); - } - else - { - errorlog.Sprintf("GetVersionNo() major is NULL version = %s", ver.GetString()); - YOGLOG(0, errorlog.GetString()); + } + else + { + errorlog.Sprintf("GetVersionNo() major is NULL version = %s", ver.GetString()); + YOGLOG(0, errorlog.GetString()); } if(minor) { minorver = atoi(minor); - } - else - { - errorlog.Sprintf("GetVersionNo() minor is NULL version = %s", ver.GetString()); - YOGLOG(0, errorlog.GetString()); + } + else + { + errorlog.Sprintf("GetVersionNo() minor is NULL version = %s", ver.GetString()); + YOGLOG(0, errorlog.GetString()); } if(minorminor) @@ -295,6 +295,17 @@ IsMySQL80011(Tunnel * tunnel, PMYSQL mysql) else return wyFalse; } +/*For bug issue 2250*/ +wyBool +IsMySQL800(PMYSQL mysql) +{ + wyUInt32 me = mysql_get_server_version(*mysql);/* Only available from MySQLv8.0*/ + + if (me >= 80000) + return wyTrue; + else + return wyFalse; +} wyBool IsMariaDB100200(Tunnel * tunnel, PMYSQL mysql) diff --git a/src/ObjectInfo.cpp b/src/ObjectInfo.cpp index 91da4cf..557ef5c 100644 --- a/src/ObjectInfo.cpp +++ b/src/ObjectInfo.cpp @@ -20,6 +20,8 @@ #include "EditorFont.h" #include "Htmlrender.h" + + #define TABLEINFO_X 2 #define TABLEINFO_Y 30 #define TABLEINFO_HEIGHT_ADJ 33 @@ -2030,8 +2032,9 @@ ObjectInfo::AddObjectInfoHtmlFormat(MDIWindow *wnd, MYSQL_RES *myres, wyString * htmlbuffer->Add(title.GetString()); htmlbuffer->Add("
"); + /*Bug issue 2250 is solved at here*/ if(obj == OBJECT_TABLE && m_istostopcaption == wyFalse - && m_isoptimizationaborted == wyFalse && m_isschemaoptimized == wyFalse && m_istableanalyse == wyFalse) + && m_isoptimizationaborted == wyFalse && m_isschemaoptimized == wyFalse && m_istableanalyse == wyFalse && (IsMySQL800(&wnd->m_mysql) == wyFalse || IsMariaDB(wnd->m_tunnel,&wnd->m_mysql))) { htmlbuffer->AddSprintf("
"); @@ -2067,7 +2070,7 @@ ObjectInfo::AddObjectInfoHtmlFormat(MDIWindow *wnd, MYSQL_RES *myres, wyString * } #ifndef COMMUNITY - else if(obj == OBJECT_TABLE && m_istostopcaption == wyTrue) + else if(obj == OBJECT_TABLE && m_istostopcaption == wyTrue && (IsMySQL800(&wnd->m_mysql) == wyFalse && IsMariaDB(wnd->m_tunnel, &wnd->m_mysql)))/*Bug #2250 solved at here*/ { htmlbuffer->AddSprintf("
"); diff --git a/src/OtherDialogs.cpp b/src/OtherDialogs.cpp index 78de09f..52a9200 100644 --- a/src/OtherDialogs.cpp +++ b/src/OtherDialogs.cpp @@ -30,6 +30,7 @@ #include "DataType.h" #include "GUIHelper.h" #include "EditorFont.h" +#include "CCustomComboBox.h" #include @@ -3107,6 +3108,8 @@ TableDiag::InitializeCOMBOBOX() dbname.SetAs(db); VERIFY(ret = SendMessage(m_hwndcombo, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)dbname.GetAsWideChar())!= CB_ERR); + wyInt32 width = SetComboWidth(m_hwndcombo); + SendMessage(m_hwndcombo, CB_SETDROPPEDWIDTH, width + COMBOWIDTHMARGIN, 0); } // Now get the selected textbox from the main COMBOBOX. diff --git a/src/PreferenceBase.cpp b/src/PreferenceBase.cpp index 094f276..2b6c762 100644 --- a/src/PreferenceBase.cpp +++ b/src/PreferenceBase.cpp @@ -1244,18 +1244,23 @@ PreferenceBase::EnableBulkInsert(HWND hwnd, wyInt32 enable) EnableWindow(GetDlgItem(hwnd, IDC_BULKINSERT), TRUE); } -void +void PreferenceBase::GetGeneralPrefSizeValues(HWND hwnd) { - wyInt32 bulksize = 0; - wyWChar limit[32] = {0}; + wyInt32 bulksize = 0; + wyWChar limit[32] = { 0 }; wyString dirstr(m_directory); - - bulksize = wyIni::IniGetInt(GENERALPREFA, "RowLimit", ROW_LIMIT_DEFAULT, dirstr.GetString()); + int ret; + + bulksize = wyIni::IniGetInt(GENERALPREFA, "RowLimit", ROW_LIMIT_DEFAULT, dirstr.GetString()); + if (bulksize <= 0) + { + bulksize = 1000; + } _snwprintf(limit, 31, L"%d", bulksize); SetWindowText(GetDlgItem(hwnd, IDC_ROW_LIMIT), limit); - - bulksize = wyIni::IniGetInt(GENERALPREFA, "BulkSize", BULKINSERT_DEFAULT, dirstr.GetString()); + + bulksize = wyIni::IniGetInt(GENERALPREFA, "BulkSize", BULKINSERT_DEFAULT, dirstr.GetString()); _snwprintf(limit, 31, L"%d", bulksize); SetWindowText(GetDlgItem(hwnd, IDC_BULKINSERT), limit); } diff --git a/src/TableTabInterface.cpp b/src/TableTabInterface.cpp index 47cc1a4..a44cb68 100644 --- a/src/TableTabInterface.cpp +++ b/src/TableTabInterface.cpp @@ -27,6 +27,7 @@ #include "TabPreview.h" #include "DoubleBuffer.h" #include "TabCheck.h" +#include "CCustomComboBox.h" #define SIZE_24 24 #define SIZE_12 12 @@ -1826,7 +1827,10 @@ TableTabInterface::CreateOtherWindows() style | CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP | WS_GROUP, 0, 0, 0, 0, m_hwnd, (HMENU) IDC_DBNAME, (HINSTANCE)pGlobals->m_hinstance, NULL); - ShowWindow(m_hcmbdbname , SW_SHOW); + + + + ShowWindow(m_hcmbdbname , SW_SHOW); UpdateWindow(m_hcmbdbname); //...Creating Table-type Windows (Static & Combo) @@ -2356,9 +2360,12 @@ TableTabInterface::GetAllDatabases() if(pdbarr[ind]->GetLength()) { SendMessage(m_hcmbdbname, CB_ADDSTRING, 0, (LPARAM) pdbarr[ind]->GetAsWideChar()); - delete pdbarr[ind]; + delete pdbarr[ind]; } } + //Changed (Bug fixed) + wyInt32 width = SetComboWidth(m_hcmbdbname); + SendMessage(m_hcmbdbname, CB_SETDROPPEDWIDTH, width + COMBOWIDTHMARGIN, 0); free(pdbarr); } diff --git a/src/UserManager.cpp b/src/UserManager.cpp index 382e2c9..49d078e 100644 --- a/src/UserManager.cpp +++ b/src/UserManager.cpp @@ -25,6 +25,7 @@ Author: Vishal P.R #include "UserManager.h" #include "MySQLVersionHelper.h" #include "DoubleBuffer.h" +#include "CCustomComboBox.h" #define U_ACCESSDENIED _("SQLyog cannot retrieve what information is required to populate the User Manager dialog. \ Most likely the user does not have SELECT privilege to privileges tables in the `mysql` database. \ @@ -827,6 +828,27 @@ UserManager::SavePassword() m_authpluginname.SetAs(pluginname.GetString()); } } + else { + wyString queryString; + + if (m_ismariadb && m_serververno < 100200) { + queryString.SetAs("SET PASSWORD FOR '%s'@'%s' = PASSWORD('%s');"); + } + else{ + queryString.SetAs("ALTER USER '%s'@'%s' IDENTIFIED BY '%s';"); + } + + query.Sprintf(queryString.GetString(), + EscapeMySQLString(m_username.GetString(), tempuser).GetString(), + EscapeMySQLString(m_host.GetString(), temphost).GetString(), + EscapeMySQLString(password.GetString(), temppassword).GetString()); + + if (ExecuteUMQuery(query) == wyFalse) { + return wyFalse; + } + m_authpluginname.SetAs(pluginname.GetString()); + } + } // Mysql < 5.7 or MariaDb <10.4 else // no proper support for plugin changing...update password if has changed { @@ -1095,6 +1117,9 @@ UserManager::OnSaveChanges() //add the created user to the combo box and internaly call the CBN_CHANGE handler. user.Sprintf("%s@%s", m_username.GetString(), m_host.GetString()); m_selindex = SendMessage(hwndcombo, CB_ADDSTRING, 0, (LPARAM)user.GetAsWideChar()); + + + SendMessage(hwndcombo, CB_SETITEMDATA, (WPARAM)m_selindex, (LPARAM)m_username.GetLength()); SendMessage(hwndcombo, CB_SETCURSEL, (WPARAM)m_selindex, 0); @@ -1378,6 +1403,11 @@ UserManager::PopulateUserCombo() length = temp.GetLength(); temp.AddSprintf("@%s", row[0]); index = SendMessage(hwndusercombo, CB_ADDSTRING, 0, (LPARAM)temp.GetAsWideChar()); + + + wyInt32 width = SetComboWidth(hwndusercombo); + SendMessage(hwndusercombo, CB_SETDROPPEDWIDTH, width + COMBOWIDTHMARGIN, 0); + SendMessage(hwndusercombo, CB_SETITEMDATA, (WPARAM)index, (LPARAM)length); tempnode->m_uname.SetAs(temp.GetString()); tempnode->m_dropdown = wyTrue; @@ -1452,6 +1482,7 @@ UserManager::PopulateAuthPluginCombo() length = temp.GetLength(); index = SendMessage(hwndPlugincombo, CB_ADDSTRING, 0, (LPARAM)temp.GetAsWideChar()); + SendMessage(hwndPlugincombo, CB_SETITEMDATA, (WPARAM)index, (LPARAM)length); } @@ -1749,6 +1780,7 @@ UserManager::OnHandleEditChange() { index=SendMessage(hwndusercombo, CB_ADDSTRING, 0,(LPARAM)itr->m_uname.GetAsWideChar()); VERIFY(SendMessage(hwndusercombo, CB_SETITEMDATA, index,itr->m_itemvalue.GetAsInt32())); + itr->m_dropdown=wyTrue; } diff --git a/src/WinMain.cpp b/src/WinMain.cpp index 1fe756d..452f152 100644 --- a/src/WinMain.cpp +++ b/src/WinMain.cpp @@ -29,9 +29,9 @@ #include "GUIHelper.h" #include "MiniDump.h" -#ifndef COMMUNITY +/*#ifndef COMMUNITY #include"openssl\applink.c" -#endif +#endif*/ #ifndef VC6 #include