comparison server/main.cpp @ 42:a47a4477f347

Misc: new style, closes #578
author David Demelier <markand@malikania.fr>
date Tue, 29 Nov 2016 21:21:36 +0100
parents d4f5f7231b84
children b0593a3e2ca8
comparison
equal deleted inserted replaced
41:3645200f46bf 42:a47a4477f347
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */ 17 */
18 18
19 #include <iostream> 19 int main()
20
21 #include "malikania/account.hpp"
22 #include "malikania/dao-account.hpp"
23 #include "malikania/database.hpp"
24
25 using namespace malikania;
26
27 int main(int, char **)
28 { 20 {
29 try {
30 Database database("./pgsql", {
31 { "user", "kingdom" },
32 { "host", "localhost" },
33 { "database", "kingdomdb" }
34 });
35
36 AccountDao act(database);
37 Account account;
38
39 account.setId(2);
40
41 act.remove(account);
42
43 for (const Account &ac : act.list()) {
44 std::cout << "id : " << ac.id() << std::endl;
45 std::cout << "name : " << ac.name() << std::endl;
46 std::cout << "email : " << ac.email() << std::endl;
47 std::cout << "firstname : " << ac.firstName() << std::endl;
48 std::cout << "lastname : " << ac.lastName() << std::endl;
49 }
50 } catch (const std::exception &ex) {
51 std::cerr << ex.what() << std::endl;
52 }
53
54 return 0;
55 } 21 }