Update query operation enum and add EXECUTE

Changed the query operation enum to contain implicit enum values instead
of providing. The operation was never used as a bitmask so it is pointless
to declare them as such.

Added the EXECUTE type to the enum and used it in qc_sqlite and
qc_mysqlembedded.
This commit is contained in:
Markus Mäkelä 2017-06-19 15:27:14 +03:00
parent 1ac37d6a50
commit 65df87d801
3 changed files with 19 additions and 13 deletions

View File

@ -82,19 +82,20 @@ typedef enum qc_query_type
*/
typedef enum qc_query_op
{
QUERY_OP_UNDEFINED = 0,
QUERY_OP_SELECT = (1 << 0),
QUERY_OP_UPDATE = (1 << 1),
QUERY_OP_INSERT = (1 << 2),
QUERY_OP_DELETE = (1 << 3),
QUERY_OP_TRUNCATE = (1 << 4),
QUERY_OP_ALTER = (1 << 5),
QUERY_OP_CREATE = (1 << 6),
QUERY_OP_DROP = (1 << 7),
QUERY_OP_CHANGE_DB = (1 << 8),
QUERY_OP_LOAD = (1 << 9),
QUERY_OP_GRANT = (1 << 10),
QUERY_OP_REVOKE = (1 << 11)
QUERY_OP_UNDEFINED = 0,
QUERY_OP_SELECT,
QUERY_OP_UPDATE,
QUERY_OP_INSERT,
QUERY_OP_DELETE,
QUERY_OP_TRUNCATE,
QUERY_OP_ALTER,
QUERY_OP_CREATE,
QUERY_OP_DROP,
QUERY_OP_CHANGE_DB,
QUERY_OP_LOAD,
QUERY_OP_GRANT,
QUERY_OP_REVOKE,
QUERY_OP_EXECUTE,
} qc_query_op_t;
/**

View File

@ -1745,6 +1745,10 @@ int32_t qc_mysql_get_operation(GWBUF* querybuf, int32_t* operation)
*operation = QUERY_OP_REVOKE;
break;
case SQLCOM_EXECUTE:
*operation = QUERY_OP_EXECUTE;
break;
default:
*operation = QUERY_OP_UNDEFINED;
}

View File

@ -2032,6 +2032,7 @@ void maxscaleExecute(Parse* pParse, Token* pName)
info->status = QC_QUERY_PARSED;
info->type_mask = QUERY_TYPE_WRITE;
info->operation = QUERY_OP_EXECUTE;
// If information is collected in several passes, then we may
// this information already.