-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
146 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
CC = gcc | ||
LDFLAGS = -L../../target/release -Wl,-rpath,../../target/release | ||
LIBS = -llibsql | ||
|
||
TARGET = example | ||
|
||
all: $(TARGET) | ||
|
||
../../target/release/liblibsql.so: | ||
@echo "Building libsql..." | ||
@cd ../.. && cargo build --release | ||
|
||
$(TARGET): example.c ../../target/release/liblibsql.so | ||
$(CC) $(LDFLAGS) -o $@ $< $(LIBS) | ||
|
||
clean: | ||
rm -f $(TARGET) | ||
|
||
.PHONY: all clean |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../Makefile.common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Batch | ||
|
||
This example demonstrates how to use libsql to execute a batch of SQL statements. | ||
|
||
## Building | ||
|
||
```bash | ||
make | ||
``` | ||
|
||
## Running | ||
|
||
Execute the example: | ||
|
||
```bash | ||
./example | ||
``` | ||
|
||
This will create a local database, execute a batch of SQL statements (creating tables, inserting data, etc.), and then query the results. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../Makefile.common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Local | ||
|
||
This example demonstrates how to use libsql with a local SQLite file. | ||
|
||
## Building | ||
|
||
```bash | ||
make | ||
``` | ||
|
||
## Running | ||
|
||
```bash | ||
./example | ||
``` | ||
|
||
This will connect to a local SQLite, insert some data, and query it. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../Makefile.common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Remote | ||
|
||
This example demonstrates how to use libsql with a remote database. | ||
|
||
## Building | ||
|
||
```bash | ||
make | ||
``` | ||
|
||
## Running | ||
|
||
```bash | ||
TURSO_DATABASE_URL="..." TURSO_AUTH_TOKEN="..." ./example | ||
``` | ||
|
||
This will connect to a remote database, insert some data, and query it. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../Makefile.common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Sync | ||
|
||
This example demonstrates how to use libsql with a synced database (local file synced with a remote database). | ||
|
||
## Building | ||
|
||
```bash | ||
make | ||
``` | ||
|
||
## Running | ||
|
||
```bash | ||
TURSO_DATABASE_URL="..." TURSO_AUTH_TOKEN="..." ./example | ||
``` | ||
|
||
This will create a local database file that syncs with a remote database, insert some data, and query it. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../Makefile.common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Transactions | ||
|
||
This example demonstrates how to use transactions with libsql. It shows how to start a transaction, perform multiple operations, and then commit or rollback the transaction. | ||
|
||
## Building | ||
|
||
```bash | ||
make | ||
``` | ||
|
||
## Running | ||
|
||
```bash | ||
./example | ||
``` | ||
|
||
This example will: | ||
|
||
1. Create a new table called `users`. | ||
2. Start a transaction. | ||
3. Insert multiple users within the transaction. | ||
4. Demonstrate how to rollback a transaction. | ||
5. Start another transaction. | ||
6. Insert more users and commit the transaction. | ||
7. Query and display the final state of the `users` table. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../Makefile.common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Vector | ||
|
||
This example demonstrates how to use libsql vector search with a local database. | ||
|
||
## Building | ||
|
||
```bash | ||
make | ||
``` | ||
|
||
## Running | ||
|
||
```bash | ||
./example | ||
``` | ||
|
||
This will create a local database file that with a table for embeddings, insert some data (including embeddings), and query using the vector similarity search function. |