6#ifndef __CWIST_DB_POOL_H__
7#define __CWIST_DB_POOL_H__
11#include <cjson/cJSON.h>
Database operations wrapper (SQLite3).
cwist_db * cwist_db_pool_acquire(cwist_db_pool_t *pool)
Acquire a connection from the pool. Blocks until one is available.
cwist_error_t cwist_db_pool_exec(cwist_db_pool_t *pool, const char *sql)
Execute a non-query using a pooled connection.
cwist_db * cwist_db_pool_acquire_timeout(cwist_db_pool_t *pool, int timeout_ms)
Lease a pooled connection, waiting at most timeout_ms.
void cwist_db_pool_release(cwist_db_pool_t *pool, cwist_db *conn)
Return a connection to the pool.
cwist_db_pool_t * cwist_db_pool_create(const char *path, size_t max_conns)
Create a pool of SQLite connections.
bool cwist_db_pool_destroy_timeout(cwist_db_pool_t *pool, int timeout_ms)
Close a pool, waiting up to timeout_ms for leased connections.
void cwist_db_pool_destroy(cwist_db_pool_t *pool)
Destroy the pool and close all connections.
cwist_error_t cwist_db_pool_query(cwist_db_pool_t *pool, const char *sql, cJSON **result)
Execute a query using a pooled connection.
struct cwist_db_pool cwist_db_pool_t
Opaque database connection pool handle.
size_t cwist_db_pool_in_use(cwist_db_pool_t *pool)
Count connections currently leased from the pool.
Wrapper for Database Operations. Currently uses SQLite3.
Integrated error structure used throughout the system.
Unified error code and type definitions for the CWIST system layer.