mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-25 02:21:37 +08:00
Check current SQLite version while registering module
This commit is contained in:
parent
6e0684b69f
commit
33e5f127cf
@ -62,11 +62,15 @@ pub enum VTabKind {
|
|||||||
/// Non-eponymous
|
/// Non-eponymous
|
||||||
Default,
|
Default,
|
||||||
/// [`create`](CreateVTab::create) == [`connect`](VTab::connect)
|
/// [`create`](CreateVTab::create) == [`connect`](VTab::connect)
|
||||||
|
///
|
||||||
|
/// See [SQLite doc](https://sqlite.org/vtab.html#eponymous_virtual_tables)
|
||||||
Eponymous,
|
Eponymous,
|
||||||
/// No [`create`](CreateVTab::create) / [`destroy`](CreateVTab::destroy) or
|
/// No [`create`](CreateVTab::create) / [`destroy`](CreateVTab::destroy) or
|
||||||
/// not used
|
/// not used
|
||||||
///
|
///
|
||||||
/// SQLite >= 3.9.0
|
/// SQLite >= 3.9.0
|
||||||
|
///
|
||||||
|
/// See [SQLite doc](https://sqlite.org/vtab.html#eponymous_only_virtual_tables)
|
||||||
EponymousOnly,
|
EponymousOnly,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -835,6 +839,13 @@ impl InnerConnection {
|
|||||||
module: &'static Module<'vtab, T>,
|
module: &'static Module<'vtab, T>,
|
||||||
aux: Option<T::Aux>,
|
aux: Option<T::Aux>,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
|
use crate::version;
|
||||||
|
if version::version_number() < 3_009_000 && module.base.xCreate.is_none() {
|
||||||
|
return Err(Error::ModuleError(format!(
|
||||||
|
"Eponymous-only virtual table not supported by SQLite version {}",
|
||||||
|
version::version()
|
||||||
|
)));
|
||||||
|
}
|
||||||
let c_name = str_to_cstring(module_name)?;
|
let c_name = str_to_cstring(module_name)?;
|
||||||
let r = match aux {
|
let r = match aux {
|
||||||
Some(aux) => {
|
Some(aux) => {
|
||||||
|
@ -88,7 +88,7 @@ fn test_dummy_module() -> rusqlite::Result<()> {
|
|||||||
db.create_module::<DummyTab>("dummy", module, None)?;
|
db.create_module::<DummyTab>("dummy", module, None)?;
|
||||||
|
|
||||||
let version = version_number();
|
let version = version_number();
|
||||||
if version < 3_008_012 {
|
if version < 3_009_000 {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user