diff --git a/diesel-wasm-sqlite/.vscode/settings.json b/diesel-wasm-sqlite/.vscode/settings.json index cb6099b62..ae0d8b87d 100644 --- a/diesel-wasm-sqlite/.vscode/settings.json +++ b/diesel-wasm-sqlite/.vscode/settings.json @@ -13,7 +13,8 @@ "napi-derive": ["napi"], "async-recursion": ["async_recursion"], "ctor": ["ctor"], - "tokio": ["test"] + "tokio": ["test"], + "diesel": ["table"], } } }, diff --git a/diesel-wasm-sqlite/src/connection/mod.rs b/diesel-wasm-sqlite/src/connection/mod.rs index a91ab2c92..2694eadfe 100644 --- a/diesel-wasm-sqlite/src/connection/mod.rs +++ b/diesel-wasm-sqlite/src/connection/mod.rs @@ -30,7 +30,6 @@ use std::sync::{Arc, Mutex}; use diesel::{connection::{ConnectionSealed, Instrumentation}, query_builder::{AsQuery, QueryFragment, QueryId}, QueryResult}; pub use diesel_async::{AnsiTransactionManager, AsyncConnection, SimpleAsyncConnection, TransactionManager, stmt_cache::StmtCache}; -use row::SqliteRow; use crate::{get_sqlite_unchecked, WasmSqlite, WasmSqliteError}; @@ -43,7 +42,6 @@ pub struct WasmSqliteConnection { transaction_manager: AnsiTransactionManager, // this exists for the sole purpose of implementing `WithMetadataLookup` trait // and avoiding static mut which will be deprecated in 2024 edition - metadata_lookup: (), instrumentation: Arc>>>, } @@ -286,7 +284,6 @@ impl WasmSqliteConnection { statement_cache: StmtCache::new(), raw_connection, transaction_manager: AnsiTransactionManager::default(), - metadata_lookup: (), instrumentation: Arc::new(Mutex::new(None)), }) } diff --git a/diesel-wasm-sqlite/src/connection/raw.rs b/diesel-wasm-sqlite/src/connection/raw.rs old mode 100644 new mode 100755 index bba6ac89d..65d3cb4bc --- a/diesel-wasm-sqlite/src/connection/raw.rs +++ b/diesel-wasm-sqlite/src/connection/raw.rs @@ -1,3 +1,6 @@ +#![allow(dead_code)] +// functions are needed, but missing functionality means they aren't used yet. + use crate::{ sqlite_types::{SqliteFlags, SqliteOpenFlags}, SqliteType, WasmSqlite, WasmSqliteError, diff --git a/diesel-wasm-sqlite/src/connection/sqlite_value.rs b/diesel-wasm-sqlite/src/connection/sqlite_value.rs index 559dcba25..7510a892b 100644 --- a/diesel-wasm-sqlite/src/connection/sqlite_value.rs +++ b/diesel-wasm-sqlite/src/connection/sqlite_value.rs @@ -81,38 +81,39 @@ impl<'row, 'stmt> SqliteValue<'row, 'stmt> { Some(ret) } } + /* + pub(crate) fn parse_string(&self, f: impl FnOnce(String) -> R) -> R { + let sqlite3 = crate::get_sqlite_unchecked(); + let s = sqlite3.value_text(&self.value); + f(s) + } - pub(crate) fn parse_string(&self, f: impl FnOnce(String) -> R) -> R { - let sqlite3 = crate::get_sqlite_unchecked(); - let s = sqlite3.value_text(&self.value); - f(s) - } - - // TODO: Wasm bindgen can't work with references yet - // not sure if this will effect perf - pub(crate) fn read_text(&self) -> String { - self.parse_string(|s| s) - } + // TODO: Wasm bindgen can't work with references yet + // not sure if this will effect perf + pub(crate) fn read_text(&self) -> String { + self.parse_string(|s| s) + } - pub(crate) fn read_blob(&self) -> Vec { - let sqlite3 = crate::get_sqlite_unchecked(); - sqlite3.value_blob(&self.value) - } + pub(crate) fn read_blob(&self) -> Vec { + let sqlite3 = crate::get_sqlite_unchecked(); + sqlite3.value_blob(&self.value) + } - pub(crate) fn read_integer(&self) -> i32 { - let sqlite3 = crate::get_sqlite_unchecked(); - sqlite3.value_int(&self.value) - } + pub(crate) fn read_integer(&self) -> i32 { + let sqlite3 = crate::get_sqlite_unchecked(); + sqlite3.value_int(&self.value) + } - pub(crate) fn read_long(&self) -> i64 { - let sqlite3 = crate::get_sqlite_unchecked(); - sqlite3.value_int64(&self.value) - } + pub(crate) fn read_long(&self) -> i64 { + let sqlite3 = crate::get_sqlite_unchecked(); + sqlite3.value_int64(&self.value) + } - pub(crate) fn read_double(&self) -> f64 { - let sqlite3 = crate::get_sqlite_unchecked(); - sqlite3.value_double(&self.value) - } + pub(crate) fn read_double(&self) -> f64 { + let sqlite3 = crate::get_sqlite_unchecked(); + sqlite3.value_double(&self.value) + } + */ /// Get the type of the value as returned by sqlite pub fn value_type(&self) -> Option { diff --git a/diesel-wasm-sqlite/src/connection/stmt.rs b/diesel-wasm-sqlite/src/connection/stmt.rs index e291f5d51..37958f19c 100644 --- a/diesel-wasm-sqlite/src/connection/stmt.rs +++ b/diesel-wasm-sqlite/src/connection/stmt.rs @@ -1,21 +1,17 @@ #![allow(unsafe_code)] //TODO: can probably remove for wa-sqlite -use super::bind_collector::{ - InternalSqliteBindValue, OwnedSqliteBindValue, SqliteBindCollector, SqliteBindCollectorData, -}; +use super::bind_collector::{OwnedSqliteBindValue, SqliteBindCollectorData}; use super::raw::RawConnection; use super::sqlite_value::OwnedSqliteValue; use crate::ffi::SQLiteCompatibleType; use crate::{ sqlite_types::{self, PrepareOptions, SqlitePrepareFlags}, - SqliteType, WasmSqlite, + SqliteType, }; -use diesel::query_builder::bind_collector; use diesel::{ connection::{ statement_cache::{MaybeCached, PrepareForCache}, Instrumentation, }, - query_builder::{QueryFragment, QueryId}, result::{Error, QueryResult}, }; use std::cell::OnceCell; @@ -189,6 +185,7 @@ struct BoundStatement<'stmt> { // generic type, we use NonNull to communicate // that this is a shared buffer // query: Option>>, + #[allow(unused)] instrumentation: Arc>, has_error: bool, }