Skip to content

Commit

Permalink
Bump bindings version to libsql-rs-v0.5.0 (#26)
Browse files Browse the repository at this point in the history
* Update bindings to libsql-rs-v0.5.0

* Fix changes in bindings interface
  • Loading branch information
tvandinther authored Aug 31, 2024
1 parent 04cd738 commit a6435b1
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 8 deletions.
7 changes: 6 additions & 1 deletion Libsql.Client/DatabaseWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,14 @@ private unsafe int OpenRemoteDatabase(DatabaseClientOptions options, ref Error e

fixed (byte* replicaPathPtr = Encoding.UTF8.GetBytes(replicaPath))
{
var readYourWrites = true;
byte* localEncryptionKeyPtr = null;
return Bindings.libsql_open_sync(
replicaPathPtr,
urlPtr,
authTokenPtr,
*(byte*)&readYourWrites,
localEncryptionKeyPtr,
dbPtr,
errorCodePtr
);
Expand Down Expand Up @@ -152,13 +156,14 @@ public async Task<IResultSet> Execute(string sql, params object[] args)
});
}

// TODO: Differentiate query statements and execute statements.
private unsafe IResultSet ExecuteStatement(Statement statement)
{
var error = new Error();
var rows = new libsql_rows_t();
int exitCode;

exitCode = Bindings.libsql_execute_stmt(statement.Stmt, &rows, &error.Ptr);
exitCode = Bindings.libsql_query_stmt(statement.Stmt, &rows, &error.Ptr);
statement.Dispose();

error.ThrowIfNonZero(exitCode, "Failed to execute statement");
Expand Down
10 changes: 5 additions & 5 deletions generate-bindings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -euo pipefail

script_dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"

export LIBSQL_VERSION="0.2.2"
export LIBSQL_RS_VERSION="0.5.0"
bindings_dir="${script_dir}/rust-bindings"
force=false

Expand Down Expand Up @@ -41,11 +41,11 @@ fi
# git sparse-checkout init
# git sparse-checkout set bindings/c bindings/wasm libsql libsql-sys
# -----
git fetch --quiet origin
git checkout bdb526e
# git fetch --quiet origin
# git checkout fb85262
# -----
# git fetch --depth 1 origin tag v${LIBSQL_VERSION}
# git reset --hard tags/v${LIBSQL_VERSION}
git fetch --depth 1 origin tag libsql-rs-v${LIBSQL_RS_VERSION}
git reset --hard tags/libsql-rs-v${LIBSQL_RS_VERSION}

cd ..
cargo build --release
6 changes: 5 additions & 1 deletion rust-bindings/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ members = [
]

[workspace.dependencies]
rusqlite = { package = "libsql-rusqlite", path = "libsql/vendored/rusqlite", version = "0.29", default-features = false, features = [
rusqlite = { package = "libsql-rusqlite", path = "libsql/vendored/rusqlite", version = "0.32", default-features = false, features = [
"libsql-experimental",
"column_decltype",
"load_extension",
"modern_sqlite",
"functions",
"limits",
"hooks",
] }
hyper = { version = "0.14" }
tower = { version = "0.4.13" }
4 changes: 3 additions & 1 deletion rust-bindings/csharp-bindings/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ edition = "2021"
[lib]
crate-type = ["dylib"]
path = "../libsql/bindings/c/src/lib.rs"
doc = false

[build-dependencies]
csbindgen = "1.2.0"

[dependencies]
sql-experimental = { path = "../libsql/bindings/c" }
bytes = "1.5.0"
libsql = { path = "../libsql/libsql" }
lazy_static = "1.4.0"
tokio = { version = "1.29.1", features = [ "rt-multi-thread" ] }
hyper-rustls = { version = "0.25", features = ["webpki-roots"]}
12 changes: 12 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{ pkgs ? import <nixpkgs> {} }:

pkgs.mkShell {
buildInputs = with pkgs; [
rustup
cmake
];

shellHook = ''
rustup default stable
'';
}

0 comments on commit a6435b1

Please sign in to comment.