With this change, for a statement like
SELECT t2.a FROM t1 t2;
the affected field is reported as t1.a and not as t2.a, as it
was before.
For a statement like
SELECT t.f FROM d.t;
qc_mysqlembedded will now return "d.t.f" as the affected field,
while qc_sqlite will still return "t.f" as both implementations did
before. In qc_mysqlembedded's case that is a side-effect of the
alias handling. To get qc_sqlite to return the same (which would
be good), the table names would have to be collected in a smarter
way than they are now.
Alias names for tables are now collected, so that the true
table name of a referred to field can be reported. That modification
will be made in a subsequent commit.
If a particular table appears in a statement multiple times,
qc_get_table_names will report it as many times as it appears.
Each name should be reported just once. Same applies for
database names.
The update_names() will have to be updated to take a possible alias
name as well. That needs to be tracked inside QcSqliteInfo, so that
when there is a statement like "select t2.a from t1 t2" we report
the field as t1.a and not as t2.a.
The structure for storing statement information is now a C++ class.
At least initially it will not be turned into a full-fledged class
that would contain all functionality, but the code will be a mishmash
of C and C++.
- Fields in CTEs are marked as being used in subselects.
- In qc_mysqlembedded all selects must be walked if CTE is present.
- In qc_sqlite unions need special handling.
The default sql mode must now be provided explicitly when the query
classifier is setup. This is in preparation for "sql_mode" becoming
a global configuration parameter of MaxScale.
That's where it belongs as it is only the mysql client protocol that
will use it. It's a bit unfortunate that the qc test program compare
now needs to include a file from a protocol module directory, but
the fact is that the query classifier implementation and the test
programs should actually be *under* the mysql client protocol module.
The sql mode is now a property of the info object used for storing
parsing related information. It is initialized with the value of the
sql mode qc_sqlite was initialized with.
This will be further changed so that the mode can be adjusted at
runtime so that the sql mode can be the property of a session. That
is, once set it will affect all future parsing for that session.