SQL error on conditional comments.

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
DidierG
Posts: 6
Joined: Thu 30 Jan 2020 10:35

SQL error on conditional comments.

Post by DidierG » Thu 30 Jan 2020 11:33

Hi all,

I get a SQL error with Mydac version 10.1.2 when I execute a query with conditional comments in which there is a colon (:).
In this case, all conditional queries are not executed.

Originally, I had the problem when I executed the query from a dump file because of the following line :
/*!40103 SET TIME_ZONE='+00:00' */;

This is the beginning of the query:

Code: Select all

-- MySQL dump 10.13 Distrib 5.7.13, for Win64 (x86_64)
--
-- Host: localhost Database: test_didier
-- ------------------------------------------------------
-- Server version 5.7.13-log

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Current Database: `test_didier`
--

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test_didier` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_bin */;

USE `test_didier`;
This is the SQL error:
#42000You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; -- -- CREATE DATABASE `test_didier` ; ' at line 6


It is possible to reproduce the problem easily.
This request without (:) works:

Code: Select all

/*!40103 SET @TOTO='+0000' */;
SELECT @TOTO
This one doesn't work:

Code: Select all

/*!40103 SET @TOTO='+00:00' */;
SELECT @TOTO
SQL Error: #42000You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '; SELECT @TOTO' at line 1

For information, mySQL version is 5.7.

How can I fix this error.

Thanks in advance and sorry for my bad english.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: SQL error on conditional comments.

Post by ViktorV » Fri 31 Jan 2020 13:04

Thank you for the information. The issue investigation is in progress. We will inform you when we have any results.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: SQL error on conditional comments.

Post by ViktorV » Fri 31 Jan 2020 14:11

Thank you for the information. We have reproduced and fixed the issue. This fix will be included in the next build of IBDAC.

DidierG
Posts: 6
Joined: Thu 30 Jan 2020 10:35

Re: SQL error on conditional comments.

Post by DidierG » Mon 03 Feb 2020 08:36

Hi,

Thank you for the answer.
ViktorV wrote: Fri 31 Jan 2020 14:11 This fix will be included in the next build of IBDAC.
I hope mean MYDAC. ;-)

Can I know when the new build will be released or is there a way for me to make the correction on the current version?
We have a problem with this on our main application.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: SQL error on conditional comments.

Post by ViktorV » Mon 03 Feb 2020 09:14

Sorry for the inaccuracy in the previous post. I meant MyDAC.
As soon as we have a stable night build, we will be able to send it to you.
Please provide your license number and IDE version to us using the contact form https://devart.com/company/contactform.html and we will send you a night build.

Post Reply