You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 25, 2020. It is now read-only.
Repository navigation
This repository was archived by the owner on Jul 25, 2020. It is now read-only.
The function sqlite3_errmsg returns the error message from "the most recent call". If this is going to be exposed then every single function calling a sqlite3_* function needs to take a mutable self, otherwise this function will be racy.
Probably the better thing is to not expose this message and instead bundle its result into any Errs that are returned from SqliteResult-returning function, since it is not very Rustic to have error reporting be separated from error occurance like this.
Ditto for Database::get_changes() and Database::get_last_insert_rowid(), which are the kind of functions that should be safe to call from multiple threads, provided that no thread has mutable access. Rust can enforce this (allowing the Database to be both Send and Share) but every method which modifies the underlying database (exec at least) would need to take a &mut self, as per my other bug report(s).
I think the correct model for mapping between the Rust Database and the database is that anything that might mutate the database should require mutable access to the Database, exactly so that these functions can work in a threadsafe way.
Activity
fixes various mutability problems.
apoelstra commentedon Jul 30, 2014
Ditto for
Database::get_changes()andDatabase::get_last_insert_rowid(), which are the kind of functions that should be safe to call from multiple threads, provided that no thread has mutable access. Rust can enforce this (allowing theDatabaseto be bothSendandShare) but every method which modifies the underlying database (execat least) would need to take a&mut self, as per my other bug report(s).I think the correct model for mapping between the Rust
Databaseand the database is that anything that might mutate the database should require mutable access to theDatabase, exactly so that these functions can work in a threadsafe way.