-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
26 lines (22 loc) · 747 Bytes
/
Copy pathmain.cpp
File metadata and controls
26 lines (22 loc) · 747 Bytes
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
#include "User.hpp"
#include "UserMapping.hpp"
#include "ORM.hpp"
#include <iostream>
int main() {
try {
Database::connect("user", "pass", "mock_db");
User user(1, "Alice", 100.5, true);
ORM::insertObject(Database::conn, user);
std::cout << "User inserted (mock)\n";
User loaded = ORM::getObjectById<User>(Database::conn, 1);
std::cout << "Loaded user: "
<< loaded.id << ", "
<< loaded.name << ", "
<< loaded.balance << ", "
<< loaded.is_active << "\n";
Database::disconnect();
} catch (const std::exception& e) {
std::cerr << "Error: " << e.what() << "\n";
}
return 0;
}