DWASearch.cpp 641 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include "DatabaseManager.h"
#include "SQLiteObject.h"
#include <map>


class Player {
SQLITE_OBJECT

DECLARE_PROPERTY(id, int)

DECLARE_PROPERTY(firstName, std::string)

DECLARE_PROPERTY(lastName, std::string)

DECLARE_PROPERTY(country, std::string)
};

Q
qq_36105691 已提交
18 19

int main(int argc, char *argv[], [[maybe_unused]] char *envp[]) {
20 21 22 23 24 25 26
    const std::string sql = "SELECT * FROM Player";
    auto db = Mika::DatabaseManager::getInstance();

    auto results = db->executeQuery<Player>(sql);
    for (const auto &result: results) {
        LOG_INFO("Player: " + result.getfirstName() + " " + result.getlastName() + " from " + result.getcountry());
    }
Q
qq_36105691 已提交
27
}