Commit Graph

561 Commits

Author SHA1 Message Date
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
61b265467b MXS-1196: Add support for DROP SEQUENCE 2017-06-28 21:33:04 +02:00
6645a0581f MXS-1196: Add support for [SHOW] CREATE SEQUENCE 2017-06-28 21:33:04 +02:00
8b4e092d26 MXS-1196: Give same argument to both classifiers 2017-06-28 21:33:04 +02:00
bea8513f9d MXS-1196: Amend default arguments with given 2017-06-28 21:33:04 +02:00
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
116e2cd974 MXS-1196: Handle Oracle EXECUTE and PREPARE statements
- EXECUTE IMMEDIATE ...
- PREPARE stmt FROM dynamic string
2017-06-28 21:33:04 +02:00
7c1afe5d2c MXS-1196: Not all preparable stmts can be parsed
But the out arguments of ...get_[field|function]_infos must
be sensible and the functions must not crash.
2017-06-28 21:33:04 +02:00
66e027febd MXS-1196: Accept EXECUTE ... USING <INTEGER> 2017-06-28 21:33:04 +02:00
471fa01f40 MXS-1196: A single '?' is not a user variable 2017-06-28 21:33:04 +02:00
fba45fd763 MXS-1196: Add more Oracle tests 2017-06-28 21:33:04 +02:00
ee54f3ac61 MXS-1196: Hide implicit translations
The embedded library, when used in Oracle mode, reports the use of
"concat" as "concat_operator_oracle" and the use of "decode" as "case.
2017-06-28 21:33:04 +02:00
6c334aa12c MXS-1196: Add Oracle test 2017-06-28 21:33:04 +02:00
a5637a311c MXS-1196: Recognize builtin Oracle functions 2017-06-28 21:33:04 +02:00
1d2ca5cde7 MXS-1196: Translate NVL into IFNULL 2017-06-28 21:33:04 +02:00
abd12d1376 MXS-1196: Add Oracle test 2017-06-28 21:33:04 +02:00
c46f16041e MXS-1196: Ignore the DUAL table
The embedded parser ignores the DUAL table so it's better if
qc_sqlite does that as well.
2017-06-28 21:33:04 +02:00
339cc6cc0c MXS-1196: Add Oracle tests to the test suite 2017-06-28 21:33:04 +02:00
e6f8432e33 MXS-1196: Accept :'a' as placeholder variables
Oracle SQL accepts statements like

  PREPARE stmt FROM 'INSERT INTO t1 VALUES (:a,:b)';
  PREPARE stmt FROM 'INSERT INTO t1 VALUES (:"a",:"b")';

That is, the variable may be surrounded by quotes.
2017-06-28 21:33:04 +02:00
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
e80a378213 MXS-1196: Add 'sql_mode' argument to qc_sqlite 2017-06-28 21:33:04 +02:00
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
8c1d53192c MXS-1196: Handle REPLACE explicitly
Allowing REPLACE to implicitly decay into an identifier does not
work.
2017-06-28 21:33:04 +02:00
ceaf2110ab MXS-1196: Add smarter delimiter handling
DELIMITER $$;
--delimiter $$
2017-06-28 21:33:04 +02:00
e7ef6c855f MXS-1196: Register if variables are used in function calls 2017-06-28 21:33:04 +02:00
593070b865 MXS-1196: Tentative commit 2017-06-28 21:33:04 +02:00
0de99dc686 MXS-1196: Use a syntactically correct stmt for init 2017-06-28 21:33:04 +02:00
32d4a6a8c7 MXS-1196: Oracle mode needs to be turned on repeatedly
Seems it not sufficient to turn it on when the qc module is loaded.
2017-06-28 21:33:04 +02:00
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
422ea7f912 MXS-1196: In 10.3 a unary minus is not a function 2017-06-28 21:33:04 +02:00
0c51dd75fe MXS-1196: Pre 10.3 or 10.3 mode selected with option
The embedded parser of 10.3 parses things slightly differently than
how the embedded parser of earlier releases does. When comparing the
output of different query classifiers you need to be able to specify
with what qc_sqlite should be compatible with.
2017-06-28 21:33:04 +02:00
e0c78d4242 MXS-1196: Qc arguments are separated by ",", not by ";" 2017-06-28 21:33:04 +02:00
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
53dfa818e3 MXS-1196: Make MODE_ORACLE optional
Turned on by providing an argument when loading the query classifier.
2017-06-28 21:33:04 +02:00
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
62a64cba31 MXS-1196: Report user var read when prepared statements 2017-06-28 21:33:04 +02:00
da0900786a MXS-1196: Accept UNIQUE as synonym for DISTINCT 2017-06-28 21:33:04 +02:00
518f7e81ca MXS-1196: Handle preparable statements when db is 10.3 2017-06-28 21:33:04 +02:00
298d5642f6 MXS-1196: Accept top-level variable assignments
In Oracle you can write

    set autocommit=1
or
    autocommit:=1
2017-06-28 21:33:04 +02:00
9ae3ab522d MXS-1196: Turn on Oracle compatibility 2017-06-28 21:33:04 +02:00
13fad9933c MXS-1196: Make qc_mysqlembedded 10.3 compatible.
- Strings no longer null-terminated but pointer + length.
- Preparable statements NOT yet handled.
2017-06-28 21:33:04 +02:00
b191e6ecda MXS-1196: qc_mysqlembedded will not always claim a stmt was parsed
When developing the oracle related parser extensions, it makes
things simpler if also qc_mysqlembedded properly reports when
it cannot parse a statement.

Note, although this change is marked for 2.1, it will not be
merged into the first 2.1 GA release.
2017-06-28 21:33:04 +02:00
43ab0f036e MXS-1196: Do not parse EXPLAIN statements
EXPLAIN statements are no longer parsed completely as doing so makes
it hard to modify the grammar for the needs or Oracle SQL.

Consequently, for an EXPLAIN statement you now bascially only get the
type and the operation (the newly added QUERY_OP_EXPLAIN and QUERY_OP_SHOW).
The other information is not interesting and is related to
information_schema and similar tables.
2017-06-28 21:33:04 +02:00
65df87d801 Update query operation enum and add EXECUTE
Changed the query operation enum to contain implicit enum values instead
of providing. The operation was never used as a bitmask so it is pointless
to declare them as such.

Added the EXECUTE type to the enum and used it in qc_sqlite and
qc_mysqlembedded.
2017-06-22 10:40:18 +03:00
50b2316fa7 MXS-1249: Test json recognition
If the version if >= 10.2.3 recognized/builtin Json function should
be typed as QUERY_TYPE_READ while unrecognized ones should be typed
as QUERY_TYPE_READ | QUERY_TYPE_WRITE.
2017-06-21 13:28:59 +03:00
43895b6f28 MXS-1249: Add json functions
The json function are treated as read-only when the server version
is >= 10.2.3.
https://mariadb.com/kb/en/mariadb/json-functions/
2017-06-21 13:28:59 +03:00
dcfe118457 MXS-1249: Qc, the server version is passed as a single integer
To be compatible with how the version is managed elsewhere.
2017-06-21 13:28:59 +03:00
1034cc51be MXS-1249: Qc, allow setting the server version
In the case of qc_sqlite, the server version may affect how statements
are parsed.
2017-06-21 13:28:59 +03:00
3ef142bfe3 MXS-1249: Remove qc_dummy
Not used for anything and takes time and effort to keep up to date
with the query classifier API.
2017-06-21 13:28:59 +03:00