-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Explicitly store the last processed frame number in the database - De-duplicate output for the watcher script
- Loading branch information
Showing
6 changed files
with
89 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ compile_commands.json | |
*.kdev4 | ||
|
||
.idea | ||
*.egg-info/ | ||
|
||
# swap | ||
[._]*.s[a-w][a-z] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// | ||
// Created by Dennis Sitelew on 28.12.22. | ||
// | ||
|
||
#ifndef OCS_IDL_INCLUDE | ||
#error Internal use only | ||
#endif | ||
|
||
namespace { | ||
|
||
void update_v2(db_t &db) { | ||
std::int64_t current_max = 0; | ||
|
||
// Get the maximal frame number | ||
auto max_stmt = std::make_unique<db::statement>("get_max_frame_num"); | ||
max_stmt->prepare(db, R"sql(SELECT MAX(frame_num) FROM ocr_entries;)sql", false); | ||
max_stmt->reset(); | ||
|
||
auto code = max_stmt->evaluate(); | ||
if (code == SQLITE_ROW && !max_stmt->is_null(0)) { | ||
current_max = max_stmt->get_int64(0); | ||
} | ||
|
||
// Add the frame number column | ||
auto sql = R"sql( | ||
BEGIN TRANSACTION; | ||
ALTER TABLE metadata | ||
ADD COLUMN last_processed_frame INT DEFAULT(0); | ||
COMMIT; | ||
)sql"; | ||
ocs::db::statement::exec(db, sql); | ||
|
||
// Update the frame number itself | ||
std::string update = "UPDATE metadata SET last_processed_frame="; | ||
update += std::to_string(current_max); | ||
update += ';'; | ||
|
||
ocs::db::statement::exec(db, update.c_str()); | ||
} | ||
|
||
} // namespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters