mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-22 16:29:20 +08:00
Remove usage of unstable library feature 'duration'
This commit is contained in:
parent
ef254fdca0
commit
9c415f9c9e
@ -50,7 +50,6 @@
|
||||
//! }
|
||||
//! }
|
||||
//! ```
|
||||
#![cfg_attr(test, feature(duration))]
|
||||
extern crate libc;
|
||||
extern crate libsqlite3_sys as ffi;
|
||||
#[macro_use] extern crate bitflags;
|
||||
|
10
src/trace.rs
10
src/trace.rs
@ -80,19 +80,17 @@ mod test {
|
||||
super::config_log(None).unwrap();
|
||||
}
|
||||
|
||||
extern "C" fn profile_callback(_: *mut ::libc::c_void, sql: *const ::libc::c_char, nanoseconds: u64) {
|
||||
use std::time::Duration;
|
||||
extern "C" fn trace_callback(_: *mut ::libc::c_void, sql: *const ::libc::c_char) {
|
||||
unsafe {
|
||||
let c_slice = ::std::ffi::CStr::from_ptr(sql).to_bytes();
|
||||
let d = Duration::from_millis(nanoseconds / 1_000_000);
|
||||
let _ = writeln!(::std::io::stderr(), "PROFILE: {:?} ({})", ::std::str::from_utf8(c_slice), d);
|
||||
let _ = writeln!(::std::io::stderr(), "TRACE: {:?}", ::std::str::from_utf8(c_slice));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_profile() {
|
||||
fn test_trace() {
|
||||
let mut db = SqliteConnection::open_in_memory().unwrap();
|
||||
db.profile(Some(profile_callback));
|
||||
db.trace(Some(trace_callback));
|
||||
db.execute_batch("PRAGMA application_id = 1").unwrap();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user