A statement like
select if(@@hostname='box02','prod_mariadb02','n');
does not modify @@hostname. Hence the type mask should be
QUERY_TYPE_READ|QUERY_TYPE_SYSVAR_READ and NOT
QUERY_TYPE_READ|QUERY_TYPE_GSYSVAR_WRITE.
Since the thread initialization was removed from the process
initialization function, the thread finish function should not be called
in the process finish function.
By moving the initialization into Worker::run, all threads, including the
main thread, are properly initialized. This was not noticed before as
qc_sqlite initialized the main thread in the process initialization
callback.
The enums exposed by the connector are not intended to be used by the
users of the library. The fact that the protocol, and other, modules used
it was in violation of how the library is intended to be used.
Adding an internal mapping into MaxScale also removes some of the
dependencies that the core has on the connector.
Cleaned up the MaxScale version of the mysql.h header by removing all
unused includes. This revealed a large amount of dependencies on these
removed includes in other files which needed to be fixed.
Also sorted all includes in changed files by type and alphabetical
order. Removed explicit revision history from modified files.
Basically it would be trivial to report far more operations
explicitly, but for the fact that the values in qc_query_op_t
currently, quite unnecessarily, form a bitmask.
In 2.2 that is no longer the case, so other operations will be
added there.
We are only interested in asterisks and column names. Everything
else - integers, floating point numbers, strings, etc. - is of
no interest and not an error.
Before this change, only db2.t2 was reported as table name for a
select like
select * from db1.t1 union select * from db2.t2
With this change, db1.t1 and db2.t2 are reported.
In qc_sqlite the fields that a particular function refers to are now
collected and reported. Qc_mysqlembedded needs to be updated accordingly
and also the compare utility. For subsequent commits.
With sqlite3 3110100, which is used in MaxScale, the the generation
of the used op-codes could sometime generate code that did not define
all opcodes. That resulted then in a compilation error like:
.../sqlite-bld-3110100/sqlite3.c: In function 'sqlite3VdbeExec':
.../sqlite-bld-3110100/sqlite3.c:75427:6: error: 'OP_Real' undeclared
(first use in this function)
case OP_Real: { /* same as TK_FLOAT, out2 */
^
The reason seems to be that if a particular op-code was not used, the
generation stopped at that point:
#define OP_Explain 160
#define OP_NotUsed_161 161
With mkopcodeh.tcl from sqlite3 version 3200000, the generated code
looks like
#define OP_NotUsed_161 161
#define OP_Real 162 /* same as TK_FLOAT,
synopsis: r[P2]=P4 */
and the code compiles.
Thus, mkopcodeh.tsl is updated from the newer sqlite3 version.
In case of very large compound selects or an INSERT with many
values, qc_sqlite could run out of stack space. To deal with
that, the critical recursion is turned into an iteration.
There are some issues still
- With recursive CTEs qc_mysqlembedded and qc_sqlite agree upon
the real columns, but disagree on the CTE related "virtual"
columns. That's largely irrelevant though.
- qc_sqlite cannot parse "SET STATEMENT var=... FOR stmt",
but it will be classified as QUERY_TYPE_GSYSVAR_WRITE.
This is not directly CTE related.
Alias handling must be made so that in a subselect, aliases created
in an outer select are available, but aliases created in another
subselect are not.
The sqlite3 initialization is done a bit more properly now.
It is also ensured that issues are logged at most once, even
if a statement is parsed twice.