Skip to content

Conversation

@tvandinther
Copy link
Owner

@tvandinther tvandinther commented Aug 31, 2024

Closes #25

This MR implements an interface to expose prepared statements. The internals are also changed to support this new feature.

Public interface changes are present in this MR.

Parameter binding implementation
Bound parameters are held internally in C# and are bound late when the statement is sent for execution. Resetting the statement currently creates a new prepared statement. A change to the bindings code needs to be made to make this both performant and to prevent new bindings from being made.

@tvandinther tvandinther self-assigned this Aug 31, 2024
@tvandinther tvandinther force-pushed the 25-expose-prepared-statements branch from 2fa47f9 to 5401452 Compare August 31, 2024 17:42
@tvandinther
Copy link
Owner Author

Wondering if I revert this to commit 5401452

The current implementation isn't ideal.

However, need to solve the issue in 5401452 where getting the first row of a queried statement after it was reset returns a row with a null pointer which creates a column type array with an enum value of 0 which is invalid. Seems like there is some kind of cursor reset somewhere?

@tvandinther tvandinther force-pushed the 25-expose-prepared-statements branch from fb175d7 to 85e5e7b Compare August 31, 2024 19:52
@tvandinther
Copy link
Owner Author

Waiting for fix to C bindings to be merged upstream tursodatabase/libsql#1713

@tvandinther
Copy link
Owner Author

Upstream fix has been merged. This branch requires an update to the revision of libsql being built to include it.

@tvandinther
Copy link
Owner Author

tvandinther commented Aug 30, 2025

Update: This feature requires some extra FFI bindings as defined in this branch/fork: https://github.com/tvandinther/libsql/tree/add-missing-statement-functions

It appears that libsql_stmt_columns is the last function to be correctly implemented for this feature to be ready.

@tvandinther tvandinther force-pushed the 25-expose-prepared-statements branch from b4fdef5 to 2b3c305 Compare August 31, 2025 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose the prepared statements interface

1 participant