mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-19 09:34:18 +01:00
Switch Connection to use Arc instead of Rc
Connection needs to be Arc so that bindings can wrap it with `Mutex` for multi-threading.
This commit is contained in:
@@ -228,7 +228,7 @@ fn stmt_is_ddl(sql: &str) -> bool {
|
||||
#[pyclass(unsendable)]
|
||||
#[derive(Clone)]
|
||||
pub struct Connection {
|
||||
conn: Rc<limbo_core::Connection>,
|
||||
conn: Arc<limbo_core::Connection>,
|
||||
io: Arc<dyn limbo_core::IO>,
|
||||
}
|
||||
|
||||
@@ -310,13 +310,13 @@ pub fn connect(path: &str) -> Result<Connection> {
|
||||
":memory:" => {
|
||||
let io: Arc<dyn limbo_core::IO> = Arc::new(limbo_core::MemoryIO::new());
|
||||
let db = open_or(io.clone(), path)?;
|
||||
let conn: Rc<limbo_core::Connection> = db.connect().unwrap();
|
||||
let conn: Arc<limbo_core::Connection> = db.connect().unwrap();
|
||||
Ok(Connection { conn, io })
|
||||
}
|
||||
path => {
|
||||
let io: Arc<dyn limbo_core::IO> = Arc::new(limbo_core::PlatformIO::new()?);
|
||||
let db = open_or(io.clone(), path)?;
|
||||
let conn: Rc<limbo_core::Connection> = db.connect().unwrap();
|
||||
let conn: Arc<limbo_core::Connection> = db.connect().unwrap();
|
||||
Ok(Connection { conn, io })
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user