Important: This documentation describes the underlying SQLite C library API, not the JavaScript API exposed by
@photostructure/sqlite. Most functions documented here (likesqlite3_config(),sqlite3_limit(),sqlite3_blob_open()) are not directly callable from JavaScript.For the JavaScript API, see API Reference.
This reference is for understanding the underlying SQLite capabilities and for developers working on the native bindings.
Main index for the SQLite C/C++ API documentation. The API is organized into logical sections for navigation. This is a machine-generated summary of documentation found on sqlite.org, used as a reference during development.
The SQLite C/C++ API provides low-level access to all SQLite functionality. This documentation covers the essential APIs needed for building SQLite library implementations.
1. Core API
Foundation APIs for basic database operations
- Database connections (opening, closing)
- Basic SQL execution
- Error handling and result codes
- Transaction control
- Utility functions (version, randomness, etc.)
Prepared statement and data handling
- Compiling and preparing SQL statements
- Parameter binding
- Result retrieval and column access
- Statement metadata
- Data types and encodings
Custom functionality extensions
- User-defined scalar functions
- Aggregate functions
- Window functions
- Custom collations
- Virtual tables
- Auxiliary data management
Specialized APIs for advanced use cases
- Backup API for live database copying
- Blob I/O for incremental access
- Session extension for change tracking
- Threading and concurrency features
- Hooks and callbacks
- Extension loading
- WAL mode operations
System configuration and resource management
- Memory allocation and management
- Global configuration options
- Per-database configuration
- Runtime limits
- Compile-time options
- Status and statistics monitoring
Getting started
sqlite3_open()- Open databasesqlite3_close()- Close databasesqlite3_exec()- Execute SQL directlysqlite3_errmsg()- Get error message
Prepared Statements
sqlite3_prepare_v2()- Compile SQLsqlite3_step()- Execute statementsqlite3_bind_*()- Bind parameterssqlite3_column_*()- Get resultssqlite3_finalize()- Clean up statement
Extensions
sqlite3_create_function_v2()- Create custom functionsqlite3_create_collation_v2()- Create custom collationsqlite3_create_module_v2()- Create virtual table
Configuration
sqlite3_config()- Global configurationsqlite3_db_config()- Database configurationsqlite3_limit()- Set runtime limits
- SQLite Extensions API - Extension and user-defined function APIs
-
API stability: SQLite maintains strong backward compatibility. Functions are rarely deprecated.
-
Thread safety: Configure threading mode with
sqlite3_config()before using SQLite. -
Error checking: Always check return codes. Most functions return
SQLITE_OKon success. -
Memory management: Understand ownership rules for strings and memory passed to/from SQLite.
-
Version compatibility: Use
sqlite3_libversion()to check SQLite version at runtime.
When implementing a SQLite wrapper or binding:
- Core database operations (open, close, exec)
- Prepared statement support
- Proper error handling and reporting
- Parameter binding for all data types
- User-defined function support
- Transaction management
- Thread safety configuration
- Memory management and limits
- Status and statistics reporting
- Each section builds on previous ones; read in order if new to SQLite
- Use your editor's search across all files to find specific functions
- Function names in code blocks can be searched in official SQLite docs
- Examples show common usage patterns