summaryrefslogtreecommitdiff
path: root/src/account-server/dalstoragesql.hpp
blob: 34cdec5bf54af09e9da7274ea5143d6d0a17691d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/*
 *  The Mana World Server
 *  Copyright 2008 The Mana World Development Team
 *
 *  This file is part of The Mana World.
 *
 *  The Mana World  is free software; you can redistribute  it and/or modify it
 *  under the terms of the GNU General  Public License as published by the Free
 *  Software Foundation; either version 2 of the License, or any later version.
 *
 *  The Mana  World is  distributed in  the hope  that it  will be  useful, but
 *  WITHOUT ANY WARRANTY; without even  the implied warranty of MERCHANTABILITY
 *  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 *  more details.
 *
 *  You should  have received a  copy of the  GNU General Public  License along
 *  with The Mana  World; if not, write to the  Free Software Foundation, Inc.,
 *  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */

#ifndef _TMWSERV_DALSTORAGE_SQL_H_
#define _TMWSERV_DALSTORAGE_SQL_H_

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#if !defined (MYSQL_SUPPORT) && !defined (SQLITE_SUPPORT) && \
    !defined (POSTGRESQL_SUPPORT)
#error "(dalstorage.hpp) no database backend defined"
#endif


#include <string>

// TODO: Fix problem with PostgreSQL null primary key's.

/**
 * MySQL specificities:
 *     - TINYINT is an integer (1 byte) type defined as an extension to
 *       the SQL standard.
 *     - all integer types can have an optional (non-standard) attribute
 *       UNSIGNED (http://dev.mysql.com/doc/mysql/en/numeric-types.html)
 *
 * SQLite3 specificities:
 *     - any column (but only one for each table) with the exact type of
 *       'INTEGER PRIMARY KEY' is taken as auto-increment.
 *     - the supported data types are: NULL, INTEGER, REAL, TEXT and BLOB
 *       (http://www.sqlite.org/datatype3.html)
 *     - the size of TEXT cannot be set, it is just ignored by the engine.
 *     - IMPORTANT: foreign key constraints are not yet supported
 *       (http://www.sqlite.org/omitted.html). Included in case of future
 *       support.
 *
 * Notes:
 *     - the SQL queries will take advantage of the most appropriate data
 *       types supported by a particular database engine in order to
 *       optimize the server database size.
 */


/**
 * TABLE: tmw_accounts.
 */
static char const *ACCOUNTS_TBL_NAME = "tmw_accounts";

/**
 * TABLE: tmw_characters.
 *     - gender is 0 for male, 1 for female.
 */
static char const *CHARACTERS_TBL_NAME = "tmw_characters";

/**
 * TABLE: tmw_char_skills.
 */
static char const *CHAR_SKILLS_TBL_NAME = "tmw_char_skills";

/**
 * TABLE: tmw_inventories.
 */
static char const *INVENTORIES_TBL_NAME("tmw_inventories");

/**
 * TABLE: tmw_items.
 */
static char const *ITEMS_TBL_NAME("tmw_items");

/**
 * TABLE: tmw_guilds.
 * Store player guilds
 */
static char const *GUILDS_TBL_NAME = "tmw_guilds";

/**
 * TABLE: tmw_guild_members.
 * Store guild members
 */
static char const *GUILD_MEMBERS_TBL_NAME = "tmw_guild_members";

/**
 * TABLE: tmw_quests.
 */
static char const *QUESTS_TBL_NAME = "tmw_quests";

/**
 * TABLE: tmw_world_states
 */
static char const *WORLD_STATES_TBL_NAME = "tmw_world_states";

/**
 * TABLE: tmw_post
 * Store letters sent by characters
 */
static char const *POST_TBL_NAME = "tmw_post";

/**
 * TABLE: tmw_post_attachments
 * Store attachments per letter.
 */
static char const *POST_ATTACHMENTS_TBL_NAME = "tmw_post_attachments";

/**
 * TABLE: tmw_auctions
 * Store items auctions.
 */
static char const *AUCTION_TBL_NAME = "tmw_auctions";

/**
 * TABLE: tmw_auction_bids
 * Store bids on auctions.
 */
static char const *AUCTION_BIDS_TBL_NAME = "tmw_auction_bids";

/**
 * TABLE: tmw_online_list
 * List currently online users.
 */
static char const *ONLINE_USERS_TBL_NAME = "tmw_online_list";

/**
 * TABLE: tmw_transactions
 * Stores all transactions
 */
static char const *TRANSACTION_TBL_NAME = "tmw_transactions";

#endif // _TMWSERV_DALSTORAGE_SQL_H_