Skip to content

Conversation

glittershark
Copy link
Contributor

As discussed in #194, MySQL actually accepts arbitrary sequences of
bytes, not just utf-8 strings, as queries, but this crate is limited to
only working with types that impl AsRef. To allow sending arbitrary
byte slices as queries this commit, which goes along with and requires
blackbeam/rust_mysql_common#64, introduces a new
AsQuery trait, which is impl'd for all of the standard library types
that either impl AsRef or AsRef<[u8]>, and uses that trait in place
of AsRef<str> for all query methods, going on down the chain to error
types, internal cache structures, etc. as well.

As discussed in blackbeam#194, MySQL actually accepts arbitrary sequences of
bytes, not just utf-8 strings, as queries, but this crate is limited to
only working with types that impl AsRef<str>. To allow sending arbitrary
byte slices as queries this commit, which goes along with and requires
blackbeam/rust_mysql_common#64, introduces a new
`AsQuery` trait, which is impl'd for all of the standard library types
that either impl AsRef<str> or AsRef<[u8]>, and uses that trait in place
of `AsRef<str>` for all query methods, going on down the chain to error
types, internal cache structures, etc. as well.

Fixes: blackbeam#194
@glittershark
Copy link
Contributor Author

Will obviously fail CI until blackbeam/rust_mysql_common#64 is merged, since this includes an update to APIs broken there.

@blackbeam blackbeam merged commit f4f2ab6 into blackbeam:master Jun 1, 2022
@glittershark glittershark deleted the query-byte-slice branch June 1, 2022 15:15
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