-
Notifications
You must be signed in to change notification settings - Fork 1k
/
Copy pathc_tokenizer.h
58 lines (49 loc) · 1.83 KB
/
c_tokenizer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#pragma once
#ifndef C_TOKENIZER_H
#define C_TOKENIZER_H
#define PROXYSQL_TOKENIZER_BUFFSIZE 128
#ifndef FIRST_COMMENT_MAX_LENGTH
#define FIRST_COMMENT_MAX_LENGTH 1024
#endif /* FIRST_COMMENT_MAX_LENGTH */
typedef struct
{
char buffer[PROXYSQL_TOKENIZER_BUFFSIZE];
int s_length;
char* s;
const char* delimiters;
char* current;
char* next;
int is_ignore_empties;
}
tokenizer_t;
enum { TOKENIZER_EMPTIES_OK, TOKENIZER_NO_EMPTIES };
/**
* @brief Struct for holding all the configuration options used for query digests generation.
*/
typedef struct _options {
bool lowercase;
bool replace_null;
bool replace_number;
bool keep_comment;
int grouping_limit;
int groups_grouping_limit;
int max_query_length;
} options;
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
//tokenizer_t tokenizer( const char* s, const char* delimiters, int empties );
void tokenizer( tokenizer_t *, const char* s, const char* delimiters, int empties );
const char* free_tokenizer( tokenizer_t* tokenizer );
const char* tokenize( tokenizer_t* tokenizer );
char * mysql_query_digest_first_stage(const char* const q, int q_len, char** const fst_cmnt, char* const buf);
char * mysql_query_digest_second_stage(const char* const q, int q_len, char** const fst_cmnt, char* const buf);
char * mysql_query_digest_and_first_comment_2(const char* const q, int q_len, char** const fst_cmnt, char* const buf);
char * mysql_query_digest_and_first_comment_one_it(char *s , int len , char **first_comment, char *buf);
void c_split_2(const char *in, const char *del, char **out1, char **out2);
char * query_strip_comments(char* s, int len, bool lowercase);
char * query_digest_and_first_comment_2(const char* const q, int q_len, char** const fst_cmnt, char* const buf, const options* opts);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif