150 Commits

Author SHA1 Message Date
Johan Wikman
a60b6473ed MXS-1275: Check for "set sql_mode=ORACLE" and act accordingly 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
cc0c193d2e MXS-1196: Run Oracle test only when built against 10.3 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
b492f09d61 MXS-1196: Add Oracle tests 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
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
Johan Wikman
8b4e092d26 MXS-1196: Give same argument to both classifiers 2017-06-28 21:33:04 +02:00
Johan Wikman
bea8513f9d MXS-1196: Amend default arguments with given 2017-06-28 21:33:04 +02:00
Johan Wikman
6b93a44be1 MXS-1196: Add PS tests
The names of the Oracle related tests are renamed as well to make it easier
to see what exactly fails.
2017-06-28 21:33:04 +02:00
Johan Wikman
fba45fd763 MXS-1196: Add more Oracle tests 2017-06-28 21:33:04 +02:00
Johan Wikman
6c334aa12c MXS-1196: Add Oracle test 2017-06-28 21:33:04 +02:00
Johan Wikman
abd12d1376 MXS-1196: Add Oracle test 2017-06-28 21:33:04 +02:00
Johan Wikman
339cc6cc0c MXS-1196: Add Oracle tests to the test suite 2017-06-28 21:33:04 +02:00
Johan Wikman
dece33f7b5 MXS-1196: Ignore "reset master"
Qc_sqlite does not parse that, so it needs to be commented out in
test files.
2017-06-28 21:33:04 +02:00
Johan Wikman
50413c5195 MXS-1196: Add Oracle specific tests
Copied from .../server/mysql-test/suite/compat/oracle/t

Will be used as a baseline and edited as needed.
2017-06-28 21:33:04 +02:00
Johan Wikman
ceaf2110ab MXS-1196: Add smarter delimiter handling
DELIMITER $$;
--delimiter $$
2017-06-28 21:33:04 +02:00
Johan Wikman
9ea380c456 MXS-1196: Turn on 10.3 mode for qc_sqlite
Turn on 10.3 mode for qc_sqlite if qc_mysqlembedded is built using 10.3.
2017-06-28 21:33:04 +02:00
Johan Wikman
8a0455c2fe MXS-1196: Allow delimiters to be multi-character
In some new test files, the delimiter is 2 characters.
2017-06-28 21:33:04 +02:00
Johan Wikman
cd6e9fa44b MXS-1196: Extend flags of compare
Sometimes you want to know whether the parsing using different
queryclassifiers differs, irrespective of whether they agree
upon the outcome or not.

With -R it is now possible to cause a difference in the return
value of qc_parse() to be printed.
2017-06-28 21:33:04 +02:00
Markus Mäkelä
8e2c7fd952 Merge branch '2.0' into 2.1 2017-05-10 09:12:42 +03:00
Johan Wikman
d70dad260a Implement collecting behaviour in qc_sqlite
By default, only the essentials - the type and the operation - of
a statement will be collected and only if fields, tables, functions
and databases are explicitly asked for, will they be collected.
However, a statement will be parsed at most twice; if parsing is
needed a second time then all information will be collected.

If it is known that some particular information is needed, then
qc_parse() can be called explicitly to ensure it is collected
at first parsing.
2017-03-22 11:09:36 +02:00
Johan Wikman
d0a9571da0 Introduce new qc_parse() prototype
It is now possible to specify what information the caller is interested
in. With this the cost for collecting information during the query parsing
that nobody is interested in can be avoided.
2017-03-22 11:09:36 +02:00
Johan Wikman
a58f944f23 Allow query classifier to initialize itself
The process and thread initialization/finalization of the query
classifier plugins is handled using the process and thread
initialization/finalization functions in the module object.

