2017-02-06 20:19:55 -05:00
|
|
|
use ffi;
|
|
|
|
use std::ffi::CStr;
|
|
|
|
|
|
|
|
/// Returns the SQLite version as an integer; e.g., `3016002` for version 3.16.2.
|
|
|
|
///
|
2017-11-17 11:37:23 -07:00
|
|
|
/// See [`sqlite3_libversion_number()`](https://www.sqlite.org/c3ref/libversion.html).
|
2017-02-06 20:19:55 -05: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-17 11:37:23 -07:00
|
|
|
/// See [`sqlite3_libversion()`](https://www.sqlite.org/c3ref/libversion.html).
|
2017-02-06 20:19:55 -05:00
|
|
|
pub fn version() -> &'static str {
|
|
|
|
let cstr = unsafe { CStr::from_ptr(ffi::sqlite3_libversion()) };
|
2017-04-07 19:43:24 +02:00
|
|
|
cstr.to_str()
|
|
|
|
.expect("SQLite version string is not valid UTF8 ?!")
|
2017-02-06 20:19:55 -05:00
|
|
|
}
|