mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-24 18:01:37 +08:00
Remove direct dependency on libsqlite3_sys
This commit is contained in:
parent
fe64d51422
commit
849dbda5e8
@ -18,6 +18,7 @@ use std::slice;
|
||||
use context::set_result;
|
||||
use error::error_from_sqlite_code;
|
||||
use ffi;
|
||||
pub use ffi::{sqlite3_vtab, sqlite3_vtab_cursor};
|
||||
use types::{FromSql, FromSqlError, ToSql, ValueRef};
|
||||
use {str_to_cstring, Connection, Error, InnerConnection, Result};
|
||||
|
||||
|
@ -1,17 +1,15 @@
|
||||
//! Ensure Virtual tables can be declared outside `rusqlite` crate.
|
||||
|
||||
extern crate libsqlite3_sys as ffi;
|
||||
#[cfg(feature = "vtab")]
|
||||
extern crate rusqlite;
|
||||
|
||||
#[cfg(feature = "vtab")]
|
||||
#[test]
|
||||
fn test_dummy_module() {
|
||||
use ffi;
|
||||
use rusqlite::vtab::{
|
||||
eponymous_only_module, Context, IndexInfo, VTab, VTabConnection, VTabCursor, Values,
|
||||
eponymous_only_module, sqlite3_vtab, sqlite3_vtab_cursor, Context, IndexInfo, VTab, VTabConnection, VTabCursor, Values,
|
||||
};
|
||||
use rusqlite::{Connection, Result};
|
||||
use rusqlite::{version_number, Connection, Result};
|
||||
use std::os::raw::c_int;
|
||||
|
||||
let module = eponymous_only_module::<DummyTab>();
|
||||
@ -19,7 +17,7 @@ fn test_dummy_module() {
|
||||
#[repr(C)]
|
||||
struct DummyTab {
|
||||
/// Base class. Must be first
|
||||
base: ffi::sqlite3_vtab,
|
||||
base: sqlite3_vtab,
|
||||
}
|
||||
|
||||
impl VTab for DummyTab {
|
||||
@ -32,7 +30,7 @@ fn test_dummy_module() {
|
||||
_args: &[&[u8]],
|
||||
) -> Result<(String, DummyTab)> {
|
||||
let vtab = DummyTab {
|
||||
base: ffi::sqlite3_vtab::default(),
|
||||
base: sqlite3_vtab::default(),
|
||||
};
|
||||
Ok(("CREATE TABLE x(value)".to_owned(), vtab))
|
||||
}
|
||||
@ -51,7 +49,7 @@ fn test_dummy_module() {
|
||||
#[repr(C)]
|
||||
struct DummyTabCursor {
|
||||
/// Base class. Must be first
|
||||
base: ffi::sqlite3_vtab_cursor,
|
||||
base: sqlite3_vtab_cursor,
|
||||
/// The rowid
|
||||
row_id: i64,
|
||||
}
|
||||
@ -88,7 +86,7 @@ fn test_dummy_module() {
|
||||
db.create_module::<DummyTab>("dummy", &module, None)
|
||||
.unwrap();
|
||||
|
||||
let version = unsafe { ffi::sqlite3_libversion_number() };
|
||||
let version = version_number();
|
||||
if version < 3008012 {
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user