summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2019-12-20 15:51:25 +0100
committerSergei Golubchik <serg@mariadb.org>2019-12-21 10:42:12 +0100
commit83b0468c4704ac48ee1ac198264318b878ef6afd (patch)
tree32f54b624591bca4b54a358b2857f6b6ffea8913
parent67f928d8c243c57f11ddfc8cd4217d5e55fb2c5f (diff)
downloadmariadb-git-83b0468c4704ac48ee1ac198264318b878ef6afd.tar.gz
dependencies for VS
item_cmpfunc.h includes pcre2.h, so with the bundled pcre2 it has to be built before anything that includes pcre2.h . And item_cmpfunc.h is indirectly included everywhere, also in many plugins. Somehow Ninja and Makefiles generators can still deduce the correct build dependencies, but Visual Studio generator cannot. Two changes: * move pcre2.h from item_cmpfunc.h to item_cmpfunc.cc * create an explicit dependency on pcre2 for the server
-rw-r--r--sql/CMakeLists.txt4
-rw-r--r--sql/item_cmpfunc.cc24
-rw-r--r--sql/item_cmpfunc.h28
-rw-r--r--sql/sys_vars.cc3
4 files changed, 36 insertions, 23 deletions
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index 98df1988176..e3e2fba8c78 100644
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -198,6 +198,10 @@ TARGET_LINK_LIBRARIES(sql
${SSL_LIBRARIES}
${LIBSYSTEMD})
+IF(TARGET pcre2)
+ ADD_DEPENDENCIES(sql pcre2)
+ENDIF()
+
FOREACH(se aria partition perfschema sql_sequence wsrep)
# These engines are used directly in sql sources.
IF(TARGET ${se})
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 2e892fb36e8..b6acbee37f9 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -33,6 +33,8 @@
#include "sql_parse.h" // check_stack_overrun
#include "sql_base.h" // dynamic_column_error_message
+#define PCRE2_STATIC 1 /* Important on Windows */
+#include "pcre2.h" /* pcre2 header file */
/*
Compare row signature of two expressions
@@ -5827,6 +5829,28 @@ int Regexp_processor_pcre::default_regex_flags()
return default_regex_flags_pcre(current_thd);
}
+void Regexp_processor_pcre::cleanup()
+{
+ pcre2_match_data_free(m_pcre_match_data);
+ pcre2_code_free(m_pcre);
+ reset();
+}
+
+void Regexp_processor_pcre::init(CHARSET_INFO *data_charset, int extra_flags)
+{
+ m_library_flags= default_regex_flags() | extra_flags |
+ (data_charset != &my_charset_bin ?
+ (PCRE2_UTF | PCRE2_UCP) : 0) |
+ ((data_charset->state &
+ (MY_CS_BINSORT | MY_CS_CSSORT)) ? 0 : PCRE2_CASELESS);
+
+ // Convert text data to utf-8.
+ m_library_charset= data_charset == &my_charset_bin ?
+ &my_charset_bin : &my_charset_utf8mb3_general_ci;
+
+ m_conversion_is_needed= (data_charset != &my_charset_bin) &&
+ !my_charset_same(data_charset, m_library_charset);
+}
/**
Convert string to lib_charset, if needed.
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index c6ce2f1792a..b2938ee509c 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -24,8 +24,6 @@
#endif
#include "item_func.h" /* Item_int_func, Item_bool_func */
-#define PCRE2_STATIC 1 /* Important on Windows */
-#include "pcre2.h" /* pcre2 header file */
#include "item.h"
extern Item_result item_cmp_type(Item_result a,Item_result b);
@@ -2802,6 +2800,9 @@ public:
};
+typedef struct pcre2_real_code_8 pcre2_code;
+typedef struct pcre2_real_match_data_8 pcre2_match_data;
+#define PCRE2_SIZE size_t
class Regexp_processor_pcre
{
pcre2_code *m_pcre;
@@ -2830,21 +2831,7 @@ public:
m_library_charset(&my_charset_utf8mb3_general_ci)
{}
int default_regex_flags();
- void init(CHARSET_INFO *data_charset, int extra_flags)
- {
- m_library_flags= default_regex_flags() | extra_flags |
- (data_charset != &my_charset_bin ?
- (PCRE2_UTF | PCRE2_UCP) : 0) |
- ((data_charset->state &
- (MY_CS_BINSORT | MY_CS_CSSORT)) ? 0 : PCRE2_CASELESS);
-
- // Convert text data to utf-8.
- m_library_charset= data_charset == &my_charset_bin ?
- &my_charset_bin : &my_charset_utf8mb3_general_ci;
-
- m_conversion_is_needed= (data_charset != &my_charset_bin) &&
- !my_charset_same(data_charset, m_library_charset);
- }
+ void init(CHARSET_INFO *data_charset, int extra_flags);
void fix_owner(Item_func *owner, Item *subject_arg, Item *pattern_arg);
bool compile(String *pattern, bool send_error);
bool compile(Item *item, bool send_error);
@@ -2875,12 +2862,7 @@ public:
m_pcre_match_data= NULL;
m_prev_pattern.length(0);
}
- void cleanup()
- {
- pcre2_match_data_free(m_pcre_match_data);
- pcre2_code_free(m_pcre);
- reset();
- }
+ void cleanup();
bool is_compiled() const { return m_pcre != NULL; }
bool is_const() const { return m_is_const; }
void set_const(bool arg) { m_is_const= arg; }
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index f5b915ec916..3441a1ae4b1 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -67,6 +67,9 @@
#include "semisync_slave.h"
#include <ssl_compat.h>
+#define PCRE2_STATIC 1 /* Important on Windows */
+#include "pcre2.h" /* pcre2 header file */
+
/*
The rule for this file: everything should be 'static'. When a sys_var
variable or a function from this file is - in very rare cases - needed