This commit is contained in:
김선우 2025-01-18 09:16:09 +09:00
parent 39245f35cc
commit eaa8743c36
3 changed files with 4 additions and 20 deletions

View file

@ -11,6 +11,7 @@ use limbo_core::Connection;
use std::rc::Rc;
#[derive(Clone)]
#[allow(dead_code)]
pub struct LimboConnection {
pub(crate) conn: Rc<Connection>,
pub(crate) io: Rc<dyn limbo_core::IO>,
@ -39,20 +40,6 @@ pub fn to_limbo_connection(ptr: jlong) -> Result<&'static mut LimboConnection> {
}
}
/// Returns a pointer to a `Cursor` object.
///
/// The Java application will pass this pointer to native functions,
/// which will use it to reference the `Cursor` object.
///
/// # Arguments
///
/// * `_env` - The JNI environment pointer.
/// * `_class` - The Java class calling this function.
/// * `connection_ptr` - A pointer to the `Connection` object.
///
/// # Returns
///
/// A `jlong` representing the pointer to the newly created `Cursor` object.
#[no_mangle]
pub extern "system" fn Java_org_github_tursodatabase_core_LimboConnection_prepareUtf8<'local>(
mut env: JNIEnv<'local>,

View file

@ -1,12 +1,12 @@
use crate::errors::{LimboError, Result, LIMBO_ETC};
use crate::limbo_connection::LimboConnection;
use crate::utils::set_err_msg_and_throw_exception;
use jni::objects::{JByteArray, JObject};
use jni::sys::{jint, jlong};
use jni::JNIEnv;
use limbo_core::Database;
use std::rc::Rc;
use std::sync::Arc;
use crate::utils::set_err_msg_and_throw_exception;
struct LimboDB {
db: Arc<Database>,
@ -127,10 +127,7 @@ pub extern "system" fn Java_org_github_tursodatabase_core_LimboDB_connect0<'loca
}
},
};
let conn = LimboConnection::new(
db.db.connect(),
io,
);
let conn = LimboConnection::new(db.db.connect(), io);
conn.to_ptr()
}