MXS-2397 Provide context information for fields

The query classifier now returns contextual information for a fields;
does it appear in the (right hand side) of a UNION or in a SUBQUERY.
This commit is contained in:
Johan Wikman
2019-03-21 13:58:52 +02:00
parent fadbdc7514
commit f37340e9fd
3 changed files with 115 additions and 36 deletions

View File

@ -127,13 +127,23 @@ typedef enum qc_parse_result
} qc_parse_result_t;
/**
* QC_FIELD_INFO contains information about a field used in a statement.
* qc_field_context_t defines the context where a field appears.
*
* NOTE: A particular bit does NOT mean that the field appears ONLY in the context,
* but it may appear in other contexts as well.
*/
typedef enum qc_field_context
{
QC_FIELD_UNION = 1, /** The field appears on the right hand side in a UNION. */
QC_FIELD_SUBQUERY = 2 /** The field appears in a subquery. */
} qc_field_context_t;
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. */
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 context; /** The context in which the field appears. */
} QC_FIELD_INFO;
/**