Problems with GUID in existing database

Hi !

I have problems to store an GUID-field in the database.
In the database we use GUID-fields, stored in the field ID_User in a MySQL-Database.
The field is my primary-key in the database and is defined as binary(16), in the describing class in my project they are defined as TGUID.
The problem is as followed:
I fill the ID-field with TGUID.NewGuid and set the property with the value i.e.:
{426c32ed-96e2-49f7-8081-9e.....}
when the instance is saved I find in the database '{426c32ed-96e2-4', but I await the GUID converted into an array of bytes like:
ed326c42e296f74980819e .....

What must I do ? Must I convert the value before saving per code ? Where and how can I solve this with Aurelius ?

Best regards and greetings from the german Northseacoast

Rolf

Hi,

I guess this is database/adapter dependent. BUT I had a similar problem with Firebird binary UUIDs (16 octets). If I declared FId as string it would not fit the binary(16). The correct way would be to declare it as TBytes but than, this type is not supported for Id fields in Aurelius.

I found no solution so a created my own mod of Aurelius sources to add support for Firebird UUIDs (16 octets).

Good luck.

2 Likes

It really depends on how your id is declared (string or TGUID), which RDBMS you are using, and which component are you using to access the database. I'm also not sure where do you want to have the GUID converted to array of bytes?