Commit Graph

459 Commits

Author SHA1 Message Date
cb15d90da9 MXS-1337 qc_sqlite info structure now a C++ class
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++.
2017-08-02 09:11:35 +03:00
e4f0598743 Convert qc_sqlite.c to C++
MXS-1307 requries some modifications in the query classifier and
making those changes is easier if STL collections are available.
2017-08-01 08:45:03 +03:00
3eb99139f5 Merge branch '2.1' into develop 2017-07-31 15:57:05 +03:00
4985bf9b6e MXS-1328 Mark regexp functions as builtin functions
Regexp functions were not listed among the builtin read-only
functions and consequently any SELECT using one of those was
routed to master.
2017-07-27 09:58:32 +03:00
2d59148a9f MXS-1307 Grant statements excluded
MaxScale does not need to fully parse grant statements. Hence
they are commented out from cte_grant.test.
2017-07-27 09:22:19 +03:00
f7bd195e9f MXS-1248: Add CTE tests
All cte tests from the server
2017-06-30 13:01:14 +02:00
d060320b36 MXS-1248: Further modifications for CTE
- 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.
2017-06-30 12:49:28 +02:00
b5d54292a4 Fix merge error 2017-06-30 11:07:00 +02:00
7297ae129c MXS-1248: Pointer value alone does not tell validity
The pointer pointing to a recursive select may be non-null even
if it is not valid. The specific boolean must be checked as well.
2017-06-30 11:05:15 +02:00
2c5aaeff0e Develop Merge
Develop Merge
2017-06-30 10:14:45 +02:00
f91df4617a MXS-1248: Add simple cte test 2017-06-30 08:36:19 +02:00
84c5aa9934 MXS-1248: Report fields from CTE expressions
Now field and function information of CTE expressions are
collected.
2017-06-30 08:36:19 +02:00
48a67eeef2 qc_mysqlembedded: Collect ... WHERE EXISTS ...
Information was not collected from the subselect in a situation
e.g. like

    SELECT ... WHERE NOT EXISTS (SELECT ...)
2017-06-30 08:36:19 +02:00
cb57e10761 Develop merge
Develop merge
2017-06-29 15:34:22 +02:00
6cd6ded3d8 Merge branch '2.1-oracle-compat' into develop-new-merge-oracle 2017-06-29 09:39:55 +02:00
f0ddbc5c8f MXS-1258: Remove non-critical failing test-cases
"SELECT LENGTH(_utf8 0xC39F), LENGTH(CHAR(14844588 USING utf8));"

