-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
UUID Fix #1112
UUID Fix #1112
Conversation
Upon further investigating I found this was only an issue when I was inserting Codables. I have duplicated the issue by inserting a Codable and then querying the table for the UUID - it won't find it because it will compare an unwrapped UUID to one wrapped in quotes. |
Thanks for the PR. Looks like there are still some linting errors. |
Ok. Is there something I should run before I push an update? I should
probably look up lint and clean up my code.
…On Mon, Feb 21, 2022 at 2:15 AM Jan Berkel ***@***.***> wrote:
Thanks for the PR. Looks like there are still some linting errors.
—
Reply to this email directly, view it on GitHub
<#1112 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALJFUISZULV4CMDIVFOGTRLU4HYC7ANCNFSM5OY64MWA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Install
|
Sources/SQLite/Typed/Coding.swift
Outdated
@@ -207,6 +207,8 @@ private class SQLiteEncoder: Encoder { | |||
encoder.setters.append(Expression(key.stringValue) <- data) | |||
} else if let date = value as? Date { | |||
encoder.setters.append(Expression(key.stringValue) <- date.datatypeValue) | |||
} else if let uuid = value as? UUID { | |||
encoder.setters.append(Expression(key.stringValue) <- uuid.uuidString) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<- uuid.datatypeValue
} else { | ||
XCTFail("Search for uuid failed") | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the tests should be in QueryTests.swift
. Look for test_insert_encodable
Inserting a UUID as Expression<UUID> resulted in escaped quotes on either side of the uuidString and thus actual quotes stored inside the DB. When retrieving a row, the result of UUID(uudiString:) returns null when a uuidString with quotes on either side is given.
This appears to be an issue with JSONEncoder.
Fix pre-empts JSONEncoder and inserts a proper uuidString without escaped quotes on either side.