Implements the `->` and `->>` operators. Also fixes a few
inconsistencies between sqlite and limbo for `json_extract` function.
Those three functions are similar, yet return slightly different data
types.
Closes#636
### Purpose of this PR
- Enhance exception handling logic
- When exceptions has to be thrown from Rust to Java, let's just
return the error message directly.
- Removes JNI call to get error message using
`Java_org_github_tursodatabase_core_LimboDB_getErrorMessageUtf8`
- Add `throwJavaException` to assure that the exception throwing logic
works corretly
Closes#642
## Purpose of this PR
- Implement open function
- Add basic structure for the following
- exception handling
- testing using gradle
## Changes
- Java
- Remove unnecessary example code(Connection.java, Cursor.java,
Limbo.java)
- Implement `open`
- Add exception handling logic
- Add junit test
- Rust
- Add limbo_db.rs which implements native functions defined in
`Limbo.java`
- Remove unnecessary example code in lib.rs
## TODOS
- Implement core features for AbstractDB.java and LimboDB.java (I'm
currently referencing sqlite-java, but there are some minor differences
as we use rust instead of C)
## Reference
- https://github.com/tursodatabase/limbo/issues/615Closes#632
`balance_non_root` should be as close as possible to `balance_non_root`
in SQLite. This commits extract `balance_non_root` from `balance` and
renames `balance_leaf` to `balance` as it enables future work on a
complete `balance_non_root` procedure.
Closes#634
This PR fixes queries like:
```sql
SELECT count(*) FROM users WHERE ((age > 25 OR age < 18) AND (city = 'Boston' OR state = 'MA'));
```
Previously we would return `7516` rows instead of `146`, due to
disregarding the final `AND` from within the nested `OR` conditions,
unconditionally short circuiting when a TRUE is found in an OR
expression without any surrounding relevant context.
or:
```sql
SELECT * FROM users WHERE (((age > 18 AND city = 'New Mario') OR age = 92) AND city = 'Lake Paul');
```
Previously we would incorrectly return the top row:
```
9984|Leah|Russell|..|..|6733 Weber Crossing|New Mario|SC|57707|78
9989|Timothy|Harrison|..|..|782 Wright Harbors|Lake Paul|ID|52330|92
```
Added localized jump targets for OR expressions within AND blocks to
prevent premature short-circuiting and `parent operator` to condition
metadata to trigger them.
If parent operator should instead be another function param on
`translate_conditional_expr`, instead of a field in condition_metadata,
let me know and I can change it.
EDIT: sorry I realize I should have included the other cleanup changes
in a different PR. I will fix this after work
Reviewed-by: Jussi Saurio <kacperoza@gmail.com>
Closes#633
`balance_non_root` should be as close as possible to `balance_non_root`
in SQLite. This commits extract `balance_non_root` from `balance` and
renames `balance_leaf` to `balance` as it enables future work on a
complete `balance_non_root` procedure.
Closes#629
- Fix bug with column being considered rowid alias based on
'primary_key' (non INTEGER pks are not rowid aliases)
- fix logic bug in check_index_scan() that swapped lhs/rhs but not the
comparison op
- Rename eliminate_between to rewrite_exprs and add true/false->1/0 case
there
Closes#630
This PR fixes the issue with tests running on slow systems such as
github actions, where a couple `datetime` tests would be off by very
small margins and fail (e.g. #626)

Closes#627
As was suggested in #502 I have renamed the IO backends from `darwin` to
`unix` and from `linux` to `io_uring`. The `unix` backend is now
available to Linux platforms without io_uring.
On the topic of letting platforms disable io_uring support, the primary
example is Google, which posted this
[blog](https://security.googleblog.com/2023/06/learnings-from-kctf-
vrps-42-linux.html) in 2023 about disabling io_uring by default in most
of their servers/platforms, including Android (prime candidate user for
a SQLite rewrite).
Closes#628
TLDR: no need to call either of:
---
program.emit_insn_with_label_dependency() -> just call
program.emit_insn()
program.defer_label_resolution() -> just call program.resolve_label()
---
Changes:
- make BranchOffset an explicit enum (Label, Offset, Placeholder)
- remove program.emit_insn_with_label_dependency() - label dependency is
automatically detected
- for label to offset mapping, use a hashmap from label(negative i32) to
offset (positive u32)
- resolve all labels in program.build()
- remove program.defer_label_resolution() - all labels are resolved in
build()
Closes#625