mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 00:55:28 +00:00
fix memory index restore
This commit is contained in:
parent
da0f8e0b44
commit
5c19a2cda9
1 changed files with 14 additions and 5 deletions
|
|
@ -67,7 +67,7 @@ int History::restore(
|
||||||
R"SQL(
|
R"SQL(
|
||||||
SELECT * FROM `app_browser_main_tab_page_navigation_history__session`
|
SELECT * FROM `app_browser_main_tab_page_navigation_history__session`
|
||||||
WHERE `app_browser_main_tab_page_navigation__session__id` = %d
|
WHERE `app_browser_main_tab_page_navigation__session__id` = %d
|
||||||
ORDER BY `id` DESC LIMIT 1
|
ORDER BY `id` DESC
|
||||||
)SQL",
|
)SQL",
|
||||||
APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID
|
APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID
|
||||||
).c_str(),
|
).c_str(),
|
||||||
|
|
@ -79,12 +79,15 @@ int History::restore(
|
||||||
|
|
||||||
if (PREPARE_STATUS == SQLITE_OK)
|
if (PREPARE_STATUS == SQLITE_OK)
|
||||||
{
|
{
|
||||||
// Use latest record as order
|
// Reset current memory index
|
||||||
|
index = -1;
|
||||||
|
|
||||||
|
// Cleanup memory vector
|
||||||
|
memory.clear();
|
||||||
|
|
||||||
|
// Restore memory from database records
|
||||||
while (sqlite3_step(statement) == SQLITE_ROW)
|
while (sqlite3_step(statement) == SQLITE_ROW)
|
||||||
{
|
{
|
||||||
// Cleanup
|
|
||||||
memory.clear();
|
|
||||||
|
|
||||||
// Restore
|
// Restore
|
||||||
memory.push_back(
|
memory.push_back(
|
||||||
{
|
{
|
||||||
|
|
@ -108,6 +111,12 @@ int History::restore(
|
||||||
|
|
||||||
// Restore children components here (on available)
|
// Restore children components here (on available)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Navigate to latest memory index on current value still not found in database
|
||||||
|
if (index == -1)
|
||||||
|
{
|
||||||
|
index = memory.size() - 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return sqlite3_finalize(
|
return sqlite3_finalize(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue