Skip to content
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

Binary Guid Handling with sqlite-net #284

Open
d0kt0r1 opened this issue May 23, 2014 · 3 comments
Open

Binary Guid Handling with sqlite-net #284

d0kt0r1 opened this issue May 23, 2014 · 3 comments

Comments

@d0kt0r1
Copy link

d0kt0r1 commented May 23, 2014

I have been working with a Windows Store app that relies on a Sqlite database.
The Guids are stored in the database in binary form.
In code, I am using the sqlite-net library to access the database.
However, sqlite-net by default, treats Guids as they are stored in string format.

What I am doing right now:
I am modifying:
https://github.com/praeclarum/sqlite-net/blob/master/src/SQLite.cs#L2238
to:
var byteArray = ((Guid)value).ToByteArray();
SQLite3.BindBlob(stmt, index, byteArray, byteArray.Length, NegativePointer);

and:
https://github.com/praeclarum/sqlite-net/blob/master/src/SQLite.cs#L2304
to:
var text = SQLite3.ColumnByteArray(stmt, index);//var text = SQLite3.ColumnString(stmt, index);

Is this the right way? Or I am missing some configuration tweak that might be done to the connection string.
If there is no support right now for such feature, I would be happy to implement it.

@d0kt0r1
Copy link
Author

d0kt0r1 commented Jun 7, 2014

Any update on this one?
Regards,
Genti

@praeclarum
Copy link
Owner

Sorry no updates - most people store the guids as text. But I would not be opposed to a StoreGuidAsBytes option PR.

gentledepp pushed a commit to Opti-Q/sqlite-net that referenced this issue Apr 18, 2020
gentledepp pushed a commit to Opti-Q/sqlite-net that referenced this issue Apr 18, 2020
gentledepp pushed a commit to Opti-Q/sqlite-net that referenced this issue Apr 18, 2020
@gentledepp
Copy link

so.. second try with our PR that solved this 2 years ago.
Maybe you will give it a try now ;-)

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

3 participants