SQLite Modules cannot be destroyed.

This commit is contained in:
gwenn 2016-05-07 12:04:16 +02:00
parent 6fb549420b
commit 8e92ef6cf3

View File

@ -25,8 +25,14 @@ pub fn create_int_array(conn: &Connection, name: &str) -> Result<Rc<RefCell<Vec<
/// Destroy the intarray object by dropping the virtual table. /// Destroy the intarray object by dropping the virtual table.
/// If not done explicitly by the application, the virtual table will be dropped implicitly /// If not done explicitly by the application, the virtual table will be dropped implicitly
/// by the system when the database connection is closed. /// by the system when the database connection is closed.
/// In fact, the intarray is not destroy until the connection is closed
/// because there is no other way to destroy the associated module.
pub fn drop_int_array(conn: &Connection, name: &str) -> Result<()> { pub fn drop_int_array(conn: &Connection, name: &str) -> Result<()> {
conn.execute_batch(&format!("DROP TABLE temp.\"{0}\"", escape_double_quote(name))) conn.execute_batch(&format!("DROP TABLE temp.\"{0}\"", escape_double_quote(name)))
// http://www.mail-archive.com/sqlite-users%40mailinglists.sqlite.org/msg08423.html
// "Once a virtual table module has been created, it cannot be modified or destroyed, except by closing the database connection."
/*let aux: Option<()> = None;
conn.create_module(name, ptr::null() as *const ffi::sqlite3_module, aux)*/
} }
init_module!(INT_ARRAY_MODULE, init_module!(INT_ARRAY_MODULE,