Commit Graph

251 Commits

Author SHA1 Message Date
PThorpe92
7ee52fca4d bindings/go: update readme with example, change module name 2025-01-31 19:22:21 -05:00
PThorpe92
8d93130809 bindings/go: enable multiple connections, register all symbols at library load 2025-01-31 13:28:05 -05:00
PThorpe92
950f29daab bindings/go: Adjust tests for multiple concurrent connections 2025-01-31 13:28:05 -05:00
PThorpe92
d03ed353dc Free memory of strings + blobs created on the Rust side 2025-01-29 12:03:52 -05:00
PThorpe92
d9966d2dc8 Support blob types in query arguments for Go bindings 2025-01-29 12:03:47 -05:00
Pekka Enberg
e47240705c Merge 'bindings/go: Progress on Go driver, first working incremental state' from Preston Thorpe
This PR brings the Go database/sql driver to it's first working state
and adds a Go package to demonstrate.
The example pkg demonstrates (in it's most bare/naive form at this
point):
1. Open database (memory, in this case)
2. Create connection
3. Prepare statement (Create table)
4. `Exec`
5. Prepare statement (Insert, bind 3 arguments (int, string, blob) (
6. `Exec`
7. Prepare statement (Select *)
8. `Columns` -> print columns
9. `Query` -> print rows
10. Close db connection
![image](https://github.com/user-
attachments/assets/b59ec9f5-9ac6-4a59-9cad-fbb57893fbf8)
still tons of work to do but I at least wanted to get it to a state
where it's not totally broken.
I'll add some actual tests tomorrow

Closes #796
2025-01-29 13:10:52 +02:00
Pekka Enberg
aec7f1ddd2 Merge 'bindings/java: Implement methods in JDBC4ResultSet' from Kim Seon Woo
## Purpose of this PR
- Implement `JDBC4ResultSet`'s `getXXX(columnIndex)` methods
## Changes
- `JDBC4ResultSet`'s `getXXX(columnIndex)` methods are implemented
- Add some docs for clarification(+ leaving history)
## Reference
- [Issue](https://github.com/tursodatabase/limbo/issues/615)

Closes #813
2025-01-29 09:45:26 +02:00
김선우
9fd2c67b4d Add tests for out of bound access to arrays 2025-01-29 12:04:07 +09:00
김선우
7fe5ba84c7 Fix test that uses wrong data types 2025-01-29 11:59:42 +09:00
김선우
3649e8f67c Add test to verify behavior on null columns 2025-01-29 11:56:49 +09:00
김선우
041c8fbddc Fix executeQuery to not run statement.execute() 2025-01-29 11:53:44 +09:00
김선우
2e62abe6df Implement basic getXX methods for JDBC4ResultSet 2025-01-29 11:41:56 +09:00
Glauber Costa
bf1cfe3a1d avoid potentially expensive operations on prepare, query, execute
This simple patch makes sure we can operate with a reference to the
string instead of being forced to transform it to a string, and makes
sure that the Arc doesn't have to be cloned (which can be expensive in
multi-core systems).

This doesn't really make a large difference in benchmarks, given how
expensive Parse::new() is.
2025-01-28 13:44:34 -05:00
PThorpe92
bf6b80edab Continue progress go database/sql driver, add tests and CI 2025-01-28 11:24:57 -05:00
Pekka Enberg
3baca19f75 Merge 'bindings/java: Implement close() for LimboStatement and LimboResultSet ' from Kim Seon Woo
## Purpose of this PR
- Implement `close()` method for `LimboStatement`(+`JDBC4Statement`) and
`LimboResultSet`(+ `JDBC4ResultSet`)
## Changes
- Add `consumeAll` method in `LimboResultSet`
- Implement `close()` methods
  - Because  `JDBC4Statement` has longer lifecycle in compared to
`LimboStatement`, we manage different `close` fields(`LimboStatement` is
created when first `execute` method is called on `JDBC4Statemenet`)
## Reference
- [Issue](https://github.com/tursodatabase/limbo/issues/615)

Closes #799
2025-01-28 14:18:01 +02:00
김선우
55a7cd230e Add README.md for bindings/java 2025-01-28 10:48:44 +09:00
김선우
b17511b559 Fix test to use lighter query 2025-01-28 09:25:57 +09:00
김선우
a82c459ed0 Implement close on LimboStatement and JDBC4Statement independently 2025-01-28 09:20:07 +09:00
김선우
eeed305b07 Nit 2025-01-27 20:40:43 +09:00
김선우
c18418bed0 Nit 2025-01-27 20:35:11 +09:00
김선우
e48d7aa763 Add consumeAll method in LimboResultSet and let JDBC4Statement to use it 2025-01-27 20:31:37 +09:00
김선우
4dd2d1c64a Implement close() on LimboStatement 2025-01-27 20:20:10 +09:00
김선우
6252947232 Fix the logic on determining whether connection is closed 2025-01-27 19:49:10 +09:00
김선우
1125e51a59 Add test for close() 2025-01-27 19:19:34 +09:00
김선우
dae15ef0e3 Implement limbo close() 2025-01-27 19:15:02 +09:00
Pekka Enberg
5a1e1f690a Merge 'bindings/java: Log driver loading error' from Pekka Enberg
Reviewed-by: Kim Seon Woo (@seonWKim)

Closes #791
2025-01-27 09:09:03 +02:00
Pekka Enberg
6f93f290e1 bindings/java: Log driver loading error 2025-01-26 21:07:18 +02:00
Pekka Enberg
0918fc40d4 bindings/go: Rename to Limbo
...we'll likely call this Turso eventually, but right now, let's keep
the code consistent.
2025-01-26 20:58:10 +02:00
Pekka Enberg
4f1548d27b Merge 'bindings/java: Apply spotless formatting in bindings/java project ' from Kim Seon Woo
## Changes
- Add lint related commands in Makefile
- Apply spotless formatting
## Related
- [Issue](https://github.com/tursodatabase/limbo/issues/615)

Closes #783
2025-01-26 20:48:42 +02:00
Pekka Enberg
7967cc5efc core: Kill Rows wrapper struct
It's just an useless wrapper, kill it.
2025-01-26 16:27:19 +02:00
김선우
2212cc2a09 Apply lints 2025-01-26 20:04:57 +09:00
김선우
8b6e761496 Add lint commands in Makefile 2025-01-26 20:04:30 +09:00
Pekka Enberg
6c80b1dc78 Merge 'bindings/go: Begin implementation of Go database/sql driver' from Preston Thorpe
This WIP driver uses the [purego](github.com/ebitengine/purego) library,
that supports cross platform `Dlopen`/`Dlsym` and not a whole lot else.
I really didn't want to use CGO, have very little experience with WASM
and I heard nothing but good things about this library. It's very easy
to use and stable especially when you consider the use case here of 3
functions.
![image](https://github.com/user-
attachments/assets/ae28c8f2-1d11-4d25-b999-22af8bd65a92)
NOTE: The WIP state that this PR is in right at this moment, is not able
to run these simple queries. This screengrab was taken from a couple
days ago when I wrote up a quick demo to load the library, call a simple
query and had it println! the result to make sure everything was working
properly.
I am opening this so kind of like the Java bindings, I can incrementally
work on this. I didn't want to submit a massive PR, try to keep them at
~1k lines max. The state of what's in this PR is highly subject and
likely to change.
I will update when they are at a working state where they can be tested
out and make sure they work across platforms.

Closes #776
2025-01-26 08:51:27 +02:00
PThorpe92
32c985f9a8 Progress on Go bindings, add prepare + query statement 2025-01-25 23:01:46 -05:00
PThorpe92
4be1f9c3cc Begin work on Go bindings (purego) 2025-01-25 11:37:12 -05:00
김선우
7d81c32261 Add spotless support for bindings/java formatting 2025-01-25 15:25:13 +09:00
김선우
f10b41c5b5 Pass io to statement from db 2025-01-24 15:43:44 +09:00
김선우
53586b9d00 Break the loop when step() returns Err 2025-01-24 15:06:10 +09:00
김선우
0481e69217 Handle Err case from connection.io 2025-01-24 14:07:52 +09:00
김선우
36dff168b3 Execute io.run_once when receiving StepResult::IO 2025-01-24 13:52:54 +09:00
김선우
d05ffce613 Apply fmt 2025-01-24 13:52:54 +09:00
김선우
82e9fe0219 Handle invalid step results 2025-01-24 13:52:54 +09:00
김선우
f7a8d1b428 Change Java_org_github_tursodatabase_core_LimboStatement_step to run in loop to handle StepResult::IO 2025-01-24 13:52:54 +09:00
Pekka Enberg
39ceddc7c1 Merge 'bindings/java: Implement JDBC ResultSet' from Kim Seon Woo
## Purpose of this PR
Associate jdbc's `ResultSet` with the returned values from limbo's step
function.
## Changes
### Rust
- `Java_org_github_tursodatabase_core_LimboStatement_step` now returns
an object of java's `LimboStepResult.java`
### Java
- Added `LimboStepResult.java` in order to distinguish the type of
`StepResult`(which limbo returns) and to encapsulate the interpretation
of limbo's `StepResult`
- Change `JDBC4ResultSet` inheriting `LimboResultSet` to composition.
IMO when using inheritance, it's too burdensome to fit unmatching parts
together.
- Enhance `JDBC4Statement.java`'s `execute` method
  - By looking at the `ResultSet` created after executing the qury, it's
now able to determine the (boolean) result.
## Reference
- https://github.com/tursodatabase/limbo/issues/615

Closes #743
2025-01-20 09:33:33 +02:00
sonhmai
75f0cf9e20 chore: make clippy happy 2025-01-20 13:29:23 +07:00
김선우
ddfbf11659 Fix test 2025-01-19 22:14:17 +09:00
김선우
e8a62b67d2 Disable failing test 2025-01-19 21:56:50 +09:00
김선우
8f9e70417d Implement executeQuery and executeUpdate 2025-01-19 21:56:50 +09:00
김선우
fb2b5eb11f Add debugging logs 2025-01-19 21:56:50 +09:00
김선우
f8cc08e5ad Remove unused method 2025-01-19 21:56:50 +09:00