mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-05 17:24:21 +01:00
return row as reference to registers
This commit is contained in:
@@ -104,17 +104,17 @@ fn row_to_obj_array<'local>(
|
||||
) -> Result<JObject<'local>> {
|
||||
let obj_array = env.new_object_array(row.len() as i32, "java/lang/Object", JObject::null())?;
|
||||
|
||||
for (i, value) in row.get_values().iter().enumerate() {
|
||||
for (i, value) in row.get_values().enumerate() {
|
||||
let obj = match value {
|
||||
limbo_core::RefValue::Null => JObject::null(),
|
||||
limbo_core::RefValue::Integer(i) => {
|
||||
limbo_core::OwnedValue::Null => JObject::null(),
|
||||
limbo_core::OwnedValue::Integer(i) => {
|
||||
env.new_object("java/lang/Long", "(J)V", &[JValue::Long(*i)])?
|
||||
}
|
||||
limbo_core::RefValue::Float(f) => {
|
||||
limbo_core::OwnedValue::Float(f) => {
|
||||
env.new_object("java/lang/Double", "(D)V", &[JValue::Double(*f)])?
|
||||
}
|
||||
limbo_core::RefValue::Text(s) => env.new_string(s.as_str())?.into(),
|
||||
limbo_core::RefValue::Blob(b) => env.byte_array_from_slice(&b.to_slice())?.into(),
|
||||
limbo_core::OwnedValue::Text(s) => env.new_string(s.as_str())?.into(),
|
||||
limbo_core::OwnedValue::Blob(b) => env.byte_array_from_slice(&b.as_slice())?.into(),
|
||||
};
|
||||
if let Err(e) = env.set_object_array_element(&obj_array, i as i32, obj) {
|
||||
eprintln!("Error on parsing row: {:?}", e);
|
||||
|
||||
Reference in New Issue
Block a user