| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
#ifndef INCLUDED_SQL_COMMON_TYPES |
| 20 |
#define INCLUDED_SQL_COMMON_TYPES |
| 21 |
|
| 22 |
namespace pvpgn |
| 23 |
{ |
| 24 |
|
| 25 |
namespace bnetd |
| 26 |
{ |
| 27 |
|
| 28 |
typedef unsigned int t_sql_info; |
| 29 |
|
| 30 |
|
| 31 |
#define t_sql_res void |
| 32 |
|
| 33 |
typedef char * t_sql_row; |
| 34 |
|
| 35 |
typedef char * t_sql_field; |
| 36 |
|
| 37 |
typedef struct { |
| 38 |
int(*init)(const char *host, const char *port, const char *socket, const char *name, const char *user, const char *pass); |
| 39 |
int(*close)(void); |
| 40 |
t_sql_res * (*query_res)(const char *); |
| 41 |
int(*query)(const char *); |
| 42 |
t_sql_row * (*fetch_row)(t_sql_res *); |
| 43 |
void(*free_result)(t_sql_res *); |
| 44 |
unsigned int(*num_rows)(t_sql_res *); |
| 45 |
unsigned int(*num_fields)(t_sql_res *); |
| 46 |
unsigned int(*affected_rows)(void); |
| 47 |
t_sql_field * (*fetch_fields)(t_sql_res *); |
| 48 |
int(*free_fields)(t_sql_field *); |
| 49 |
void(*escape_string)(char *, const char *, int); |
| 50 |
} t_sql_engine; |
| 51 |
|
| 52 |
} |
| 53 |
|
| 54 |
} |
| 55 |
|
| 56 |
#endif |
| 57 |
|
| 58 |
#ifndef JUST_NEED_TYPES |
| 59 |
#ifndef INCLUDED_SQL_COMMON_PROTOS |
| 60 |
#define INCLUDED_SQL_COMMON_PROTOS |
| 61 |
|
| 62 |
#include "storage.h" |
| 63 |
|
| 64 |
namespace pvpgn |
| 65 |
{ |
| 66 |
|
| 67 |
namespace bnetd |
| 68 |
{ |
| 69 |
|
| 70 |
extern t_storage storage_sql; |
| 71 |
|
| 72 |
#ifdef SQL_INTERNAL |
| 73 |
|
| 74 |
#define CURRENT_DB_VERSION 150 |
| 75 |
|
| 76 |
#define DB_MAX_ATTRKEY 128 |
| 77 |
#define DB_MAX_ATTRVAL 180 |
| 78 |
#define DB_MAX_TAB 64 |
| 79 |
|
| 80 |
#define SQL_UID_FIELD "uid" |
| 81 |
#define STORAGE_SQL_DEFAULT_UID 0 |
| 82 |
#define SQL_DEFAULT_PREFIX "" |
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
extern t_sql_engine *sql; |
| 89 |
extern unsigned int sql_defacct; |
| 90 |
extern const char* tab_prefix; |
| 91 |
|
| 92 |
#ifndef SQL_ON_DEMAND |
| 93 |
extern char const *sql_tables[]; |
| 94 |
#endif |
| 95 |
|
| 96 |
extern int sql_init(const char *); |
| 97 |
extern int sql_close(void); |
| 98 |
extern unsigned sql_read_maxuserid(void); |
| 99 |
extern int sql_read_accounts(int flag, t_read_accounts_func cb, void *data); |
| 100 |
extern int sql_cmp_info(t_storage_info * info1, t_storage_info * info2); |
| 101 |
extern int sql_free_info(t_storage_info * info); |
| 102 |
extern t_storage_info *sql_get_defacct(void); |
| 103 |
extern int sql_load_clans(t_load_clans_func cb); |
| 104 |
extern int sql_write_clan(void *data); |
| 105 |
extern int sql_remove_clan(int clantag); |
| 106 |
extern int sql_remove_clanmember(int uid); |
| 107 |
extern int sql_load_teams(t_load_teams_func cb); |
| 108 |
extern int sql_write_team(void *data); |
| 109 |
extern int sql_remove_team(unsigned int teamid); |
| 110 |
|
| 111 |
#endif |
| 112 |
|
| 113 |
} |
| 114 |
|
| 115 |
} |
| 116 |
|
| 117 |
#endif |
| 118 |
#endif |