Pass io to statement from db

This commit is contained in:
김선우 2025-01-24 15:43:44 +09:00
parent 53586b9d00
commit f10b41c5b5
3 changed files with 22 additions and 58 deletions

View file

@ -9,16 +9,19 @@ use jni::sys::jlong;
use jni::JNIEnv;
use limbo_core::Connection;
use std::rc::Rc;
use std::sync::Arc;
#[derive(Clone)]
#[allow(dead_code)]
pub struct LimboConnection {
// Because java's LimboConnection is 1:1 mapped to limbo connection, we can use Rc
pub(crate) conn: Rc<Connection>,
pub(crate) io: Rc<dyn limbo_core::IO>,
// Because io is shared across multiple `LimboConnection`s, wrap it with Arc
pub(crate) io: Arc<dyn limbo_core::IO>,
}
impl LimboConnection {
pub fn new(conn: Rc<Connection>, io: Rc<dyn limbo_core::IO>) -> Self {
pub fn new(conn: Rc<Connection>, io: Arc<dyn limbo_core::IO>) -> Self {
LimboConnection { conn, io }
}