#pragma once /* * Copyright (c) 2016 MariaDB Corporation Ab * * Use of this software is governed by the Business Source License included * in the LICENSE.TXT file and at www.mariadb.com/bsl11. * * Change Date: 2019-07-01 * * On the date above, in accordance with the Business Source License, use * of this software will be governed by version 2 or later of the General * Public License. */ #include #include #include #include #include MXS_BEGIN_DECLS /** Length-encoded integers */ size_t mxs_leint_bytes(const uint8_t* ptr); uint64_t mxs_leint_value(const uint8_t* c); uint64_t mxs_leint_consume(uint8_t ** c); /** Length-encoded strings */ char* mxs_lestr_consume_dup(uint8_t** c); char* mxs_lestr_consume(uint8_t** c, size_t *size); /** * Creates a connection to a MySQL database engine. If necessary, initializes SSL. * * @param con A valid MYSQL structure. * @param server The server on which the MySQL engine is running. * @param user The MySQL login ID. * @param passwd The password for the user. * * @return New connection or NULL on error */ MYSQL* mxs_mysql_real_connect(MYSQL *mysql, SERVER *server, const char *user, const char *passwd); /** * Execute a query * * This function wraps mysql_query in a way that automatic query retry is possible. * * @param conn MySQL connection * @param query Query to execute * * @return return value of mysql_query */ int mxs_mysql_query(MYSQL* conn, const char* query); /** * 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); typedef enum mxs_pcre_quote_approach { MXS_PCRE_QUOTE_VERBATIM, /*