Type and operation collected correctly, but function names are not
2017-06-28 21:36:08 +02:00
8128c74341 MXS-1196: Update Oracle tests 2017-06-28 21:36:08 +02:00
a690b44919 MXS-1278: Sql mode must be specified explicitly
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.
2017-06-28 21:36:08 +02:00
12a291919a MXS-1275: SetSqlModeParser moved under MySQLClient
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.
2017-06-28 21:36:08 +02:00
51452ecb3b MXS-1275: No need to be explicit about the sql mode
As statements as "set sql_mode=oracle" are recognized and the
behaviour of the classifiers is configured accordingly, the mode
need not the hardwired.
2017-06-28 21:36:08 +02:00
d9448e1550 MXS-1275: Function name mappings need to follow sql_mode 2017-06-28 21:36:08 +02:00
a60b6473ed MXS-1275: Check for "set sql_mode=ORACLE" and act accordingly 2017-06-28 21:36:08 +02:00
021fe09edb MXS-1275: qc_mysqlembedded, add support for qc_[get|set]_sql_mode 2017-06-28 21:36:08 +02:00
368ae65779 MXS-1275: // is not an mysql comment token 2017-06-28 21:36:08 +02:00
3084e95772 MXS-1275: Implement qc_[get|set]_sql_mode for qc_sqlite 2017-06-28 21:36:08 +02:00
9ae0526efb MXS-1275: Extend QC-API to allow setting of sql mode
Only API changes, implementation will follow.
2017-06-28 21:36:08 +02:00
94b0b082e4 MXS-1275: Make sql_mode a property of the current context
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.
2017-06-28 21:33:04 +02:00
cc0c193d2e MXS-1196: Run Oracle test only when built against 10.3 2017-06-28 21:33:04 +02:00
d9b4013b69 MXS-1196: Add Oracle tests 2017-06-28 21:33:04 +02:00
9431aded48 MXS-1196: Do not translate keywords that arrive first 2017-06-28 21:33:04 +02:00
e9ad1ea7bb MXS-1196: Recognize SQL%ROWCOUNT
Special handling is needed as otherwise "SQL%ROWCOUNT" does not
appear as a function but as the function "%" and the fields "SQL"
and "ROWCOUNT".
2017-06-28 21:33:04 +02:00
8b6fc49dc1 MXS-1196: Turn certain keywords into ids 2017-06-28 21:33:04 +02:00
77f05b49d0 MXS-1196: Handle top-level FOR loops
The content is ignored and the type is QUERY_TYPE_WRITE.
2017-06-28 21:33:04 +02:00
b492f09d61 MXS-1196: Add Oracle tests 2017-06-28 21:33:04 +02:00
f9eef5ee3b MXS-1196: Classify SHOW as QUERY_TYPE_READ 2017-06-28 21:33:04 +02:00
49c9c60c63 MXS-1196: Parse arguments to CALL. 2017-06-28 21:33:04 +02:00
dd5360d30c MXS-1196: Handle delimiter explicitly, ignore comments 2017-06-28 21:33:04 +02:00
fd3258f7f7 MXS-1196: Ignore mysqltest keywords unless delim is ; 2017-06-28 21:33:04 +02:00
a73200ad50 MXS-1196: Add Oracle tests 2017-06-28 21:33:04 +02:00
eaf5a4152b MXS-1196: Handle eol-comments
Eol-comments need to be followed by a newline as otherwise the
rest of a test-statement will be excluded.
2017-06-28 21:33:04 +02:00
332e1bbb7c MXS-1196: Add more Oracle tests 2017-06-28 21:33:04 +02:00
31f2b340ea MXS-1196: Add more Oracle tests 2017-06-28 21:33:04 +02:00
38863bd319 MXS-1196: Handle "exit" correctly
"exit" is both a mysqltest and PL/SQL keyword.
2017-06-28 21:33:04 +02:00
09b0c44be5 MXS-1196: Add new Oracle test 2017-06-28 21:33:04 +02:00
2a89a4de45 MXS-1196: Handle DECLARE
DECLARE can also begin an anonymous block in PL/SQL.
2017-06-28 21:33:04 +02:00
bf54a9bf9f MXS-1196: Handle anonymous blocks
In PL/SQL BEGIN starts a block (i.e. not a transaction). Whenever we
see that, we assume it is such a block, consume all input and set the
type to QUERY_TYPE_WRITE to ensure it goes to master.
2017-06-28 21:33:04 +02:00
f26fb085bc MXS-1196: Handle "while" correctly
"while" is both a mysqltest and PL/SQL keyword.
2017-06-28 21:33:04 +02:00
b700a77da6 MXS-1196: Add test for Oracle sequences 2017-06-28 21:33:04 +02:00
573a2c6160 MXS-1196: Accept ".tbl.col" columns names 2017-06-28 21:33:04 +02:00
9ecd5da255 MXS-1196: Handle sequence related fields/functions
Both 10.3 and Oracle support sequence pseudo colums and corresponding
functions. Getting the next number in the sequence is in both cases
obtained using nextval/nextval() but the current number is in Oracle
obtained using currval/currval() and in 10.3 using lastval/lastval().

These fields/functions are now ignored, in the sense that they will
not show up in the field/function infos. However, they will cause the
type mask of the statement to contain the bit QUERY_TYPE_WRITE so that
statements accessing the sequence will always be sent to the master.
2017-06-28 21:33:04 +02:00