Move quote triming function to common place

Function for removing MySQL quote characters surrounding a
string moved from Cache's rules.cc to common place and renamed.

The function was now moved to mysql_utils.[h|c], which is in
maxscale-common, and not to the perhaps more appropriate place
protocol/mysql.h, as the latter would have implied that MySQLCommon
would have to be linked to, which actually might be the right thing
to do. However, that has to wait until protocol/mysql.h gets an
overhaul.
This commit is contained in:
Johan Wikman
2016-12-29 09:44:38 +02:00
parent b40872e600
commit c6e155cf2b
3 changed files with 85 additions and 82 deletions

View File

@ -31,4 +31,17 @@ char* mxs_lestr_consume(uint8_t** c, size_t *size);
MYSQL *mxs_mysql_real_connect(MYSQL *mysql, SERVER *server, const char *user, const char *passwd);
/**
* Trim MySQL quote characters surrounding a string.
*
* 'abcd' => abcd
* "abcd" => abcd
* `abcd` => abcd
*
* @param s The string to be trimmed.
*
* @note The string is modified in place.
*/
bool mxs_mysql_trim_quotes(char *s);
MXS_END_DECLS