Commit Graph

215 Commits

Author SHA1 Message Date
김선우
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
김선우
24ead40f88 Change LimboStatement.java to throw exception when the result is null which is the error case 2025-01-19 21:56:50 +09:00
김선우
9c3c6271a3 Remove System.out.println 2025-01-19 21:56:50 +09:00
김선우
10a7b1b035 Disable for now 2025-01-19 21:56:50 +09:00
김선우
5fbce67774 Temporarily remove restrictions of running test for 1 second 2025-01-19 21:56:50 +09:00
김선우
f80823a297 Add LimboStepResult.java constructor 2025-01-19 21:56:50 +09:00
김선우
b80438226b Commit for testing 2025-01-19 21:56:49 +09:00
김선우
9de80e19aa Fix limbo_statement.rs to handle other StepResults 2025-01-19 21:56:49 +09:00
김선우
647f7124bf Update test code's while loop to run for max 1 second 2025-01-19 21:56:49 +09:00
김선우
0f46aaa0ec Update JDBC4Statement.java execute method to return result correctly 2025-01-19 21:56:40 +09:00
김선우
afbf041e2f Enhance docs 2025-01-19 21:56:40 +09:00
김선우
6967b62bc0 Add invokeFrom field to NativeInvocation.java 2025-01-19 21:56:40 +09:00
김선우
33effdbfd4 Implement JDBC4ResultSEt.java's next() method 2025-01-19 21:56:40 +09:00
김선우
73f8eab651 Remove the tight coupling(using inheritance) between LimboXXX and JDBCXXX and favor composition instead 2025-01-19 21:56:40 +09:00
Pekka Enberg
0abb917604 Limbo 0.0.13 2025-01-19 13:30:56 +02:00
Pekka Enberg
466bc8be0c Merge 'npm packaging for node and web' from Elijah Morgan
Add web support to npm package.
**Still a WIP need to do some cleanup still**
I assumed it is better to keep the server code and web code together in
the same package (bigger download number). It took quite a bit of
experimentation but the ultimate experience is
node - commonjs
```js
const { Database } = require("limbo-wasm/node");
```
web - module
```js
const worker = new Worker(new URL('limbo-wasm/web/limbo-worker.js', import.meta.url), { type: 'module' });
```
Like I said this took a lot of experimentation on my part as this is my
first time trying to create an npm package let alone that mixes commonjs
and modules.
The structure is an npm workspace with two sub packages (web and node).
```
node
├── dist
│   ├── README.md
│   ├── index.d.ts
│   ├── index.js
│   ├── index_bg.wasm
│   ├── index_bg.wasm.d.ts
│   └── snippets
│       └── limbo-wasm-d1562e55b90f5289
│           └── node
│               └── src
│                   └── vfs.js
├── package.json
└── src
    └── vfs.js
web
├── dist
│   ├── README.md
│   ├── index.d.ts
│   ├── index.js
│   ├── index_bg.wasm
│   ├── index_bg.wasm.d.ts
│   └── snippets
│       └── limbo-wasm-d1562e55b90f5289
│           └── web
│               └── src
│                   └── web-vfs.js
├── html
│   ├── index.html
│   ├── limbo-opfs-test.html
│   └── limbo-test.html
├── node_modules
├── package.json
├── playwright.config.js
├── src
│   ├── limbo-worker.js
│   ├── opfs-interface.js
│   ├── opfs-sync-proxy.js
│   ├── opfs-worker.js
│   ├── opfs.js
│   └── web-vfs.js
├── test
│   ├── helpers.js
│   ├── limbo.test.js
│   ├── opfs.test.js
│   └── setup.js
└── vite.config.js
```
The output of wasm-pack gets put in <web/node>dist
JS code moves into <web/node>src/
Tests move under web/test
The npm package looks like (you can see I need to cleanup some of the
stuff that gets included).
```
-rw-r--r--  0 0      0         195 Oct 26  1985 package/web/html/index.html
-rw-r--r--  0 0      0        2733 Oct 26  1985 package/web/html/limbo-opfs-test.html
-rw-r--r--  0 0      0         162 Oct 26  1985 package/web/html/limbo-test.html
-rw-r--r--  0 0      0         632 Oct 26  1985 package/web/test/helpers.js
-rw-r--r--  0 0      0       18128 Oct 26  1985 package/node/dist/index.js
-rw-r--r--  0 0      0       21732 Oct 26  1985 package/web/dist/index.js
-rw-r--r--  0 0      0        1836 Oct 26  1985 package/web/src/limbo-worker.js
-rw-r--r--  0 0      0        2108 Oct 26  1985 package/web/test/limbo.test.js
-rw-r--r--  0 0      0        1764 Oct 26  1985 package/web/src/opfs-interface.js
-rw-r--r--  0 0      0        3409 Oct 26  1985 package/web/src/opfs-sync-proxy.js
-rw-r--r--  0 0      0        1430 Oct 26  1985 package/web/src/opfs-worker.js
-rw-r--r--  0 0      0        3976 Oct 26  1985 package/web/src/opfs.js
-rw-r--r--  0 0      0        4502 Oct 26  1985 package/web/test/opfs.test.js
-rw-r--r--  0 0      0         269 Oct 26  1985 package/web/playwright.config.js
-rw-r--r--  0 0      0           0 Oct 26  1985 package/web/test/setup.js
-rw-r--r--  0 0      0         519 Oct 26  1985 package/node/dist/snippets/limbo-wasm-d1562e55b90f5289/node/src/vfs.js
-rw-r--r--  0 0      0         519 Oct 26  1985 package/node/src/vfs.js
-rw-r--r--  0 0      0         608 Oct 26  1985 package/web/vite.config.js
-rw-r--r--  0 0      0         435 Oct 26  1985 package/web/dist/snippets/limbo-wasm-d1562e55b90f5289/web/src/web-vfs.js
-rw-r--r--  0 0      0         435 Oct 26  1985 package/web/src/web-vfs.js
-rw-r--r--  0 0      0         146 Oct 26  1985 package/web/node_modules/.vite/deps/_metadata.json
-rw-r--r--  0 0      0         309 Oct 26  1985 package/node/package.json
-rw-r--r--  0 0      0         671 Oct 26  1985 package/package.json
-rw-r--r--  0 0      0          23 Oct 26  1985 package/web/node_modules/.vite/deps/package.json
-rw-r--r--  0 0      0         602 Oct 26  1985 package/web/package.json
-rw-r--r--  0 0      0         153 Oct 26  1985 package/web/node_modules/.vite/vitest/results.json
-rw-r--r--  0 0      0        1296 Oct 26  1985 package/node/dist/README.md
-rw-r--r--  0 0      0        1296 Oct 26  1985 package/README.md
-rw-r--r--  0 0      0        1296 Oct 26  1985 package/web/dist/README.md
-rw-r--r--  0 0      0        1217 Oct 26  1985 package/node/dist/index_bg.wasm.d.ts
-rw-r--r--  0 0      0        1217 Oct 26  1985 package/web/dist/index_bg.wasm.d.ts
-rw-r--r--  0 0      0         449 Oct 26  1985 package/node/dist/index.d.ts
-rw-r--r--  0 0      0        2554 Oct 26  1985 package/web/dist/index.d.ts
-rw-r--r--  0 0      0     2215065 Oct 26  1985 package/node/dist/index_bg.wasm
-rw-r--r--  0 0      0     2213889 Oct 26  1985 package/web/dist/index_bg.wasm
```
resolves #624

