Mercurial > malikania
diff server/main.cpp @ 29:99792c6c8b06
Server: add initial postgresql account management, #475
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 26 May 2016 07:32:05 +0200 |
parents | 8991989c4708 |
children | a1e80d991968 |
line wrap: on
line diff
--- a/server/main.cpp Tue Apr 19 21:13:23 2016 +0200 +++ b/server/main.cpp Thu May 26 07:32:05 2016 +0200 @@ -18,17 +18,38 @@ #include <iostream> -#include <malikania/Game.h> -#include <malikania/ResourcesLocator.h> -#include <malikania/ResourcesLoader.h> +#include "malikania/account.h" +#include "malikania/dao-account.h" +#include "malikania/database.h" using namespace malikania; int main(int, char **) { - ResourcesLocatorDirectory locator("/home/markand/mygame"); - ResourcesLoader loader(locator); - Game game = loader.loadGame(); + try { + Database database("./pgsql", { + { "user", "kingdom" }, + { "host", "localhost" }, + { "database", "kingdomdb" } + }); + + AccountDao act(database); + Account account; + + account.setId(2); + + act.remove(account); + + for (const Account &ac : act.list()) { + std::cout << "id : " << ac.id() << std::endl; + std::cout << "name : " << ac.name() << std::endl; + std::cout << "email : " << ac.email() << std::endl; + std::cout << "firstname : " << ac.firstName() << std::endl; + std::cout << "lastname : " << ac.lastName() << std::endl; + } + } catch (const std::exception &ex) { + std::cerr << ex.what() << std::endl; + } return 0; }