Skip to content

Conversation

@joshtriplett
Copy link
Contributor

This adds support for SQL conversions for the bstr::BString binary
string type, and for the git2::Oid object ID type. Both types are
encoded and decoded as bytes.

These types are database-independent and work with any database that can
handle bytes, so add tests that work with sqlite.

This allows queries to convert between BString and SQL data types.
This allows queries to convert between Oid and SQL data types.
@joshtriplett
Copy link
Contributor Author

With this, Decode seems to work, but Encode doesn't compile when used with either BString or Oid. I think the bound on Encode needs to be something like &'q [u8]: ... rather than [u8]: ....

@mehcode mehcode merged commit 603c195 into launchbadge:master Dec 19, 2020
@mehcode
Copy link
Member

mehcode commented Dec 19, 2020

Thanks! Got the impls merged and working. Only weirdness is I had to change the test because:

sqlite> SELECT 'abc123' is cast('abc123' as blob);
0
sqlite> SELECT  cast('abc123' as blob);
abc123
sqlite> SELECT cast('abc123' as blob) is cast('abc123' as blob);
1

@joshtriplett
Copy link
Contributor Author

@mehcode Much appreciated, thank you! I look forward to using these impls once the next release comes out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants