Bug in GUID fields

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
createmark
Posts: 9
Joined: Wed 01 Jun 2011 07:54

Bug in GUID fields

Post by createmark » Fri 11 Jan 2019 11:36

Hi,

I use last version of SDAC (8.2.8) for RAD Studio 10.2 + MS SQL Server 2012.

Tested with TMSQuery. I found bug on adding GUID data. For example you have table with uniqueidentifier column and trying to add data from client application that use TMSQuery.

If you pass such value {00000000-0000-0000-0000-000000000001} - everything fine.
But if you pass value without brackets 00000000-0000-0000-0000-000000000001 application shows exception: Invalid class string.

Thanks,
Alexey

Stellar
Devart Team
Posts: 215
Joined: Tue 03 Oct 2017 11:00

Re: Bug in GUID fields

Post by Stellar » Tue 15 Jan 2019 09:14

To convert a GUID string view into an equivalent TGUID data structure, SDAC uses a standard StringToGUID function.
The string literal must be enclosed in parentheses and look in the following way:
'{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}'
It is a standard approach in Delphi for the work with GUID.

createmark
Posts: 9
Joined: Wed 01 Jun 2011 07:54

Re: Bug in GUID fields

Post by createmark » Tue 15 Jan 2019 18:53

Hi,

Yes, you're right. But both {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} and XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX are correct too, so what's problem to check ingoing value on existing of brackets? When I got this strange error i spent lot of time to figure out, what's problem. For MS SQL Server both values are correct. I can receive GUID value from different sources, and I can get GUID without brackets in this case i will receive this strange error. This mean that I need to check every GUID on existing of brackets. I cannot believe that you think this that it good solution.

For my opinion it's bug or bad architecture.

Stellar
Devart Team
Posts: 215
Joined: Tue 03 Oct 2017 11:00

Re: Bug in GUID fields

Post by Stellar » Fri 18 Jan 2019 10:25

Thank you for the information. We have fixed the issue, and the fix will be included in the next SDAC build.

createmark
Posts: 9
Joined: Wed 01 Jun 2011 07:54

Re: Bug in GUID fields

Post by createmark » Fri 18 Jan 2019 12:18

Hi,

Thank you so much.

Post Reply