Sample Header Ad - 728x90

MySQL not throwing some errors in prepared statement

1 vote
0 answers
194 views
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
Asked by Marlon de Oliveira dos Santos (11 rep)
May 26, 2022, 04:08 PM
Last activity: May 26, 2022, 04:41 PM