Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve C bindings #641

Merged
merged 2 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions bindings/c/include/libsql.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ int libsql_column_name(libsql_rows_t res, int col, const char **out_name, const

int libsql_column_type(libsql_rows_t res, int col, int *out_type, const char **out_err_msg);

uint64_t libsql_changes(libsql_connection_t conn);

int64_t libsql_last_insert_rowid(libsql_connection_t conn);

int libsql_next_row(libsql_rows_t res, libsql_row_t *out_row, const char **out_err_msg);

void libsql_free_row(libsql_row_t res);
Expand Down
12 changes: 12 additions & 0 deletions bindings/c/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,18 @@ pub unsafe extern "C" fn libsql_column_type(
0
}

#[no_mangle]
pub unsafe extern "C" fn libsql_changes(conn: libsql_connection_t) -> u64 {
let conn = conn.get_ref();
conn.changes()
}

#[no_mangle]
pub unsafe extern "C" fn libsql_last_insert_rowid(conn: libsql_connection_t) -> i64 {
let conn = conn.get_ref();
conn.last_insert_rowid()
}

#[no_mangle]
pub unsafe extern "C" fn libsql_next_row(
res: libsql_rows_t,
Expand Down
Loading