Uncrustify maxscale
See script directory for method. The script to run in the top level MaxScale directory is called maxscale-uncrustify.sh, which uses another script, list-src, from the same directory (so you need to set your PATH). The uncrustify version was 0.66.
This commit is contained in:
@ -10,7 +10,7 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxbase/jansson.h>
|
||||
@ -25,8 +25,8 @@ MXS_BEGIN_DECLS
|
||||
*/
|
||||
typedef enum qc_init_kind
|
||||
{
|
||||
QC_INIT_SELF = 0x01, /*< Initialize/finalize the query classifier itself. */
|
||||
QC_INIT_PLUGIN = 0x02, /*< Initialize/finalize the plugin. */
|
||||
QC_INIT_SELF = 0x01, /*< Initialize/finalize the query classifier itself. */
|
||||
QC_INIT_PLUGIN = 0x02, /*< Initialize/finalize the plugin. */
|
||||
QC_INIT_BOTH = 0x03
|
||||
} qc_init_kind_t;
|
||||
|
||||
@ -36,8 +36,8 @@ typedef enum qc_init_kind
|
||||
*/
|
||||
typedef enum qc_sql_mode
|
||||
{
|
||||
QC_SQL_MODE_DEFAULT, /*< Assume the statements are MariaDB SQL. */
|
||||
QC_SQL_MODE_ORACLE /*< Assume the statements are PL/SQL. */
|
||||
QC_SQL_MODE_DEFAULT, /*< Assume the statements are MariaDB SQL. */
|
||||
QC_SQL_MODE_ORACLE /*< Assume the statements are PL/SQL. */
|
||||
} qc_sql_mode_t;
|
||||
|
||||
/**
|
||||
@ -45,13 +45,13 @@ typedef enum qc_sql_mode
|
||||
*/
|
||||
typedef enum qc_collect_info
|
||||
{
|
||||
QC_COLLECT_ESSENTIALS = 0x00, /*< Collect only the base minimum. */
|
||||
QC_COLLECT_TABLES = 0x01, /*< Collect table names. */
|
||||
QC_COLLECT_DATABASES = 0x02, /*< Collect database names. */
|
||||
QC_COLLECT_FIELDS = 0x04, /*< Collect field information. */
|
||||
QC_COLLECT_FUNCTIONS = 0x08, /*< Collect function information. */
|
||||
QC_COLLECT_ESSENTIALS = 0x00, /*< Collect only the base minimum. */
|
||||
QC_COLLECT_TABLES = 0x01, /*< Collect table names. */
|
||||
QC_COLLECT_DATABASES = 0x02, /*< Collect database names. */
|
||||
QC_COLLECT_FIELDS = 0x04, /*< Collect field information. */
|
||||
QC_COLLECT_FUNCTIONS = 0x08, /*< Collect function information. */
|
||||
|
||||
QC_COLLECT_ALL = (QC_COLLECT_TABLES|QC_COLLECT_DATABASES|QC_COLLECT_FIELDS|QC_COLLECT_FUNCTIONS)
|
||||
QC_COLLECT_ALL = (QC_COLLECT_TABLES | QC_COLLECT_DATABASES | QC_COLLECT_FIELDS | QC_COLLECT_FUNCTIONS)
|
||||
} qc_collect_info_t;
|
||||
/**
|
||||
* qc_query_type_t defines bits that provide information about a
|
||||
@ -61,32 +61,32 @@ typedef enum qc_collect_info
|
||||
*/
|
||||
typedef enum qc_query_type
|
||||
{
|
||||
QUERY_TYPE_UNKNOWN = 0x000000, /*< Initial value, can't be tested bitwisely */
|
||||
QUERY_TYPE_LOCAL_READ = 0x000001, /*< Read non-database data, execute in MaxScale:any */
|
||||
QUERY_TYPE_READ = 0x000002, /*< Read database data:any */
|
||||
QUERY_TYPE_WRITE = 0x000004, /*< Master data will be modified:master */
|
||||
QUERY_TYPE_MASTER_READ = 0x000008, /*< Read from the master:master */
|
||||
QUERY_TYPE_SESSION_WRITE = 0x000010, /*< Session data will be modified:master or all */
|
||||
QUERY_TYPE_USERVAR_WRITE = 0x000020, /*< Write a user variable:master or all */
|
||||
QUERY_TYPE_USERVAR_READ = 0x000040, /*< Read a user variable:master or any */
|
||||
QUERY_TYPE_SYSVAR_READ = 0x000080, /*< Read a system variable:master or any */
|
||||
QUERY_TYPE_UNKNOWN = 0x000000, /*< Initial value, can't be tested bitwisely */
|
||||
QUERY_TYPE_LOCAL_READ = 0x000001, /*< Read non-database data, execute in MaxScale:any */
|
||||
QUERY_TYPE_READ = 0x000002, /*< Read database data:any */
|
||||
QUERY_TYPE_WRITE = 0x000004, /*< Master data will be modified:master */
|
||||
QUERY_TYPE_MASTER_READ = 0x000008, /*< Read from the master:master */
|
||||
QUERY_TYPE_SESSION_WRITE = 0x000010, /*< Session data will be modified:master or all */
|
||||
QUERY_TYPE_USERVAR_WRITE = 0x000020, /*< Write a user variable:master or all */
|
||||
QUERY_TYPE_USERVAR_READ = 0x000040, /*< Read a user variable:master or any */
|
||||
QUERY_TYPE_SYSVAR_READ = 0x000080, /*< Read a system variable:master or any */
|
||||
/** Not implemented yet */
|
||||
//QUERY_TYPE_SYSVAR_WRITE = 0x000100, /*< Write a system variable:master or all */
|
||||
QUERY_TYPE_GSYSVAR_READ = 0x000200, /*< Read global system variable:master or any */
|
||||
QUERY_TYPE_GSYSVAR_WRITE = 0x000400, /*< Write global system variable:master or all */
|
||||
QUERY_TYPE_BEGIN_TRX = 0x000800, /*< BEGIN or START TRANSACTION */
|
||||
QUERY_TYPE_ENABLE_AUTOCOMMIT = 0x001000, /*< SET autocommit=1 */
|
||||
QUERY_TYPE_DISABLE_AUTOCOMMIT = 0x002000, /*< SET autocommit=0 */
|
||||
QUERY_TYPE_ROLLBACK = 0x004000, /*< ROLLBACK */
|
||||
QUERY_TYPE_COMMIT = 0x008000, /*< COMMIT */
|
||||
QUERY_TYPE_PREPARE_NAMED_STMT = 0x010000, /*< Prepared stmt with name from user:all */
|
||||
QUERY_TYPE_PREPARE_STMT = 0x020000, /*< Prepared stmt with id provided by server:all */
|
||||
QUERY_TYPE_EXEC_STMT = 0x040000, /*< Execute prepared statement:master or any */
|
||||
QUERY_TYPE_CREATE_TMP_TABLE = 0x080000, /*< Create temporary table:master (could be all) */
|
||||
QUERY_TYPE_READ_TMP_TABLE = 0x100000, /*< Read temporary table:master (could be any) */
|
||||
QUERY_TYPE_SHOW_DATABASES = 0x200000, /*< Show list of databases */
|
||||
QUERY_TYPE_SHOW_TABLES = 0x400000, /*< Show list of tables */
|
||||
QUERY_TYPE_DEALLOC_PREPARE = 0x1000000 /*< Dealloc named prepare stmt:all */
|
||||
// QUERY_TYPE_SYSVAR_WRITE = 0x000100, /*< Write a system variable:master or all */
|
||||
QUERY_TYPE_GSYSVAR_READ = 0x000200, /*< Read global system variable:master or any */
|
||||
QUERY_TYPE_GSYSVAR_WRITE = 0x000400, /*< Write global system variable:master or all */
|
||||
QUERY_TYPE_BEGIN_TRX = 0x000800, /*< BEGIN or START TRANSACTION */
|
||||
QUERY_TYPE_ENABLE_AUTOCOMMIT = 0x001000, /*< SET autocommit=1 */
|
||||
QUERY_TYPE_DISABLE_AUTOCOMMIT = 0x002000, /*< SET autocommit=0 */
|
||||
QUERY_TYPE_ROLLBACK = 0x004000, /*< ROLLBACK */
|
||||
QUERY_TYPE_COMMIT = 0x008000, /*< COMMIT */
|
||||
QUERY_TYPE_PREPARE_NAMED_STMT = 0x010000, /*< Prepared stmt with name from user:all */
|
||||
QUERY_TYPE_PREPARE_STMT = 0x020000, /*< Prepared stmt with id provided by server:all */
|
||||
QUERY_TYPE_EXEC_STMT = 0x040000, /*< Execute prepared statement:master or any */
|
||||
QUERY_TYPE_CREATE_TMP_TABLE = 0x080000, /*< Create temporary table:master (could be all) */
|
||||
QUERY_TYPE_READ_TMP_TABLE = 0x100000, /*< Read temporary table:master (could be any) */
|
||||
QUERY_TYPE_SHOW_DATABASES = 0x200000, /*< Show list of databases */
|
||||
QUERY_TYPE_SHOW_TABLES = 0x400000, /*< Show list of tables */
|
||||
QUERY_TYPE_DEALLOC_PREPARE = 0x1000000 /*< Dealloc named prepare stmt:all */
|
||||
} qc_query_type_t;
|
||||
|
||||
/**
|
||||
@ -120,10 +120,10 @@ typedef enum qc_query_op
|
||||
*/
|
||||
typedef enum qc_parse_result
|
||||
{
|
||||
QC_QUERY_INVALID = 0, /*< The query was not recognized or could not be parsed. */
|
||||
QC_QUERY_TOKENIZED = 1, /*< The query was classified based on tokens; incompletely classified. */
|
||||
QC_QUERY_PARTIALLY_PARSED = 2, /*< The query was only partially parsed; incompletely classified. */
|
||||
QC_QUERY_PARSED = 3 /*< The query was fully parsed; completely classified. */
|
||||
QC_QUERY_INVALID = 0, /*< The query was not recognized or could not be parsed. */
|
||||
QC_QUERY_TOKENIZED = 1, /*< The query was classified based on tokens; incompletely classified. */
|
||||
QC_QUERY_PARTIALLY_PARSED = 2, /*< The query was only partially parsed; incompletely classified. */
|
||||
QC_QUERY_PARSED = 3 /*< The query was fully parsed; completely classified. */
|
||||
} qc_parse_result_t;
|
||||
|
||||
/**
|
||||
@ -141,9 +141,9 @@ typedef struct qc_field_info
|
||||
*/
|
||||
typedef struct qc_function_info
|
||||
{
|
||||
char* name; /** Name of function. */
|
||||
QC_FIELD_INFO* fields; /** What fields the function accesses. */
|
||||
uint32_t n_fields; /** The number of fields in @c fields. */
|
||||
char* name; /** Name of function. */
|
||||
QC_FIELD_INFO* fields; /** What fields the function accesses. */
|
||||
uint32_t n_fields;/** The number of fields in @c fields. */
|
||||
} QC_FUNCTION_INFO;
|
||||
|
||||
/**
|
||||
@ -182,7 +182,7 @@ typedef struct query_classifier
|
||||
* @return QC_RESULT_OK, if the query classifier could be setup, otherwise
|
||||
* some specific error code.
|
||||
*/
|
||||
int32_t (*qc_setup)(qc_sql_mode_t sql_mode, const char* args);
|
||||
int32_t (* qc_setup)(qc_sql_mode_t sql_mode, const char* args);
|
||||
|
||||
/**
|
||||
* Called once at process startup, after @c qc_setup has successfully
|
||||
@ -190,24 +190,24 @@ typedef struct query_classifier
|
||||
*
|
||||
* @return QC_RESULT_OK, if the process initialization succeeded.
|
||||
*/
|
||||
int32_t (*qc_process_init)(void);
|
||||
int32_t (* qc_process_init)(void);
|
||||
|
||||
/**
|
||||
* Called once at process shutdown.
|
||||
*/
|
||||
void (*qc_process_end)(void);
|
||||
void (* qc_process_end)(void);
|
||||
|
||||
/**
|
||||
* Called once per each thread.
|
||||
*
|
||||
* @return QC_RESULT_OK, if the thread initialization succeeded.
|
||||
*/
|
||||
int32_t (*qc_thread_init)(void);
|
||||
int32_t (* qc_thread_init)(void);
|
||||
|
||||
/**
|
||||
* Called once when a thread finishes.
|
||||
*/
|
||||
void (*qc_thread_end)(void);
|
||||
void (* qc_thread_end)(void);
|
||||
|
||||
/**
|
||||
* Called to explicitly parse a statement.
|
||||
@ -221,7 +221,7 @@ typedef struct query_classifier
|
||||
* @return QC_RESULT_OK, if the parsing was not aborted due to resource
|
||||
* exhaustion or equivalent.
|
||||
*/
|
||||
int32_t (*qc_parse)(GWBUF* stmt, uint32_t collect, int32_t* result);
|
||||
int32_t (* qc_parse)(GWBUF* stmt, uint32_t collect, int32_t* result);
|
||||
|
||||
/**
|
||||
* Reports the type of the statement.
|
||||
@ -233,7 +233,7 @@ typedef struct query_classifier
|
||||
* @return QC_RESULT_OK, if the parsing was not aborted due to resource
|
||||
* exhaustion or equivalent.
|
||||
*/
|
||||
int32_t (*qc_get_type_mask)(GWBUF* stmt, uint32_t* type);
|
||||
int32_t (* qc_get_type_mask)(GWBUF* stmt, uint32_t* type);
|
||||
|
||||
/**
|
||||
* Reports the operation of the statement.
|
||||
@ -245,7 +245,7 @@ typedef struct query_classifier
|
||||
* @return QC_RESULT_OK, if the parsing was not aborted due to resource
|
||||
* exhaustion or equivalent.
|
||||
*/
|
||||
int32_t (*qc_get_operation)(GWBUF* stmt, int32_t* op);
|
||||
int32_t (* qc_get_operation)(GWBUF* stmt, int32_t* op);
|
||||
|
||||
/**
|
||||
* Reports the name of a created table.
|
||||
@ -257,7 +257,7 @@ typedef struct query_classifier
|
||||
* @return QC_RESULT_OK, if the parsing was not aborted due to resource
|
||||
* exhaustion or equivalent.
|
||||
*/
|
||||
int32_t (*qc_get_created_table_name)(GWBUF* stmt, char** name);
|
||||
int32_t (* qc_get_created_table_name)(GWBUF* stmt, char** name);
|
||||
|
||||
/**
|
||||
* Reports whether a statement is a "DROP TABLE ..." statement.
|
||||
@ -269,7 +269,7 @@ typedef struct query_classifier
|
||||
* @return QC_RESULT_OK, if the parsing was not aborted due to resource
|
||||
* exhaustion or equivalent.
|
||||
*/
|
||||
int32_t (*qc_is_drop_table_query)(GWBUF* stmt, int32_t* is_drop_table);
|
||||
int32_t (* qc_is_drop_table_query)(GWBUF* stmt, int32_t* is_drop_table);
|
||||
|
||||
/**
|
||||
* Returns all table names.
|
||||
@ -284,7 +284,7 @@ typedef struct query_classifier
|
||||
* @return QC_RESULT_OK, if the parsing was not aborted due to resource
|
||||
* exhaustion or equivalent.
|
||||
*/
|
||||
int32_t (*qc_get_table_names)(GWBUF* stmt, int32_t full_names, char*** names, int32_t *n_names);
|
||||
int32_t (* qc_get_table_names)(GWBUF* stmt, int32_t full_names, char*** names, int32_t* n_names);
|
||||
|
||||
/**
|
||||
* The canonical version of a statement.
|
||||
@ -296,7 +296,7 @@ typedef struct query_classifier
|
||||
* @return QC_RESULT_OK, if the parsing was not aborted due to resource
|
||||
* exhaustion or equivalent.
|
||||
*/
|
||||
int32_t (*qc_get_canonical)(GWBUF* stmt, char** canonical);
|
||||
int32_t (* qc_get_canonical)(GWBUF* stmt, char** canonical);
|
||||
|
||||
/**
|
||||
* Reports whether the statement has a where clause.
|
||||
@ -308,7 +308,7 @@ typedef struct query_classifier
|
||||
* @return QC_RESULT_OK, if the parsing was not aborted due to resource
|
||||
* exhaustion or equivalent.
|
||||
*/
|
||||
int32_t (*qc_query_has_clause)(GWBUF* stmt, int32_t* has_clause);
|
||||
int32_t (* qc_query_has_clause)(GWBUF* stmt, int32_t* has_clause);
|
||||
|
||||
/**
|
||||
* Reports the database names.
|
||||
@ -322,7 +322,7 @@ typedef struct query_classifier
|
||||
* @return QC_RESULT_OK, if the parsing was not aborted due to resource
|
||||
* exhaustion or equivalent.
|
||||
*/
|
||||
int32_t (*qc_get_database_names)(GWBUF* stmt, char*** names, int32_t* size);
|
||||
int32_t (* qc_get_database_names)(GWBUF* stmt, char*** names, int32_t* size);
|
||||
|
||||
/**
|
||||
* Reports the prepare name.
|
||||
@ -334,7 +334,7 @@ typedef struct query_classifier
|
||||
* @return QC_RESULT_OK, if the parsing was not aborted due to resource
|
||||
* exhaustion or equivalent.
|
||||
*/
|
||||
int32_t (*qc_get_prepare_name)(GWBUF* stmt, char** name);
|
||||
int32_t (* qc_get_prepare_name)(GWBUF* stmt, char** name);
|
||||
|
||||
/**
|
||||
* Reports field information.
|
||||
@ -346,7 +346,7 @@ typedef struct query_classifier
|
||||
* @return QC_RESULT_OK, if the parsing was not aborted due to resource
|
||||
* exhaustion or equivalent.
|
||||
*/
|
||||
int32_t (*qc_get_field_info)(GWBUF* stmt, const QC_FIELD_INFO** infos, uint32_t* n_infos);
|
||||
int32_t (* qc_get_field_info)(GWBUF* stmt, const QC_FIELD_INFO** infos, uint32_t* n_infos);
|
||||
|
||||
/**
|
||||
* The canonical version of a statement.
|
||||
@ -358,7 +358,7 @@ typedef struct query_classifier
|
||||
* @return QC_RESULT_OK, if the parsing was not aborted due to resource
|
||||
* exhaustion or equivalent.
|
||||
*/
|
||||
int32_t (*qc_get_function_info)(GWBUF* stmt, const QC_FUNCTION_INFO** infos, uint32_t* n_infos);
|
||||
int32_t (* qc_get_function_info)(GWBUF* stmt, const QC_FUNCTION_INFO** infos, uint32_t* n_infos);
|
||||
|
||||
/**
|
||||
* Return the preparable statement of a PREPARE statement.
|
||||
@ -375,7 +375,7 @@ typedef struct query_classifier
|
||||
* @return QC_RESULT_OK, if the parsing was not aborted due to resource
|
||||
* exhaustion or equivalent.
|
||||
*/
|
||||
int32_t (*qc_get_preparable_stmt)(GWBUF* stmt, GWBUF** preparable_stmt);
|
||||
int32_t (* qc_get_preparable_stmt)(GWBUF* stmt, GWBUF** preparable_stmt);
|
||||
|
||||
/**
|
||||
* Set the version of the server. The version may affect how a statement
|
||||
@ -385,7 +385,7 @@ typedef struct query_classifier
|
||||
* @param version Version encoded as MariaDB encodes the version, i.e.:
|
||||
* version = major * 10000 + minor * 100 + patch
|
||||
*/
|
||||
void (*qc_set_server_version)(uint64_t version);
|
||||
void (* qc_set_server_version)(uint64_t version);
|
||||
|
||||
/**
|
||||
* Get the thread specific version assumed of the server. If the version has
|
||||
@ -394,7 +394,7 @@ typedef struct query_classifier
|
||||
* @param version The version encoded as MariaDB encodes the version, i.e.:
|
||||
* version = major * 10000 + minor * 100 + patch
|
||||
*/
|
||||
void (*qc_get_server_version)(uint64_t* version);
|
||||
void (* qc_get_server_version)(uint64_t* version);
|
||||
|
||||
/**
|
||||
* Gets the sql mode of the *calling* thread.
|
||||
@ -403,7 +403,7 @@ typedef struct query_classifier
|
||||
*
|
||||
* @return QC_RESULT_OK
|
||||
*/
|
||||
int32_t (*qc_get_sql_mode)(qc_sql_mode_t* sql_mode);
|
||||
int32_t (* qc_get_sql_mode)(qc_sql_mode_t* sql_mode);
|
||||
|
||||
/**
|
||||
* Sets the sql mode for the *calling* thread.
|
||||
@ -412,7 +412,7 @@ typedef struct query_classifier
|
||||
*
|
||||
* @return QC_RESULT_OK if @sql_mode is valid, otherwise QC_RESULT_ERROR.
|
||||
*/
|
||||
int32_t (*qc_set_sql_mode)(qc_sql_mode_t sql_mode);
|
||||
int32_t (* qc_set_sql_mode)(qc_sql_mode_t sql_mode);
|
||||
|
||||
/**
|
||||
* Dups the provided info object. After having been dupped, the info object
|
||||
@ -422,7 +422,7 @@ typedef struct query_classifier
|
||||
*
|
||||
* @return The same info that was provided as argument.
|
||||
*/
|
||||
QC_STMT_INFO* (*qc_info_dup)(QC_STMT_INFO* info);
|
||||
QC_STMT_INFO* (*qc_info_dup)(QC_STMT_INFO * info);
|
||||
|
||||
/**
|
||||
* Closes a dupped info object. After the info object has been closed, it must
|
||||
@ -430,7 +430,7 @@ typedef struct query_classifier
|
||||
*
|
||||
* @param info The info to be closed.
|
||||
*/
|
||||
void (*qc_info_close)(QC_STMT_INFO* info);
|
||||
void (* qc_info_close)(QC_STMT_INFO* info);
|
||||
} QUERY_CLASSIFIER;
|
||||
|
||||
/**
|
||||
@ -438,7 +438,7 @@ typedef struct query_classifier
|
||||
*/
|
||||
typedef struct QC_CACHE_PROPERTIES
|
||||
{
|
||||
int64_t max_size; /** The maximum size of the cache. */
|
||||
int64_t max_size; /** The maximum size of the cache. */
|
||||
} QC_CACHE_PROPERTIES;
|
||||
|
||||
/**
|
||||
@ -446,11 +446,11 @@ typedef struct QC_CACHE_PROPERTIES
|
||||
*/
|
||||
typedef struct QC_CACHE_STATS
|
||||
{
|
||||
int64_t size; /** The current size of the cache. */
|
||||
int64_t inserts; /** The number of inserts. */
|
||||
int64_t hits; /** The number of hits. */
|
||||
int64_t misses; /** The number of misses. */
|
||||
int64_t evictions; /** The number of evictions. */
|
||||
int64_t size; /** The current size of the cache. */
|
||||
int64_t inserts; /** The number of inserts. */
|
||||
int64_t hits; /** The number of hits. */
|
||||
int64_t misses; /** The number of misses. */
|
||||
int64_t evictions; /** The number of evictions. */
|
||||
} QC_CACHE_STATS;
|
||||
|
||||
/**
|
||||
@ -475,7 +475,8 @@ typedef struct QC_CACHE_STATS
|
||||
*/
|
||||
bool qc_setup(const QC_CACHE_PROPERTIES* cache_properties,
|
||||
qc_sql_mode_t sql_mode,
|
||||
const char* plugin_name, const char* plugin_args);
|
||||
const char* plugin_name,
|
||||
const char* plugin_args);
|
||||
|
||||
/**
|
||||
* Loads and setups the default query classifier, and performs
|
||||
@ -497,8 +498,8 @@ bool qc_setup(const QC_CACHE_PROPERTIES* cache_properties,
|
||||
*/
|
||||
bool qc_init(const QC_CACHE_PROPERTIES* cache_properties,
|
||||
qc_sql_mode_t sql_mode,
|
||||
const char* plugin_name,
|
||||
const char* plugin_args);
|
||||
const char* plugin_name,
|
||||
const char* plugin_args);
|
||||
|
||||
/**
|
||||
* Performs thread and process finalization.
|
||||
|
||||
Reference in New Issue
Block a user