Add functionality for bypassing MySQL whitespace/comments
This functionality is needed both in the query classifier, where it was first created, and in the cache.
This commit is contained in:
@ -53,9 +53,29 @@ GWBUF* modutil_create_mysql_err_msg(int packet_number,
|
||||
int merrno,
|
||||
const char *statemsg,
|
||||
const char *msg);
|
||||
|
||||
int modutil_count_signal_packets(GWBUF*, int, int, int*);
|
||||
mxs_pcre2_result_t modutil_mysql_wildcard_match(const char* pattern, const char* string);
|
||||
|
||||
/**
|
||||
* Given a buffer containing a MySQL statement, this function will return
|
||||
* a pointer to the first character that is not whitespace. In this context,
|
||||
* comments are also counted as whitespace. For instance:
|
||||
*
|
||||
* "SELECT" => "SELECT"
|
||||
* " SELECT => "SELECT"
|
||||
* " / * A comment * / SELECT" => "SELECT"
|
||||
* "-- comment\nSELECT" => "SELECT"
|
||||
*
|
||||
* @param sql Pointer to buffer containing a MySQL statement
|
||||
* @param len Length of sql.
|
||||
*
|
||||
* @return The first non whitespace (including comments) character. If the
|
||||
* entire buffer is only whitespace, the returned pointer will point
|
||||
* to the character following the buffer (i.e. sql + len).
|
||||
*/
|
||||
char* modutil_MySQL_bypass_whitespace(char* sql, size_t len);
|
||||
|
||||
/** Character and token searching functions */
|
||||
char* strnchr_esc(char* ptr, char c, int len);
|
||||
char* strnchr_esc_mysql(char* ptr, char c, int len);
|
||||
|
Reference in New Issue
Block a user