Commit 83b0468c authored by Sergei Golubchik's avatar Sergei Golubchik

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
parent 67f928d8
......@@ -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})
......
......@@ -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.
......
......@@ -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 @@ class Item_func_like :public Item_bool_func2
};
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 @@ class Regexp_processor_pcre
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 @@ class Regexp_processor_pcre
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; }
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment