7997 Commits

Author SHA1 Message Date
Johan Wikman
6cd6ded3d8 Merge branch '2.1-oracle-compat' into develop-new-merge-oracle 2017-06-29 09:39:55 +02:00
Johan Wikman
7f1a949198 Firewall must use its own operator codes
The firewall uses a bitmask for representing what operations a
particular rule should be applied to. Consquently it cannot use
the query classifier qc_query_op_t enumerator values as such,
as they are consecutive numbers.
2017-06-28 21:36:08 +02:00
Johan Wikman
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
Johan Wikman
bea551092d MXS-1278: Change modes when 'set sql_mode=' is encountered.
The initial setting of sql_mode affects how MaxScale initially
behaves with respect to autocommit.

When 'set sql_mode=[default|oracle];" is encountered, the query
classifier and autocommit modes are adjusted accordingly.
2017-06-28 21:36:08 +02:00
Johan Wikman
8128c74341 MXS-1196: Update Oracle tests 2017-06-28 21:36:08 +02:00
Johan Wikman
a14755a403 MXS-1278: Add 'sql_mode' configuration parameter
Using the 'sql_mode' configuration parameter, the initial sql mode
can be specified.
2017-06-28 21:36:08 +02:00
Johan Wikman
83f8010c4b MXS-1278: Add 'sql_mode' configuration parameter
Using the 'sql_mode' configuration parameter, the initial sql mode
can be specified.
2017-06-28 21:36:08 +02:00
Johan Wikman
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
Johan Wikman
057ba4156d MXS-1278: Turn on ORCALE mode dynamically
If statement input is required for a session, we check the input
for "SET SQL_MODE..." statements and adjust the query classifier
accordingly.
2017-06-28 21:36:08 +02:00
Johan Wikman
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
Johan Wikman
25314b6662 MXS-1275: Add client protocol data to MXS_SESSION
The current sql mode will be tracked in that variable. Since one
thread will handle multiple sessions, we need to track the sql mode
of a session, so that the sql mode of the query classifier can be
set whenever we handle a request of a particular session.

As the sql-mode will be managed by the client protocol, the data
can be private to it as well.
2017-06-28 21:36:08 +02:00
Johan Wikman
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
Johan Wikman
d9448e1550 MXS-1275: Function name mappings need to follow sql_mode 2017-06-28 21:36:08 +02:00
Johan Wikman
a60b6473ed MXS-1275: Check for "set sql_mode=ORACLE" and act accordingly 2017-06-28 21:36:08 +02:00
Johan Wikman
021fe09edb MXS-1275: qc_mysqlembedded, add support for qc_[get|set]_sql_mode 2017-06-28 21:36:08 +02:00
Johan Wikman
368ae65779 MXS-1275: // is not an mysql comment token 2017-06-28 21:36:08 +02:00
Johan Wikman
b385e862b0 MXS-1275: Move SetSqlModeParser to .../server/core/maxscale
The parser is needed not only by mysql_client but also by the test
program of the qc-plugins, so it need to be available someplace
common.

Not that nice that both a qc-component and mysql_client will include
stuff from server/core/maxscale, but at least temporarily ok.
2017-06-28 21:36:08 +02:00
Johan Wikman
3084e95772 MXS-1275: Implement qc_[get|set]_sql_mode for qc_sqlite 2017-06-28 21:36:08 +02:00
Johan Wikman
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
Johan Wikman
4bf2b27b3e MXS-1275: Accept @@[SESSION|GLOBAL].sql_mode = ... 2017-06-28 21:36:08 +02:00
Johan Wikman
21c1845798 MXS-1275: Accept LOCAL as a synonum for SESSION 2017-06-28 21:36:08 +02:00
Johan Wikman
2483f95be2 MXS-1275: Test comment handling 2017-06-28 21:36:08 +02:00
Johan Wikman
1c6c19d6ae MXS-1275: Inherit TrxBoundaryParser from CustomParser 2017-06-28 21:36:08 +02:00
Johan Wikman
9386143437 MXS-1275: Test also using non-contiguous statements 2017-06-28 21:33:04 +02:00
Johan Wikman
ee27efd62e MXS-1275: Add custom parser for "SET SQL_MODE=..."
SetSqlModeParser is a custom parser for detecting "SET SQL_MODE=..."
statements. It will be used in mysql_client and the result will be
used for updating the sql_mode of a session (that is to be added).

Thereafter, whenever a statement arrives, the value of that sql_mode
will be used for setting the mode of the query_classifier.
2017-06-28 21:33:04 +02:00
Johan Wikman
04cae711f6 MXS-1275: Add class for custom parsing
maxscale::CustomParser is a helper class to be used when making
custom recursive-descent parsers for detecting something specific.
2017-06-28 21:33:04 +02:00
Johan Wikman
cd1e3f26cf MXS-1275: Compile mysql_client as C++
A custom parser for detecting "set sql_mode=ORACLE" is needed
and writing that is C++ is more convenient than writing it in
C. Consequently, so as to be able to use that parser, mysql_client
must be compiled as C++.
2017-06-28 21:33:04 +02:00
Johan Wikman
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
Johan Wikman
cc0c193d2e MXS-1196: Run Oracle test only when built against 10.3 2017-06-28 21:33:04 +02:00
Johan Wikman
3cf2db32d7 Find right embedded library 2017-06-28 21:33:04 +02:00
Johan Wikman
d9b4013b69 MXS-1196: Add Oracle tests 2017-06-28 21:33:04 +02:00
Johan Wikman
9431aded48 MXS-1196: Do not translate keywords that arrive first 2017-06-28 21:33:04 +02:00
Johan Wikman
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
Johan Wikman
8b6fc49dc1 MXS-1196: Turn certain keywords into ids 2017-06-28 21:33:04 +02:00
Johan Wikman
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
Johan Wikman
b492f09d61 MXS-1196: Add Oracle tests 2017-06-28 21:33:04 +02:00
Johan Wikman
f9eef5ee3b MXS-1196: Classify SHOW as QUERY_TYPE_READ 2017-06-28 21:33:04 +02:00
Johan Wikman
49c9c60c63 MXS-1196: Parse arguments to CALL. 2017-06-28 21:33:04 +02:00
Johan Wikman
dd5360d30c MXS-1196: Handle delimiter explicitly, ignore comments 2017-06-28 21:33:04 +02:00
Johan Wikman
fd3258f7f7 MXS-1196: Ignore mysqltest keywords unless delim is ; 2017-06-28 21:33:04 +02:00
Johan Wikman
a73200ad50 MXS-1196: Add Oracle tests 2017-06-28 21:33:04 +02:00
Johan Wikman
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
Johan Wikman
332e1bbb7c MXS-1196: Add more Oracle tests 2017-06-28 21:33:04 +02:00
Johan Wikman
31f2b340ea MXS-1196: Add more Oracle tests 2017-06-28 21:33:04 +02:00
Johan Wikman
38863bd319 MXS-1196: Handle "exit" correctly
"exit" is both a mysqltest and PL/SQL keyword.
2017-06-28 21:33:04 +02:00
Johan Wikman
09b0c44be5 MXS-1196: Add new Oracle test 2017-06-28 21:33:04 +02:00
Johan Wikman
2a89a4de45 MXS-1196: Handle DECLARE
DECLARE can also begin an anonymous block in PL/SQL.
2017-06-28 21:33:04 +02:00
Johan Wikman
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
Johan Wikman
f26fb085bc MXS-1196: Handle "while" correctly
"while" is both a mysqltest and PL/SQL keyword.
2017-06-28 21:33:04 +02:00
Johan Wikman
b700a77da6 MXS-1196: Add test for Oracle sequences 2017-06-28 21:33:04 +02:00