Added query operation type requirements on where clauses and fixed a bug with regex rules.

This commit is contained in:
Markus Makela
2014-11-14 15:59:15 +02:00
parent 171af0fc03
commit ca13e18f53
3 changed files with 196 additions and 117 deletions

View File

@ -1284,6 +1284,7 @@ char* skygw_get_affected_fields(GWBUF* buf)
bool skygw_query_has_clause(GWBUF* buf)
{
LEX* lex;
SELECT_LEX* current;
bool clause = false;
if(!query_is_parsed(buf)){
@ -1294,15 +1295,15 @@ bool skygw_query_has_clause(GWBUF* buf)
return false;
}
lex->current_select = lex->all_selects_list;
current = lex->all_selects_list;
while(lex->current_select)
while(current)
{
if(lex->current_select->where || lex->current_select->having){
if(current->where || current->having){
clause = true;
}
lex->current_select = lex->current_select->next_select_in_list();
current = current->next_select_in_list();
}
return clause;
}

View File

@ -61,10 +61,18 @@ typedef enum {
} skygw_query_type_t;
typedef enum {
QUERY_OP_UNDEFINED, QUERY_OP_SELECT, QUERY_OP_CREATE_TABLE, QUERY_OP_CREATE_INDEX,
QUERY_OP_ALTER_TABLE, QUERY_OP_UPDATE, QUERY_OP_INSERT, QUERY_OP_INSERT_SELECT,
QUERY_OP_DELETE, QUERY_OP_TRUNCATE, QUERY_OP_DROP_TABLE, QUERY_OP_DROP_INDEX,
QUERY_OP_UNDEFINED = 0,
QUERY_OP_SELECT = 1,
QUERY_OP_UPDATE = (1 << 1),
QUERY_OP_INSERT = (1 << 2),
QUERY_OP_DELETE = (1 << 3),
QUERY_OP_INSERT_SELECT = (1 << 4),
QUERY_OP_TRUNCATE = (1 << 5),
QUERY_OP_ALTER_TABLE = (1 << 6),
QUERY_OP_CREATE_TABLE = (1 << 7),
QUERY_OP_CREATE_INDEX = (1 << 8),
QUERY_OP_DROP_TABLE = (1 << 9),
QUERY_OP_DROP_INDEX = (1 << 10)
}skygw_query_op_t;
typedef struct parsing_info_st {