Use the new bind_all() everywhere

This commit is contained in:
King_DuckZ 2020-08-15 02:34:51 +01:00
parent 5df60661d3
commit ce892691f3

View file

@ -348,8 +348,7 @@ void OriginsDB::update (const Icons& icons) {
ItemIdToTableId item_id_to_table_id(db, false);
SQLite::Transaction transaction(db);
for (const auto& ico : icons.icons) {
query.bind(1, item_id_to_table_id(ico.item_id));
query.bind(2, ico.icon);
bind_all(query, item_id_to_table_id(ico.item_id), no_copy(ico.icon));
query.exec();
query.reset();
@ -404,30 +403,23 @@ void OriginsDB::update (const Shops& shops) {
if (sshot_id_ins)
continue;
ins_sshot.bind(1, shop_id_ins.first);
ins_sshot.bind(2, shop_hash(shop));
bind_all(ins_sshot, shop_id_ins.first, shop_hash(shop));
ins_sshot.exec();
ins_sshot.reset();
}
const auto sshot_id = db.getLastInsertRowid();
for (const auto& item : shop.items) {
ins_item.bind(1, sshot_id);
ins_item.bind(2, item_id_to_table_id(item.item_id));
ins_item.bind(3, item.amount);
ins_item.bind(4, item.price);
ins_item.bind(5, item.refine);
ins_item.bind(6, item.star_crumbs);
bind(ins_item, 7, item.element);
bind(ins_item, 8, item.creator);
bind<int>(ins_item, 9, item.beloved);
bind_all(ins_item, sshot_id, item_id_to_table_id(item.item_id),
item.amount, item.price, item.refine, item.star_crumbs,
item.element, item.creator, cast<int>(item.beloved)
);
ins_item.exec();
ins_item.reset();
const auto shop_item_id = db.getLastInsertRowid();
for (unsigned int card_id : item.cards) {
ins_card.bind(1, shop_item_id);
ins_card.bind(2, item_id_to_table_id(card_id));
bind_all(ins_card, shop_item_id, item_id_to_table_id(card_id));
ins_card.exec();
ins_card.reset();
}
@ -442,10 +434,7 @@ void OriginsDB::update (const Creators& creat) {
auto insert_creators = [](SQLite::Statement& query, const std::vector<oro::Creator>& creats, int type) {
for (const auto& creator : creats) {
query.bind(1, type);
query.bind(2, creator.char_id);
query.bind(3, creator.name);
query.bind(4, creator.points);
bind_all(query, type, creator.char_id, no_copy(creator.name), creator.points);
query.exec();
query.reset();
}