|
Csilk 0.2.1
A lightweight, high-performance C HTTP web framework
|
MongoDB database driver for csilk. More...
#include <mongoc/mongoc.h>#include <stdlib.h>#include <string.h>#include "csilk/csilk.h"#include "csilk/drivers/db.h"
Data Structures | |
| struct | mongodb_conn_t |
| Per-connection data for the MongoDB driver. More... | |
Functions | |
| static void | mongodb_ensure_init (void) |
| Initialize libmongoc once. | |
| static int | mongodb_connect (csilk_db_pool_t *pool, const char *dsn) |
| Open a connection to MongoDB using a URI. | |
| static int | mongodb_disconnect (csilk_db_pool_t *pool) |
| Close the MongoDB connection and free associated data. | |
| static void | mongodb_free_result (csilk_db_result_t *result) |
| Free a MongoDB query result set. | |
| static char * | bson_val_to_str (const bson_iter_t *iter) |
| Helper: Convert a BSON value to a string representation. | |
| static int | mongodb_query (csilk_db_pool_t *pool, const char *sql, csilk_db_result_t *result) |
| Execute a MongoDB query and return results as tabular rows. | |
| static int | mongodb_exec (csilk_db_pool_t *pool, const char *sql) |
| Execute a non-query command (INSERT, UPDATE, DELETE). | |
| static int | mongodb_transaction_begin (csilk_db_pool_t *pool) |
| static int | mongodb_transaction_commit (csilk_db_pool_t *pool) |
| static int | mongodb_transaction_rollback (csilk_db_pool_t *pool) |
| void | csilk_db_mongodb_init (void) |
Variables | |
| csilk_db_driver_t | csilk_db_mongodb_driver |
MongoDB database driver for csilk.
Implements the csilk_db_driver_t vtable using the native libmongoc C API. Key design points:
| struct mongodb_conn_t |
|
static |
Helper: Convert a BSON value to a string representation.
| void csilk_db_mongodb_init | ( | void | ) |
|
static |
Open a connection to MongoDB using a URI.
Extracts the database name from the URI if provided, otherwise defaults to "test".
| pool | The database pool to initialize. |
| dsn | MongoDB URI string. |
|
static |
Close the MongoDB connection and free associated data.
|
static |
Initialize libmongoc once.
|
static |
Execute a non-query command (INSERT, UPDATE, DELETE).
The 'sql' parameter should be a JSON command.
|
static |
Free a MongoDB query result set.
|
static |
Execute a MongoDB query and return results as tabular rows.
Support:
|
static |
|
static |
|
static |
| csilk_db_driver_t csilk_db_mongodb_driver |