exceptions and triggers

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
m227
Posts: 75
Joined: Mon 06 Aug 2007 12:41

exceptions and triggers

Post by m227 » Thu 23 Aug 2007 14:11

I have added a trigger to one of my tables which checks if the field value fulfills a custom pattern, and if not I put

Code: Select all

NEW.thatValidatedField = 'error'
The field i assign 'error' value to, is a numeric one, so when inserting not correct data in MySQL Query Browser (edit mode) i get a message in the info panel (lower part of result window) where is said "incorrect 'error' value for field...".
When I do it using DBGrid in Delphi, this field is filled with 0 (may be it is any string representation when throwing on numeric field), but I'd like to get any error message or/and prevent from inserting that field into table.
Can it be done with MyDAC? How to design Trigger and Table Field properties? (XP SP2, MySQL 5.0.45, MyDAC 5.10, TurboDelphi)

Michal

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

Post by Antaeus » Mon 27 Aug 2007 07:12

I could not reproduce the problem.
Please send me a complete small sample at evgeniyD*crlab*com to demonstrate it, including script to create the table with the trigger.

Post Reply