Skip to content

Wrong GUID to string conversion with SQLite BinaryGuid=False #2110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
oskarb opened this issue Apr 9, 2019 · 1 comment
Closed

Wrong GUID to string conversion with SQLite BinaryGuid=False #2110

oskarb opened this issue Apr 9, 2019 · 1 comment

Comments

@oskarb
Copy link
Member

oskarb commented Apr 9, 2019

Before NH 5.2, conversion from GUID to string (eg. entity.GuidProperty.ToString()) inside sqlite used a simple cast. This worked if BinaryGuid=False had been specified in the connection string.

Example SQL

    select
        cast(entity0_.Id as char) as col_0_0_ 
    from
        Entity entity0_

Following the fix for #1151 the conversion from GUID to string inside sqlite is now based on a sequence of substr() and hex(). This gives the correct result if BinaryGuid=True (the default), but not if BinaryGuid=False. This is a regression in NH 5.2 (seems undocumented).

@oskarb
Copy link
Member Author

oskarb commented Apr 9, 2019

In NH 5.2, when BinaryGuid=False, the resulting string from NHibernate's guid-to-string expressions for SQLite will be of this format:
36333033-6562-3061-2D63-3631652D343436622D616163342D383430366436366363343234

Before 5.2 it came out as a properly formatted GUID.

oskarb added a commit to oskarb/nhibernate-core that referenced this issue Apr 9, 2019
oskarb added a commit to oskarb/nhibernate-core that referenced this issue Apr 9, 2019
oskarb added a commit to oskarb/nhibernate-core that referenced this issue Apr 14, 2019
oskarb added a commit to oskarb/nhibernate-core that referenced this issue Apr 14, 2019
oskarb added a commit to oskarb/nhibernate-core that referenced this issue Apr 14, 2019
…).

The cases for nhibernateGH-2109 are marked as ignored for now, as that is not a regression.
oskarb added a commit to oskarb/nhibernate-core that referenced this issue Apr 14, 2019
oskarb added a commit to oskarb/nhibernate-core that referenced this issue Apr 22, 2019
…).

The cases for nhibernateGH-2109 are marked as ignored for now, as that is not a regression.
oskarb added a commit to oskarb/nhibernate-core that referenced this issue Apr 22, 2019
oskarb added a commit to oskarb/nhibernate-core that referenced this issue Apr 22, 2019
…).

The cases for nhibernateGH-2109 are marked as ignored for now, as that is not a regression.
oskarb added a commit to oskarb/nhibernate-core that referenced this issue Apr 22, 2019
oskarb added a commit to oskarb/nhibernate-core that referenced this issue Apr 22, 2019
…).

The cases for nhibernateGH-2109 are marked as ignored for now, as that is not a regression.
oskarb added a commit to oskarb/nhibernate-core that referenced this issue Apr 22, 2019
oskarb added a commit to oskarb/nhibernate-core that referenced this issue Apr 23, 2019
…).

The cases for nhibernateGH-2109 are marked as ignored for now, as that is not a regression.
oskarb added a commit to oskarb/nhibernate-core that referenced this issue Apr 23, 2019
fredericDelaporte pushed a commit that referenced this issue Aug 24, 2019
* Add helper methods to get the configured connection string
* Expand NH-3426 tests to expose GH-2110 (and GH-2109)
* Detect BinaryGuid setting and apply correct GUID-to-string expression
* Document the new sqlite.binaryguid setting

BinaryGuid is a configuration property of some MySql drivers, but relates to type used in the database for handling GUIDs, which impacts the dialect.

The cases for GH-2109 are marked as ignored for now, as that is not a regression.

Fixes #2110
@fredericDelaporte fredericDelaporte added this to the 5.2.6 milestone Aug 24, 2019
@fredericDelaporte fredericDelaporte changed the title SQLite GUID to string conversion wrong with BinaryGuid=False (regression) Wrong GUID to string conversion with SQLite BinaryGuid=False Aug 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants