Commit Graph

458 Commits

Author SHA1 Message Date
Owen Delahoy
c31f2b10b7 fix: implement generate_random_number for wasm binding 2025-05-22 20:12:48 +09:00
Diego Reis
4766c9c286 bind/rust: Fix lifetime issue with pragma_query
Shallow cloning in Row ended up invalidating the pointer
to value
2025-05-19 21:29:07 -03:00
Diego Reis
ed0e3b1ba2 bind/rust: Implement pragma_query 2025-05-19 14:04:59 -03:00
Diego Reis
72a1cd5e3c wip: pragma_query method 2025-05-18 17:39:22 -03:00
Diego Reis
bc88b7cb65 bind/js: Formatting 2025-05-18 00:51:49 -03:00
Diego Reis
9f6e242e42 bind/js: Partially implements iterate() method
The API still is sync and isn't variadic
2025-05-18 00:51:23 -03:00
Pekka Enberg
e3f71259d8 Rename OwnedValue -> Value
We have not had enough merge conflicts for a while so let's do a
tree-wide rename.
2025-05-15 09:59:46 +03:00
Pekka Enberg
31ebbb190a Limbo 0.0.20 2025-05-14 09:49:05 +03:00
Pekka Enberg
bef665b7f3 Limbo 0.0.20-pre.2 2025-05-14 09:17:07 +03:00
Diego Reis
bc72c396f0 binds: Add empty prepared statement tests 2025-05-12 10:41:05 -03:00
Jussi Saurio
7b388b9696 Merge 'Bindings/Go: Fix symbols for FFI calls' from Preston Thorpe
While debugging another issue for #1469, I noticed that the symbols
aren't being properly referenced for `getError` for either limboRows or
limboStmt types.

Closes #1470
2025-05-12 10:44:31 +03:00
PThorpe92
755a19658f Bindings/Go: Fix symbols for rows + stmt getError FFI calls 2025-05-11 15:26:07 -04:00
PThorpe92
1c7a50de96 Update comments and correct vtab insert behavior 2025-05-10 10:03:00 -04:00
PThorpe92
50f2621c12 Add several more rust tests for parameter binding 2025-05-10 07:46:29 -04:00
PThorpe92
7a5422ee30 Clean up api for remap parameters and consoidate code 2025-05-10 07:46:29 -04:00
PThorpe92
3b09b9892c Comment out Go tests for binding parameters 2025-05-10 07:46:29 -04:00
PThorpe92
273711bf81 Impl Debug for Limbo value type in Go bindings 2025-05-10 07:46:28 -04:00
PThorpe92
e5723b2ca1 Add test in Go bindings for parameters at diff indexes than table ordering 2025-05-10 07:44:29 -04:00
Pekka Enberg
f2372e9aac Merge 'bindings/java: Remove disabled annotation for UPDATE and DELETE ' from Kim Seon Woo
## Changes
Since limbo now supports UPDATE and DELETE, I'm planning to implement
the rest of the features for integrating JDBC and limbo.
Since limbo's [total_changes() function seems to work differently in
compared to the sqlite's](https://discord.com/channels/12586588262579610
20/1321869557459058778/1368830400985563176), let's remove the
`@Disabled` annotation from
`execute_update_should_return_number_of_updated_elements` test  after
the issue is handled.
## Reference
https://github.com/tursodatabase/limbo/issues/615

Closes #1451
2025-05-10 08:02:13 +03:00
Pekka Enberg
97396a553d Merge 'bindings/wasm: add types property for typescript setting' from 오병진
This pull request includes a small change to the
`bindings/wasm/package.json` file. The change adds a `types` field
pointing to the TypeScript declaration file for the package (`[bindings/
wasm/package.jsonR15](diffhunk://#diff-
1f41234b939ba148924b9bbfedd557853ebcd22351a9c300e568ce7af0291babR15)`).

Closes #1460
2025-05-10 07:59:03 +03:00
Pekka Enberg
a105c20f69 Merge 'Implement transaction support in Go adapter' from Jonathan Ness
This PR implements basic transaction support in the Limbo Go adapter by
adding the required methods to fulfill the `driver.Tx` interface.
## Changes
- Add `Begin()` method to `limboConn` to start a transaction
- Add `BeginTx()` method with context support and proper handling of
transaction options
- Implement `Commit()` method to commit transaction changes
- Implement `Rollback()` method with appropriate error handling
- Add transaction tests
## Implementation Details
- Uses the standard SQLite transaction commands (BEGIN, COMMIT,
ROLLBACK)
- Follows the same pattern as other SQL operations in the adapter
(prepare-execute-close)
- Maintains consistent locking and error handling patterns
## Limitations
- Currently, ROLLBACK operations will return an error as they're not yet
fully supported in the underlying Limbo implementation
- Only the default isolation level is supported; all other isolation
levels return `driver.ErrSkip`
- Read-only transactions are not supported and return `driver.ErrSkip`
## Testing
- Added basic transaction tests that verify BEGIN and COMMIT operations
- Adjusted tests to work with the current Limbo implementation
capabilities
These transaction methods enable the Go adapter to be used in
applications that require transaction support while providing clear
error messages when unsupported features are requested.  I'll add to it
when Limbo supports ROLLBACK and/or additional isolation levels.

Closes #1435
2025-05-10 07:58:29 +03:00
Pekka Enberg
9bc1b73d67 Merge 'bindings/javascript: Improve compatibility with better-sqlite' from Diego Reis
Probably this is larger than it should, but this PR:
- Enhance error handling (instead of `unwraps`, napi's `GenericFailure`
with custom message)
- Add missing methods and properties for Database and Statements to turn
explicit what should be done
- Implement `all()` and `run()`* methods for `Statement`
- Bump napi version to the latest stable
- Implement `DatabaseStorage::sync()` for DatabaseFile
- Add conversion from js values to limbo values
\* `run()` isn't 100% compatible yet for two reasons:
 1. The function API isn't variadic -- I chatted with napi's maintainer
in Discord and he said that this isn't possible using only napi (in this
version), and we could normalize "[...] parameters at the JavaScript
layer before passing them to Rust". Something similar to [this](https://
github.com/rolldown/rolldown/blob/main/packages/rolldown/src/utils/bindi
ngify-input-options.ts), which I plan to do in another PR.
2. better-sqlite version returns a result object, which isn't currently
supported by core (AFAIK), I also plan to do this in another PR.

Closes #1464
2025-05-10 07:55:19 +03:00
Pekka Enberg
9bf3f1e90d Merge 'Add time.Time and bool data types support in Go adapter' from Jonathan Ness
PR #1442 added support for using time.Time as query parameters.
Scanning time.Time values from query results still fails:
`sql: Scan error on column index 4, name "mod_time": unsupported Scan,
storing driver.Value type string into type *time.Time`
This change modifies the `toGoValue` function to detect RFC3339
formatted datetime strings and convert them back to time.Time objects
when reading from the database. This provides complete roundtrip support
for time.Time values.
Also added boolean support by converting Go bool values to integers (0
for false, 1 for true) when binding parameters, following SQLite's
convention for representing boolean values.

Reviewed-by: Preston Thorpe (@PThorpe92)

Closes #1465
2025-05-10 07:54:10 +03:00
PThorpe92
efd4767b6a Bindings/Go: Upgrade ebitengine/purego to allow for use with go 1.23.9 2025-05-09 20:25:29 -04:00
jnesss
02d141e3ce add support for bool type 2025-05-09 09:01:24 -07:00
jnesss
c0dd79adc2 Add time.Time support for scanning query results 2025-05-08 20:51:54 -07:00
Diego Reis
242f4d7cdc bind/js: Add tests and some fixes 2025-05-08 15:57:46 -03:00
Diego Reis
64874bca4e bind/js: Add method all() 2025-05-08 15:23:39 -03:00
Diego Reis
559263ce3c bind/js: Add execution of prepared statements with bindings 2025-05-08 15:16:19 -03:00
Diego Reis
0aa46154ab bind/js: Add conversion from js types to limbo types 2025-05-08 10:32:46 -03:00
Diego Reis
74f585d2e0 bind/js: Add missing methods for Database and Statement 2025-05-08 08:46:38 -03:00
Diego Reis
e4014d290f bind/js: Implement DatabaseStorage::sync 2025-05-08 08:42:13 -03:00
Diego Reis
259bfc04b7 bind/js: Improve error handling 2025-05-08 08:40:53 -03:00
Diego Reis
f0a08612b0 bind/js: Close Database connection when it is garbage collected 2025-05-08 08:36:27 -03:00
Diego Reis
787de5e2b3 bind/js: Comment out unused properties
Just left here so we don't lose track of which properties the objects should have
2025-05-08 08:34:48 -03:00
Diego Reis
25df20dc97 bind/js: Bump napi and napi-derive versions 2025-05-08 08:22:04 -03:00
sunrabbit123
67dbd59e2d fix(bindings/wasm): add types property for typescript setting
Signed-off-by: sunrabbit123 <qudwls185@naver.com>
2025-05-08 14:42:54 +09:00
Jonathan Ness
dd56d92b6a Merge branch 'main' into feature/go-transactions 2025-05-07 12:48:20 -07:00
Pekka Enberg
2bd221e5db Merge 'Add embedded library support to Go adapter' from Jonathan Ness
This change enables the Go adapter to embed platform-specific libraries
and extract them at runtime, eliminating the need for users to set
LD_LIBRARY_PATH or other environment variables.
- Add embedded.go with core library extraction functionality
- Update limbo_unix.go and limbo_windows.go to use embedded libraries
- Add build_lib.sh script to generate platform-specific libraries
- Update README.md with documentation for the new feature
- Add .gitignore to prevent committing binary files
- Add test coverage for Vector operations (vector(), vector_extract(),
vector_distance_cos()) and sqlite core features
The implementation maintains backward compatibility with the traditional
library loading mechanism as a fallback. This approach is inspired by
projects like go-embed-python that use a similar technique for native
library distribution.
https://github.com/tursodatabase/limbo/issues/506

Reviewed-by: Preston Thorpe (@PThorpe92)

Closes #1434
2025-05-07 22:31:29 +03:00
Pekka Enberg
e7902541cd Merge 'Add time.Time support to Go driver parameter binding' from Jonathan Ness
### Problem
The Limbo Go driver currently throws an "unsupported type" error when
trying to bind `time.Time` values as query parameters. This requires
applications to manually convert datetime values to strings before
passing them to queries.
### Solution
Added `time.Time` support to the `buildArgs` function in `types.go`. The
implementation:
- Converts `time.Time` to RFC3339 format strings
- Uses the existing `textVal` type for storage
- Maintains compatibility with Limbo's datetime handling
### Example Usage
```go
// Previously failed with "unsupported type: time.Time"
now := time.Now()
db.Exec("INSERT INTO events (timestamp) VALUES (?)", now)

// Now works as expected
```
### Testing
I tested with various datetime operations:
- Parameter binding with time.Time
- Round-trip storage and retrieval
- Compatibility with existing datetime functions
Values are stored in standard ISO8601/RFC3339 format which I believe is
same as sqlite.

Reviewed-by: Preston Thorpe (@PThorpe92)

Closes #1442
2025-05-07 22:30:44 +03:00
jnesss
a4c0f57f82 added embedded library usage notes 2025-05-06 21:43:18 -07:00
jnesss
548bcd4692 accept debug or release parameter - default to release 2025-05-06 20:44:02 -07:00
김선우
aeca307c90 Add reason for the @Disabled 2025-05-05 15:04:48 +09:00
김선우
cb1c538a03 Remove @Disalbed annotation for basic UPDATE and DELETE 2025-05-05 14:51:52 +09:00
Jonathan Ness
65e18cb578 Merge branch 'main' into feature/go-transactions 2025-05-03 16:09:17 -07:00
Jonathan Ness
344ec5befb Merge pull request #2 from jnesss/go-adapter-tests
Go adapter tests
2025-05-03 15:36:51 -07:00
Jonathan Ness
4912725a5d Merge pull request #1 from jnesss/time-fix
Add time.Time support to Go driver parameter binding
2025-05-03 15:36:10 -07:00
jnesss
061579e716 Add time.Time support to Go driver parameter binding 2025-05-03 14:09:25 -07:00
jnesss
091169af38 Go uses amd64 to refer to the 64-bit x86 architecture, while Linux
systems report x86_64. This change maps the architecture names to ensure the built libraries are placed in the correct directories for Go's embedded loading system (e.g., libs/linux_amd64)
2025-05-03 10:23:27 -07:00
Jussi Saurio
e57cea8de7 Merge 'reset statement before executing in rust binding' from Pedro Muniz
Closes #1426

Closes #1436
2025-05-03 18:34:44 +03:00