mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-18 00:54:19 +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:
@@ -1,5 +1,5 @@
|
||||
use crate::common::{do_flush, TempDatabase};
|
||||
use limbo_core::{StepResult, Value};
|
||||
use limbo_core::StepResult;
|
||||
|
||||
#[test]
|
||||
fn test_last_insert_rowid_basic() -> anyhow::Result<()> {
|
||||
@@ -30,8 +30,8 @@ fn test_last_insert_rowid_basic() -> anyhow::Result<()> {
|
||||
match rows.step()? {
|
||||
StepResult::Row => {
|
||||
let row = rows.row().unwrap();
|
||||
if let Value::Integer(id) = row.get_value(0).to_value() {
|
||||
assert_eq!(id, 1, "First insert should have rowid 1");
|
||||
if let limbo_core::OwnedValue::Integer(id) = row.get_value(0) {
|
||||
assert_eq!(*id, 1, "First insert should have rowid 1");
|
||||
}
|
||||
}
|
||||
StepResult::IO => {
|
||||
@@ -66,8 +66,8 @@ fn test_last_insert_rowid_basic() -> anyhow::Result<()> {
|
||||
match rows.step()? {
|
||||
StepResult::Row => {
|
||||
let row = rows.row().unwrap();
|
||||
if let Value::Integer(id) = row.get_value(0).to_value() {
|
||||
last_id = id;
|
||||
if let limbo_core::OwnedValue::Integer(id) = row.get_value(0) {
|
||||
last_id = *id;
|
||||
}
|
||||
}
|
||||
StepResult::IO => {
|
||||
@@ -112,8 +112,8 @@ fn test_integer_primary_key() -> anyhow::Result<()> {
|
||||
match select_query.step()? {
|
||||
StepResult::Row => {
|
||||
let row = select_query.row().unwrap();
|
||||
if let Value::Integer(id) = row.get_value(0).to_value() {
|
||||
rowids.push(id);
|
||||
if let limbo_core::OwnedValue::Integer(id) = row.get_value(0) {
|
||||
rowids.push(*id);
|
||||
}
|
||||
}
|
||||
StepResult::IO => tmp_db.io.run_once()?,
|
||||
|
||||
Reference in New Issue
Block a user