sqlite3_set_errmsg#1752
Conversation
| pub unsafe fn set_errmsg( | ||
| db: *mut ffi::sqlite3, | ||
| code: c_int, | ||
| msg: Option<&std::ffi::CStr>, |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1752 +/- ##
==========================================
+ Coverage 87.57% 87.64% +0.06%
==========================================
Files 58 58
Lines 10825 10878 +53
==========================================
+ Hits 9480 9534 +54
+ Misses 1345 1344 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
b2454fc to
14ee3f1
Compare
There was a problem hiding this comment.
Pull request overview
Adds support for SQLite’s sqlite3_set_errmsg() API and improves error introspection/propagation so wrapper/extension callbacks can surface richer SQLite error information.
Changes:
- Add
Error::sqlite_extended_error_code()accessor and test coverage for extended error codes. - Expose
Connection::set_errmsg()(behindmodern_sqlite) and implement the underlyingerror::set_errmsg()wrapper. - Update collation-needed callback handling to propagate Rust callback errors to SQLite via
sqlite3_set_errmsg()when available.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/statement.rs | Extends an existing test to assert extended SQLite error code. |
| src/lib.rs | Adds a Connection::set_errmsg() API (feature-gated). |
| src/error.rs | Adds sqlite_extended_error_code() and an sqlite3_set_errmsg() wrapper. |
| src/collation.rs | Sets SQLite error code/message when collation-needed callback fails. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /// Set error code and message | ||
| /// # Safety | ||
| /// This function is unsafe because it uses raw pointer | ||
| #[cfg(feature = "modern_sqlite")] // 3.51.0 | ||
| pub unsafe fn set_errmsg( | ||
| db: *mut ffi::sqlite3, | ||
| code: c_int, | ||
| msg: Option<&std::ffi::CStr>, | ||
| ) -> Result<()> { |
There was a problem hiding this comment.
The # Safety docs for error::set_errmsg are currently too vague for an unsafe fn (it’s not just “uses raw pointer”). Please document the concrete safety preconditions (e.g., db must be a valid, open sqlite3* for the duration of the call; any threading/ownership expectations if applicable).
2111f38 to
711df8f
Compare
No description provided.