mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-09 11:14:20 +01:00
core: Kill value type
We currently have two value types, `Value` and `OwnedValue`. The original thinking was that `Value` is external type and `OwnedValue` is internal type. However, this just results in unnecessary transformation between the types as data crosses the Limbo library boundary. Let's just follow SQLite here and consolidate on a single value type (where `sqlite3_value` is just an alias for the internal `Mem` type). The way this will eventually work is that we can have bunch of pre-allocated `OwnedValue` objects in `ProgramState` and basically return a reference to them all the way to the application itself, which extracts the actual value.
This commit is contained in:
@@ -302,12 +302,13 @@ fn row_to_py(py: Python, row: &limbo_core::Row) -> PyObject {
|
||||
let py_values: Vec<PyObject> = row
|
||||
.get_values()
|
||||
.iter()
|
||||
.map(|value| match value.to_value() {
|
||||
limbo_core::Value::Null => py.None(),
|
||||
limbo_core::Value::Integer(i) => i.to_object(py),
|
||||
limbo_core::Value::Float(f) => f.to_object(py),
|
||||
limbo_core::Value::Text(s) => s.to_object(py),
|
||||
limbo_core::Value::Blob(b) => b.to_object(py),
|
||||
.map(|value| match value {
|
||||
limbo_core::OwnedValue::Null => py.None(),
|
||||
limbo_core::OwnedValue::Integer(i) => i.to_object(py),
|
||||
limbo_core::OwnedValue::Float(f) => f.to_object(py),
|
||||
limbo_core::OwnedValue::Text(s) => s.as_str().to_object(py),
|
||||
limbo_core::OwnedValue::Blob(b) => b.to_object(py),
|
||||
_ => unreachable!(),
|
||||
})
|
||||
.collect();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user