Formatted query_classifier

Query_classifier formatted according to the style guide.
This commit is contained in:
Markus Makela
2015-12-02 09:55:19 +02:00
parent 9da0c206bb
commit 93f10fdb7b
2 changed files with 1431 additions and 1330 deletions

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,7 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Copyright MariaDB Corporation Ab Copyright MariaDB Corporation Ab
*/ */
/** getpid */ /** getpid */
#include <my_config.h> #include <my_config.h>
@ -33,7 +33,8 @@ EXTERN_C_BLOCK_BEGIN
* The meaninful difference is where operation is done and whether master data * The meaninful difference is where operation is done and whether master data
* is modified * is modified
*/ */
typedef enum { typedef enum
{
QUERY_TYPE_UNKNOWN = 0x000000, /*< Initial value, can't be tested bitwisely */ 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_LOCAL_READ = 0x000001, /*< Read non-database data, execute in MaxScale:any */
QUERY_TYPE_READ = 0x000002, /*< Read database data:any */ QUERY_TYPE_READ = 0x000002, /*< Read database data:any */
@ -41,11 +42,11 @@ typedef enum {
QUERY_TYPE_MASTER_READ = 0x000008, /*< Read from the master: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_SESSION_WRITE = 0x000010, /*< Session data will be modified:master or all */
/** Not implemented yet */ /** Not implemented yet */
// QUERY_TYPE_USERVAR_WRITE = 0x000020, /*< Write a user variable: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_USERVAR_READ = 0x000040, /*< Read a user variable:master or any */
QUERY_TYPE_SYSVAR_READ = 0x000080, /*< Read a system variable:master or any */ QUERY_TYPE_SYSVAR_READ = 0x000080, /*< Read a system variable:master or any */
/** Not implemented yet */ /** Not implemented yet */
// QUERY_TYPE_SYSVAR_WRITE = 0x000100, /*< Write a system variable:master or 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_READ = 0x000200, /*< Read global system variable:master or any */
QUERY_TYPE_GSYSVAR_WRITE = 0x000400, /*< Write global system variable:master or all */ QUERY_TYPE_GSYSVAR_WRITE = 0x000400, /*< Write global system variable:master or all */
QUERY_TYPE_BEGIN_TRX = 0x000800, /*< BEGIN or START TRANSACTION */ QUERY_TYPE_BEGIN_TRX = 0x000800, /*< BEGIN or START TRANSACTION */
@ -62,7 +63,8 @@ typedef enum {
QUERY_TYPE_SHOW_TABLES = 0x400000 /*< Show list of tables */ QUERY_TYPE_SHOW_TABLES = 0x400000 /*< Show list of tables */
} skygw_query_type_t; } skygw_query_type_t;
typedef enum { typedef enum
{
QUERY_OP_UNDEFINED = 0, QUERY_OP_UNDEFINED = 0,
QUERY_OP_SELECT = 1, QUERY_OP_SELECT = 1,
QUERY_OP_UPDATE = (1 << 1), QUERY_OP_UPDATE = (1 << 1),
@ -77,9 +79,10 @@ typedef enum {
QUERY_OP_DROP_INDEX = (1 << 10), QUERY_OP_DROP_INDEX = (1 << 10),
QUERY_OP_CHANGE_DB = (1 << 11), QUERY_OP_CHANGE_DB = (1 << 11),
QUERY_OP_LOAD = (1 << 12) QUERY_OP_LOAD = (1 << 12)
}skygw_query_op_t; } skygw_query_op_t;
typedef struct parsing_info_st { typedef struct parsing_info_st
{
#if defined(SS_DEBUG) #if defined(SS_DEBUG)
skygw_chk_t pi_chk_top; skygw_chk_t pi_chk_top;
#endif #endif
@ -100,23 +103,26 @@ typedef struct parsing_info_st {
*/ */
skygw_query_type_t query_classifier_get_type(GWBUF* querybuf); skygw_query_type_t query_classifier_get_type(GWBUF* querybuf);
skygw_query_op_t query_classifier_get_operation(GWBUF* querybuf); skygw_query_op_t query_classifier_get_operation(GWBUF* querybuf);
/** Free THD context and close MYSQL */
#if defined(NOT_USED) #if defined(NOT_USED)
char* skygw_query_classifier_get_stmtname(GWBUF* buf); char* skygw_query_classifier_get_stmtname(GWBUF* buf);
#endif #endif
char* skygw_get_created_table_name(GWBUF* querybuf); char* skygw_get_created_table_name(GWBUF* querybuf);
bool is_drop_table_query(GWBUF* querybuf); bool is_drop_table_query(GWBUF* querybuf);
bool skygw_is_real_query(GWBUF* querybuf); bool skygw_is_real_query(GWBUF* querybuf);
char** skygw_get_table_names(GWBUF* querybuf, int* tblsize, bool fullnames); char** skygw_get_table_names(GWBUF* querybuf, int* tblsize, bool fullnames);
char* skygw_get_canonical(GWBUF* querybuf); char* skygw_get_canonical(GWBUF* querybuf);
bool parse_query (GWBUF* querybuf); bool parse_query(GWBUF* querybuf);
parsing_info_t* parsing_info_init(void (*donefun)(void *)); parsing_info_t* parsing_info_init(void (*donefun)(void *));
/** Free THD context and close MYSQL */
void parsing_info_done(void* ptr); void parsing_info_done(void* ptr);
bool query_is_parsed(GWBUF* buf); bool query_is_parsed(GWBUF* buf);
bool skygw_query_has_clause(GWBUF* buf); bool skygw_query_has_clause(GWBUF* buf);
char* skygw_get_qtype_str(skygw_query_type_t qtype); char* skygw_get_qtype_str(skygw_query_type_t qtype);
char* skygw_get_affected_fields(GWBUF* buf); char* skygw_get_affected_fields(GWBUF* buf);
char** skygw_get_database_names(GWBUF* querybuf,int* size); char** skygw_get_database_names(GWBUF* querybuf, int* size);
EXTERN_C_BLOCK_END EXTERN_C_BLOCK_END