PR remarks #2

This commit is contained in:
Kacper Madej
2025-01-02 15:09:16 +07:00
parent 4fc1b66225
commit f27f873804
2 changed files with 11 additions and 17 deletions

View File

@@ -173,13 +173,7 @@ pub fn json_extract(value: &OwnedValue, paths: &[OwnedValue]) -> crate::Result<O
result.push(',');
}
}
OwnedValue::Null => {
if paths.len() == 1 {
return Ok(OwnedValue::Null);
} else {
result.push_str("null,");
}
}
OwnedValue::Null => return Ok(OwnedValue::Null),
_ => crate::bail_constraint_error!("JSON path error near: {:?}", path.to_string()),
}
}

View File

@@ -125,13 +125,13 @@ do_execsql_test json_extract_object_3 {
SELECT json_extract('{"a": [1,2,3]}', '$.a', '$.a[0]', '$.a[1]', null, '$.a[3]')
} {{}}
# TODO: fix me
# \x61 is the ASCII code for 'a'
# TODO: fix me - this passes on SQLite and needs to be fixed in Limbo.
# \x61 is the ASCII code for 'a'
# do_execsql_test json_extract_with_escaping {
# SELECT json_extract('{"\x61": 1}', '$.a')
# } {{1}}
# TODO: fix me
# TODO: fix me - this passes on SQLite and needs to be fixed in Limbo.
#do_execsql_test json_extract_with_escaping_2 {
# SELECT json_extract('{"\x61": 1}', '$.\x61')
#} {{1}}
@@ -140,12 +140,12 @@ do_execsql_test json_extract_null_path {
SELECT json_extract(1, null)
} {{}}
# TODO: fix me
#do_execsql_test json_extract_multiple_null_paths {
# SELECT json_extract(1, null, null, null)
#} {{[null,null,null]}}
# TODO: fix me - this passes on SQLite and needs to be fixed in Limbo.
do_execsql_test json_extract_multiple_null_paths {
SELECT json_extract(1, null, null, null)
} {{}}
# TODO: fix me
# TODO: fix me - this passes on SQLite and needs to be fixed in Limbo.
#do_execsql_test json_extract_quote {
# SELECT json_extract('{"\"":1 }', '$.\"')
#} {{1}}
@@ -175,13 +175,13 @@ do_execsql_test json_extract_overflow_int64 {
SELECT json_extract('[1,2,3]', '$[9223372036854775808]');
} {{1}}
# TODO: fix me?
# TODO: fix me - this passes on SQLite and needs to be fixed in Limbo.
# pow(2, 127) + 1 == 170141183460469231731687303715884105729
#do_execsql_test json_extract_overflow_int128 {
# SELECT json_extract('[1, 2, 3]', '$[170141183460469231731687303715884105729]');
#} {{2}}
# TODO: fix me
# TODO: fix me - this passes on SQLite and needs to be fixed in Limbo.
#do_execsql_test json_extract_blob {
# select json_extract(CAST('[1,2,3]' as BLOB), '$[1]')
#} {{2}}