ZupdateSQL Boolean fields

Forum related to MySQL

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
andreass
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 28.12.2006, 15:03

ZupdateSQL Boolean fields

Post by andreass »

Hello,

I'm working with Delphi 6 and the Zeos 6.6 beta.
I've got a table in Mysql 5.0 which has a view fields declared as
enum('N','Y') NOT NULL default 'N'
The Field editor makes Boolean fields from this which is good.
If I insert a row I only want to insert one field with a value all other fields should take the default or stay NULL.
-> ZupdateSQL.INSERTSQL:
INSERT INTO KUNDEN
( KUNDEN.MATCHCODE, )
VALUES
(:MATCHCODE)
I put all the boolean fields to autogenerate (default), and required to false.
If I insert a row I get an EZSQLException in the Zdbcmysqlutils Unit (procedure checkmysqlerror).
Check your syntax near " 0,0,0,0,0,0,0,0,0,0,0,0,0,"
But I only wanted to update one field, why are there that many values.

Can anybody help me.

Thanks in advance
Andreas
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Hi Andreas,

Can you put a ZSQLMonitor on your form to make a tracefile where you can see the generated SQL statement that is wrong? It could maybe tell us where the error is.
andreass
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 28.12.2006, 15:03

Post by andreass »

Hi mdaems,

thats the tracefile:
0:22 cat: Connect, proto: mysql-5, msg: CONNECT TO "asreben" AS USER "root"
2006-12-29 09:10:22 cat: Execute, proto: mysql-5, msg: select *
from KUNDEN left join land
on kunden.land = land.lk
order by kdnr

2006-12-29 09:10:22 cat: Execute, proto: mysql-5, msg: SHOW TABLES FROM asreben LIKE 'KUNDEN'
2006-12-29 09:10:22 cat: Execute, proto: mysql-5, msg: SHOW COLUMNS FROM asreben.kunden LIKE '%'
2006-12-29 09:10:22 cat: Execute, proto: mysql-5, msg: SHOW TABLES FROM asreben LIKE 'land'
2006-12-29 09:10:22 cat: Execute, proto: mysql-5, msg: SHOW COLUMNS FROM asreben.land LIKE '%'
2006-12-29 09:10:22 cat: Execute, proto: mysql-5, msg: SELECT * FROM kundpos

2006-12-29 09:10:22 cat: Execute, proto: mysql-5, msg: SHOW TABLES FROM asreben LIKE 'kundpos'
2006-12-29 09:10:22 cat: Execute, proto: mysql-5, msg: SHOW COLUMNS FROM asreben.kundpos LIKE '%'
2006-12-29 09:10:30 cat: Execute, proto: mysql-5, msg: SELECT ''D'',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'', errcode: 1064, 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 ''',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,''' at line 1

From this 10 lines the first 9 are made when the application starts.
Then I used a tdbnavigator which is connected with a tzquery (first select statement), here I put on the insert Button, but it seems that no SQL statement is made for this.
Afterwards I inserted one field (matchcode) and then went one row forward, then i get this error.
andreass
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 28.12.2006, 15:03

Post by andreass »

I got the fault.
I had an char(3) field with 'D' as Default, but you have to write only D as default then everything works fine.

Andreas
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Thanks for notifying us of your solution.

Happy New Year an Best Wishes for 2007

Mark
Post Reply