777 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
Markus Mäkelä
47601363a9
MXS-3873: Add test case
The test makes sure this problem is fixed by the fix for MXS-3585.
2021-11-15 12:54:40 +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
e9b767d463 MXS-3535 Fix tests
Some minor discrepancies are simply ignored at this point in time.
2021-05-24 10:57:13 +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
e7f9a5bd65 MXS-3535 Add test that reveals the problem
qc_sqlite does not collect from ON.
2021-05-24 10:50: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
49d56c31bc MXS-3404 Add tests for all trim() cases 2021-03-01 08:33:06 +02:00
Johan Wikman
66bb716ff0 MXS-3408 Fix leak in qc_mysqlembedded properly
The actual cause was a missing cleanup call.
2021-02-17 17:00:08 +02:00
Johan Wikman
8df55ca913 Merge branch '2.4.16' into 2.4 2021-02-17 13:49:29 +02:00
Johan Wikman
4724a0c79a MXS-3408 "Fix" leak in qc_mysqlembedded 2021-02-17 08:40:41 +02:00
Johan Wikman
0224f24077 2.4.16 Update Change Date 2021-02-16 14:59:00 +02:00
Johan Wikman
eca0d0d5f0 MXS-3408 Fix crash in qc_mysqlembedded
Calling send_eof() crashes nowadays and was anyway a workaround
for dynamic_cast, in the distant past when dynamic_cast did not
work.
2021-02-16 14:34:22 +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
5f42ee88c9 MXS-3404 Add test that reveals problem 2021-02-15 10:08:32 +02:00
Johan Wikman
3e7c937dbf MXS-3404 Plug one leak in test program
So keep Asan happy.
2021-02-12 18:51:15 +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
9481abb42d MXS-3318 Translate newlines in stmts given to compare
A \n encounted in a string given to the query classifier test
program compare, is not converted into a newline. Makes it easier
to debug problems related to newlines.
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
b459b6f13f MXS-3292 Add test that reveals bug 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
1dd06c3ebc MXS-2996 Add test that reveals problem
SELECT * FROM test LOCK IN SHARE MODE
  SELECT * FROM test FOR SHARE

should be classified as QUERY_TYPE_WRITE.
2020-06-18 10:14:16 +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
f96c8d3a97 MXS-3041 Add test that reveals problem 2020-06-18 08:35:33 +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