mirror of
https://github.com/allankoechke/turso.git
synced 2026-11-30 11:12:58 +00:00
Move SQLite C API to bindings/c
No reason to keep SQLite C API as a top-level directory.
This commit is contained in:
2
.github/labeler.yml
vendored
2
.github/labeler.yml
vendored
@@ -58,7 +58,7 @@ cli:
|
||||
|
||||
sqlite3:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: "sqlite3/**/*"
|
||||
- any-glob-to-any-file: "bindings/c/**/*"
|
||||
|
||||
core:
|
||||
- changed-files:
|
||||
|
||||
10
.github/workflows/c-compat.yml
vendored
10
.github/workflows/c-compat.yml
vendored
@@ -46,19 +46,19 @@ jobs:
|
||||
run: cargo build -p turso_sqlite3 --features capi --locked
|
||||
|
||||
- name: Run C compat tests from Rust
|
||||
working-directory: sqlite3
|
||||
working-directory: bindings/c
|
||||
run: cargo test --locked
|
||||
|
||||
- name: Run C compat C tests linking against real SQLite
|
||||
working-directory: sqlite3/tests
|
||||
working-directory: bindings/c/tests
|
||||
run: |
|
||||
make clean
|
||||
make LIBS="-lsqlite3"
|
||||
./sqlite3-tests
|
||||
|
||||
- name: Run C compat C tests linking against Turso
|
||||
working-directory: sqlite3/tests
|
||||
working-directory: bindings/c/tests
|
||||
run: |
|
||||
make clean
|
||||
make LIBS="-L../../target/debug -lturso_sqlite3"
|
||||
LD_LIBRARY_PATH=../../target/debug ./sqlite3-tests
|
||||
make LIBS="-L../../../target/debug -lturso_sqlite3"
|
||||
LD_LIBRARY_PATH=../../../target/debug ./sqlite3-tests
|
||||
|
||||
@@ -20,7 +20,7 @@ members = [
|
||||
"extensions/fuzzy",
|
||||
"macros",
|
||||
"testing/simulator",
|
||||
"sqlite3",
|
||||
"bindings/c",
|
||||
"testing/stress",
|
||||
"testing/sqlite_test_ext",
|
||||
"tests",
|
||||
@@ -63,7 +63,7 @@ default-members = [
|
||||
"extensions/fuzzy",
|
||||
"macros",
|
||||
"testing/simulator",
|
||||
"sqlite3",
|
||||
"bindings/c",
|
||||
"testing/stress",
|
||||
"testing/sqlite_test_ext",
|
||||
"tests",
|
||||
|
||||
@@ -240,7 +240,7 @@ mod tests {
|
||||
unsafe {
|
||||
let mut db = ptr::null_mut();
|
||||
assert_eq!(
|
||||
sqlite3_open(c"../testing/system/testing_clone.db".as_ptr(), &mut db),
|
||||
sqlite3_open(c"../../testing/system/testing_clone.db".as_ptr(), &mut db),
|
||||
SQLITE_OK
|
||||
);
|
||||
assert_eq!(sqlite3_close(db), SQLITE_OK);
|
||||
@@ -651,7 +651,7 @@ mod tests {
|
||||
unsafe {
|
||||
let mut db = std::ptr::null_mut();
|
||||
assert_eq!(
|
||||
sqlite3_open(c"../testing/system/testing.db".as_ptr(), &mut db),
|
||||
sqlite3_open(c"../../testing/system/testing.db".as_ptr(), &mut db),
|
||||
SQLITE_OK
|
||||
);
|
||||
let mut stmt = std::ptr::null_mut();
|
||||
@@ -51,7 +51,7 @@ void test_sqlite3_changes()
|
||||
char *err_msg = NULL;
|
||||
int rc;
|
||||
|
||||
rc = sqlite3_open("../../testing/testing.db", &db);
|
||||
rc = sqlite3_open("../../../testing/testing.db", &db);
|
||||
assert(rc == SQLITE_OK);
|
||||
|
||||
rc = sqlite3_exec(db,
|
||||
@@ -65,7 +65,7 @@ void test_sqlite3_changes()
|
||||
if (err_msg) { sqlite3_free(err_msg); err_msg = NULL; }
|
||||
|
||||
sqlite3_close(db);
|
||||
rc = sqlite3_open("../../testing/testing.db", &db);
|
||||
rc = sqlite3_open("../../../testing/testing.db", &db);
|
||||
assert(rc == SQLITE_OK);
|
||||
|
||||
assert(sqlite3_changes(db) == 0);
|
||||
@@ -99,7 +99,7 @@ void test_sqlite3_bind_int64()
|
||||
char *err_msg = NULL;
|
||||
int rc;
|
||||
|
||||
rc = sqlite3_open("../../testing/testing.db", &db);
|
||||
rc = sqlite3_open("../../../testing/testing.db", &db);
|
||||
assert(rc == SQLITE_OK);
|
||||
|
||||
rc = sqlite3_exec(db,
|
||||
@@ -147,7 +147,7 @@ void test_sqlite3_bind_double()
|
||||
char *err_msg = NULL;
|
||||
int rc;
|
||||
|
||||
rc = sqlite3_open("../../testing/testing.db", &db);
|
||||
rc = sqlite3_open("../../../testing/testing.db", &db);
|
||||
assert(rc == SQLITE_OK);
|
||||
|
||||
rc = sqlite3_exec(db,
|
||||
@@ -21,7 +21,7 @@
|
||||
ROOT_DIR := $(shell cd ../.. && pwd)
|
||||
TURSO_LIB := $(ROOT_DIR)/target/debug
|
||||
SRC := $(ROOT_DIR)/bindings/tcl/turso_tcl.c
|
||||
INCLUDE := $(ROOT_DIR)/sqlite3/include
|
||||
INCLUDE := $(ROOT_DIR)/bindings/c/include
|
||||
|
||||
# Default target — local build (no Docker required).
|
||||
.PHONY: all
|
||||
@@ -43,7 +43,7 @@ docker-build:
|
||||
cargo build -p turso_sqlite3 2>&1 && \
|
||||
gcc -shared -fPIC -o bindings/tcl/libturso_tcl.so \
|
||||
bindings/tcl/turso_tcl.c \
|
||||
-I sqlite3/include \
|
||||
-I bindings/c/include \
|
||||
-I /usr/include/tcl8.6 \
|
||||
-L target/debug \
|
||||
-lturso_sqlite3 \
|
||||
@@ -66,7 +66,7 @@ docker-test:
|
||||
cargo build -p turso_sqlite3 2>&1 && \
|
||||
gcc -shared -fPIC -o bindings/tcl/libturso_tcl.so \
|
||||
bindings/tcl/turso_tcl.c \
|
||||
-I sqlite3/include \
|
||||
-I bindings/c/include \
|
||||
-I /usr/include/tcl8.6 \
|
||||
-L target/debug \
|
||||
-lturso_sqlite3 \
|
||||
|
||||
@@ -751,7 +751,7 @@ static int TursoOpenCmd(ClientData cd, Tcl_Interp *interp,
|
||||
/* Extension initialisation */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
/* Defined in the sqlite3 Rust crate (sqlite3/src/lib.rs) */
|
||||
/* Defined in the sqlite3 Rust crate (bindings/c/src/lib.rs) */
|
||||
extern int sqlite3_search_count;
|
||||
|
||||
int Tursotcl_Init(Tcl_Interp *interp)
|
||||
|
||||
@@ -35,15 +35,15 @@ REPORT="$RESULTS_DIR/report_${TIMESTAMP}.txt"
|
||||
# ── Locate turso root ────────────────────────────────────────────────────────
|
||||
# Priority: 1) TURSO_ROOT env var 2) walk up to find turso repo 3) clone
|
||||
|
||||
if [ -n "$TURSO_ROOT" ] && [ -f "$TURSO_ROOT/sqlite3/include/sqlite3.h" ]; then
|
||||
if [ -n "$TURSO_ROOT" ] && [ -f "$TURSO_ROOT/bindings/c/include/sqlite3.h" ]; then
|
||||
echo "==> Using turso at $TURSO_ROOT (from environment)"
|
||||
else
|
||||
TURSO_ROOT=""
|
||||
dir="$SCRIPT_DIR"
|
||||
while [ "$dir" != "/" ]; do
|
||||
dir="$(dirname "$dir")"
|
||||
if [ -f "$dir/sqlite3/include/sqlite3.h" ] && [ -f "$dir/Cargo.toml" ]; then
|
||||
if grep -q '"sqlite3"' "$dir/Cargo.toml" 2>/dev/null; then
|
||||
if [ -f "$dir/bindings/c/include/sqlite3.h" ] && [ -f "$dir/Cargo.toml" ]; then
|
||||
if grep -q '"bindings/c"' "$dir/Cargo.toml" 2>/dev/null; then
|
||||
TURSO_ROOT="$dir"
|
||||
break
|
||||
fi
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
BACKEND ?= turso
|
||||
|
||||
TURSO_ROOT ?= ../../..
|
||||
TURSO_INC= $(TURSO_ROOT)/sqlite3/include
|
||||
TURSO_INC= $(TURSO_ROOT)/bindings/c/include
|
||||
TURSO_PROFILE ?= release
|
||||
TURSO_LIB= $(TURSO_ROOT)/target/$(TURSO_PROFILE)
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ COPY perf/throughput/rusqlite ./perf/throughput/rusqlite
|
||||
COPY perf/throughput/turso ./perf/throughput/turso
|
||||
COPY perf/memory ./perf/memory/
|
||||
COPY cli ./cli/
|
||||
COPY sqlite3 ./sqlite3/
|
||||
COPY tests ./tests/
|
||||
COPY testing ./testing/
|
||||
COPY sql_generation ./sql_generation/
|
||||
|
||||
Reference in New Issue
Block a user