mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-23 00:39:20 +08:00
Improve documentation.
This commit is contained in:
parent
9c415f9c9e
commit
59a4c5593a
@ -1,3 +1,4 @@
|
||||
//! Tracing and profiling functions. Error and warning log.
|
||||
use libc::{c_char, c_int, c_void};
|
||||
use std::ffi::CString;
|
||||
use std::ptr;
|
||||
@ -30,12 +31,16 @@ pub fn log(err_code: c_int, msg: &str) {
|
||||
}
|
||||
}
|
||||
|
||||
/// The trace callback function signature.
|
||||
pub type TraceCallback =
|
||||
Option<extern "C" fn (p_arg: *mut c_void, z_sql: *const c_char)>;
|
||||
/// The profile callback function signature.
|
||||
pub type ProfileCallback =
|
||||
Option<extern "C" fn (p_arg: *mut c_void, z_sql: *const c_char, nanoseconds: u64)>;
|
||||
|
||||
impl SqliteConnection {
|
||||
/// Register or clear a callback function that can be used for tracing the execution of SQL statements.
|
||||
///
|
||||
/// Prepared statement placeholders are replaced/logged with their assigned values.
|
||||
/// There can only be a single tracer defined for each database connection.
|
||||
/// Setting a new tracer clears the old one.
|
||||
@ -44,6 +49,7 @@ impl SqliteConnection {
|
||||
unsafe { ffi::sqlite3_trace(c.db(), x_trace, ptr::null_mut()); }
|
||||
}
|
||||
/// Register or clear a callback function that can be used for profiling the execution of SQL statements.
|
||||
///
|
||||
/// There can only be a single profiler defined for each database connection.
|
||||
/// Setting a new profiler clears the old one.
|
||||
pub fn profile(&mut self, x_profile: ProfileCallback) {
|
||||
|
Loading…
Reference in New Issue
Block a user