Binary(16) GUID leads to "found 0 records" errors
Posted: Tue 25 Feb 2020 23:06
Greetings. I have a MySQL database, some of whose tables have primary keys derived from GUIDs. The GUIDs are stored in BINARY(16) fields as I've seen recommended in various fora. These fields are populated using a BEFORE INSERT trigger that sets the value to UNHEX(REPLACE(UUID(), '-', '')). This works fine when I work with the tables using MySQL through Heidi. I can add, edit, and delete records, either directly in the Data view or using SQL.
My problem is that when I try to work with these tables using MyDAC MyTable or MyQuery components, in some cases updating or deleting a record leads to an "Update failed. Found 0 records." error. This doesn't happen with all the tables, but it happens consistently with some. It happens both when I run the app and when I work with the data using the Data Editor dialog that's available from the SQL dialog I get by double-clicking the MyDAC component.
Why do these MyDAC components fail to work successfully with these Binary key fields? Is there some setting somewhere that I can use to get around this issue? I'm not really looking forward to the idea of restructuring my database to use some other primary key type. Thanks for any suggestions.
My problem is that when I try to work with these tables using MyDAC MyTable or MyQuery components, in some cases updating or deleting a record leads to an "Update failed. Found 0 records." error. This doesn't happen with all the tables, but it happens consistently with some. It happens both when I run the app and when I work with the data using the Data Editor dialog that's available from the SQL dialog I get by double-clicking the MyDAC component.
Why do these MyDAC components fail to work successfully with these Binary key fields? Is there some setting somewhere that I can use to get around this issue? I'm not really looking forward to the idea of restructuring my database to use some other primary key type. Thanks for any suggestions.