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.
BUT
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:
ONLY_FULL_GROUP_BY,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
id
?ìd
column is aint(10) unsigned
}
into%7D
to avoid difficulties when used in a URL string.}
comes from.