TMemoField update

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Klaus Schirra
Posts: 3
Joined: Mon 19 Jun 2006 22:47

TMemoField update

Post by Klaus Schirra » Mon 19 Jun 2006 23:24

Hi,

I want to save sql-statements in a TMemoField.

Debug Example:
UPDATE berichte
SET
SQL = :6
WHERE
ID = :Old_1 AND Deleted = :Old_2 AND Name = :Old_3 AND HauptMenu = :Old_4 AND Menu IS NULL AND WFile = :Old_7 AND RFile IS NULL AND Freigabe = :Old_9 AND Seitentitel = :Old_10 AND C_DAT = :Old_11 AND I_dat = :Old_12 AND Adr_ersatz = :Old_13

:6(Memo,IN)=
:Old_1(Integer,IN)=2000
:Old_2(Integer,IN)=1
:Old_3(FixedChar[13],IN)='Dozentenliste'
:Old_4(FixedChar[8],IN)='Berichte'
:Old_7(FixedChar[12],IN)='TN_Liste.dot'
:Old_9(SmallInt,IN)=0
:Old_10(FixedChar[13],IN)='Dozentenliste'
:Old_11(DateTime,IN)=01.01.1980
:Old_12(DateTime,IN)=01.01.1980
:Old_13(SmallInt,IN)=0

Result:
#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 'SQL, WFile, Freigabe, Seitentitel, C_DAT, I_dat, Adr_ersatz)
VALUES
(2000, 1' at line 2

Without the Memo-Field Update is successfull.

Any idea, i tried all workarounds mentioned in this forum.

Klaus Schirra
Posts: 3
Joined: Mon 19 Jun 2006 22:47

Post by Klaus Schirra » Tue 20 Jun 2006 06:23

Problem must be the fieldname "SQL" in my SQL-statement.
Is this fieldname not allowed?

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Tue 20 Jun 2006 07:04

You try using reserved word 'SQL' as field name. To avoid this problem you should set option QuoteNames to True.

Klaus Schirra
Posts: 3
Joined: Mon 19 Jun 2006 22:47

Post by Klaus Schirra » Tue 20 Jun 2006 07:48

thanks Antaeus... :D

GEswin
Posts: 186
Joined: Wed 03 Nov 2004 16:57
Location: Spain
Contact:

Post by GEswin » Tue 20 Jun 2006 20:44

Best is not to use reserved words as field/table/view etc names. Have a look at http://dev.mysql.com/doc/refman/5.0/en/ ... words.html to know which ones are reserved. This will avoid you a lot of problems ;)

Post Reply