If I run the following query:
DELETE FROM `table` where `id` = '123%7D';
Notice the gibberish at the end of the where clause
I get the following error
ERROR 1292 (22007): Truncated incorrect DOUBLE value: '123%7D'
Which is the expected behavior since I'm running a MySQL (5.7.33-log) database on strict mode.
If I run the same query on a prepared statement:
PREPARE stmt FROM "delete from `table` where `id` = ?;"; SET @id = '1234%7D'; EXECUTE stmt USING @id;
The query runs fine without any error, which in my view is not expected behavior
My question is, how can I make prepared queries throw the same errors that they would throw as if they where not prepared?
Thanks in advance.
My @@sql_mode value is:
ìdcolumn is a
%7Dto avoid difficulties when used in a URL string.