1

Topic: Problem with GUID (Firebird 3.0.2, Delphi XE3, FIBPlus7.5)

Colleagues, prompt in what there can be a problem.
Firebird 3.0.2, Delphi XE3 + FIBPlus7.5
In basis I write down one GUID, and  absolutely another...
In basis I create so:

CREATE DOMAIN D_GUID AS CHAR (16) CHARACTER SET OCTETS COLLATE OCTETS;
CREATE TABLE GUIDTEST (
ID INTEGER GENERATED BY DEFAULT AS IDENTITY;
GUID D_GUID
);
INSERT INTO GUIDTEST (GUID) VALUES (CHAR_TO_UUID (' 566D179A-A30F-449B-8F82-77BE246907CF '));

In Delfi:

object pFIBDataSet1: TpFIBDataSet
SelectSQL.Strings = (' SELECT * FROM GUIDTEST ')
...
poUseGuidField = True
end
ShowMessage (GUIDToString ((F.pFIBDataSet1.FieldByName (' GUID ') as TFIBGuidField).AsGuid));

In the answer I receive "{9A176D56-0FA3-9B44-8F82-77BE246907CF}" that is completely not similar on initial "566D179A-A30F-449B-8F82-77BE246907CF"... IBExpert at review of the data of the table shows "566D179A-A30F-449B-8F82-77BE246907CF".
FIB' , or I not so do something?

2

Re: Problem with GUID (Firebird 3.0.2, Delphi XE3, FIBPlus7.5)

ShowMessage (F.itFBDataSet1.FieldByName (' GUID ').ClassName);

Produces "TFIBGuidField"

3

Re: Problem with GUID (Firebird 3.0.2, Delphi XE3, FIBPlus7.5)

developer0118 wrote:

Colleagues, prompt in what there can be a problem.
In Delfi:

object pFIBDataSet1: TpFIBDataSet
SelectSQL.Strings = (' SELECT * FROM GUIDTEST ')
...
poUseGuidField = True
end

FIB' , or I not so do something?

And why you consider, what  without sorting and conditions returns you the last record?

4

Re: Problem with GUID (Firebird 3.0.2, Delphi XE3, FIBPlus7.5)

And if so

SELECT TOP 1 * FROM GUIDTEST ORDER BY ID DESC

5

Re: Problem with GUID (Firebird 3.0.2, Delphi XE3, FIBPlus7.5)

developer0118;
{9A176D56-0FA3-9B44-8F82-77BE246907CF}
{566D179A-A30F-449B-8F82-77BE246907CF}
Bytes are confused.

6

Re: Problem with GUID (Firebird 3.0.2, Delphi XE3, FIBPlus7.5)

SQL2008 wrote:

And why you consider, what  without sorting and conditions returns you the last record?

Because there the unique record.

7

Re: Problem with GUID (Firebird 3.0.2, Delphi XE3, FIBPlus7.5)

Hommer wrote:

developer0118;
{9A176D56-0FA3-9B44-8F82-77BE246907CF}
{566D179A-A30F-449B-8F82-77BE246907CF}
Bytes are confused.

That is, an error somewhere in GetAsGuid at FIB'?

8

Re: Problem with GUID (Firebird 3.0.2, Delphi XE3, FIBPlus7.5)

developer0118;
The debugger shows where smile

9

Re: Problem with GUID (Firebird 3.0.2, Delphi XE3, FIBPlus7.5)

Still , also it became somehow absolutely sad...
http://firebirdsql.su/doku.php?id=char_to_uuid
[quote =] It is an error or a feature?
The result of conversion CHAR_TO_UUID and UUID_TO_CHAR in FB 2.5.2 differs from accepted in Windows (For example, CLSIDFromString and StringFromCLSID from Ole32.dll, or StringAsGUID, GUIDAsString, GUIDAsStringToPChar from Delphi 7) a sequence byte.
Win32 API: B3 B2 B1 B0 B5 B4 B7 B6 B8 B9 BA BB BC BD BE BF Firebird: B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
For example, from one TGUID we receive: Win32 API: 9B47BC19-D0AE-5243-A37D-AF26806BFEEA Firebird: 19BC479B-AED0-4352-A37D-AF26806BFEEA