However, the top-level query classifier will also need to perform
process and thread initialization when transaction boundaries are
detected using regular expressions.
2017-03-15 09:35:15 +02:00
Markus Mäkelä
20d89717c7 Remove unused headers
The my_config.h headers are not used.
2017-03-09 13:02:23 +02:00
Johan Wikman
a6ae60c808 Merge branch '2.0' into 2.1 2017-03-07 11:45:49 +02:00
Markus Mäkelä
dd07feda07 MXS-1025: Parse SAVEPOINT statements
The various forms of the SAVEPOINT/RELEASE/ROLLBACK statements are now
fully parsed.
2017-03-07 08:44:21 +02:00
Johan Wikman
5648f708af Update license to BSL 1.1 2017-02-14 21:42:28 +02:00
Esa Korhonen
6e38276a20 Rename files, removing "gw"-prefix
Also gwdirs.h.in -> paths.h.in
2017-01-20 12:55:52 +02:00
Johan Wikman
16a76fcd28 Rename qc_get_type() to qc_get_type_mask()
To make it plain that it is a mask that is returned and not a
specific value from the enum qc_query_type_t.
2017-01-18 08:34:53 +02:00
Johan Wikman
20034b6fd6 QC: Exclude statement that qc_sqlite does not parse 2017-01-17 14:51:19 +02:00
Markus Mäkelä
3d92263cb3 Format query classifier modules
Formatted query classifier modules with Astyle.
2017-01-17 14:48:43 +02:00
Johan Wikman
cc6a3e629e Implement qc_get_preparable_stmt
Now returns the preparable statement as a GWBUF on which the
other qc-functions can be used.
2017-01-17 10:10:38 +02:00
Johan Wikman
8a95a0f045 Remove qc_get_prepare_operation
Since the whole preparable statement will be available, it is
superfluous to provide a function using which the operation of
the preparable statement can be obtained.
2017-01-17 10:10:38 +02:00
Johan Wikman
7fee90a399 Streamline query classifier API interface
- Only types of fixed size used in API interface
- The actual function return value specifies whether the parsing
  process succeeded, while "logical" return values are returned
  as out arguments.

The wrapper function currently ignores the function return value.
2017-01-17 10:10:38 +02:00
Johan Wikman
0ce7632f57 QC: Remove qc_is_real_query
Not used.
2017-01-16 14:17:56 +02:00
Johan Wikman
482fbe6400 qc: Implement qc_get_function_info for qc_mysqlembedded
MXS-1070

Now both qc_mysqlembedded and qc_sqlite return the same stuff
for the same statement, and both include also operators in
addition to pure functions. Whether that is the right approach,
is still subject to debate.

However, if we want to make it possible to disable e.g. the
use of concat as in "select concat(a) from t", where a is a string,
to prevent the bypassing of the masking filter, then conceptually
it should be possible to prevent "select a+0 from t", where a is an
int, as well.
2017-01-09 09:17:38 +02:00
Johan Wikman
d078f56dc5 qc: Reveal function usage
MXS-1070

Just interface changes. Implementation follow in separate changes.
2017-01-09 09:17:38 +02:00
Johan Wikman
8fc5bdc2f1 Perform query classifier initialization implicitly
The setting up and the initialization of the query classifier has
now been separated. The gateway explicitly sets up the query
classifier (i.e. chooses which one to use and what arguments to
provide), but the actual initialization is performed as part of
the general module initialization.
2017-01-09 09:16:35 +02:00
Johan Wikman
530c0e9617 QC: Setup and initialization separated
This is in preparation for using the general process/thread
initialization mechanism.
2017-01-09 09:16:35 +02:00
Johan Wikman
aa2de52054 Factor out .test-reading capability
The capability for reading MySQL/MariaDB .test-files has now been
factored out from the compare.cc test program. That way, the
functionality can be used from other test programs as well.
2016-12-13 12:15:57 +02:00
Johan Wikman
994299b4f1 MXS-1043: Handle @@identity like @@last_insert_id
The type of @@identity, @@last_insert_id and last_insert_id() is
now the same, that is, QUERY_TYPE_READ|QUERY_TYPE_MASTER_READ.
2016-12-02 11:38:27 +02:00