forked from diesel-rs/diesel
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Another improvment to the sqlite bind code
Any rust container like `Box<T>`, `Vec<T>` or `String<T>` internally contains a `Unique<T>` pointer, which communicates to the compiler that this container is the owner of that memory location and all access goes through that pointer. See rust-lang/unsafe-code-guidelines#194 for details. Passing out a pointer to the underlying buffer to sqlite could cause UB according to this definition, at least if someone else accesses the buffer through the originial pointer. To prevent that we temporarily leak the Buffer and manage the pointer by ourself. Additionally this change introduces a way to construct the `BoundStatement` as early as possible as part of the `BoundStatement::bind` function, so that all cleanup code can be concetracted in the corresponding `Drop` impl
- Loading branch information
Showing
1 changed file
with
139 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters