mirror of
https://github.com/asg017/sqlite-vec.git
synced 2026-04-25 16:56:27 +02:00
Initial commit
This commit is contained in:
commit
4c8ad629e0
28 changed files with 6758 additions and 0 deletions
5
examples/sqlite3-cli/README.md
Normal file
5
examples/sqlite3-cli/README.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# `sqlite-vec` statically compiled in the SQLite CLI
|
||||
|
||||
You can compile your own version of the `sqlite3` CLI with `sqlite-vec` builtin. The process is not well documented, but the special `SQLITE_EXTRA_INIT` compile option can be used to "inject" code at initialization time. See the `Makefile` at the root of this project for some more info.
|
||||
|
||||
The `core_init.c` file here demonstrates auto-loading the `sqlite-vec` entrypoints at startup.
|
||||
8
examples/sqlite3-cli/core_init.c
Normal file
8
examples/sqlite3-cli/core_init.c
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#include "sqlite3.h"
|
||||
#include "sqlite-vec.h"
|
||||
#include <stdio.h>
|
||||
int core_init(const char *dummy) {
|
||||
int rc = sqlite3_auto_extension((void *)sqlite3_vec_init);
|
||||
if(rc != SQLITE_OK) return rc;
|
||||
return sqlite3_auto_extension((void *)sqlite3_vec_fs_read_init);
|
||||
}
|
||||
5
examples/wasm/README.md
Normal file
5
examples/wasm/README.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# `sqlite-vec` statically compiled into WASM builds
|
||||
|
||||
You can compile your own version of SQLite's WASM build with `sqlite-vec` builtin. Dynamically loading SQLite extensions is not supported in the official WASM build yet, but you can statically compile extensions in. It's not well documented, but the `sqlite3_wasm_extra_init` option in the SQLite `ext/wasm` Makefile allows you to inject your own code at initialization time. See the `Makefile` at the room of the project for more info.
|
||||
|
||||
The `wasm.c` file here demonstrates auto-loading the `sqlite-vec` entrypoints at startup.
|
||||
6
examples/wasm/wasm.c
Normal file
6
examples/wasm/wasm.c
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#include "sqlite3.h"
|
||||
#include "sqlite-vec.h"
|
||||
|
||||
int sqlite3_wasm_extra_init(const char *) {
|
||||
sqlite3_auto_extension((void (*)(void)) sqlite3_vec_init);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue