diff --git a/src/oro/private/originsdb_sqlite.cpp b/src/oro/private/originsdb_sqlite.cpp index 7c479a4..b17216d 100644 --- a/src/oro/private/originsdb_sqlite.cpp +++ b/src/oro/private/originsdb_sqlite.cpp @@ -148,7 +148,7 @@ namespace { { } - int64_t operator() (int item_id) { + SQLiteID operator() (int item_id) { if (m_use_cache) { auto it_found = m_cache.find(item_id); if (m_cache.end() != it_found) @@ -161,7 +161,7 @@ namespace { throw std::runtime_error("No item_id " + to_string(item_id) + " found in table items"); } - const int64_t table_id = m_query.getColumn(0); + const SQLiteID table_id = m_query.getColumn(0); m_query.reset(); if (m_use_cache) m_cache[item_id] = table_id; @@ -170,7 +170,7 @@ namespace { } private: - std::unordered_map m_cache; + std::unordered_map m_cache; SQLite::Database& m_db; SQLite::Statement m_query; bool m_use_cache; @@ -488,14 +488,14 @@ void OriginsDBSQLite::update (const Shops& shops, const oro::Timestamp& next_upd db.exec(g_create_slotted_cards); SQLite::Statement ins_sshot(db, "INSERT OR IGNORE INTO shop_snapshots(shop_id, hash, source_id) VALUES(?, ?, ?)"); - SQLite::Statement ins_empty_item(db, "INSERT OR IGNORE INTO items(item_id) VALUES(?)"); + SQLite::Statement ins_empty_item(db, "INSERT OR IGNORE INTO items(item_id, source_id) VALUES(?, 0)"); SQLite::Statement sel_sshot(db, "SELECT id FROM shop_snapshots WHERE shop_id = ? AND hash = ?"); SQLite::Statement ins_item(db, "INSERT INTO shop_items(snapshot_id, item_id, amount, price, refine, star_crumbs, element, creator, beloved) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)"); SQLite::Statement ins_card(db, "INSERT INTO slotted_cards(shop_item_id, card_id) VALUES(?, ?)"); SQLite::Statement upd_snapshot_date(db, "UPDATE shop_snapshots SET last_seen_date=CURRENT_TIMESTAMP WHERE id=?"); InsertShopIfn insert_shop_ifn(db); - ItemIdToTableId item_id_to_table_id(db); + ItemIdToTableId item_id_to_table_id(db, true); SQLite::Transaction transaction(db); const SQLiteID source_id = insert_source_ifn(db, source); for (const auto& shop : shops.shops) {