Make connect/create return a tuple

This commit is contained in:
gwenn
2018-06-22 17:20:47 +02:00
parent 861e8edb96
commit 6463db906d
4 changed files with 45 additions and 33 deletions

View File

@@ -7,6 +7,7 @@ use std::path::Path;
use std::result;
use std::str;
use error::error_from_sqlite_code;
use ffi;
use types::Null;
use vtab::{
@@ -84,7 +85,11 @@ impl Module for CSVModule {
self.0
}
fn connect(db: &mut ffi::sqlite3, _aux: Option<&()>, args: &[&[u8]]) -> Result<CSVTab> {
fn connect(
_: &mut ffi::sqlite3,
_aux: Option<&()>,
args: &[&[u8]],
) -> Result<(String, CSVTab)> {
if args.len() < 4 {
return Err(Error::ModuleError("no CSV file specified".to_owned()));
}
@@ -230,8 +235,7 @@ impl Module for CSVModule {
schema = Some(sql);
}
try!(CSVModule::declare_vtab(db, &schema.unwrap()));
Ok(vtab)
Ok((schema.unwrap().to_owned(), vtab))
}
}