(
db: *mut sqlite3,
name: &str,
aux: Option<T::Aux>,
)
| 550 | Ok(()) |
| 551 | } |
| 552 | pub fn define_virtual_table_writeable<'vtab, T: VTabWriteable<'vtab> + 'vtab>( |
| 553 | db: *mut sqlite3, |
| 554 | name: &str, |
| 555 | aux: Option<T::Aux>, |
| 556 | ) -> Result<()> { |
| 557 | let m = &Module { |
| 558 | base: sqlite3_module { |
| 559 | iVersion: 2, |
| 560 | xCreate: Some(rust_create::<T>), |
| 561 | xConnect: Some(rust_connect::<T>), |
| 562 | xBestIndex: Some(rust_best_index::<T>), |
| 563 | xDisconnect: Some(rust_disconnect::<T>), |
| 564 | xDestroy: Some(rust_destroy::<T>), |
| 565 | xOpen: Some(rust_open::<T>), |
| 566 | xClose: Some(rust_close::<T::Cursor>), |
| 567 | xFilter: Some(rust_filter::<T::Cursor>), |
| 568 | xNext: Some(rust_next::<T::Cursor>), |
| 569 | xEof: Some(rust_eof::<T::Cursor>), |
| 570 | xColumn: Some(rust_column::<T::Cursor>), |
| 571 | xRowid: Some(rust_rowid::<T::Cursor>), |
| 572 | xUpdate: Some(rust_update::<T>), |
| 573 | xBegin: None, //Some(rust_begin::<T>), |
| 574 | xSync: None, //Some(rust_sync::<T>), |
| 575 | xCommit: None, //Some(rust_commit::<T>), |
| 576 | xRollback: None, //Some(rust_rollback::<T>), |
| 577 | xFindFunction: None, |
| 578 | xRename: None, |
| 579 | xSavepoint: None, |
| 580 | xRelease: None, |
| 581 | xRollbackTo: None, |
| 582 | xShadowName: None, |
| 583 | }, |
| 584 | phantom: PhantomData::<&'vtab T>, |
| 585 | }; |
| 586 | let cname = CString::new(name)?; |
| 587 | let p_app = match aux { |
| 588 | Some(aux) => { |
| 589 | let boxed_aux: *mut T::Aux = Box::into_raw(Box::new(aux)); |
| 590 | boxed_aux.cast::<c_void>() |
| 591 | } |
| 592 | None => ptr::null_mut(), |
| 593 | }; |
| 594 | let result = unsafe { |
| 595 | sqlite3ext_create_module_v2( |
| 596 | db, |
| 597 | cname.as_ptr(), |
| 598 | &m.base, |
| 599 | p_app, |
| 600 | Some(destroy_aux::<T::Aux>), |
| 601 | ) |
| 602 | }; |
| 603 | if result != SQLITE_OKAY { |
| 604 | return Err(Error::new(ErrorKind::TableFunction(result))); |
| 605 | } |
| 606 | Ok(()) |
| 607 | } |
| 608 | |
| 609 | pub fn define_virtual_table_writeable_with_transactions< |
nothing calls this directly
no test coverage detected