2018-10-31 03:11:35 +08:00
|
|
|
use crate::ffi;
|
2017-02-07 09:19:55 +08:00
|
|
|
use std::ffi::CStr;
|
|
|
|
|
2018-08-17 00:29:46 +08:00
|
|
|
/// Returns the SQLite version as an integer; e.g., `3016002` for version
|
|
|
|
/// 3.16.2.
|
2017-02-07 09:19:55 +08:00
|
|
|
///
|
2017-11-18 02:37:23 +08:00
|
|
|
/// See [`sqlite3_libversion_number()`](https://www.sqlite.org/c3ref/libversion.html).
|
2020-11-04 11:10:23 +08:00
|
|
|
#[inline]
|
2017-02-07 09:19:55 +08:00
|
|
|
pub fn version_number() -> i32 {
|
|
|
|
unsafe { ffi::sqlite3_libversion_number() }
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Returns the SQLite version as a string; e.g., `"3.16.2"` for version 3.16.2.
|
|
|
|
///
|
2017-11-18 02:37:23 +08:00
|
|
|
/// See [`sqlite3_libversion()`](https://www.sqlite.org/c3ref/libversion.html).
|
2020-11-04 11:10:23 +08:00
|
|
|
#[inline]
|
2017-02-07 09:19:55 +08:00
|
|
|
pub fn version() -> &'static str {
|
|
|
|
let cstr = unsafe { CStr::from_ptr(ffi::sqlite3_libversion()) };
|
2017-04-08 01:43:24 +08:00
|
|
|
cstr.to_str()
|
|
|
|
.expect("SQLite version string is not valid UTF8 ?!")
|
2017-02-07 09:19:55 +08:00
|
|
|
}
|