nsdbi - Register a database driver implementation
The following routines are available for database-specific driver modules.
Register a set of Dbi_DriverProc callbacks to provide access to a new type of database. Call this from your module's Ns_ModuleInit() routine.
The name of a virtual server.
The name of the module instance.
The name this driver is known by.
The name of the database this driver connects to. e.g. "sqlite".
The structure used to pass callbacks during driver registration.
Log the number of connections handled by a single TCP socket:
#include "nsdbidrv.h"
NS_EXPORT int Ns_ModuleVersion = 1;
static Dbi_DriverProc procs = {
{Dbi_OpenProcId, Open},
{Dbi_CloseProcId, Close},
{Dbi_ConnectedProcId, Connected},
{Dbi_BindVarProcId, Bind},
{Dbi_PrepareProcId, Prepare},
{Dbi_PrepareCloseProcId, PrepareClose},
{Dbi_ExecProcId, Exec},
{Dbi_NextRowProcId, NextRow},
{Dbi_ColumnLengthProcId, ColumnLength},
{Dbi_ColumnValueProcId, ColumnValue},
{Dbi_ColumnNameProcId, ColumnName},
{Dbi_TransactionProcId, Transaction},
{Dbi_FlushProcId, Flush},
{Dbi_ResetProcId, Reset},
{0, NULL}
};
int
Ns_ModuleInit(CONST char *server, CONST char *module)
{
static CONST char *drivername = "dbdriver";
static CONST char *database = "db";
return Dbi_RegisterDriver(server, module,
drvername, database,
procs, NULL);
}
static int
Open(ClientData configData, Dbi_Handle *handle)
{
...
}
...
Dbi_GetHandle, Dbi_SetException, Dbi_TclGetHandle, nsdbi