Bug #42876 DML Error 1064 for slash + single qoute depending on position in query string
Submitted: 16 Feb 2009 11:43 Modified: 16 Feb 2009 15:42
Reporter: Hannes Rhl Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Query Browser Severity:S2 (Serious)
Version:1.1.20 OS:Windows
Assigned to: CPU Architecture:Any

[16 Feb 2009 11:43] Hannes Rhl
Description:
In Query Browser (v 1.1.20) running the insert query below works:
INSERT INTO publish2.parts (id,cont) VALUES(2,'<?php $frameDat = array();$frameDat[\'url\']=&lt;?>');

The problem is inserting slash + single quote in the 'cont' value. It works if they are placed in any position after the last semicolon as:

INSERT INTO publish2.parts (id,cont) VALUES(2,'<?php $frameDat = array();$frameDat[\'url\']=&lt;\'?>');

If they are placed before the last semicolon however there's the error 1064 as in:

INSERT INTO publish2.parts (id,cont) VALUES(2,'<?php $frameDat = array();$frameDat[\'url\']=&lt\';?>');

How to repeat:
Create the table and run the queries above.

DROP TABLE IF EXISTS `publish2`.`parts`;
CREATE TABLE  `publish2`.`parts` (
  `id` varchar(255) NOT NULL default '',
  `fromDate` datetime NOT NULL default '0000-00-00 00:00:00',
  `params` mediumtext NOT NULL,
  `cont` text NOT NULL,
  `type` tinyint(3) unsigned NOT NULL default '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
[16 Feb 2009 12:00] Valeriy Kravchuk
Please, check with mysql command line client. I see no problem with \' in whatever position:

mysql> create database publish2;
Query OK, 1 row affected (0.23 sec)

mysql> DROP TABLE IF EXISTS `publish2`.`parts`;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> CREATE TABLE  `publish2`.`parts` (
    ->   `id` varchar(255) NOT NULL default '',
    ->   `fromDate` datetime NOT NULL default '0000-00-00 00:00:00',
    ->   `params` mediumtext NOT NULL,
    ->   `cont` text NOT NULL,
    ->   `type` tinyint(3) unsigned NOT NULL default '0'
    -> ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Query OK, 0 rows affected (0.33 sec)

mysql> INSERT INTO publish2.parts (id,cont) VALUES(2,'<?php $frameDat = array();
$frameDat[\'url\']=&lt\';?>');
ERROR 1364 (HY000): Field 'params' doesn't have a default value
mysql> INSERT INTO publish2.parts (id,cont,params) VALUES(2,'<?php $frameDat = a
rray();$frameDat[\'url\']=&lt\';?>', '');
Query OK, 1 row affected (0.03 sec)

mysql> select version();
+------------------------------+
| version()                    |
+------------------------------+
| 5.0.74-enterprise-gpl-nt-log |
+------------------------------+
1 row in set (0.05 sec)
[16 Feb 2009 13:49] Hannes Rhl
The problem does not exist in the mysql command line client.
[16 Feb 2009 14:21] MySQL Verification Team
Changing Category since isn't repeatable with client command line.
[16 Feb 2009 14:35] Valeriy Kravchuk
Please, try to repeat with a newer version of Query Browser then, 1.2.16, and inform about the results.
[16 Feb 2009 15:07] Hannes Rhl
Testing version 1.2.16: the problem does not exist in this later version.
[16 Feb 2009 15:42] Valeriy Kravchuk
Closed as not repeatable with 1.2.16.