mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge backport of WL#3771 with mysql-next-mr.
This commit is contained in:
@ -66,8 +66,9 @@ typedef struct st_mysql_xid MYSQL_XID;
|
||||
#define MYSQL_FTPARSER_PLUGIN 2 /* Full-text parser plugin */
|
||||
#define MYSQL_DAEMON_PLUGIN 3 /* The daemon/raw plugin type */
|
||||
#define MYSQL_INFORMATION_SCHEMA_PLUGIN 4 /* The I_S plugin type */
|
||||
#define MYSQL_REPLICATION_PLUGIN 5 /* The replication plugin type */
|
||||
#define MYSQL_MAX_PLUGIN_TYPE_NUM 6 /* The number of plugin types */
|
||||
#define MYSQL_AUDIT_PLUGIN 5 /* The Audit plugin type */
|
||||
#define MYSQL_REPLICATION_PLUGIN 6 /* The replication plugin type */
|
||||
#define MYSQL_MAX_PLUGIN_TYPE_NUM 7 /* The number of plugin types */
|
||||
|
||||
/* We use the following strings to define licenses for plugins */
|
||||
#define PLUGIN_LICENSE_PROPRIETARY 0
|
||||
@ -403,191 +404,7 @@ struct st_mysql_plugin
|
||||
/*************************************************************************
|
||||
API for Full-text parser plugin. (MYSQL_FTPARSER_PLUGIN)
|
||||
*/
|
||||
|
||||
#define MYSQL_FTPARSER_INTERFACE_VERSION 0x0100
|
||||
|
||||
/* Parsing modes. Set in MYSQL_FTPARSER_PARAM::mode */
|
||||
enum enum_ftparser_mode
|
||||
{
|
||||
/*
|
||||
Fast and simple mode. This mode is used for indexing, and natural
|
||||
language queries.
|
||||
|
||||
The parser is expected to return only those words that go into the
|
||||
index. Stopwords or too short/long words should not be returned. The
|
||||
'boolean_info' argument of mysql_add_word() does not have to be set.
|
||||
*/
|
||||
MYSQL_FTPARSER_SIMPLE_MODE= 0,
|
||||
|
||||
/*
|
||||
Parse with stopwords mode. This mode is used in boolean searches for
|
||||
"phrase matching."
|
||||
|
||||
The parser is not allowed to ignore words in this mode. Every word
|
||||
should be returned, including stopwords and words that are too short
|
||||
or long. The 'boolean_info' argument of mysql_add_word() does not
|
||||
have to be set.
|
||||
*/
|
||||
MYSQL_FTPARSER_WITH_STOPWORDS= 1,
|
||||
|
||||
/*
|
||||
Parse in boolean mode. This mode is used to parse a boolean query string.
|
||||
|
||||
The parser should provide a valid MYSQL_FTPARSER_BOOLEAN_INFO
|
||||
structure in the 'boolean_info' argument to mysql_add_word().
|
||||
Usually that means that the parser should recognize boolean operators
|
||||
in the parsing stream and set appropriate fields in
|
||||
MYSQL_FTPARSER_BOOLEAN_INFO structure accordingly. As for
|
||||
MYSQL_FTPARSER_WITH_STOPWORDS mode, no word should be ignored.
|
||||
Instead, use FT_TOKEN_STOPWORD for the token type of such a word.
|
||||
*/
|
||||
MYSQL_FTPARSER_FULL_BOOLEAN_INFO= 2
|
||||
};
|
||||
|
||||
/*
|
||||
Token types for boolean mode searching (used for the type member of
|
||||
MYSQL_FTPARSER_BOOLEAN_INFO struct)
|
||||
|
||||
FT_TOKEN_EOF: End of data.
|
||||
FT_TOKEN_WORD: Regular word.
|
||||
FT_TOKEN_LEFT_PAREN: Left parenthesis (start of group/sub-expression).
|
||||
FT_TOKEN_RIGHT_PAREN: Right parenthesis (end of group/sub-expression).
|
||||
FT_TOKEN_STOPWORD: Stopword.
|
||||
*/
|
||||
|
||||
enum enum_ft_token_type
|
||||
{
|
||||
FT_TOKEN_EOF= 0,
|
||||
FT_TOKEN_WORD= 1,
|
||||
FT_TOKEN_LEFT_PAREN= 2,
|
||||
FT_TOKEN_RIGHT_PAREN= 3,
|
||||
FT_TOKEN_STOPWORD= 4
|
||||
};
|
||||
|
||||
/*
|
||||
This structure is used in boolean search mode only. It conveys
|
||||
boolean-mode metadata to the MySQL search engine for every word in
|
||||
the search query. A valid instance of this structure must be filled
|
||||
in by the plugin parser and passed as an argument in the call to
|
||||
mysql_add_word (the callback function in the MYSQL_FTPARSER_PARAM
|
||||
structure) when a query is parsed in boolean mode.
|
||||
|
||||
type: The token type. Should be one of the enum_ft_token_type values.
|
||||
|
||||
yesno: Whether the word must be present for a match to occur:
|
||||
>0 Must be present
|
||||
<0 Must not be present
|
||||
0 Neither; the word is optional but its presence increases the relevance
|
||||
With the default settings of the ft_boolean_syntax system variable,
|
||||
>0 corresponds to the '+' operator, <0 corrresponds to the '-' operator,
|
||||
and 0 means neither operator was used.
|
||||
|
||||
weight_adjust: A weighting factor that determines how much a match
|
||||
for the word counts. Positive values increase, negative - decrease the
|
||||
relative word's importance in the query.
|
||||
|
||||
wasign: The sign of the word's weight in the query. If it's non-negative
|
||||
the match for the word will increase document relevance, if it's
|
||||
negative - decrease (the word becomes a "noise word", the less of it the
|
||||
better).
|
||||
|
||||
trunc: Corresponds to the '*' operator in the default setting of the
|
||||
ft_boolean_syntax system variable.
|
||||
*/
|
||||
|
||||
typedef struct st_mysql_ftparser_boolean_info
|
||||
{
|
||||
enum enum_ft_token_type type;
|
||||
int yesno;
|
||||
int weight_adjust;
|
||||
char wasign;
|
||||
char trunc;
|
||||
/* These are parser state and must be removed. */
|
||||
char prev;
|
||||
char *quot;
|
||||
} MYSQL_FTPARSER_BOOLEAN_INFO;
|
||||
|
||||
/*
|
||||
The following flag means that buffer with a string (document, word)
|
||||
may be overwritten by the caller before the end of the parsing (that is
|
||||
before st_mysql_ftparser::deinit() call). If one needs the string
|
||||
to survive between two successive calls of the parsing function, she
|
||||
needs to save a copy of it. The flag may be set by MySQL before calling
|
||||
st_mysql_ftparser::parse(), or it may be set by a plugin before calling
|
||||
st_mysql_ftparser_param::mysql_parse() or
|
||||
st_mysql_ftparser_param::mysql_add_word().
|
||||
*/
|
||||
#define MYSQL_FTFLAGS_NEED_COPY 1
|
||||
|
||||
/*
|
||||
An argument of the full-text parser plugin. This structure is
|
||||
filled in by MySQL server and passed to the parsing function of the
|
||||
plugin as an in/out parameter.
|
||||
|
||||
mysql_parse: A pointer to the built-in parser implementation of the
|
||||
server. It's set by the server and can be used by the parser plugin
|
||||
to invoke the MySQL default parser. If plugin's role is to extract
|
||||
textual data from .doc, .pdf or .xml content, it might extract
|
||||
plaintext from the content, and then pass the text to the default
|
||||
MySQL parser to be parsed.
|
||||
|
||||
mysql_add_word: A server callback to add a new word. When parsing
|
||||
a document, the server sets this to point at a function that adds
|
||||
the word to MySQL full-text index. When parsing a search query,
|
||||
this function will add the new word to the list of words to search
|
||||
for. The boolean_info argument can be NULL for all cases except
|
||||
when mode is MYSQL_FTPARSER_FULL_BOOLEAN_INFO.
|
||||
|
||||
ftparser_state: A generic pointer. The plugin can set it to point
|
||||
to information to be used internally for its own purposes.
|
||||
|
||||
mysql_ftparam: This is set by the server. It is used by MySQL functions
|
||||
called via mysql_parse() and mysql_add_word() callback. The plugin
|
||||
should not modify it.
|
||||
|
||||
cs: Information about the character set of the document or query string.
|
||||
|
||||
doc: A pointer to the document or query string to be parsed.
|
||||
|
||||
length: Length of the document or query string, in bytes.
|
||||
|
||||
flags: See MYSQL_FTFLAGS_* constants above.
|
||||
|
||||
mode: The parsing mode. With boolean operators, with stopwords, or
|
||||
nothing. See enum_ftparser_mode above.
|
||||
*/
|
||||
|
||||
typedef struct st_mysql_ftparser_param
|
||||
{
|
||||
int (*mysql_parse)(struct st_mysql_ftparser_param *,
|
||||
char *doc, int doc_len);
|
||||
int (*mysql_add_word)(struct st_mysql_ftparser_param *,
|
||||
char *word, int word_len,
|
||||
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info);
|
||||
void *ftparser_state;
|
||||
void *mysql_ftparam;
|
||||
struct charset_info_st *cs;
|
||||
char *doc;
|
||||
int length;
|
||||
int flags;
|
||||
enum enum_ftparser_mode mode;
|
||||
} MYSQL_FTPARSER_PARAM;
|
||||
|
||||
/*
|
||||
Full-text parser descriptor.
|
||||
|
||||
interface_version is, e.g., MYSQL_FTPARSER_INTERFACE_VERSION.
|
||||
The parsing, initialization, and deinitialization functions are
|
||||
invoked per SQL statement for which the parser is used.
|
||||
*/
|
||||
|
||||
struct st_mysql_ftparser
|
||||
{
|
||||
int interface_version;
|
||||
int (*parse)(MYSQL_FTPARSER_PARAM *param);
|
||||
int (*init)(MYSQL_FTPARSER_PARAM *param);
|
||||
int (*deinit)(MYSQL_FTPARSER_PARAM *param);
|
||||
};
|
||||
#include "plugin_ftparser.h"
|
||||
|
||||
/*************************************************************************
|
||||
API for Storage Engine plugin. (MYSQL_DAEMON_PLUGIN)
|
||||
@ -596,6 +413,17 @@ struct st_mysql_ftparser
|
||||
/* handlertons of different MySQL releases are incompatible */
|
||||
#define MYSQL_DAEMON_INTERFACE_VERSION (MYSQL_VERSION_ID << 8)
|
||||
|
||||
/*
|
||||
Here we define only the descriptor structure, that is referred from
|
||||
st_mysql_plugin.
|
||||
*/
|
||||
|
||||
struct st_mysql_daemon
|
||||
{
|
||||
int interface_version;
|
||||
};
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
API for I_S plugin. (MYSQL_INFORMATION_SCHEMA_PLUGIN)
|
||||
*/
|
||||
@ -603,6 +431,17 @@ struct st_mysql_ftparser
|
||||
/* handlertons of different MySQL releases are incompatible */
|
||||
#define MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION (MYSQL_VERSION_ID << 8)
|
||||
|
||||
/*
|
||||
Here we define only the descriptor structure, that is referred from
|
||||
st_mysql_plugin.
|
||||
*/
|
||||
|
||||
struct st_mysql_information_schema
|
||||
{
|
||||
int interface_version;
|
||||
};
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
API for Storage Engine plugin. (MYSQL_STORAGE_ENGINE_PLUGIN)
|
||||
*/
|
||||
@ -623,25 +462,6 @@ struct st_mysql_storage_engine
|
||||
|
||||
struct handlerton;
|
||||
|
||||
/*
|
||||
Here we define only the descriptor structure, that is referred from
|
||||
st_mysql_plugin.
|
||||
*/
|
||||
|
||||
struct st_mysql_daemon
|
||||
{
|
||||
int interface_version;
|
||||
};
|
||||
|
||||
/*
|
||||
Here we define only the descriptor structure, that is referred from
|
||||
st_mysql_plugin.
|
||||
*/
|
||||
|
||||
struct st_mysql_information_schema
|
||||
{
|
||||
int interface_version;
|
||||
};
|
||||
|
||||
/*
|
||||
API for Replication plugin. (MYSQL_REPLICATION_PLUGIN)
|
||||
@ -655,7 +475,7 @@ struct st_mysql_information_schema
|
||||
int interface_version;
|
||||
};
|
||||
|
||||
/*
|
||||
/*************************************************************************
|
||||
st_mysql_value struct for reading values from mysqld.
|
||||
Used by server variables framework to parse user-provided values.
|
||||
Will be used for arguments when implementing UDFs.
|
||||
|
@ -76,6 +76,8 @@ struct st_mysql_plugin
|
||||
struct st_mysql_sys_var **system_vars;
|
||||
void * __reserved1;
|
||||
};
|
||||
#include "plugin_ftparser.h"
|
||||
#include "plugin.h"
|
||||
enum enum_ftparser_mode
|
||||
{
|
||||
MYSQL_FTPARSER_SIMPLE_MODE= 0,
|
||||
@ -122,11 +124,6 @@ struct st_mysql_ftparser
|
||||
int (*init)(MYSQL_FTPARSER_PARAM *param);
|
||||
int (*deinit)(MYSQL_FTPARSER_PARAM *param);
|
||||
};
|
||||
struct st_mysql_storage_engine
|
||||
{
|
||||
int interface_version;
|
||||
};
|
||||
struct handlerton;
|
||||
struct st_mysql_daemon
|
||||
{
|
||||
int interface_version;
|
||||
@ -135,6 +132,11 @@ struct st_mysql_information_schema
|
||||
{
|
||||
int interface_version;
|
||||
};
|
||||
struct st_mysql_storage_engine
|
||||
{
|
||||
int interface_version;
|
||||
};
|
||||
struct handlerton;
|
||||
struct Mysql_replication {
|
||||
int interface_version;
|
||||
};
|
||||
|
97
include/mysql/plugin_audit.h
Normal file
97
include/mysql/plugin_audit.h
Normal file
@ -0,0 +1,97 @@
|
||||
/* Copyright (C) 2007 MySQL AB
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#ifndef _my_audit_h
|
||||
#define _my_audit_h
|
||||
|
||||
/*************************************************************************
|
||||
API for Audit plugin. (MYSQL_AUDIT_PLUGIN)
|
||||
*/
|
||||
|
||||
#include "plugin.h"
|
||||
|
||||
#define MYSQL_AUDIT_CLASS_MASK_SIZE 1
|
||||
|
||||
#define MYSQL_AUDIT_INTERFACE_VERSION 0x0100
|
||||
|
||||
/*
|
||||
The first word in every event class struct indicates the specific
|
||||
class of the event.
|
||||
*/
|
||||
struct mysql_event
|
||||
{
|
||||
int event_class;
|
||||
};
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
AUDIT CLASS : GENERAL
|
||||
|
||||
LOG events occurs before emitting to the general query log.
|
||||
ERROR events occur before transmitting errors to the user.
|
||||
RESULT events occur after transmitting a resultset to the user.
|
||||
*/
|
||||
|
||||
#define MYSQL_AUDIT_GENERAL_CLASS 0
|
||||
#define MYSQL_AUDIT_GENERAL_CLASSMASK (1 << MYSQL_AUDIT_GENERAL_CLASS)
|
||||
#define MYSQL_AUDIT_GENERAL_LOG 0
|
||||
#define MYSQL_AUDIT_GENERAL_ERROR 1
|
||||
#define MYSQL_AUDIT_GENERAL_RESULT 2
|
||||
|
||||
struct mysql_event_general
|
||||
{
|
||||
int event_class;
|
||||
int general_error_code;
|
||||
unsigned long general_thread_id;
|
||||
const char *general_user;
|
||||
unsigned int general_user_length;
|
||||
const char *general_command;
|
||||
unsigned int general_command_length;
|
||||
const char *general_query;
|
||||
unsigned int general_query_length;
|
||||
struct charset_info_st *general_charset;
|
||||
unsigned long long general_time;
|
||||
unsigned long long general_rows;
|
||||
};
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
Here we define the descriptor structure, that is referred from
|
||||
st_mysql_plugin.
|
||||
|
||||
release_thd() event occurs when the event class consumer is to be
|
||||
disassociated from the specified THD. This would typically occur
|
||||
before some operation which may require sleeping - such as when
|
||||
waiting for the next query from the client.
|
||||
|
||||
event_notify() is invoked whenever an event occurs which is of any
|
||||
class for which the plugin has interest. The first word of the
|
||||
mysql_event argument indicates the specific event class and the
|
||||
remainder of the structure is as required for that class.
|
||||
|
||||
class_mask is an array of bits used to indicate what event classes
|
||||
that this plugin wants to receive.
|
||||
*/
|
||||
|
||||
struct st_mysql_audit
|
||||
{
|
||||
int interface_version;
|
||||
void (*release_thd)(MYSQL_THD);
|
||||
void (*event_notify)(MYSQL_THD, const struct mysql_event *);
|
||||
unsigned long class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE];
|
||||
};
|
||||
|
||||
|
||||
#endif
|
211
include/mysql/plugin_ftparser.h
Normal file
211
include/mysql/plugin_ftparser.h
Normal file
@ -0,0 +1,211 @@
|
||||
/* Copyright (C) 2005 MySQL AB
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#ifndef _my_plugin_ftparser_h
|
||||
#define _my_plugin_ftparser_h
|
||||
#include "plugin.h"
|
||||
|
||||
/*************************************************************************
|
||||
API for Full-text parser plugin. (MYSQL_FTPARSER_PLUGIN)
|
||||
*/
|
||||
|
||||
#define MYSQL_FTPARSER_INTERFACE_VERSION 0x0100
|
||||
|
||||
/* Parsing modes. Set in MYSQL_FTPARSER_PARAM::mode */
|
||||
enum enum_ftparser_mode
|
||||
{
|
||||
/*
|
||||
Fast and simple mode. This mode is used for indexing, and natural
|
||||
language queries.
|
||||
|
||||
The parser is expected to return only those words that go into the
|
||||
index. Stopwords or too short/long words should not be returned. The
|
||||
'boolean_info' argument of mysql_add_word() does not have to be set.
|
||||
*/
|
||||
MYSQL_FTPARSER_SIMPLE_MODE= 0,
|
||||
|
||||
/*
|
||||
Parse with stopwords mode. This mode is used in boolean searches for
|
||||
"phrase matching."
|
||||
|
||||
The parser is not allowed to ignore words in this mode. Every word
|
||||
should be returned, including stopwords and words that are too short
|
||||
or long. The 'boolean_info' argument of mysql_add_word() does not
|
||||
have to be set.
|
||||
*/
|
||||
MYSQL_FTPARSER_WITH_STOPWORDS= 1,
|
||||
|
||||
/*
|
||||
Parse in boolean mode. This mode is used to parse a boolean query string.
|
||||
|
||||
The parser should provide a valid MYSQL_FTPARSER_BOOLEAN_INFO
|
||||
structure in the 'boolean_info' argument to mysql_add_word().
|
||||
Usually that means that the parser should recognize boolean operators
|
||||
in the parsing stream and set appropriate fields in
|
||||
MYSQL_FTPARSER_BOOLEAN_INFO structure accordingly. As for
|
||||
MYSQL_FTPARSER_WITH_STOPWORDS mode, no word should be ignored.
|
||||
Instead, use FT_TOKEN_STOPWORD for the token type of such a word.
|
||||
*/
|
||||
MYSQL_FTPARSER_FULL_BOOLEAN_INFO= 2
|
||||
};
|
||||
|
||||
/*
|
||||
Token types for boolean mode searching (used for the type member of
|
||||
MYSQL_FTPARSER_BOOLEAN_INFO struct)
|
||||
|
||||
FT_TOKEN_EOF: End of data.
|
||||
FT_TOKEN_WORD: Regular word.
|
||||
FT_TOKEN_LEFT_PAREN: Left parenthesis (start of group/sub-expression).
|
||||
FT_TOKEN_RIGHT_PAREN: Right parenthesis (end of group/sub-expression).
|
||||
FT_TOKEN_STOPWORD: Stopword.
|
||||
*/
|
||||
|
||||
enum enum_ft_token_type
|
||||
{
|
||||
FT_TOKEN_EOF= 0,
|
||||
FT_TOKEN_WORD= 1,
|
||||
FT_TOKEN_LEFT_PAREN= 2,
|
||||
FT_TOKEN_RIGHT_PAREN= 3,
|
||||
FT_TOKEN_STOPWORD= 4
|
||||
};
|
||||
|
||||
/*
|
||||
This structure is used in boolean search mode only. It conveys
|
||||
boolean-mode metadata to the MySQL search engine for every word in
|
||||
the search query. A valid instance of this structure must be filled
|
||||
in by the plugin parser and passed as an argument in the call to
|
||||
mysql_add_word (the callback function in the MYSQL_FTPARSER_PARAM
|
||||
structure) when a query is parsed in boolean mode.
|
||||
|
||||
type: The token type. Should be one of the enum_ft_token_type values.
|
||||
|
||||
yesno: Whether the word must be present for a match to occur:
|
||||
>0 Must be present
|
||||
<0 Must not be present
|
||||
0 Neither; the word is optional but its presence increases the relevance
|
||||
With the default settings of the ft_boolean_syntax system variable,
|
||||
>0 corresponds to the '+' operator, <0 corrresponds to the '-' operator,
|
||||
and 0 means neither operator was used.
|
||||
|
||||
weight_adjust: A weighting factor that determines how much a match
|
||||
for the word counts. Positive values increase, negative - decrease the
|
||||
relative word's importance in the query.
|
||||
|
||||
wasign: The sign of the word's weight in the query. If it's non-negative
|
||||
the match for the word will increase document relevance, if it's
|
||||
negative - decrease (the word becomes a "noise word", the less of it the
|
||||
better).
|
||||
|
||||
trunc: Corresponds to the '*' operator in the default setting of the
|
||||
ft_boolean_syntax system variable.
|
||||
*/
|
||||
|
||||
typedef struct st_mysql_ftparser_boolean_info
|
||||
{
|
||||
enum enum_ft_token_type type;
|
||||
int yesno;
|
||||
int weight_adjust;
|
||||
char wasign;
|
||||
char trunc;
|
||||
/* These are parser state and must be removed. */
|
||||
char prev;
|
||||
char *quot;
|
||||
} MYSQL_FTPARSER_BOOLEAN_INFO;
|
||||
|
||||
/*
|
||||
The following flag means that buffer with a string (document, word)
|
||||
may be overwritten by the caller before the end of the parsing (that is
|
||||
before st_mysql_ftparser::deinit() call). If one needs the string
|
||||
to survive between two successive calls of the parsing function, she
|
||||
needs to save a copy of it. The flag may be set by MySQL before calling
|
||||
st_mysql_ftparser::parse(), or it may be set by a plugin before calling
|
||||
st_mysql_ftparser_param::mysql_parse() or
|
||||
st_mysql_ftparser_param::mysql_add_word().
|
||||
*/
|
||||
#define MYSQL_FTFLAGS_NEED_COPY 1
|
||||
|
||||
/*
|
||||
An argument of the full-text parser plugin. This structure is
|
||||
filled in by MySQL server and passed to the parsing function of the
|
||||
plugin as an in/out parameter.
|
||||
|
||||
mysql_parse: A pointer to the built-in parser implementation of the
|
||||
server. It's set by the server and can be used by the parser plugin
|
||||
to invoke the MySQL default parser. If plugin's role is to extract
|
||||
textual data from .doc, .pdf or .xml content, it might extract
|
||||
plaintext from the content, and then pass the text to the default
|
||||
MySQL parser to be parsed.
|
||||
|
||||
mysql_add_word: A server callback to add a new word. When parsing
|
||||
a document, the server sets this to point at a function that adds
|
||||
the word to MySQL full-text index. When parsing a search query,
|
||||
this function will add the new word to the list of words to search
|
||||
for. The boolean_info argument can be NULL for all cases except
|
||||
when mode is MYSQL_FTPARSER_FULL_BOOLEAN_INFO.
|
||||
|
||||
ftparser_state: A generic pointer. The plugin can set it to point
|
||||
to information to be used internally for its own purposes.
|
||||
|
||||
mysql_ftparam: This is set by the server. It is used by MySQL functions
|
||||
called via mysql_parse() and mysql_add_word() callback. The plugin
|
||||
should not modify it.
|
||||
|
||||
cs: Information about the character set of the document or query string.
|
||||
|
||||
doc: A pointer to the document or query string to be parsed.
|
||||
|
||||
length: Length of the document or query string, in bytes.
|
||||
|
||||
flags: See MYSQL_FTFLAGS_* constants above.
|
||||
|
||||
mode: The parsing mode. With boolean operators, with stopwords, or
|
||||
nothing. See enum_ftparser_mode above.
|
||||
*/
|
||||
|
||||
typedef struct st_mysql_ftparser_param
|
||||
{
|
||||
int (*mysql_parse)(struct st_mysql_ftparser_param *,
|
||||
char *doc, int doc_len);
|
||||
int (*mysql_add_word)(struct st_mysql_ftparser_param *,
|
||||
char *word, int word_len,
|
||||
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info);
|
||||
void *ftparser_state;
|
||||
void *mysql_ftparam;
|
||||
struct charset_info_st *cs;
|
||||
char *doc;
|
||||
int length;
|
||||
int flags;
|
||||
enum enum_ftparser_mode mode;
|
||||
} MYSQL_FTPARSER_PARAM;
|
||||
|
||||
/*
|
||||
Full-text parser descriptor.
|
||||
|
||||
interface_version is, e.g., MYSQL_FTPARSER_INTERFACE_VERSION.
|
||||
The parsing, initialization, and deinitialization functions are
|
||||
invoked per SQL statement for which the parser is used.
|
||||
*/
|
||||
|
||||
struct st_mysql_ftparser
|
||||
{
|
||||
int interface_version;
|
||||
int (*parse)(MYSQL_FTPARSER_PARAM *param);
|
||||
int (*init)(MYSQL_FTPARSER_PARAM *param);
|
||||
int (*deinit)(MYSQL_FTPARSER_PARAM *param);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user