-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
I have the following code in my setup()
if (SD.exists(db_filename)) {
Serial.printf("recovering existing database at %s...", db_filename.c_str());
res = recover_db(db_context, (String("/sd") + db_filename).c_str());
if (!res) {
set_db_file(fopen(db_filename.c_str(), "a+b"));
res = dblog_init_for_append(&db_context);
}
Serial.println((res == 0) ? "successful" : "failed");
}
recover_db is basically the same as in the examples (click to expand)
int recover_db( dblog_write_context &ctx, const char* filename) {
dbFile = fopen(filename, "r+b");
if (!&dbFile) {
print_error(0);
return 1;
}
int32_t page_size = dblog_read_page_size(&ctx);
if (page_size < 512) {
Serial.print(F("Error reading page size\n"));
fclose(dbFile);
return 2;
}
if (dblog_recover(&ctx)) {
Serial.print(F("Error during recover\n"));
fclose(dbFile);
return 3;
}
fclose(dbFile);
return 0;
}
copying the file to my laptop and using sqlite_micro_logger_c to append works fine:
opening the file with sqlite3 afterwards works and shows the added data
the database file: https://megastore.rz.uni-augsburg.de/get/eqVggTp9KG/
I've got an external debugger in the mail, but for now that's all the information i have.
Metadata
Metadata
Assignees
Labels
No labels