340 Commits

Author SHA1 Message Date
6e48c6e969 fix to enable compile on loongarch 2023-06-01 15:51:13 +08:00
Johan Wikman
d632c195ff 2.4.19 Update change date 2022-01-04 15:47:38 +02:00
Johan Wikman
fa83259c62
MXS-3585 Fix problem 2021-11-15 12:37:41 +02:00
Johan Wikman
2a54224927 2.4.18 Update change date 2021-10-29 08:29:51 +03:00
Markus Mäkelä
ab71e93d49
Merge branch '2.3' into 2.4 2021-06-01 12:45:58 +03:00
Markus Mäkelä
b7e4ee6faa
Fix qc_sqlite compilation failure with GCC 11
The sqlite code is indented oddly:

In file included from query_classifier/qc_sqlite/qc_sqlite3.c:21:
sqlite-bld-3110100/sqlite3.c:98051:3: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
98051 |   if( a[0]<33 ) a[0] = 33;        assert( 33==sqlite3LogEst(10) );
      |   ^~
sqlite-bld-3110100/sqlite3.c:98051:35: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
98051 |   if( a[0]<33 ) a[0] = 33;        assert( 33==sqlite3LogEst(10) );
      |                                   ^~~~~~
2021-06-01 12:21:40 +03:00
Johan Wikman
aa1b481197 MXS-3535 Collect information from ON clause
In the case of qc_sqlite, it is done "precisely", while in the
case of qc_mysqlembedded rather bluntly. Not time well spent
to figure out exactly which pointer chains need to be walked.
2021-05-24 10:54:35 +03:00
Johan Wikman
a8bfbbe254 2.4.17 Update change date 2021-03-08 09:03:02 +02:00
Johan Wikman
0408bd9531 MXS-3404 Fix parsing of TRIM()
Now should accept all possible argument variations.
2021-03-01 08:54:25 +02:00
Johan Wikman
0224f24077 2.4.16 Update Change Date 2021-02-16 14:59:00 +02:00
Johan Wikman
b21c7f4a99 MXS-3408 Fix leak in qc_sqlite
Without this fix, there will be a leak every time a SELECT statement
uses ... PRECEDING or ... FOLLOWING (except for the case when ... is
UNBOUNDED).
2021-02-16 13:23:44 +02:00
Johan Wikman
0dd5ed23d3 MXS-3404 Fix problem by extending parser 2021-02-16 08:35:22 +02:00
Johan Wikman
797d7812cc MXS-3404 Extend sqlite3 op-size from u8 to u16
To make it possible to have more tokens than 255.

Parsers operators (i.e. tokens) is one thing and opcodes
for the virtual machine of sqlite3 is another. Unfortunately
they are not completely separate, but some of the opcodes
in <build-directory>/opcodes.h are the same as the tokens in
<build-directory>/parse.h. And while the parser tokens are now
16-bit, the VM opcodes are 8-bit. However, this is probably not
a problem even if some of the parser tokens that are duplicated
in the opcodes are > 256 as we only use sqlite3 for parsing and
not for executing anything (on the sqlite3 VM).
2021-02-15 20:06:00 +02:00
Johan Wikman
bc52c918fd MXS-3404 Accept hexadecimal literals 2021-02-12 18:50:33 +02:00
Johan Wikman
16a15e02be Merge branch '2.3' into 2.4 2021-02-08 10:05:23 +02:00
Johan Wikman
bf7d53dd23 MXS-3399 Fix heap-buffer overflow
The original code for catenating an SrcList to another assumed
that the list to be catenated had only 1 element. Now works
regardless of the number of items.
2021-02-08 09:49:16 +02:00
Johan Wikman
c5bcf7a8b1 2.4.15 Update change date 2021-01-18 15:30:30 +02:00
Johan Wikman
f496ab07eb Merge branch '2.3' into 2.4 2020-12-16 10:06:38 +02:00
Johan Wikman
2b8d5076e2 MXS-3318 Fix problem
When the tokenizer encounters a keyword, it sniffs whether the
last non-whitespace character before it happens to be a '.' and
if it is, the keyword is assumed to be the second part of a
qualified name.

Thus, before this commit

    -- blah.
    UPDATE ...

would not be parsed as KEYWORD (UPDATE) followed by stuff, but as
an ID (blah.UPDATE) followed by stuff.

