Mercurial > malikania
changeset 135:5076a7b80fb2
Server: remove useless files
author | David Demelier <markand@malikania.fr> |
---|---|
date | Fri, 06 Oct 2017 16:24:20 +0200 |
parents | 88ce5dbf045c |
children | 835c8ee3f9e5 |
files | libdb-sqlite/malikania/server/db/sqlite_account_dao.cpp libdb-sqlite/malikania/server/db/sqlite_character_dao.cpp libdb-sqlite/malikania/server/db/sqlite_spell_dao.cpp |
diffstat | 3 files changed, 0 insertions(+), 233 deletions(-) [+] |
line wrap: on
line diff
--- a/libdb-sqlite/malikania/server/db/sqlite_account_dao.cpp Wed Oct 04 12:32:48 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* - * sqlite_account_dao.cpp -- account_dao for SQLite - * - * Copyright (c) 2013-2017 David Demelier <markand@malikania.fr> - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <malikania/server/db/account.hpp> -#include <malikania/server/db/account_dao.hpp> -#include <malikania/server/db/character.hpp> - -#include "common.hpp" - -namespace mlk { - -namespace server { - -class sqlite_account_dao : public account_dao { -private: - std::shared_ptr<account> get(sqlite::stmt_ptr); - -public: - using account_dao::account_dao; - - std::shared_ptr<account> authenticate(const std::string&, - const std::string&) override; - - std::shared_ptr<account> find(const std::string&) override; - - std::int64_t save(std::shared_ptr<account> ac) override; - - void set_email(std::shared_ptr<account> ac, const std::string&) override; - - void set_firstname(std::shared_ptr<account>, const std::string&) override; - - void set_lastname(std::shared_ptr<account>, const std::string&) override; -}; - - -} // !server - -} // !mlk - -extern "C" { - -BOOST_SYMBOL_EXPORT -std::unique_ptr<mlk::server::account_dao> mlk_account_dao(std::shared_ptr<mlk::server::database> db) -{ - return std::make_unique<mlk::server::sqlite_account_dao>(std::move(db)); -} - -} // !C
--- a/libdb-sqlite/malikania/server/db/sqlite_character_dao.cpp Wed Oct 04 12:32:48 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -/* - * sqlite_character_dao.cpp -- character_dao for SQLite - * - * Copyright (c) 2013-2017 David Demelier <markand@malikania.fr> - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <malikania/server/db/account.hpp> -#include <malikania/server/db/character.hpp> -#include <malikania/server/db/character_dao.hpp> - -#include "common.hpp" - -namespace mlk { - -namespace server { - -class sqlite_character_dao : public character_dao { -public: - using character_dao::character_dao; - - std::int64_t save(std::shared_ptr<character>, std::shared_ptr<account> ac) override; - - void remove(std::shared_ptr<character>) override; - - void set_name(std::shared_ptr<character>, const std::string&) override; -}; - -std::int64_t sqlite_character_dao::save(std::shared_ptr<character> ch, std::shared_ptr<account> ac) -{ - const std::string sql( - "INSERT INTO character(account_id, name) VALUES (?, ?)" - ); - - mlk::server::sqlite::exec(sql, {ac->id(), ch->name()}); - - return sqlite3_last_insert_rowid(mlk::server::sqlite::handle); -} - -void sqlite_character_dao::remove(std::shared_ptr<character> ch) -{ - const std::string sql( - "DELETE" - " FROM character" - " WHERE id = ?" - ); - - mlk::server::sqlite::exec(sql, {ch->id()}); -} - -void sqlite_character_dao::set_name(std::shared_ptr<character> ch, const std::string& name) -{ - const std::string sql( - "UPDATE character" - " SET name = ?" - " WHERE id = ?" - ); - - mlk::server::sqlite::exec(sql, {name, ch->id()}); -} - -} // !server - -} // !mlk - -extern "C" { - -BOOST_SYMBOL_EXPORT -std::unique_ptr<mlk::server::character_dao> mlk_character_dao(std::shared_ptr<mlk::server::database> db) -{ - return std::make_unique<mlk::server::sqlite_character_dao>(std::move(db)); -} - -} // !C
--- a/libdb-sqlite/malikania/server/db/sqlite_spell_dao.cpp Wed Oct 04 12:32:48 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -/* - * sqlite_spell_dao.cpp -- spell_dao for SQLite - * - * Copyright (c) 2013-2017 David Demelier <markand@malikania.fr> - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <malikania/server/db/character.hpp> -#include <malikania/server/db/spell.hpp> -#include <malikania/server/db/spell_dao.hpp> - -#include "common.hpp" - -namespace mlk { - -namespace server { - -class sqlite_spell_dao : public spell_dao { -public: - using spell_dao::spell_dao; - std::int64_t save(std::shared_ptr<spell>, std::shared_ptr<character> parent) override; - void set_level(std::shared_ptr<spell>, std::uint8_t level) override; - void remove(std::shared_ptr<spell>) override; -}; - -std::int64_t sqlite_spell_dao::save(std::shared_ptr<spell> s, std::shared_ptr<character> parent) -{ - const std::string sql( - "INSERT INTO spell(account_id, level) VALUES(?, ?)" - ); - - mlk::server::sqlite::exec(sql, { - parent->id(), - static_cast<std::uint64_t>(s->level()) - }); - - return sqlite3_last_insert_rowid(mlk::server::sqlite::handle); -} - -void sqlite_spell_dao::set_level(std::shared_ptr<spell> s, std::uint8_t level) -{ - const std::string sql( - "UPDATE spell" - " SET level = ?" - " WHERE id = ?" - ); - - mlk::server::sqlite::exec(sql, {static_cast<std::uint64_t>(level), s->id()}); -} - -void sqlite_spell_dao::remove(std::shared_ptr<spell> s) -{ - const std::string sql( - "DELETE" - " FROM spell" - " WHERE id = ?" - ); - - mlk::server::sqlite::exec(sql, {s->id()}); -} - -} // !server - -} // !mlk - -extern "C" { - -BOOST_SYMBOL_EXPORT -std::unique_ptr<mlk::server::spell_dao> mlk_spell_dao(std::shared_ptr<mlk::server::database> db) -{ - return std::make_unique<mlk::server::sqlite_spell_dao>(std::move(db)); -} - -} // !C