IRCBot Plugin API  v5
Public Attributes | List of all members
API_db Struct Reference

#include <plugins.h>

Public Attributes

sqlite3 *(* GetHandle )()
 Return's the bot's sqlite3 handle. More...
 
int(* Query )(const char *query, sqlite3_callback cb, void *parm, char **error)
 
void(* Free )(char *ptr)
 
int(* GetTable )(const char *query, char ***resultp, int *nrow, int *ncolumn, char **errmsg)
 
const char *(* GetTableEntry )(int row, int col, char **result, int nrow, int ncol)
 
void(* FreeTable )(char **result)
 
char *(* MPrintf )(const char *fmt,...)
 Identical to sqlite3_mprintf, free returned string with API_db::Free. More...
 
void(* Lock )()
 Lock the database for exclusive access, only use this if you have to (mainly for InsertID) More...
 
void(* Release )()
 Release the database lock. More...
 
int64(* InsertID )()
 Last insert ID. More...
 

Detailed Description

This structure contains functions related to the bot's internal SQLite DB. Plugins can use this to store any kind of information they want.
If you create your own tables make sure to prefix them with something unique to make sure it doesn't conflict with anyone else's work.
Also do not mess with the busy/timeout handlers, by default IRCBot will handle that for you in Query/GetTable and try the query several times to make sure it works.
I won't document all these functions since they work the same way as sqlite3's API so you can just read up there.

See also
http://www.sqlite.org/c3ref/intro.html

Member Data Documentation

sqlite3*(* API_db::GetHandle)()

Return's the bot's sqlite3 handle.

int(* API_db::Query)(const char *query, sqlite3_callback cb, void *parm, char **error)
void(* API_db::Free)(char *ptr)
int(* API_db::GetTable)(const char *query, char ***resultp, int *nrow, int *ncolumn, char **errmsg)
const char*(* API_db::GetTableEntry)(int row, int col, char **result, int nrow, int ncol)
void(* API_db::FreeTable)(char **result)
char*(* API_db::MPrintf)(const char *fmt,...)

Identical to sqlite3_mprintf, free returned string with API_db::Free.

See also
http://www.sqlite.org/c3ref/mprintf.html
void(* API_db::Lock)()

Lock the database for exclusive access, only use this if you have to (mainly for InsertID)

void(* API_db::Release)()

Release the database lock.

int64(* API_db::InsertID)()

Last insert ID.


The documentation for this struct was generated from the following file: