mysql.c File Reference

#include "services.h"

Go to the source code of this file.

Functions

int db_mysql_close ()
void db_mysql_error (int severity, char *msg)
int db_mysql_init ()
int db_mysql_load_bs_dbase (void)
int db_mysql_load_cs_dbase (void)
int db_mysql_load_exceptions (void)
int db_mysql_load_hs_dbase (void)
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)
char * db_mysql_quote (char *sql)
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 db_mysql_try (const char *fmt,...)
unsigned int mysql_rand (void)

Variables

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


Function Documentation

int db_mysql_close (  ) 

Definition at line 191 of file mysql.c.

References mysql, and mysql_is_connected.

void db_mysql_error ( int  severity,
char *  msg 
)

Definition at line 32 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 57 of file mysql.c.

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

Referenced by rdb_init().

int db_mysql_load_bs_dbase ( void   ) 

Definition at line 1090 of file mysql.c.

References botinfo_::chancount, botinfo_::created, db_mysql_try(), botinfo_::flags, botinfo_::host, makebot(), mysql, mysql_res, mysql_row, botinfo_::real, sstrdup(), and botinfo_::user.

Referenced by rdb_load_bs_dbase().

int db_mysql_load_cs_dbase ( void   ) 

Definition at line 1373 of file mysql.c.

References chaninfo_::access, chaninfo_::accesscount, AutoKick::addtime, 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, badword_::in_use, ChanAccess::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, AutoKick::nc, ChanAccess::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   ) 

Definition at line 1192 of file mysql.c.

References db_mysql_try(), exceptions, exception_::expires, exception_::limit, exception_::mask, mysql, mysql_res, mysql_row, nexceptions, NICKMAX, exception_::reason, scalloc(), snprintf(), sstrdup(), and exception_::time.

Referenced by rdb_load_exceptions().

int db_mysql_load_hs_dbase ( void   ) 

Definition at line 1122 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   ) 

Definition at line 1150 of file mysql.c.

References db_mysql_try(), mysql, mysql_res, mysql_row, news, news_size, NICKMAX, nnews, scalloc(), snprintf(), and sstrdup().

Referenced by rdb_load_news().

int db_mysql_load_ns_dbase ( void   ) 

Definition at line 1685 of file mysql.c.

References nickcore_::access, nickcore_::accesscount, nickcore_::aliases, alpha_insert_alias(), nickcore_::channelcount, nickcore_::channelmax, db_mysql_quote(), db_mysql_try(), nickcore_::display, nickcore_::email, findcore(), memo_::flags, nickcore_::flags, nickcore_::greet, nickcore_::icq, insert_core(), nickcore_::language, nickalias_::last_quit, nickalias_::last_realname, nickalias_::last_seen, nickalias_::last_usermask, MemoInfo::memocount, MemoInfo::memomax, MemoInfo::memos, nickcore_::memos, mysql, mysql_res, mysql_row, nickalias_::nc, NI_KILL_IMMED, NI_SERVICES_ADMIN, NI_SERVICES_OPER, NI_SERVICES_ROOT, nickalias_::nick, NICKMAX, NS_TEMPORARY, NSAllowKillImmed, memo_::number, nickcore_::pass, RootNumber, row, scalloc(), memo_::sender, servadmins, ServicesRoots, servopers, slist_add(), snprintf(), sstrdup(), nickalias_::status, stricmp(), memo_::text, memo_::time, nickalias_::time_registered, and nickcore_::url.

Referenced by rdb_load_ns_dbase().

int db_mysql_load_ns_req_dbase ( void   ) 

Definition at line 1652 of file mysql.c.

References db_mysql_try(), nickrequest_::email, insert_requestnick(), mysql, mysql_res, mysql_row, nickrequest_::nick, nickrequest_::passcode, nickrequest_::password, nickrequest_::requested, scalloc(), and sstrdup().

Referenced by rdb_load_ns_req_dbase().

int db_mysql_load_os_dbase ( void   ) 

Definition at line 1227 of file mysql.c.

References akills, sxline_::by, akill_::by, db_mysql_try(), sxline_::expires, akill_::expires, akill_::host, sxline_::mask, maxusercnt, maxusertime, mysql, mysql_res, mysql_row, sxline_::reason, akill_::reason, scalloc(), sxline_::seton, akill_::seton, sglines, slist_add(), slist_setcapacity(), sqlines, sstrdup(), szlines, and akill_::user.

Referenced by rdb_load_os_dbase().

int db_mysql_open (  ) 

Definition at line 95 of file mysql.c.

References db_mysql_error(), log_perror(), mysql, mysql_is_connected, MysqlHost, MysqlName, MysqlPass, MysqlPort, MysqlSock, and MysqlUser.

Referenced by db_mysql_init(), db_mysql_query(), and rdb_open().

int db_mysql_query ( char *  sql  ) 

Definition at line 136 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  ) 

Definition at line 170 of file mysql.c.

References mysql, and sstrdup().

Referenced by db_mysql_load_cs_dbase(), db_mysql_load_ns_dbase(), db_mysql_save_bs_core(), db_mysql_save_cs_info(), db_mysql_save_exceptions(), db_mysql_save_hs_core(), db_mysql_save_news(), db_mysql_save_ns_alias(), db_mysql_save_ns_core(), db_mysql_save_ns_req(), db_mysql_save_os_db(), and rdb_quote().

int db_mysql_save_bs_core ( BotInfo bi  ) 

Definition at line 1047 of file mysql.c.

References botinfo_::chancount, botinfo_::created, db_mysql_quote(), db_mysql_try(), botinfo_::flags, botinfo_::host, mysql, botinfo_::nick, botinfo_::real, and botinfo_::user.

Referenced by rdb_save_bs_core().

int db_mysql_save_cs_info ( ChannelInfo ci  ) 

Definition at line 488 of file mysql.c.

References chaninfo_::access, chaninfo_::accesscount, chaninfo_::akickcount, chaninfo_::bantype, chaninfo_::bi, chaninfo_::botflags, chaninfo_::bwcount, chaninfo_::capsmin, chaninfo_::capspercent, db_mysql_quote(), db_mysql_secure(), db_mysql_try(), chaninfo_::desc, nickcore_::display, chaninfo_::email, chaninfo_::entry_message, memo_::flags, chaninfo_::flags, chaninfo_::floodlines, chaninfo_::floodsecs, chaninfo_::forbidby, chaninfo_::forbidreason, chaninfo_::founder, chaninfo_::founderpass, ChanAccess::in_use, ChanAccess::last_seen, chaninfo_::last_topic, chaninfo_::last_topic_setter, chaninfo_::last_topic_time, chaninfo_::last_used, ChanAccess::level, 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, chaninfo_::name, ChanAccess::nc, botinfo_::nick, memo_::number, chaninfo_::repeattimes, memo_::sender, chaninfo_::successor, memo_::text, memo_::time, chaninfo_::time_registered, and chaninfo_::url.

Referenced by rdb_save_cs_info().

int db_mysql_save_exceptions ( Exception e  ) 

Definition at line 959 of file mysql.c.

References db_mysql_quote(), db_mysql_try(), exception_::expires, exception_::limit, exception_::mask, mysql, exception_::reason, exception_::time, and exception_::who.

Referenced by rdb_save_exceptions().

int db_mysql_save_hs_core ( HostCore hc  ) 

Definition at line 1005 of file mysql.c.

References hostcore_::creator, db_mysql_quote(), db_mysql_try(), mysql, hostcore_::nick, hostcore_::time, hostcore_::vHost, and hostcore_::vIdent.

Referenced by rdb_save_hs_core().

int db_mysql_save_news ( NewsItem ni  ) 

Definition at line 925 of file mysql.c.

References db_mysql_quote(), db_mysql_try(), mysql, newsitem_::num, newsitem_::text, newsitem_::time, newsitem_::type, and newsitem_::who.

Referenced by rdb_save_news().

int db_mysql_save_ns_alias ( NickAlias na  ) 

Definition at line 430 of file mysql.c.

References db_mysql_quote(), db_mysql_try(), nickcore_::display, nickalias_::last_quit, nickalias_::last_realname, nickalias_::last_seen, nickalias_::last_usermask, mysql, nickalias_::nc, nickalias_::nick, nickalias_::status, and nickalias_::time_registered.

Referenced by rdb_save_ns_alias().

int db_mysql_save_ns_core ( NickCore nc  ) 

Definition at line 318 of file mysql.c.

References nickcore_::access, nickcore_::accesscount, nickcore_::channelcount, nickcore_::channelmax, db_mysql_quote(), db_mysql_secure(), db_mysql_try(), nickcore_::display, nickcore_::email, memo_::flags, nickcore_::flags, nickcore_::greet, nickcore_::icq, nickcore_::language, MemoInfo::memocount, MemoInfo::memomax, MemoInfo::memos, nickcore_::memos, mysql, memo_::number, nickcore_::pass, memo_::sender, memo_::text, memo_::time, and nickcore_::url.

Referenced by rdb_save_ns_core().

int db_mysql_save_ns_req ( NickRequest nr  ) 

Definition at line 275 of file mysql.c.

References db_mysql_quote(), db_mysql_try(), nickrequest_::email, mysql, nickrequest_::nick, nickrequest_::passcode, nickrequest_::password, and nickrequest_::requested.

Referenced by rdb_save_ns_req().

int db_mysql_save_os_db ( unsigned int  maxucnt,
unsigned int  maxutime,
SList ak,
SList sgl,
SList sql,
SList szl 
)

Definition at line 787 of file mysql.c.

References sxline_::by, akill_::by, slist_::count, db_mysql_quote(), db_mysql_try(), sxline_::expires, akill_::expires, akill_::host, slist_::list, sxline_::mask, mysql, sxline_::reason, akill_::reason, sxline_::seton, akill_::seton, and akill_::user.

Referenced by rdb_save_os_db().

char* db_mysql_secure ( char *  pass  ) 

Definition at line 231 of file mysql.c.

References BUFSIZE, enc_decrypt(), MysqlSecure, PASSMAX, snprintf(), and sstrdup().

Referenced by db_mysql_save_cs_info(), and db_mysql_save_ns_core().

int db_mysql_try ( const char *  fmt,
  ... 
)

Definition at line 205 of file mysql.c.

References db_mysql_error(), db_mysql_query(), log_perror(), and vsnprintf.

Referenced by db_mysql_load_bs_dbase(), db_mysql_load_cs_dbase(), db_mysql_load_exceptions(), db_mysql_load_hs_dbase(), db_mysql_load_news(), db_mysql_load_ns_dbase(), db_mysql_load_ns_req_dbase(), db_mysql_load_os_dbase(), db_mysql_save_bs_core(), db_mysql_save_cs_info(), db_mysql_save_exceptions(), db_mysql_save_hs_core(), db_mysql_save_news(), db_mysql_save_ns_alias(), db_mysql_save_ns_core(), db_mysql_save_ns_req(), db_mysql_save_os_db(), mysql_rand(), rdb_clean_table(), rdb_clean_table_where(), rdb_empty_table(), rdb_ns_set_display(), rdb_scrub_table(), rdb_tag_table(), and rdb_tag_table_where().

unsigned int mysql_rand ( void   ) 

Definition at line 1867 of file mysql.c.

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

Referenced by rand_init().


Variable Documentation

MYSQL* mysql

Definition at line 20 of file mysql.c.

MYSQL_FIELD* mysql_fields

Definition at line 22 of file mysql.c.

int mysql_is_connected = 0

Definition at line 25 of file mysql.c.

Referenced by db_mysql_close(), and db_mysql_open().

MYSQL_RES* mysql_res

Definition at line 21 of file mysql.c.

Referenced by db_mysql_load_bs_dbase(), db_mysql_load_cs_dbase(), db_mysql_load_exceptions(), db_mysql_load_hs_dbase(), db_mysql_load_news(), db_mysql_load_ns_dbase(), db_mysql_load_ns_req_dbase(), db_mysql_load_os_dbase(), and mysql_rand().

MYSQL_ROW mysql_row

Definition at line 23 of file mysql.c.

Referenced by db_mysql_load_bs_dbase(), db_mysql_load_cs_dbase(), db_mysql_load_exceptions(), db_mysql_load_hs_dbase(), db_mysql_load_news(), db_mysql_load_ns_dbase(), db_mysql_load_ns_req_dbase(), db_mysql_load_os_dbase(), and mysql_rand().


Generated on Sun Dec 30 09:26:57 2007 for Anope by  doxygen 1.5.1-20070107