Skip to content

db.count error when using multiple tables #34

@alceuscardoso

Description

@alceuscardoso

Hi!

I have a issue when i try to use multiple tables. A just created table don't retrieve zero when call count function.

Follow a example of output:

#define TABLE_SIZE 8192
#define TABLE_1 0
#define TABLE_2 1
#define TABLE_3 2
#define TABLE_4 3

enum Enum1
{
    OPT1,
    OPT2
};

enum Enum2
{
    OPT1,
    OPT2
};

enum Enum3
{
    OPT1,
    OPT2
};

struct  Struct1
{
    uint8_t field1;
    Enum1 field2;
};

struct Struct2
{
    int id;
    char* field1;
    tmElements_t field2;
    tmElements_t field3;
    int field4;
    int field5;
    int field6;
    Enum2 field7;
    Enum2 field8;
};

struct Struct3
{
    Enum3 field1;
};

struct Struct4
{
    int field1;
    tmElements_t field2;
    tmElements_t field3;
    int field4;
};

void Test() {
    db.create(TABLE_1, TABLE_SIZE, sizeof(Struct1));
    db.create(TABLE_2, TABLE_SIZE, sizeof(Struct4));
    db.create(TABLE_3, TABLE_SIZE, sizeof(Struct2));
    db.create(TABLE_4, TABLE_SIZE, sizeof(Struct3));

    db.open(TABLE_1);
    Serial.println(_db.count()); >> 0

    db.open(TABLE_2);
    Serial.println(_db.count()); >> 301989888

    db.open(TABLE_3);
    Serial.println(_db.count()); >> 1179648

    db.open(TABLE_4);
    Serial.println(_db.count()); >> 4608
}

How can i proceed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions