Page 1 of 1

Problem with double backslash in TZQuery SQL property

Posted: 23.11.2005, 02:55
by carlosk
I am trying to execute a very simple INSERT query on MySQL 4.1 using a TZQuery object

INSERT INTO mediaobjects (description, filename, filepath, medialength, reallength, volume)
VALUES ('File1', 'File1.mpg', 'AFolder\\', '00:00:10:08', 0.0001194444, 0)

where TABLE `mediaobjects` (
`MO_ID` int(11) NOT NULL auto_increment,
`Description` varchar(80) ,
`FileName` varchar(255) ,
`FilePath` varchar(255) ,
`MediaLength` varchar(40) ,
`RealLength` double ,
`Volume` int(11) ,
PRIMARY KEY (`MO_ID`),
UNIQUE KEY `FileName` (`FileName`),
KEY `IDX_MediaObjects_1` (`MO_ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1

I had the same query stored into the TZQuery object''s design-time SQL property as:
INSERT INTO mediaobjects (description, filename, filepath, medialength, reallength, volume)
VALUES (:description, :fileName, :filePath, :mediaLength, :realLength, :volume);
and was setting the params during runtime. It worked fine that way

As soon as I changed it to runtime SQL assignment, I cannot longer execute any query containing a "\\" in the 'filepath' field value, even when the same query works fine when executed from MySQLBrowser.
I get the following error
SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '00:00:10:08', 0.0001194444, 0)' at line 1"

If filepath value doesn't contain any backslash, the query works ok
Any idea about this ?
Thanks, Carlos

Posted: 24.11.2005, 11:07
by zippo
Try using the sign "/" instead of "\". I don't know if it works here, but when using LOAD DATA INFILE it works..