MXS-1364 Drop the usage field

But for the most trivial statements did not really provide
useful information.

The arguments of the "function" '=' are now reported.
This commit is contained in:
Johan Wikman
2017-08-23 14:21:04 +03:00
parent 4c100a305e
commit ad4e8dad94
14 changed files with 330 additions and 649 deletions

View File

@ -122,38 +122,6 @@ typedef enum qc_parse_result
QC_QUERY_PARSED = 3 /*< The query was fully parsed; completely classified. */
} qc_parse_result_t;
/**
* qc_field_usage_t defines where a particular field appears.
*
* QC_USED_IN_SELECT : The field appears on the left side of FROM in a top-level SELECT statement.
* QC_USED_IN_SUBSELECT: The field appears on the left side of FROM in a sub-select SELECT statement.
* QC_USED_IN_WHERE : The field appears in a WHERE clause.
* QC_USED_IN_SET : The field appears in the SET clause of an UPDATE statement.
* QC_USED_IN_GROUP_BY : The field appears in a GROUP BY clause.
*
* Note that multiple bits may be set at the same time. For instance, for a statement like
* "SELECT fld FROM tbl WHERE fld = 1 GROUP BY fld", the bits QC_USED_IN_SELECT, QC_USED_IN_WHERE
* and QC_USED_IN_GROUP_BY will be set.
*/
typedef enum qc_field_usage
{
QC_USED_IN_SELECT = 0x01, /*< SELECT fld FROM... */
QC_USED_IN_SUBSELECT = 0x02, /*< SELECT 1 FROM ... SELECT fld ... */
QC_USED_IN_WHERE = 0x04, /*< SELECT ... FROM ... WHERE fld = ... */
QC_USED_IN_SET = 0x08, /*< UPDATE ... SET fld = ... */
QC_USED_IN_GROUP_BY = 0x10, /*< ... GROUP BY fld */
} qc_field_usage_t;
/**
* QC_FIELD_NAME contains information about the name of a field used in a statement.
*/
typedef struct qc_field_name
{
char* database; /** Present if the field is of the form "a.b.c", NULL otherwise. */
char* table; /** Present if the field is of the form "a.b", NULL otherwise. */
char* column; /** Always present. */
} QC_FIELD_NAME;
/**
* QC_FIELD_INFO contains information about a field used in a statement.
*/
@ -162,7 +130,6 @@ typedef struct qc_field_info
char* database; /** Present if the field is of the form "a.b.c", NULL otherwise. */
char* table; /** Present if the field is of the form "a.b", NULL otherwise. */
char* column; /** Always present. */
uint32_t usage; /** Bitfield denoting where the column appears. */
} QC_FIELD_INFO;
/**
@ -171,8 +138,7 @@ typedef struct qc_field_info
typedef struct qc_function_info
{
char* name; /** Name of function. */
uint32_t usage; /** Bitfield denoting where the column appears. */
QC_FIELD_NAME* fields; /** What fields the function accesses. */
QC_FIELD_INFO* fields; /** What fields the function accesses. */
uint32_t n_fields; /** The number of fields in @c fields. */
} QC_FUNCTION_INFO;
@ -569,25 +535,6 @@ void qc_thread_end(uint32_t kind);
*/
qc_parse_result_t qc_parse(GWBUF* stmt, uint32_t collect);
/**
* Convert a qc_field_usage_t enum to corresponding string.
*
* @param usage The value to be converted
*
* @return The corresponding string. Must @b not be freed.
*/
const char* qc_field_usage_to_string(qc_field_usage_t usage);
/**
* Convert a mask of qc_field_usage_t enum values to corresponding string.
*
* @param usage_mask Mask of qc_field_usage_t values.
*
* @return The corresponding string, or NULL if memory allocation fails.
* @b Must be freed by the caller.
*/
char* qc_field_usage_mask_to_string(uint32_t usage_mask);
/**
* Returns information about affected fields.
*