~aleteoryx/muditaos

ref: 10a2c379699cbb9783be27ff7b1fa30fbd38953c muditaos/module-db/Tables/AlarmsStatusTable.cpp -rw-r--r-- 1.5 KiB
10a2c379 — Wiktor S. Ovalle Correa [EGD-3649] Fix paths in UT 4 years ago
                                                                                
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "AlarmsStatusTable.hpp"

AlarmsStatusTable::AlarmsStatusTable(Database *db) : Table(db)
{}

bool AlarmsStatusTable::create()
{
    return true;
}

bool AlarmsStatusTable::add(AlarmsStatusRow entry)
{
    return db->execute("INSERT or ignore INTO alarmStatuses ( name ) VALUES ('%q');", entry.name.c_str());
}

uint32_t AlarmsStatusTable::count()
{
    auto queryRet = db->query("SELECT COUNT(*) FROM alarmStatuses;");
    if (!queryRet || queryRet->getRowCount() == 0) {
        return 0;
    }

    return (*queryRet)[0].getUInt32();
}

bool AlarmsStatusTable::removeById(uint32_t id)
{
    return false;
}

bool AlarmsStatusTable::update(AlarmsStatusRow entry)
{
    return false;
}

AlarmsStatusRow AlarmsStatusTable::getById(uint32_t id)
{
    return AlarmsStatusRow();
}

std::vector<AlarmsStatusRow> AlarmsStatusTable::getLimitOffset(uint32_t offset, uint32_t limit)
{
    return std::vector<AlarmsStatusRow>();
}

std::vector<AlarmsStatusRow> AlarmsStatusTable::getLimitOffsetByField(uint32_t offset,
                                                                      uint32_t limit,
                                                                      AlarmsStatusFields field,
                                                                      const char *str)
{
    return std::vector<AlarmsStatusRow>();
}

uint32_t AlarmsStatusTable::countByFieldId(const char *field, uint32_t id)
{
    return count();
}