mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-23 17:05:36 +01:00
Rename OwnedValue -> Value
We have not had enough merge conflicts for a while so let's do a tree-wide rename.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
use crate::common::TempDatabase;
|
||||
use limbo_core::{OwnedValue, StepResult};
|
||||
use limbo_core::{StepResult, Value};
|
||||
|
||||
#[test]
|
||||
fn test_statement_reset_bind() -> anyhow::Result<()> {
|
||||
@@ -8,15 +8,15 @@ fn test_statement_reset_bind() -> anyhow::Result<()> {
|
||||
|
||||
let mut stmt = conn.prepare("select ?")?;
|
||||
|
||||
stmt.bind_at(1.try_into()?, OwnedValue::Integer(1));
|
||||
stmt.bind_at(1.try_into()?, Value::Integer(1));
|
||||
|
||||
loop {
|
||||
match stmt.step()? {
|
||||
StepResult::Row => {
|
||||
let row = stmt.row().unwrap();
|
||||
assert_eq!(
|
||||
*row.get::<&OwnedValue>(0).unwrap(),
|
||||
limbo_core::OwnedValue::Integer(1)
|
||||
*row.get::<&Value>(0).unwrap(),
|
||||
limbo_core::Value::Integer(1)
|
||||
);
|
||||
}
|
||||
StepResult::IO => tmp_db.io.run_once()?,
|
||||
@@ -26,15 +26,15 @@ fn test_statement_reset_bind() -> anyhow::Result<()> {
|
||||
|
||||
stmt.reset();
|
||||
|
||||
stmt.bind_at(1.try_into()?, OwnedValue::Integer(2));
|
||||
stmt.bind_at(1.try_into()?, Value::Integer(2));
|
||||
|
||||
loop {
|
||||
match stmt.step()? {
|
||||
StepResult::Row => {
|
||||
let row = stmt.row().unwrap();
|
||||
assert_eq!(
|
||||
*row.get::<&OwnedValue>(0).unwrap(),
|
||||
limbo_core::OwnedValue::Integer(2)
|
||||
*row.get::<&Value>(0).unwrap(),
|
||||
limbo_core::Value::Integer(2)
|
||||
);
|
||||
}
|
||||
StepResult::IO => tmp_db.io.run_once()?,
|
||||
@@ -52,14 +52,14 @@ fn test_statement_bind() -> anyhow::Result<()> {
|
||||
|
||||
let mut stmt = conn.prepare("select ?, ?1, :named, ?3, ?4")?;
|
||||
|
||||
stmt.bind_at(1.try_into()?, OwnedValue::build_text("hello"));
|
||||
stmt.bind_at(1.try_into()?, Value::build_text("hello"));
|
||||
|
||||
let i = stmt.parameters().index(":named").unwrap();
|
||||
stmt.bind_at(i, OwnedValue::Integer(42));
|
||||
stmt.bind_at(i, Value::Integer(42));
|
||||
|
||||
stmt.bind_at(3.try_into()?, OwnedValue::from_blob(vec![0x1, 0x2, 0x3]));
|
||||
stmt.bind_at(3.try_into()?, Value::from_blob(vec![0x1, 0x2, 0x3]));
|
||||
|
||||
stmt.bind_at(4.try_into()?, OwnedValue::Float(0.5));
|
||||
stmt.bind_at(4.try_into()?, Value::Float(0.5));
|
||||
|
||||
assert_eq!(stmt.parameters().count(), 4);
|
||||
|
||||
@@ -67,23 +67,23 @@ fn test_statement_bind() -> anyhow::Result<()> {
|
||||
match stmt.step()? {
|
||||
StepResult::Row => {
|
||||
let row = stmt.row().unwrap();
|
||||
if let limbo_core::OwnedValue::Text(s) = row.get::<&OwnedValue>(0).unwrap() {
|
||||
if let limbo_core::Value::Text(s) = row.get::<&Value>(0).unwrap() {
|
||||
assert_eq!(s.as_str(), "hello")
|
||||
}
|
||||
|
||||
if let limbo_core::OwnedValue::Text(s) = row.get::<&OwnedValue>(1).unwrap() {
|
||||
if let limbo_core::Value::Text(s) = row.get::<&Value>(1).unwrap() {
|
||||
assert_eq!(s.as_str(), "hello")
|
||||
}
|
||||
|
||||
if let limbo_core::OwnedValue::Integer(i) = row.get::<&OwnedValue>(2).unwrap() {
|
||||
if let limbo_core::Value::Integer(i) = row.get::<&Value>(2).unwrap() {
|
||||
assert_eq!(*i, 42)
|
||||
}
|
||||
|
||||
if let limbo_core::OwnedValue::Blob(v) = row.get::<&OwnedValue>(3).unwrap() {
|
||||
if let limbo_core::Value::Blob(v) = row.get::<&Value>(3).unwrap() {
|
||||
assert_eq!(v.as_slice(), &vec![0x1 as u8, 0x2, 0x3])
|
||||
}
|
||||
|
||||
if let limbo_core::OwnedValue::Float(f) = row.get::<&OwnedValue>(4).unwrap() {
|
||||
if let limbo_core::Value::Float(f) = row.get::<&Value>(4).unwrap() {
|
||||
assert_eq!(*f, 0.5)
|
||||
}
|
||||
}
|
||||
@@ -117,7 +117,7 @@ fn test_insert_parameter_remap() -> anyhow::Result<()> {
|
||||
|
||||
// prepare INSERT with re-ordered columns and constants
|
||||
let mut ins = conn.prepare("insert into test (d, c, a, b) values (22, ?, 7, ?);")?;
|
||||
let args = [OwnedValue::Integer(111), OwnedValue::Integer(222)];
|
||||
let args = [Value::Integer(111), Value::Integer(222)];
|
||||
for (i, arg) in args.iter().enumerate() {
|
||||
let idx = i + 1;
|
||||
ins.bind_at(idx.try_into()?, arg.clone());
|
||||
@@ -138,22 +138,16 @@ fn test_insert_parameter_remap() -> anyhow::Result<()> {
|
||||
let row = sel.row().unwrap();
|
||||
// insert_index = 3
|
||||
// A = 7
|
||||
assert_eq!(row.get::<&OwnedValue>(0).unwrap(), &OwnedValue::Integer(7));
|
||||
assert_eq!(row.get::<&Value>(0).unwrap(), &Value::Integer(7));
|
||||
// insert_index = 4
|
||||
// B = 222
|
||||
assert_eq!(
|
||||
row.get::<&OwnedValue>(1).unwrap(),
|
||||
&OwnedValue::Integer(222)
|
||||
);
|
||||
assert_eq!(row.get::<&Value>(1).unwrap(), &Value::Integer(222));
|
||||
// insert_index = 2
|
||||
// C = 111
|
||||
assert_eq!(
|
||||
row.get::<&OwnedValue>(2).unwrap(),
|
||||
&OwnedValue::Integer(111)
|
||||
);
|
||||
assert_eq!(row.get::<&Value>(2).unwrap(), &Value::Integer(111));
|
||||
// insert_index = 1
|
||||
// D = 22
|
||||
assert_eq!(row.get::<&OwnedValue>(3).unwrap(), &OwnedValue::Integer(22));
|
||||
assert_eq!(row.get::<&Value>(3).unwrap(), &Value::Integer(22));
|
||||
}
|
||||
StepResult::IO => tmp_db.io.run_once()?,
|
||||
StepResult::Done | StepResult::Interrupt => break,
|
||||
@@ -187,10 +181,10 @@ fn test_insert_parameter_remap_all_params() -> anyhow::Result<()> {
|
||||
let mut ins = conn.prepare("insert into test (d, a, c, b) values (?, ?, ?, ?);")?;
|
||||
|
||||
let values = [
|
||||
OwnedValue::Integer(999), // ?1 → d
|
||||
OwnedValue::Integer(111), // ?2 → a
|
||||
OwnedValue::Integer(333), // ?3 → c
|
||||
OwnedValue::Integer(444), // ?4 → b
|
||||
Value::Integer(999), // ?1 → d
|
||||
Value::Integer(111), // ?2 → a
|
||||
Value::Integer(333), // ?3 → c
|
||||
Value::Integer(444), // ?4 → b
|
||||
];
|
||||
for (i, value) in values.iter().enumerate() {
|
||||
let idx = i + 1;
|
||||
@@ -215,28 +209,16 @@ fn test_insert_parameter_remap_all_params() -> anyhow::Result<()> {
|
||||
|
||||
// insert_index = 2
|
||||
// A = 111
|
||||
assert_eq!(
|
||||
row.get::<&OwnedValue>(0).unwrap(),
|
||||
&OwnedValue::Integer(111)
|
||||
);
|
||||
assert_eq!(row.get::<&Value>(0).unwrap(), &Value::Integer(111));
|
||||
// insert_index = 4
|
||||
// B = 444
|
||||
assert_eq!(
|
||||
row.get::<&OwnedValue>(1).unwrap(),
|
||||
&OwnedValue::Integer(444)
|
||||
);
|
||||
assert_eq!(row.get::<&Value>(1).unwrap(), &Value::Integer(444));
|
||||
// insert_index = 3
|
||||
// C = 333
|
||||
assert_eq!(
|
||||
row.get::<&OwnedValue>(2).unwrap(),
|
||||
&OwnedValue::Integer(333)
|
||||
);
|
||||
assert_eq!(row.get::<&Value>(2).unwrap(), &Value::Integer(333));
|
||||
// insert_index = 1
|
||||
// D = 999
|
||||
assert_eq!(
|
||||
row.get::<&OwnedValue>(3).unwrap(),
|
||||
&OwnedValue::Integer(999)
|
||||
);
|
||||
assert_eq!(row.get::<&Value>(3).unwrap(), &Value::Integer(999));
|
||||
}
|
||||
StepResult::IO => tmp_db.io.run_once()?,
|
||||
StepResult::Done | StepResult::Interrupt => break,
|
||||
@@ -266,10 +248,10 @@ fn test_insert_parameter_multiple_remap_backwards() -> anyhow::Result<()> {
|
||||
let mut ins = conn.prepare("insert into test (d,c,b,a) values (?, ?, ?, ?);")?;
|
||||
|
||||
let values = [
|
||||
OwnedValue::Integer(444), // ?1 → d
|
||||
OwnedValue::Integer(333), // ?2 → c
|
||||
OwnedValue::Integer(222), // ?3 → b
|
||||
OwnedValue::Integer(111), // ?4 → a
|
||||
Value::Integer(444), // ?1 → d
|
||||
Value::Integer(333), // ?2 → c
|
||||
Value::Integer(222), // ?3 → b
|
||||
Value::Integer(111), // ?4 → a
|
||||
];
|
||||
for (i, value) in values.iter().enumerate() {
|
||||
let idx = i + 1;
|
||||
@@ -294,28 +276,16 @@ fn test_insert_parameter_multiple_remap_backwards() -> anyhow::Result<()> {
|
||||
|
||||
// insert_index = 2
|
||||
// A = 111
|
||||
assert_eq!(
|
||||
row.get::<&OwnedValue>(0).unwrap(),
|
||||
&OwnedValue::Integer(111)
|
||||
);
|
||||
assert_eq!(row.get::<&Value>(0).unwrap(), &Value::Integer(111));
|
||||
// insert_index = 4
|
||||
// B = 444
|
||||
assert_eq!(
|
||||
row.get::<&OwnedValue>(1).unwrap(),
|
||||
&OwnedValue::Integer(222)
|
||||
);
|
||||
assert_eq!(row.get::<&Value>(1).unwrap(), &Value::Integer(222));
|
||||
// insert_index = 3
|
||||
// C = 333
|
||||
assert_eq!(
|
||||
row.get::<&OwnedValue>(2).unwrap(),
|
||||
&OwnedValue::Integer(333)
|
||||
);
|
||||
assert_eq!(row.get::<&Value>(2).unwrap(), &Value::Integer(333));
|
||||
// insert_index = 1
|
||||
// D = 999
|
||||
assert_eq!(
|
||||
row.get::<&OwnedValue>(3).unwrap(),
|
||||
&OwnedValue::Integer(444)
|
||||
);
|
||||
assert_eq!(row.get::<&Value>(3).unwrap(), &Value::Integer(444));
|
||||
}
|
||||
StepResult::IO => tmp_db.io.run_once()?,
|
||||
StepResult::Done | StepResult::Interrupt => break,
|
||||
@@ -344,10 +314,10 @@ fn test_insert_parameter_multiple_no_remap() -> anyhow::Result<()> {
|
||||
let mut ins = conn.prepare("insert into test (a,b,c,d) values (?, ?, ?, ?);")?;
|
||||
|
||||
let values = [
|
||||
OwnedValue::Integer(111), // ?1 → a
|
||||
OwnedValue::Integer(222), // ?2 → b
|
||||
OwnedValue::Integer(333), // ?3 → c
|
||||
OwnedValue::Integer(444), // ?4 → d
|
||||
Value::Integer(111), // ?1 → a
|
||||
Value::Integer(222), // ?2 → b
|
||||
Value::Integer(333), // ?3 → c
|
||||
Value::Integer(444), // ?4 → d
|
||||
];
|
||||
for (i, value) in values.iter().enumerate() {
|
||||
let idx = i + 1;
|
||||
@@ -372,28 +342,16 @@ fn test_insert_parameter_multiple_no_remap() -> anyhow::Result<()> {
|
||||
|
||||
// insert_index = 2
|
||||
// A = 111
|
||||
assert_eq!(
|
||||
row.get::<&OwnedValue>(0).unwrap(),
|
||||
&OwnedValue::Integer(111)
|
||||
);
|
||||
assert_eq!(row.get::<&Value>(0).unwrap(), &Value::Integer(111));
|
||||
// insert_index = 4
|
||||
// B = 444
|
||||
assert_eq!(
|
||||
row.get::<&OwnedValue>(1).unwrap(),
|
||||
&OwnedValue::Integer(222)
|
||||
);
|
||||
assert_eq!(row.get::<&Value>(1).unwrap(), &Value::Integer(222));
|
||||
// insert_index = 3
|
||||
// C = 333
|
||||
assert_eq!(
|
||||
row.get::<&OwnedValue>(2).unwrap(),
|
||||
&OwnedValue::Integer(333)
|
||||
);
|
||||
assert_eq!(row.get::<&Value>(2).unwrap(), &Value::Integer(333));
|
||||
// insert_index = 1
|
||||
// D = 999
|
||||
assert_eq!(
|
||||
row.get::<&OwnedValue>(3).unwrap(),
|
||||
&OwnedValue::Integer(444)
|
||||
);
|
||||
assert_eq!(row.get::<&Value>(3).unwrap(), &Value::Integer(444));
|
||||
}
|
||||
StepResult::IO => tmp_db.io.run_once()?,
|
||||
StepResult::Done | StepResult::Interrupt => break,
|
||||
@@ -422,14 +380,14 @@ fn test_insert_parameter_multiple_row() -> anyhow::Result<()> {
|
||||
let mut ins = conn.prepare("insert into test (b,a,d,c) values (?, ?, ?, ?), (?, ?, ?, ?);")?;
|
||||
|
||||
let values = [
|
||||
OwnedValue::Integer(222), // ?1 → b
|
||||
OwnedValue::Integer(111), // ?2 → a
|
||||
OwnedValue::Integer(444), // ?3 → d
|
||||
OwnedValue::Integer(333), // ?4 → c
|
||||
OwnedValue::Integer(666), // ?1 → b
|
||||
OwnedValue::Integer(555), // ?2 → a
|
||||
OwnedValue::Integer(888), // ?3 → d
|
||||
OwnedValue::Integer(777), // ?4 → c
|
||||
Value::Integer(222), // ?1 → b
|
||||
Value::Integer(111), // ?2 → a
|
||||
Value::Integer(444), // ?3 → d
|
||||
Value::Integer(333), // ?4 → c
|
||||
Value::Integer(666), // ?1 → b
|
||||
Value::Integer(555), // ?2 → a
|
||||
Value::Integer(888), // ?3 → d
|
||||
Value::Integer(777), // ?4 → c
|
||||
];
|
||||
for (i, value) in values.iter().enumerate() {
|
||||
let idx = i + 1;
|
||||
@@ -454,20 +412,20 @@ fn test_insert_parameter_multiple_row() -> anyhow::Result<()> {
|
||||
let row = sel.row().unwrap();
|
||||
|
||||
assert_eq!(
|
||||
row.get::<&OwnedValue>(0).unwrap(),
|
||||
&OwnedValue::Integer(if i == 0 { 111 } else { 555 })
|
||||
row.get::<&Value>(0).unwrap(),
|
||||
&Value::Integer(if i == 0 { 111 } else { 555 })
|
||||
);
|
||||
assert_eq!(
|
||||
row.get::<&OwnedValue>(1).unwrap(),
|
||||
&OwnedValue::Integer(if i == 0 { 222 } else { 666 })
|
||||
row.get::<&Value>(1).unwrap(),
|
||||
&Value::Integer(if i == 0 { 222 } else { 666 })
|
||||
);
|
||||
assert_eq!(
|
||||
row.get::<&OwnedValue>(2).unwrap(),
|
||||
&OwnedValue::Integer(if i == 0 { 333 } else { 777 })
|
||||
row.get::<&Value>(2).unwrap(),
|
||||
&Value::Integer(if i == 0 { 333 } else { 777 })
|
||||
);
|
||||
assert_eq!(
|
||||
row.get::<&OwnedValue>(3).unwrap(),
|
||||
&OwnedValue::Integer(if i == 0 { 444 } else { 888 })
|
||||
row.get::<&Value>(3).unwrap(),
|
||||
&Value::Integer(if i == 0 { 444 } else { 888 })
|
||||
);
|
||||
i += 1;
|
||||
}
|
||||
@@ -494,8 +452,8 @@ fn test_bind_parameters_update_query() -> anyhow::Result<()> {
|
||||
}
|
||||
}
|
||||
let mut ins = conn.prepare("update test set a = ? where b = ?;")?;
|
||||
ins.bind_at(1.try_into()?, OwnedValue::Integer(222));
|
||||
ins.bind_at(2.try_into()?, OwnedValue::build_text("test1"));
|
||||
ins.bind_at(1.try_into()?, Value::Integer(222));
|
||||
ins.bind_at(2.try_into()?, Value::build_text("test1"));
|
||||
loop {
|
||||
match ins.step()? {
|
||||
StepResult::IO => tmp_db.io.run_once()?,
|
||||
@@ -510,14 +468,8 @@ fn test_bind_parameters_update_query() -> anyhow::Result<()> {
|
||||
match sel.step()? {
|
||||
StepResult::Row => {
|
||||
let row = sel.row().unwrap();
|
||||
assert_eq!(
|
||||
row.get::<&OwnedValue>(0).unwrap(),
|
||||
&OwnedValue::Integer(222)
|
||||
);
|
||||
assert_eq!(
|
||||
row.get::<&OwnedValue>(1).unwrap(),
|
||||
&OwnedValue::build_text("test1"),
|
||||
);
|
||||
assert_eq!(row.get::<&Value>(0).unwrap(), &Value::Integer(222));
|
||||
assert_eq!(row.get::<&Value>(1).unwrap(), &Value::build_text("test1"),);
|
||||
}
|
||||
StepResult::IO => tmp_db.io.run_once()?,
|
||||
StepResult::Done | StepResult::Interrupt => break,
|
||||
@@ -544,9 +496,9 @@ fn test_bind_parameters_update_query_multiple_where() -> anyhow::Result<()> {
|
||||
}
|
||||
}
|
||||
let mut ins = conn.prepare("update test set a = ? where b = ? and c = 4 and d = ?;")?;
|
||||
ins.bind_at(1.try_into()?, OwnedValue::Integer(222));
|
||||
ins.bind_at(2.try_into()?, OwnedValue::build_text("test1"));
|
||||
ins.bind_at(3.try_into()?, OwnedValue::Integer(5));
|
||||
ins.bind_at(1.try_into()?, Value::Integer(222));
|
||||
ins.bind_at(2.try_into()?, Value::build_text("test1"));
|
||||
ins.bind_at(3.try_into()?, Value::Integer(5));
|
||||
loop {
|
||||
match ins.step()? {
|
||||
StepResult::IO => tmp_db.io.run_once()?,
|
||||
@@ -561,16 +513,10 @@ fn test_bind_parameters_update_query_multiple_where() -> anyhow::Result<()> {
|
||||
match sel.step()? {
|
||||
StepResult::Row => {
|
||||
let row = sel.row().unwrap();
|
||||
assert_eq!(
|
||||
row.get::<&OwnedValue>(0).unwrap(),
|
||||
&OwnedValue::Integer(222)
|
||||
);
|
||||
assert_eq!(
|
||||
row.get::<&OwnedValue>(1).unwrap(),
|
||||
&OwnedValue::build_text("test1"),
|
||||
);
|
||||
assert_eq!(row.get::<&OwnedValue>(2).unwrap(), &OwnedValue::Integer(4));
|
||||
assert_eq!(row.get::<&OwnedValue>(3).unwrap(), &OwnedValue::Integer(5));
|
||||
assert_eq!(row.get::<&Value>(0).unwrap(), &Value::Integer(222));
|
||||
assert_eq!(row.get::<&Value>(1).unwrap(), &Value::build_text("test1"),);
|
||||
assert_eq!(row.get::<&Value>(2).unwrap(), &Value::Integer(4));
|
||||
assert_eq!(row.get::<&Value>(3).unwrap(), &Value::Integer(5));
|
||||
}
|
||||
StepResult::IO => tmp_db.io.run_once()?,
|
||||
StepResult::Done | StepResult::Interrupt => break,
|
||||
@@ -601,11 +547,8 @@ fn test_bind_parameters_update_rowid_alias() -> anyhow::Result<()> {
|
||||
match sel.step()? {
|
||||
StepResult::Row => {
|
||||
let row = sel.row().unwrap();
|
||||
assert_eq!(row.get::<&OwnedValue>(0).unwrap(), &OwnedValue::Integer(1));
|
||||
assert_eq!(
|
||||
row.get::<&OwnedValue>(1).unwrap(),
|
||||
&OwnedValue::build_text("test"),
|
||||
);
|
||||
assert_eq!(row.get::<&Value>(0).unwrap(), &Value::Integer(1));
|
||||
assert_eq!(row.get::<&Value>(1).unwrap(), &Value::build_text("test"),);
|
||||
}
|
||||
StepResult::IO => tmp_db.io.run_once()?,
|
||||
StepResult::Done | StepResult::Interrupt => break,
|
||||
@@ -613,8 +556,8 @@ fn test_bind_parameters_update_rowid_alias() -> anyhow::Result<()> {
|
||||
}
|
||||
}
|
||||
let mut ins = conn.prepare("update test set name = ? where id = ?;")?;
|
||||
ins.bind_at(1.try_into()?, OwnedValue::build_text("updated"));
|
||||
ins.bind_at(2.try_into()?, OwnedValue::Integer(1));
|
||||
ins.bind_at(1.try_into()?, Value::build_text("updated"));
|
||||
ins.bind_at(2.try_into()?, Value::Integer(1));
|
||||
loop {
|
||||
match ins.step()? {
|
||||
StepResult::IO => tmp_db.io.run_once()?,
|
||||
@@ -629,11 +572,8 @@ fn test_bind_parameters_update_rowid_alias() -> anyhow::Result<()> {
|
||||
match sel.step()? {
|
||||
StepResult::Row => {
|
||||
let row = sel.row().unwrap();
|
||||
assert_eq!(row.get::<&OwnedValue>(0).unwrap(), &OwnedValue::Integer(1));
|
||||
assert_eq!(
|
||||
row.get::<&OwnedValue>(1).unwrap(),
|
||||
&OwnedValue::build_text("updated"),
|
||||
);
|
||||
assert_eq!(row.get::<&Value>(0).unwrap(), &Value::Integer(1));
|
||||
assert_eq!(row.get::<&Value>(1).unwrap(), &Value::build_text("updated"),);
|
||||
}
|
||||
StepResult::IO => tmp_db.io.run_once()?,
|
||||
StepResult::Done | StepResult::Interrupt => break,
|
||||
@@ -660,16 +600,13 @@ fn test_bind_parameters_update_rowid_alias_seek_rowid() -> anyhow::Result<()> {
|
||||
StepResult::Row => {
|
||||
let row = sel.row().unwrap();
|
||||
assert_eq!(
|
||||
row.get::<&OwnedValue>(0).unwrap(),
|
||||
&OwnedValue::Integer(if i == 0 { 1 } else { 2 })
|
||||
row.get::<&Value>(0).unwrap(),
|
||||
&Value::Integer(if i == 0 { 1 } else { 2 })
|
||||
);
|
||||
assert_eq!(row.get::<&Value>(1).unwrap(), &Value::build_text("test"),);
|
||||
assert_eq!(
|
||||
row.get::<&OwnedValue>(1).unwrap(),
|
||||
&OwnedValue::build_text("test"),
|
||||
);
|
||||
assert_eq!(
|
||||
row.get::<&OwnedValue>(2).unwrap(),
|
||||
&OwnedValue::Integer(if i == 0 { 4 } else { 11 })
|
||||
row.get::<&Value>(2).unwrap(),
|
||||
&Value::Integer(if i == 0 { 4 } else { 11 })
|
||||
);
|
||||
}
|
||||
StepResult::IO => tmp_db.io.run_once()?,
|
||||
@@ -679,10 +616,10 @@ fn test_bind_parameters_update_rowid_alias_seek_rowid() -> anyhow::Result<()> {
|
||||
i += 1;
|
||||
}
|
||||
let mut ins = conn.prepare("update test set name = ? where id < ? AND age between ? and ?;")?;
|
||||
ins.bind_at(1.try_into()?, OwnedValue::build_text("updated"));
|
||||
ins.bind_at(2.try_into()?, OwnedValue::Integer(2));
|
||||
ins.bind_at(3.try_into()?, OwnedValue::Integer(3));
|
||||
ins.bind_at(4.try_into()?, OwnedValue::Integer(5));
|
||||
ins.bind_at(1.try_into()?, Value::build_text("updated"));
|
||||
ins.bind_at(2.try_into()?, Value::Integer(2));
|
||||
ins.bind_at(3.try_into()?, Value::Integer(3));
|
||||
ins.bind_at(4.try_into()?, Value::Integer(5));
|
||||
loop {
|
||||
match ins.step()? {
|
||||
StepResult::IO => tmp_db.io.run_once()?,
|
||||
@@ -699,8 +636,8 @@ fn test_bind_parameters_update_rowid_alias_seek_rowid() -> anyhow::Result<()> {
|
||||
StepResult::Row => {
|
||||
let row = sel.row().unwrap();
|
||||
assert_eq!(
|
||||
row.get::<&OwnedValue>(0).unwrap(),
|
||||
&OwnedValue::build_text(if i == 0 { "updated" } else { "test" }),
|
||||
row.get::<&Value>(0).unwrap(),
|
||||
&Value::build_text(if i == 0 { "updated" } else { "test" }),
|
||||
);
|
||||
}
|
||||
StepResult::IO => tmp_db.io.run_once()?,
|
||||
@@ -725,10 +662,10 @@ fn test_bind_parameters_delete_rowid_alias_seek_out_of_order() -> anyhow::Result
|
||||
|
||||
let mut ins =
|
||||
conn.prepare("delete from test where age between ? and ? AND id > ? AND name = ?;")?;
|
||||
ins.bind_at(1.try_into()?, OwnedValue::Integer(10));
|
||||
ins.bind_at(2.try_into()?, OwnedValue::Integer(12));
|
||||
ins.bind_at(3.try_into()?, OwnedValue::Integer(4));
|
||||
ins.bind_at(4.try_into()?, OwnedValue::build_text("test"));
|
||||
ins.bind_at(1.try_into()?, Value::Integer(10));
|
||||
ins.bind_at(2.try_into()?, Value::Integer(12));
|
||||
ins.bind_at(3.try_into()?, Value::Integer(4));
|
||||
ins.bind_at(4.try_into()?, Value::build_text("test"));
|
||||
loop {
|
||||
match ins.step()? {
|
||||
StepResult::IO => tmp_db.io.run_once()?,
|
||||
@@ -744,10 +681,7 @@ fn test_bind_parameters_delete_rowid_alias_seek_out_of_order() -> anyhow::Result
|
||||
match sel.step()? {
|
||||
StepResult::Row => {
|
||||
let row = sel.row().unwrap();
|
||||
assert_eq!(
|
||||
row.get::<&OwnedValue>(0).unwrap(),
|
||||
&OwnedValue::build_text("correct"),
|
||||
);
|
||||
assert_eq!(row.get::<&Value>(0).unwrap(), &Value::build_text("correct"),);
|
||||
}
|
||||
StepResult::IO => tmp_db.io.run_once()?,
|
||||
StepResult::Done | StepResult::Interrupt => break,
|
||||
|
||||
Reference in New Issue
Block a user