NamedServerFilter PCRE2 matching and refactoring

Change to modutil_extract_SQL(), add pcre2_data to filter session.
The pattern is now jit-compiled for maximum speed. Move general
pcre2 error printing to a function and macro. Add instance-level
statistics so the filter always prints diagnostic info. Add a mention
of PCRE2 to release notes.
This commit is contained in:
Esa Korhonen
2017-03-06 14:15:36 +02:00
parent 55f038bc1f
commit d7e48f93bb
4 changed files with 179 additions and 119 deletions

View File

@ -30,6 +30,13 @@ MXS_BEGIN_DECLS
#include <pcre2.h>
/**
* Print an error message explaining an error code.
* @param errorcode value returned by pcre2 functions
*/
#define MXS_PCRE2_PRINT_ERROR(errorcode)\
mxs_pcre2_print_error(errorcode, MXS_MODULE_NAME, __FILE__,__LINE__, __func__)
typedef enum
{
MXS_PCRE2_MATCH,
@ -41,5 +48,11 @@ mxs_pcre2_result_t mxs_pcre2_substitute(pcre2_code *re, const char *subject,
const char *replace, char** dest, size_t* size);
mxs_pcre2_result_t mxs_pcre2_simple_match(const char* pattern, const char* subject,
int options, int* error);
/**
* Print an error message explaining an error code. Best used through the macro
* MXS_PCRE2_PRINT_ERROR
*/
void mxs_pcre2_print_error(int errorcode, const char *module_name, const char *filename,
int line_num, const char* func_name);
MXS_END_DECLS