With this change, newlines are no longer counted as whitespace.
2020-12-15 17:02:34 +02:00
Johan Wikman
df36ef86d0 2.4.14 Update Change Date 2020-11-16 14:23:26 +02:00
Johan Wikman
a1a1bdf93d MXS-3292 Fix bug
The string given to USE must be dequoted before being stored.
2020-11-11 12:37:36 +02:00
Johan Wikman
faaf7f483e 2.4.13 Update Change Date 2020-10-14 09:15:46 +03:00
Johan Wikman
babcda3eca 2.4.12 Update Change Date 2020-08-24 09:42:48 +03:00
Johan Wikman
c0cd751215 Merge branch '2.3' into 2.4 2020-08-20 14:29:16 +03:00
Johan Wikman
c5870cbaba MXS-3121 Expose statement currently being classified
Intended to be used from fatal signal handlers. As the statement will
be returned only while classification is in process, if a statement
is returned, it is an indication that the crash was caused by the
classification.
2020-08-20 13:27:55 +03:00
Johan Wikman
02b0a4c52c Merge branch '2.3' into 2.4 2020-08-19 16:37:52 +03:00
Johan Wikman
bf6ff8a578 MXS-3120 Check whether sqlite SrcList is NULL
According to bug-report it seems that a SrcList can be NULL. This
fixes the immediate problem, but it would be good to know in what
contexts the SrcList can be NULL so that the check could be made
before calling the function instead of checking (possibly
unnecessarily at times) in the function.
2020-08-19 16:37:24 +03:00
Markus Mäkelä
c0ea4cae54
Merge branch '2.3' into 2.4 2020-08-17 17:30:55 +03:00
Markus Mäkelä
9318319b96
Fix build failure with GCC 10.2
GCC is smart enough to detect that the address of a local variable is
returned. Since this appears to be code used for a debug assertion, we can
just return a null pointer.
2020-08-17 13:23:33 +03:00
Johan Wikman
fc9c9fcd77 2.4.11 Update change date 2020-07-07 10:01:38 +03:00
Johan Wikman
31eade1a75 Merge branch '2.3' into 2.4 2020-06-18 11:58:38 +03:00
Johan Wikman
c2c0b4ef60 Merge branch '2.3' into 2.4 2020-06-18 11:43:01 +03:00
Johan Wikman
9fb5336615 MXS-2996 Fix classification of "SELECT ... LOCK IN SHARE MODE"
And also of "SELECT ... FOR SHARE"
2020-06-18 10:17:08 +03:00
Johan Wikman
3972e372ae MXS-3041 Fix 'SELECT handler FROM t FOR UPDATE'
Problem was that 'handler' is a keyword. To make it work,
the keyword must be listed as one of those that turns into
an id where it cannot be used as a keyword.
2020-06-18 08:40:22 +03:00
Johan Wikman
5ebae9be90 Merge branch '2.3' into 2.4 2020-06-05 09:36:24 +03:00
Johan Wikman
aa11c960b1 2.3.20 Update change date 2020-06-05 09:31:45 +03:00
Johan Wikman
f5c118d27b Merge branch '2.3' into 2.4 2020-05-13 11:04:18 +03:00
Johan Wikman
b212117fd3 MXS-2990 Fix the problem, treat ! as not
If '!' is followed by '=' then it is NOT-EQUAL, otherwise it is
just NOT.
2020-05-13 10:38:07 +03:00
Markus Mäkelä
d3d7054639
Merge branch '2.3' into 2.4 2020-04-24 16:09:20 +03:00
Johan Wikman
f527a8f2e6 2.3.19 Update Change Date 2020-04-23 14:23:57 +03:00
Johan Wikman
d0ab797938 Merge branch '2.3' into 2.4 2020-03-12 10:33:57 +02:00
Johan Wikman
e0cd6adb26 Update change date for 2.3.18 2020-03-10 10:45:47 +02:00
Johan Wikman
163a7b3b84 MXS-2917 Add missing destructors to sqlite rules (2.4) 2020-03-09 16:01:49 +02:00
Johan Wikman
55425b22ce Merge branch '2.3' into 2.4 2020-03-09 15:45:37 +02:00
Johan Wikman
8dd9a4ca27 MXS-2917 Add missing destructors to sqlite rules
Lemon (the sqlite parser generator) destructors are needed for
all rules that return dynamically allocated structures. Otherwise
there may be leaks if a statement is not completely parsed.
2020-03-09 15:24:20 +02:00
Johan Wikman
0aae500577 MXS-2898 Classify @@last_insert_id() and last_insert_id() identically
With this change, both 'SET @my_id = (SELECT LAST_INSERT_ID())' and
'SET @my_id = (SELECT @@LAST_INSERT_ID)' are classified as

QUERY_TYPE_MASTER_READ|QUERY_TYPE_SESSION_WRITE|QUERY_TYPE_USERVAR_WRITE

Earlier @@last_insert_id had the QUERY_TYPE_READ bit set as well, which
indirectly caused the problems of MXS-2898.
2020-03-04 13:18:09 +02:00
Johan Wikman
4c2909e86c MXS-2227 Fix problem, parse OPTIMIZE statements
OPTIMIZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE
    tbl_name [, tbl_name] ...
    [WAIT n | NOWAIT]
2020-03-04 13:10:46 +02:00
Johan Wikman
ee8e43f26b MXS-2508 Fix problem
DIV and MOD are now also accepted instead of / and % respectively.
MOD is a keyword but (in principle incorrectly) decays into an id
when used in some other context. That is so that it will be
parser by the general function rule ("id ( ... )"). If used
incorrectly, the server will later reject.
2020-03-03 11:30:58 +02:00
Johan Wikman
8b763fb88b Merge branch '2.3' into 2.4 2020-02-12 08:27:48 +02:00
Johan Wikman
cfb3f79b54 Update 2.3.17 Change Date 2020-02-10 15:28:38 +02:00