Closes #657
2025-01-19 12:53:21 +02:00
Elijah Morgan
74ddc42df0 Add back integration tests
Fix package.json for better imports vs web/nodejs
Fix examples and integration tests
2025-01-18 15:01:16 -05:00
Jorge López
683125fefb syntactic changes: factor duplicated code into helper function that can be reused 2025-01-18 19:20:11 +01:00
Jorge López
e4ab2fb273 syntactic changes: rewrite loop with while 2025-01-18 19:19:49 +01:00
Jorge López
86a4714711 syntactic changes: remove unneeded paths when the type is already imported 2025-01-18 18:29:12 +01:00
김선우
ab23e20732 Revert java image. Disable some failing test for now. 2025-01-18 09:52:42 +09:00
김선우
aa88dd5d1a Print out yest results while build 2025-01-18 09:42:48 +09:00
김선우
eaa8743c36 Nit 2025-01-18 09:16:09 +09:00
김선우
39245f35cc Add TODOs 2025-01-18 09:09:36 +09:00
김선우
5b9a158db1 Remove unused methods 2025-01-18 09:09:36 +09:00
김선우
a3a31e787c Initial pass on step function 2025-01-18 09:09:36 +09:00
김선우
5fc5f650cd Extract set_err_msg_and_throw_exception to utils.rs 2025-01-18 09:09:36 +09:00
김선우
7028d963ba Remove unused methods for now 2025-01-18 09:09:36 +09:00
김선우
f6ec2252cf Group "pointer to struct" and "struct to pointer" functions 2025-01-18 09:09:36 +09:00
김선우
9765eaba52 Implement prepare 2025-01-18 09:09:36 +09:00
김선우
b77bf879f7 Implement prepare on java side 2025-01-18 09:09:36 +09:00
김선우
3e2e998060 Rename fileName to filePath for clarity 2025-01-18 09:09:36 +09:00
김선우
0819963b2f Implement rust side connect and prepare function 2025-01-18 09:09:36 +09:00
김선우
7e78ec448b Clean up error code related classes 2025-01-18 09:09:36 +09:00
김선우
fcadc2f825 Add connect function for creating connections from limbo db 2025-01-18 09:09:36 +09:00
김선우
3409a82513 Add LimboDBFactory to support multiple LimboDB in single process 2025-01-18 09:09:36 +09:00
김선우
0a071d26f7 Add logback dependency for logging 2025-01-18 09:09:36 +09:00