From 61dba077fdb780eb481afe4b0921d3de04b62f59 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Sun, 6 Dec 2009 21:29:12 +0100 Subject: Moved storagesql.hpp into storage.hpp Also removed the not very useful documentation, so that the list of constants is more readable. --- src/account-server/storage.cpp | 48 +++++++++++-- src/account-server/storagesql.hpp | 148 -------------------------------------- 2 files changed, 44 insertions(+), 152 deletions(-) delete mode 100644 src/account-server/storagesql.hpp (limited to 'src/account-server') diff --git a/src/account-server/storage.cpp b/src/account-server/storage.cpp index 2964109f..60532b02 100644 --- a/src/account-server/storage.cpp +++ b/src/account-server/storage.cpp @@ -25,7 +25,6 @@ #include "point.h" #include "account-server/account.hpp" -#include "account-server/storagesql.hpp" #include "chat-server/chatchannel.hpp" #include "chat-server/guild.hpp" #include "chat-server/post.hpp" @@ -37,12 +36,53 @@ #include "utils/xml.hpp" // TODO: make data/items.xml a constant or read it from config file -#define DEFAULT_ITEM_FILE "data/items.xml" +static const char *DEFAULT_ITEM_FILE = "data/items.xml"; // defines the supported db version -#define DB_VERSION_PARAMETER "database_version" -#define SUPPORTED_DB_VERSION "7" +static const char *DB_VERSION_PARAMETER = "database_version"; +static const char *SUPPORTED_DB_VERSION = "7"; +/* + * 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. + * + * TODO: Fix problem with PostgreSQL null primary key's. + */ + +static const char *ACCOUNTS_TBL_NAME = "mana_accounts"; +static const char *CHARACTERS_TBL_NAME = "mana_characters"; +static const char *CHAR_SKILLS_TBL_NAME = "mana_char_skills"; +static const char *CHAR_STATUS_EFFECTS_TBL_NAME = "mana_char_status_effects"; +static const char *INVENTORIES_TBL_NAME = "mana_inventories"; +static const char *ITEMS_TBL_NAME = "mana_items"; +static const char *GUILDS_TBL_NAME = "mana_guilds"; +static const char *GUILD_MEMBERS_TBL_NAME = "mana_guild_members"; +static const char *QUESTS_TBL_NAME = "mana_quests"; +static const char *WORLD_STATES_TBL_NAME = "mana_world_states"; +static const char *POST_TBL_NAME = "mana_post"; +static const char *POST_ATTACHMENTS_TBL_NAME = "mana_post_attachments"; +static const char *AUCTION_TBL_NAME = "mana_auctions"; +static const char *AUCTION_BIDS_TBL_NAME = "mana_auction_bids"; +static const char *ONLINE_USERS_TBL_NAME = "mana_online_list"; +static const char *TRANSACTION_TBL_NAME = "mana_transactions"; /** * Constructor. diff --git a/src/account-server/storagesql.hpp b/src/account-server/storagesql.hpp deleted file mode 100644 index ac4c2c6e..00000000 --- a/src/account-server/storagesql.hpp +++ /dev/null @@ -1,148 +0,0 @@ -/* - * The Mana Server - * Copyright (C) 2008 The Mana World Development Team - * - * This file is part of The Mana Server. - * - * The Mana Server 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 Server 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 Server. If not, see . - */ - -#ifndef _MANASERV_DALSTORAGE_SQL_H -#define _MANASERV_DALSTORAGE_SQL_H - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#if !defined (MYSQL_SUPPORT) && !defined (SQLITE_SUPPORT) && \ - !defined (POSTGRESQL_SUPPORT) -#error "(storage.hpp) no database backend defined" -#endif - -// 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: mana_accounts. - */ -static const char *ACCOUNTS_TBL_NAME = "mana_accounts"; - -/** - * TABLE: mana_characters. - * - gender is 0 for male, 1 for female. - */ -static const char *CHARACTERS_TBL_NAME = "mana_characters"; - -/** - * TABLE: mana_char_skills. - */ -static const char *CHAR_SKILLS_TBL_NAME = "mana_char_skills"; - -/** - * TABLE: mana_char_status_effects. - */ -static const char *CHAR_STATUS_EFFECTS_TBL_NAME = "mana_char_status_effects"; - -/** - * TABLE: mana_inventories. - */ -static const char *INVENTORIES_TBL_NAME = "mana_inventories"; - -/** - * TABLE: mana_items. - */ -static const char *ITEMS_TBL_NAME = "mana_items"; - -/** - * TABLE: mana_guilds. - * Store player guilds - */ -static const char *GUILDS_TBL_NAME = "mana_guilds"; - -/** - * TABLE: mana_guild_members. - * Store guild members - */ -static const char *GUILD_MEMBERS_TBL_NAME = "mana_guild_members"; - -/** - * TABLE: mana_quests. - */ -static const char *QUESTS_TBL_NAME = "mana_quests"; - -/** - * TABLE: mana_world_states - */ -static const char *WORLD_STATES_TBL_NAME = "mana_world_states"; - -/** - * TABLE: mana_post - * Store letters sent by characters - */ -static const char *POST_TBL_NAME = "mana_post"; - -/** - * TABLE: mana_post_attachments - * Store attachments per letter. - */ -static const char *POST_ATTACHMENTS_TBL_NAME = "mana_post_attachments"; - -/** - * TABLE: mana_auctions - * Store items auctions. - */ -static const char *AUCTION_TBL_NAME = "mana_auctions"; - -/** - * TABLE: mana_auction_bids - * Store bids on auctions. - */ -static const char *AUCTION_BIDS_TBL_NAME = "mana_auction_bids"; - -/** - * TABLE: mana_online_list - * List currently online users. - */ -static const char *ONLINE_USERS_TBL_NAME = "mana_online_list"; - -/** - * TABLE: mana_transactions - * Stores all transactions - */ -static const char *TRANSACTION_TBL_NAME = "mana_transactions"; - -#endif // _MANASERV_DALSTORAGE_SQL_H -- cgit v1.2.3-60-g2f50