Accept either bytes or strings for queries #203
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 typesthat 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 errortypes, internal cache structures, etc. as well.