Installing
To use the libSQL C bindings, you need to include thelibsql.h header file in your project and link against the liblibsql.so shared library.
libSQL C
Build from source code
In-Memory Databases
libSQL supports connecting to [in-memory databases](https://www.sqlite.org/inmemorydb.htm databases for cases where you don’t require persistence:Local Development
You can work locally using an SQLite file:Remote Databases
You can connect to remote databases using a URL and auth token:Embedded Replicas
You can work with embedded replicas that can sync from the remote URL and delegate writes to the remote primary database:Manual Sync
Thelibsql_database_sync function allows you to sync manually the local database with the remote counterpart:
Sync Interval
Thesync_interval parameter in the database description allows you to set an interval for automatic synchronization of the database in the background:
Read Your Own Writes
Thenot_read_your_writes parameter in the database description configures the database connection to ensure that writes are immediately visible to subsequent read operations initiated by the same connection. This is enabled by default, and you can disable it by setting not_read_your_writes to true:
Simple query
You can uselibsql_connection_batch for simple queries without parameters:
libsql_connection_prepare and libsql_statement_query:
Prepared Statements
You can prepare a statement usinglibsql_connection_prepare and then execute it with libsql_statement_execute or libsql_statement_query: