PostgreSQL and GUID

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Bert1234
Posts: 8
Joined: Fri 25 Mar 2016 15:36

PostgreSQL and GUID

Post by Bert1234 » Fri 25 Mar 2016 15:45

The default presentation of uuid differs from the guid used by Microsoft on Windows systems.
PostgreSQL recognizes the Microsoft format with curly braces.

The following works:

Code: Select all

select * from tablename
where fieldname = '{39a46e00-6f7a-49da-9745-782ffca2ee8d}'
Now, when I use a TUniTable component and hook that up to tablename, the following doesn't work:

Code: Select all

UniTable1.Locate('fieldname', '{39a46e00-6f7a-49da-9745-782ffca2ee8d}', []);
The Locate function always returns False.

The following works:

Code: Select all

UniTable1.Locate('fieldname', '39a46e00-6f7a-49da-9745-782ffca2ee8d', []);
The problem is that I don't know (or don't want to know) which database I am connected to. Sometimes I can use SQL which works fine, but sometimes I need the TUniTable approach.

Is there a setting available to let the Locate work with TUniTable?

Regards,
Bert

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: PostgreSQL and GUID

Post by AlexP » Mon 28 Mar 2016 10:40

Hello,

The Locate method searches for data in the DataSet (and not generates a query to the server), and the server returns uuid without braces. Therefore you should manually remove braces when using Locate.

Post Reply