Anope IRC Services  Version 1.8
Functions | Variables
mysql.c File Reference
#include "services.h"
Include dependency graph for mysql.c:

Go to the source code of this file.


void db_mysql_error (int severity, char *msg)
int db_mysql_init ()
int db_mysql_open ()
int db_mysql_query (char *sql)
char * db_mysql_quote (char *sql)
char * db_mysql_quote_buffer (char *sql, int size)
int db_mysql_close ()
int db_mysql_try (const char *fmt,...)
char * db_mysql_secure (char *pass, int size)
int db_mysql_save_ns_req (NickRequest *nr)
int db_mysql_save_ns_core (NickCore *nc)
int db_mysql_save_ns_alias (NickAlias *na)
int db_mysql_save_cs_info (ChannelInfo *ci)
int db_mysql_save_os_db (unsigned int maxucnt, unsigned int maxutime, SList *ak, SList *sgl, SList *sql, SList *szl)
int db_mysql_save_news (NewsItem *ni)
int db_mysql_save_exceptions (Exception *e)
int db_mysql_save_hs_core (HostCore *hc)
int db_mysql_save_bs_core (BotInfo *bi)
int db_mysql_load_bs_dbase (void)
int db_mysql_load_hs_dbase (void)
int db_mysql_load_news (void)
int db_mysql_load_exceptions (void)
int db_mysql_load_os_dbase (void)
int db_mysql_load_cs_dbase (void)
int db_mysql_load_ns_req_dbase (void)
int db_mysql_load_ns_dbase (void)
unsigned int mysql_rand (void)


MYSQL * mysql
MYSQL_RES * mysql_res
MYSQL_FIELD * mysql_fields
MYSQL_ROW mysql_row
int mysql_is_connected = 0

Function Documentation

int db_mysql_close ( )

Definition at line 204 of file mysql.c.

References mysql, and mysql_is_connected.

void db_mysql_error ( int  severity,
char *  msg 

Definition at line 31 of file mysql.c.

References log_perror(), mysql, and snprintf().

Referenced by db_mysql_open(), db_mysql_query(), and db_mysql_try().

int db_mysql_init ( )

Definition at line 56 of file mysql.c.

References alog(), db_mysql_open(), MysqlHost, MysqlName, and MysqlUser.

Referenced by rdb_init().

int db_mysql_load_bs_dbase ( void  )
int db_mysql_load_cs_dbase ( void  )

Definition at line 1413 of file mysql.c.

References chaninfo_::access, chaninfo_::accesscount, AutoKick::addtime, AK_ISNICK, AK_USED, chaninfo_::akick, chaninfo_::akickcount, alog(), alpha_insert_chan(), chaninfo_::badwords, chaninfo_::bantype, chaninfo_::bi, chaninfo_::botflags, chaninfo_::bwcount, CA_SIZE, chaninfo_::capsmin, chaninfo_::capspercent, chanlists, CHANMAX, CI_INHABIT, CI_VERBOTEN, AutoKick::creator, db_mysql_quote(), db_mysql_try(), delchan(), chaninfo_::desc, chaninfo_::email, chaninfo_::entry_message, findbot(), findcore(), memo_::flags, AutoKick::flags, chaninfo_::flags, chaninfo_::floodlines, chaninfo_::floodsecs, chaninfo_::forbidby, chaninfo_::forbidreason, chaninfo_::founder, chaninfo_::founderpass, ChanAccess::in_use, badword_::in_use, ChanAccess::last_seen, chaninfo_::last_topic, chaninfo_::last_topic_setter, chaninfo_::last_topic_time, chaninfo_::last_used, ChanAccess::level, chaninfo_::levels, AutoKick::mask, MemoInfo::memocount, MemoInfo::memomax, MemoInfo::memos, chaninfo_::memos, chaninfo_::mlock_flood, chaninfo_::mlock_key, chaninfo_::mlock_limit, chaninfo_::mlock_off, chaninfo_::mlock_on, chaninfo_::mlock_redirect, mysql, mysql_res, mysql_row, chaninfo_::name, ChanAccess::nc, AutoKick::nc, chaninfo_::next, NICKMAX, memo_::number, PASSMAX, AutoKick::reason, chaninfo_::repeattimes, reset_levels(), row, s_ChanServ, scalloc(), snprintf(), sstrdup(), chaninfo_::successor, memo_::text, memo_::time, chaninfo_::time_registered, chaninfo_::ttb, TTB_SIZE, badword_::type, AutoKick::u, chaninfo_::url, and badword_::word.

Referenced by rdb_load_cs_dbase().

int db_mysql_load_exceptions ( void  )
int db_mysql_load_hs_dbase ( void  )

Definition at line 1154 of file mysql.c.

References addHostCore(), db_mysql_try(), mysql, mysql_res, and mysql_row.

Referenced by rdb_load_hs_dbase().

int db_mysql_load_news ( void  )
int db_mysql_load_ns_dbase ( void  )
int db_mysql_load_ns_req_dbase ( void  )
int db_mysql_load_os_dbase ( void  )
int db_mysql_open ( )
int db_mysql_query ( char *  sql)

Definition at line 135 of file mysql.c.

References alog(), db_mysql_error(), db_mysql_open(), debug, log_perror(), mysql, MysqlRetries, and MysqlRetryGap.

Referenced by db_mysql_try(), and rdb_direct_query().

char* db_mysql_quote ( char *  sql)
char* db_mysql_quote_buffer ( char *  sql,
int  size 

Quote a buffer to be safely included in a query. The result is allocated and needs to be freed by caller.

Definition at line 191 of file mysql.c.

References mysql, and scalloc().

Referenced by db_mysql_save_ns_req(), and db_mysql_secure().

int db_mysql_save_bs_core ( BotInfo bi)
int db_mysql_save_cs_info ( ChannelInfo ci)
int db_mysql_save_exceptions ( Exception e)
int db_mysql_save_hs_core ( HostCore hc)
int db_mysql_save_news ( NewsItem ni)
int db_mysql_save_ns_alias ( NickAlias na)
int db_mysql_save_ns_core ( NickCore nc)
int db_mysql_save_ns_req ( NickRequest nr)
int db_mysql_save_os_db ( unsigned int  maxucnt,
unsigned int  maxutime,
SList ak,
SList sgl,
SList sql,
SList szl 
char* db_mysql_secure ( char *  pass,
int  size 

Returns a string (buffer) to insert into a SQL query. The string will, once evaluated by MySQL, result in the given pass encoded in the encryption type selected for MysqlSecure The result of this function is an allocated MySQL safe string.

passThe buffer containing the password to secure.
sizeThe size of the password-to-secure buffer.
Returns a MySQL safe string containing the password, hash or SQL instruction to encrypt the password. Needs to be free'd.

Definition at line 248 of file mysql.c.

References db_mysql_quote_buffer(), enc_decrypt(), MysqlSecure, PASSMAX, scalloc(), and snprintf().

Referenced by db_mysql_save_cs_info(), and db_mysql_save_ns_core().

int db_mysql_try ( const char *  fmt,
unsigned int mysql_rand ( void  )

Definition at line 1978 of file mysql.c.

References db_mysql_try(), mysql, mysql_res, mysql_row, and UserKey3.

Referenced by rand_init().

Variable Documentation

MYSQL* mysql
MYSQL_FIELD* mysql_fields

Definition at line 21 of file mysql.c.

int mysql_is_connected = 0

Definition at line 24 of file mysql.c.

Referenced by db_mysql_close(), and db_mysql_open().

MYSQL_RES* mysql_res
MYSQL_ROW mysql_row