Page 1 of 1

support for uuid for MariaDB

Posted: 27.03.2023, 13:57
by aducom
Recent versions of Maria support the uuid datatype. I could not find a way to implement it, so I dove into the code.
In ZDbcMySqlUtils.pas I added:

Code: Select all

  end else if TypeName = 'uuid' then begin
    FieldType := stGUID;
    ColumnSize := 16;
around line 668

Not sure how to implement it in a way that it is verified against mysql/maria.

Btw, I finally recovered my password, but there is no reset password on the login page...

Re: support for uuid for MariaDB

Posted: 28.03.2023, 13:52
by marsupilami
aducom wrote: 27.03.2023, 13:57 Recent versions of Maria support the uuid datatype. I could not find a way to implement it, so I dove into the code.
In ZDbcMySqlUtils.pas I added:

Code: Select all

  end else if TypeName = 'uuid' then begin
    FieldType := stGUID;
    ColumnSize := 16;
around line 668

Not sure how to implement it in a way that it is verified against mysql/maria.
I am also not sure ;) What happens if you fetch a uuid type from the database with the current Zeos? Is it represented as a string field? Something like char (16) or char (20)? The MariaDB documentation on the UUID Data Type seems to suggest that it is transported as a string:
Data retrieved by this data type is in the string representation defined in RFC4122.
aducom wrote: 27.03.2023, 13:57 Btw, I finally recovered my password, but there is no reset password on the login page...
Unfortunatel there is no way to recover lost passwords because the forums cannot send emails. This is a limitation by sourceforge.

Re: support for uuid for MariaDB

Posted: 02.04.2023, 19:48
by aducom
Yes, the field is treated as a string in Lazarus. When applied, the format must comply with the uuid specs. As UUid is an existing datatype for oracle, postgres and sqlserver, I guess they will be treated the same way.

Re: support for uuid for MariaDB

Posted: 05.04.2023, 08:42
by marsupilami
Hello aducom,

the problem here is that at least MariaDB decided to have a column type for UUIDs but they don't have a new data type. So we will have to inspect a result set if it could have a uuid column and then later on check with the database if it really is a uuid column because it could as well just be a char or varchar column. Also we will have to convert between string and byte representation when transferring data.

I will have to set up a new MariaDB instance to check this further. Also these changes might only make it into Zeos 8 and not into Zeos 7.2 - depending on Zeos 7.2 support for UUID columns.

With best regards,

Jan

Re: support for uuid for MariaDB

Posted: 06.04.2023, 09:41
by aducom
Actually, I expect that the implementation of MariaDB complies with what other databases do. See https://mariadb.com/kb/en/uuid-data-type/.
As UUID is not a real datatype (in any programming language), I assume they are all treated similarly. In my code, I did not experience issues as the field is accepted as a string as long as the UUID format is correct. As MySQL does not have this datatype, it will not report this in the metadata. So I don't expect issues here. The only thing for devs to remember is that using UUID datatype breaks interchangeability with MySQL. That can be an issue. But the datatype is supported by most databases, and I expect that MySQL will follow.