mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-22 07:09:20 +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
|
||||
Default,
|
||||
/// [`create`](CreateVTab::create) == [`connect`](VTab::connect)
|
||||
///
|
||||
/// See [SQLite doc](https://sqlite.org/vtab.html#eponymous_virtual_tables)
|
||||
Eponymous,
|
||||
/// No [`create`](CreateVTab::create) / [`destroy`](CreateVTab::destroy) or
|
||||
/// not used
|
||||
///
|
||||
/// SQLite >= 3.9.0
|
||||
///
|
||||
/// See [SQLite doc](https://sqlite.org/vtab.html#eponymous_only_virtual_tables)
|
||||
EponymousOnly,
|
||||
}
|
||||
|
||||
@ -835,6 +839,13 @@ impl InnerConnection {
|
||||
module: &'static Module<'vtab, T>,
|
||||
aux: Option<T::Aux>,
|
||||
) -> 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 r = match aux {
|
||||
Some(aux) => {
|
||||
|
@ -88,7 +88,7 @@ fn test_dummy_module() -> rusqlite::Result<()> {
|
||||
db.create_module::<DummyTab>("dummy", module, None)?;
|
||||
|
||||
let version = version_number();
|
||||
if version < 3_008_012 {
|
||||
if version < 3_009_000 {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user