qc: Provide information about field usage
Together with the field names, now qc_get_field_info also returns field usage information, that is, in what context a field is used. This allows, for instance, the cache to take action if a a particular field is selected (SELECT a FROM ...), but not if it is used in a GROUP BY clause (...GROUP BY a). This caused a significant modifications of qc_mysqlembedded that earlier did not walk the parse-tree, but instead looped over of a list of st_select_lex instances that, the name notwithstanding, also contain information about other things but SELECTs. The former approach lost all contextual information, so it was not possible to know where a particular field was used. Now the parse tree is walked, which means that the contextual information is known, and thus the field usage can be updated.
This commit is contained in:
@ -94,7 +94,7 @@ extern int mxs_sqlite3Select(Parse*, Select*, SelectDest*);
|
||||
extern void mxs_sqlite3StartTable(Parse*,Token*,Token*,int,int,int,int);
|
||||
extern void mxs_sqlite3Update(Parse*, SrcList*, ExprList*, Expr*, int);
|
||||
|
||||
extern void maxscaleCollectInfoFromSelect(Parse*, Select*);
|
||||
extern void maxscaleCollectInfoFromSelect(Parse*, Select*, int);
|
||||
|
||||
extern void maxscaleAlterTable(Parse*, mxs_alter_t command, SrcList*, Token*);
|
||||
extern void maxscaleCall(Parse*, SrcList* pName);
|
||||
@ -1444,7 +1444,7 @@ table_factor(A) ::= nm(X) DOT nm(Y) as_opt id(Z). {
|
||||
}
|
||||
|
||||
table_factor(A) ::= LP oneselect(S) RP as_opt id. {
|
||||
maxscaleCollectInfoFromSelect(pParse, S);
|
||||
maxscaleCollectInfoFromSelect(pParse, S, 1);
|
||||
sqlite3SelectDelete(pParse->db, S);
|
||||
A = 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user