//function which updates the playerlist.
void World::updatePlayerList() {
    using namespace Database;
    std::cout<<"Updateplayerlist start"<<std::endl;

    PConnection connection = ConnectionManager::getInstance().getConnection();

    try {
        connection->beginTransaction();

        DeleteQuery delQuery(connection);
        delQuery.setServerTable("onlineplayer");
        delQuery.execute();

        if (!Players.empty()) {
            InsertQuery insQuery(connection);
            insQuery.setServerTable("onlineplayer");
            const InsertQuery::columnIndex column = insQuery.addColumn("on_playerid");

            PLAYERVECTOR::iterator plIterator;

            for (plIterator = Players.begin(); plIterator != Players.end(); ++plIterator) {
                insQuery.addValue<TYPE_OF_CHARACTER_ID>(column, (*plIterator)->id);
            }

            insQuery.execute();
        }

        connection->commitTransaction();
    } catch (std::exception &e) {
        std::cerr<<"caught exception during online player save: "<<e.what()<<std::endl;
        connection->rollbackTransaction();
    }

    std::cout<<"updateplayerlist end"<<std::endl;
}
//function which updates the playerlist.
void World::updatePlayerList() {
    using namespace Database;

    PConnection connection = ConnectionManager::getInstance().getConnection();

    try {
        connection->beginTransaction();

        DeleteQuery delQuery(connection);
        delQuery.setServerTable("onlineplayer");
        delQuery.execute();

        if (!Players.empty()) {
            InsertQuery insQuery(connection);
            insQuery.setServerTable("onlineplayer");
            const InsertQuery::columnIndex column = insQuery.addColumn("on_playerid");

            Players.for_each([&](Player *player) {
                insQuery.addValue<TYPE_OF_CHARACTER_ID>(column, player->getId());
            });

            insQuery.execute();
        }

        connection->commitTransaction();
    } catch (std::exception &e) {
        Logger::error(LogFacility::World) << "Exception during saving online player list: " << e.what() << Log::end;
        connection->rollbackTransaction();
    }
}
bool LongTimeEffect::save(uint32_t playerid, int32_t currentTime) {
    using namespace Database;
    PConnection connection = ConnectionManager::getInstance().getConnection();

    try {
        connection->beginTransaction();

        {
            InsertQuery insQuery(connection);
            insQuery.setServerTable("playerlteffects");
            const InsertQuery::columnIndex userColumn = insQuery.addColumn("plte_playerid");
            const InsertQuery::columnIndex effectColumn = insQuery.addColumn("plte_effectid");
            const InsertQuery::columnIndex nextCalledColumn = insQuery.addColumn("plte_nextcalled");
            const InsertQuery::columnIndex numberCalledColumn = insQuery.addColumn("plte_numbercalled");
            insQuery.addValue(userColumn, playerid);
            insQuery.addValue(effectColumn, effectId);
            insQuery.addValue(nextCalledColumn, executionTime - currentTime);
            insQuery.addValue(numberCalledColumn, numberOfCalls);
            insQuery.execute();
        }

        {
            InsertQuery insQuery(connection);
            insQuery.setServerTable("playerlteffectvalues");
            const InsertQuery::columnIndex userColumn = insQuery.addColumn("pev_playerid");
            const InsertQuery::columnIndex effectColumn = insQuery.addColumn("pev_effectid");
            const InsertQuery::columnIndex nameColumn = insQuery.addColumn("pev_name");
            const InsertQuery::columnIndex valueColumn = insQuery.addColumn("pev_value");

            for (const auto &value : values) {
                insQuery.addValue(nameColumn, value.first);
                insQuery.addValue(valueColumn, value.second);
                insQuery.addValue(userColumn, playerid);
                insQuery.addValue(effectColumn, effectId);
            }

            insQuery.execute();
        }

        connection->commitTransaction();
        return true;
    } catch (std::exception &e) {
        Logger::error(LogFacility::Other) << "Exception while saving long time effects: " << e.what() << Log::end;
        connection->rollbackTransaction();
        return false;
    }

    return true;
}
MonsterTable::MonsterTable() {
    Logger::info(LogFacility::Other) << "MonsterTable::constructor" << Log::end;

    try {
        using namespace Database;
        PConnection connection = ConnectionManager::getInstance().getConnection();
        connection->beginTransaction();

        SelectQuery monquery(connection);
        monquery.addColumn("monster", "mob_monsterid");
        monquery.addColumn("monster", "mob_name_de");
        monquery.addColumn("monster", "mob_name_en");
        monquery.addColumn("monster", "mob_race");
        monquery.addColumn("monster", "mob_hitpoints");
        monquery.addColumn("monster", "mob_movementtype");
        monquery.addColumn("monster", "mob_canattack");
        monquery.addColumn("monster", "mob_canhealself");
        monquery.addColumn("monster", "script");
        monquery.addColumn("monster", "mob_minsize");
        monquery.addColumn("monster", "mob_maxsize");
        monquery.addServerTable("monster");
        monquery.addOrderBy("monster", "mob_monsterid", Database::SelectQuery::ASC);

        Database::Result monresults = monquery.execute();

        if (!monresults.empty()) {
            auto questNodes = QuestNodeTable::getInstance().getMonsterNodes();
            auto questItr = questNodes.first;
            auto questEnd = questNodes.second;

            SelectQuery monLootDataQuery(connection);
            monLootDataQuery.addColumn("monster_drop_data", "mdd_id");
            monLootDataQuery.addColumn("monster_drop_data", "mdd_key");
            monLootDataQuery.addColumn("monster_drop_data", "mdd_value");
            monLootDataQuery.addServerTable("monster_drop_data");
            auto lootDataResults = monLootDataQuery.execute();

            std::map<uint32_t, std::map<std::string, std::string>> lootData;

            for (const auto &row: lootDataResults) {
                auto &lootDataEntry = lootData[row["mdd_id"].as<uint32_t>()];
                lootDataEntry.insert(std::make_pair(row["mdd_key"].as<std::string>(),
                                                    row["mdd_value"].as<std::string>()));
            }

            for (const auto &row : monresults) {
                MonsterStruct temprecord;
                const uint32_t id = row["mob_monsterid"].as<uint32_t>();
                temprecord.nameDe = row["mob_name_de"].as<std::string>();
                temprecord.nameEn = row["mob_name_en"].as<std::string>();
                temprecord.race = row["mob_race"].as<TYPE_OF_RACE_ID>();
                temprecord.hitpoints = row["mob_hitpoints"].as<uint16_t>();
                temprecord.canselfheal = row["mob_canhealself"].as<bool>();
                temprecord.canattack = row["mob_canattack"].as<bool>();
                temprecord.minsize = row["mob_minsize"].as<uint16_t>();
                temprecord.maxsize = row["mob_maxsize"].as<uint16_t>();

                const std::string movementType = row["mob_movementtype"].as<std::string>("");

                if (movementType == "walk") {
                    temprecord.movement = movement_type::walk;
                } else if (movementType == "fly") {
                    temprecord.movement = movement_type::fly;
                } else if (movementType == "crawl") {
                    temprecord.movement = movement_type::crawl;
                } else {
                    //TODO: Some proper error handling for invalid data
                    temprecord.movement = movement_type::walk;
                }

                if (!row["script"].is_null()) {
                    const std::string scriptname = row["script"].as<std::string>();

                    try {
                        std::shared_ptr<LuaMonsterScript> script(new LuaMonsterScript(scriptname));
                        temprecord.script = script;
                    } catch (ScriptException &e) {
                        Logger::error(LogFacility::Script) << "Error while loading monster script: " << scriptname << ": " << e.what() << Log::end;
                    }
                } else if (questItr != questEnd && questItr->first == id) {
                    std::shared_ptr<LuaMonsterScript> tmpScript = std::make_shared<LuaMonsterScript>();
                    temprecord.script = tmpScript;
                }

                while (questItr != questEnd && questItr->first == id) {
                    temprecord.script->addQuestScript(questItr->second.entrypoint, questItr->second.script);
                    ++questItr;
                }

                SelectQuery monAttrQuery(connection);
                monAttrQuery.addColumn("monster_attributes", "mobattr_name");
                monAttrQuery.addColumn("monster_attributes", "mobattr_min");
                monAttrQuery.addColumn("monster_attributes", "mobattr_max");
                monAttrQuery.addEqualCondition("monster_attributes", "mobattr_monsterid", id);
                monAttrQuery.addServerTable("monster_attributes");

                Database::Result monAttrResults = monAttrQuery.execute();

                for (const auto &row : monAttrResults) {
                    const std::string attribute = row["mobattr_name"].as<std::string>("");
                    uint16_t minValue = row["mobattr_min"].as<uint16_t>();
                    uint16_t maxValue = row["mobattr_max"].as<uint16_t>();

                    if (attribute == "luck") {
                        temprecord.attributes.luck = std::make_pair(minValue, maxValue);
                    } else if (attribute == "strength") {
                        temprecord.attributes.strength = std::make_pair(minValue, maxValue);
                    } else if (attribute == "dexterity") {
                        temprecord.attributes.dexterity = std::make_pair(minValue, maxValue);
                    } else if (attribute == "constitution") {
                        temprecord.attributes.constitution = std::make_pair(minValue, maxValue);
                    } else if (attribute == "agility") {
                        temprecord.attributes.agility = std::make_pair(minValue, maxValue);
                    } else if (attribute == "intelligence") {
                        temprecord.attributes.intelligence = std::make_pair(minValue, maxValue);
                    } else if (attribute == "perception") {
                        temprecord.attributes.perception = std::make_pair(minValue, maxValue);
                    } else if (attribute == "willpower") {
                        temprecord.attributes.willpower = std::make_pair(minValue, maxValue);
                    } else if (attribute == "essence") {
                        temprecord.attributes.essence = std::make_pair(minValue, maxValue);
                    } else {
                        Logger::error(LogFacility::Other) << "Unknown attribute type for monster " << id << ": " << attribute << Log::end;
                    }
                }

                SelectQuery monSkillQuery(connection);
                monSkillQuery.addColumn("monster_skills", "mobsk_skill_id");
                monSkillQuery.addColumn("monster_skills", "mobsk_minvalue");
                monSkillQuery.addColumn("monster_skills", "mobsk_maxvalue");
                monSkillQuery.addEqualCondition("monster_skills", "mobsk_monsterid", id);
                monSkillQuery.addServerTable("monster_skills");

                Database::Result monSkillResults = monSkillQuery.execute();

                for (const auto &row : monSkillResults) {
                    TYPE_OF_SKILL_ID skill = TYPE_OF_SKILL_ID(row["mobsk_skill_id"].as<uint16_t>());
                    uint16_t minValue = row["mobsk_minvalue"].as<uint16_t>();
                    uint16_t maxValue = row["mobsk_maxvalue"].as<uint16_t>();

                    temprecord.skills[skill] = std::make_pair(minValue, maxValue);
                }

                SelectQuery monItemQuery(connection);
                monItemQuery.addColumn("monster_items", "mobit_itemid");
                monItemQuery.addColumn("monster_items", "mobit_position");
                monItemQuery.addColumn("monster_items", "mobit_mincount");
                monItemQuery.addColumn("monster_items", "mobit_maxcount");
                monItemQuery.addEqualCondition("monster_items", "mobit_monsterid", id);
                monItemQuery.addServerTable("monster_items");

                Database::Result monItemResults = monItemQuery.execute();

                for (const auto &row : monItemResults) {
                    itemdef_t tempitem;
                    tempitem.itemid = row["mobit_itemid"].as<TYPE_OF_ITEM_ID>();
                    tempitem.amount = std::make_pair(
                                          row["mobit_mincount"].as<uint16_t>(),
                                          row["mobit_maxcount"].as<uint16_t>());

                    const std::string position = row["mobit_position"].as<std::string>("");
                    uint16_t location;

                    if (position == "head") {
                        location = 1;
                    } else if (position == "neck") {
                        location = 2;
                    } else if (position == "breast") {
                        location = 3;
                    } else if (position == "hands") {
                        location = 4;
                    } else if (position == "left hand") {
                        location = 5;
                    } else if (position == "right hand") {
                        location = 6;
                    } else if (position == "left finger") {
                        location = 7;
                    } else if (position == "right finger") {
                        location = 8;
                    } else if (position == "legs") {
                        location = 9;
                    } else if (position == "feet") {
                        location = 10;
                    } else if (position == "coat") {
                        location = 11;
                    } else if (position == "belt1") {
                        location = 12;
                    } else if (position == "belt2") {
                        location = 13;
                    } else if (position == "belt3") {
                        location = 14;
                    } else if (position == "belt4") {
                        location = 15;
                    } else if (position == "belt5") {
                        location = 16;
                    } else if (position == "belt6") {
                        location = 17;
                    } else {
                        Logger::error(LogFacility::Other) << "Invalid itemslot for monster " << id << ": " << position << Log::end;
                        location = 99;
                    }

                    const auto &tempCommon = Data::CommonItems[tempitem.itemid];

                    if (location < 99 && tempCommon.isValid()) {
                        tempitem.AgeingSpeed = tempCommon.AgeingSpeed;
                        temprecord.items[location].push_back(tempitem);
                    } else if (location < 99) {
                        Logger::error(LogFacility::Other) << "Invalid item for monster " << id << ": " << tempitem.itemid << Log::end;
                    }
                }

                SelectQuery monLootQuery(connection);
                monLootQuery.addColumn("monster_drop", "md_id");
                monLootQuery.addColumn("monster_drop", "md_category");
                monLootQuery.addColumn("monster_drop", "md_probability");
                monLootQuery.addColumn("monster_drop", "md_itemid");
                monLootQuery.addColumn("monster_drop", "md_amount_min");
                monLootQuery.addColumn("monster_drop", "md_amount_max");
                monLootQuery.addColumn("monster_drop", "md_quality_min");
                monLootQuery.addColumn("monster_drop", "md_quality_max");
                monLootQuery.addColumn("monster_drop", "md_durability_min");
                monLootQuery.addColumn("monster_drop", "md_durability_max");
                monLootQuery.addEqualCondition("monster_drop", "md_monsterid", id);
                monLootQuery.addServerTable("monster_drop");

                const auto monLootResults = monLootQuery.execute();

                for (const auto &row : monLootResults) {
                    auto lootId = row["md_id"].as<uint32_t>();
                    auto categoryId = row["md_category"].as<uint16_t>();

                    auto &category = temprecord.loot[categoryId];
                    auto &lootItem = category[lootId];

                    lootItem.itemId = row["md_itemid"].as<TYPE_OF_ITEM_ID>();
                    lootItem.probability = row["md_probability"].as<double>();
                    lootItem.amount = std::make_pair(row["md_amount_min"].as<uint16_t>(),
                                                     row["md_amount_max"].as<uint16_t>());
                    lootItem.quality = std::make_pair(row["md_quality_min"].as<uint16_t>(),
                                                      row["md_quality_max"].as<uint16_t>());
                    lootItem.durability = std::make_pair(row["md_durability_min"].as<uint16_t>(),
                                                         row["md_durability_max"].as<uint16_t>());
                    lootItem.data = std::move(lootData[lootId]);
                }

                



                table[id] = temprecord;
                dataOK = true;
            }
        }

        connection->commitTransaction();
        Logger::info(LogFacility::Other) << "Loaded " << table.size() << " monsters!" << Log::end;
    } catch (std::exception &e) {
        Logger::error(LogFacility::Other) << "Exception in MonsterTable::reload: " << e.what() << Log::end;
        dataOK = false;
    }

}
Example #5
0
void MonsterTable::reload() {
#ifdef DataConnect_DEBUG
    std::cout << "MonsterTable: reload" << std::endl;
#endif

    try {
        using namespace Database;
        PConnection connection = ConnectionManager::getInstance().getConnection();
        connection->beginTransaction();

        SelectQuery monquery(connection);
        monquery.addColumn("monster", "mob_monsterid");
        monquery.addColumn("monster", "mob_name_de");
        monquery.addColumn("monster", "mob_name_en");
        monquery.addColumn("monster", "mob_race");
        monquery.addColumn("monster", "mob_hitpoints");
        monquery.addColumn("monster", "mob_movementtype");
        monquery.addColumn("monster", "mob_canattack");
        monquery.addColumn("monster", "mob_canhealself");
        monquery.addColumn("monster", "script");
        monquery.addColumn("monster", "mob_minsize");
        monquery.addColumn("monster", "mob_maxsize");
        monquery.addServerTable("monster");
        monquery.addOrderBy("monster", "mob_monsterid", Database::SelectQuery::ASC);

        Database::Result monresults = monquery.execute();

        if (!monresults.empty()) {
            clearOldTable();

            auto questNodes = QuestNodeTable::getInstance()->getMonsterNodes();
            auto questItr = questNodes.first;
            auto questEnd = questNodes.second;

            for (Database::ResultConstIterator itr = monresults.begin();
                 itr != monresults.end(); ++itr) {
                MonsterStruct temprecord;
                std::string movementType;
                std::string scriptname;
                uint32_t id;

                id = (*itr)["mob_monsterid"].as<uint32_t>();
                temprecord.nameDe = (*itr)["mob_name_de"].as<std::string>();
                temprecord.nameEn = (*itr)["mob_name_en"].as<std::string>();
                temprecord.race = (Character::race_type)((*itr)["mob_race"].as<uint16_t>());
                temprecord.hitpoints = (*itr)["mob_hitpoints"].as<uint16_t>();
                temprecord.canselfheal = (*itr)["mob_canhealself"].as<bool>();
                temprecord.canattack = (*itr)["mob_canattack"].as<bool>();
                temprecord.minsize = (*itr)["mob_minsize"].as<uint16_t>();
                temprecord.maxsize = (*itr)["mob_maxsize"].as<uint16_t>();

                movementType = (*itr)["mob_movementtype"].as<std::string>();

                if (movementType == "walk") {
                    temprecord.movement = Character::walk;
                } else if (movementType == "fly") {
                    temprecord.movement = Character::fly;
                } else if (movementType == "crawl") {
                    temprecord.movement = Character::crawl;
                } else {
                    //TODO: Some proper error handling for invalid data
                    temprecord.movement = Character::walk;
                }

                if (!(*itr)["script"].is_null()) {
                    scriptname = (*itr)["script"].as<std::string>();

                    try {
                        boost::shared_ptr<LuaMonsterScript> script(new LuaMonsterScript(scriptname));
                        temprecord.script = script;
                    } catch (ScriptException &e) {
                        Logger::writeError("scripts", "Error while loading monster script: " + scriptname + ":\n" + e.what() + "\n");
                    }
                } else if (questItr != questEnd && questItr->first == id) {
                    boost::shared_ptr<LuaMonsterScript> tmpScript(new LuaMonsterScript());
                    temprecord.script = tmpScript;
                }

                while (questItr != questEnd && questItr->first == id) {
                    temprecord.script->addQuestScript(questItr->second.entrypoint, questItr->second.script);
                    ++questItr;
                }

                SelectQuery monAttrQuery(connection);
                monAttrQuery.addColumn("monster_attributes", "mobattr_name");
                monAttrQuery.addColumn("monster_attributes", "mobattr_min");
                monAttrQuery.addColumn("monster_attributes", "mobattr_max");
                monAttrQuery.addEqualCondition("monster_attributes", "mobattr_monsterid", id);
                monAttrQuery.addServerTable("monster_attributes");

                Database::Result monAttrResults = monAttrQuery.execute();

                if (!monAttrResults.empty()) {
                    std::string attribute;
                    uint16_t minValue, maxValue;

                    for (Database::ResultConstIterator itr2 = monAttrResults.begin();
                         itr2 != monAttrResults.end(); ++itr2) {
                        attribute = (*itr2)["mobattr_name"].as<std::string>();
                        minValue = (*itr2)["mobattr_min"].as<uint16_t>();
                        maxValue = (*itr2)["mobattr_max"].as<uint16_t>();

                        if (attribute == "luck") {
                            temprecord.attributes.luck = std::make_pair(minValue, maxValue);
                        } else if (attribute == "strength") {
                            temprecord.attributes.strength = std::make_pair(minValue, maxValue);
                        } else if (attribute == "dexterity") {
                            temprecord.attributes.dexterity = std::make_pair(minValue, maxValue);
                        } else if (attribute == "constitution") {
                            temprecord.attributes.constitution = std::make_pair(minValue, maxValue);
                        } else if (attribute == "agility") {
                            temprecord.attributes.agility = std::make_pair(minValue, maxValue);
                        } else if (attribute == "intelligence") {
                            temprecord.attributes.intelligence = std::make_pair(minValue, maxValue);
                        } else if (attribute == "perception") {
                            temprecord.attributes.perception = std::make_pair(minValue, maxValue);
                        } else if (attribute == "willpower") {
                            temprecord.attributes.willpower = std::make_pair(minValue, maxValue);
                        } else if (attribute == "essence") {
                            temprecord.attributes.essence = std::make_pair(minValue, maxValue);
                        } else {
                            std::cerr << "unknown attribute type: "<< attribute << std::endl;
                        }
                    } // for (Database::ResultConstIterator itr2 = monAttrResults...
                } // if (!monAttrResults.empty())

                SelectQuery monSkillQuery(connection);
                monSkillQuery.addColumn("monster_skills", "mobsk_skill_id");
                monSkillQuery.addColumn("monster_skills", "mobsk_minvalue");
                monSkillQuery.addColumn("monster_skills", "mobsk_maxvalue");
                monSkillQuery.addEqualCondition("monster_skills", "mobsk_monsterid", id);
                monSkillQuery.addServerTable("monster_skills");

                Database::Result monSkillResults = monSkillQuery.execute();

                if (!monSkillResults.empty()) {
                    TYPE_OF_SKILL_ID skill;
                    uint16_t minValue, maxValue;

                    for (Database::ResultConstIterator itr2 = monSkillResults.begin();
                         itr2 != monSkillResults.end(); ++itr2) {
                        skill = (TYPE_OF_SKILL_ID)((*itr2)["mobsk_skill_id"].as<uint16_t>());
                        minValue = (*itr2)["mobsk_minvalue"].as<uint16_t>();
                        maxValue = (*itr2)["mobsk_maxvalue"].as<uint16_t>();

                        temprecord.skills[skill] = std::make_pair(minValue, maxValue);
                    } // for (Database::ResultConstIterator itr2 = monSkillResults...
                } // if (!monSkillResults.empty())

                SelectQuery monItemQuery(connection);
                monItemQuery.addColumn("monster_items", "mobit_itemid");
                monItemQuery.addColumn("monster_items", "mobit_position");
                monItemQuery.addColumn("monster_items", "mobit_mincount");
                monItemQuery.addColumn("monster_items", "mobit_maxcount");
                monItemQuery.addEqualCondition("monster_items", "mobit_monsterid", id);
                monItemQuery.addServerTable("monster_items");

                Database::Result monItemResults = monItemQuery.execute();

                if (!monItemResults.empty()) {
                    itemdef_t tempitem;
                    uint16_t location;
                    std::string position;

                    for (Database::ResultConstIterator itr2 = monItemResults.begin();
                         itr2 != monItemResults.end(); ++itr2) {
                        tempitem.itemid = (*itr2)["mobit_itemid"].as<TYPE_OF_ITEM_ID>();
                        tempitem.amount = std::make_pair(
                                              (*itr2)["mobit_mincount"].as<uint16_t>(),
                                              (*itr2)["mobit_maxcount"].as<uint16_t>());

                        position = (*itr2)["mobit_position"].as<std::string>();

                        if (position == "head") {
                            location = 1;
                        } else if (position == "neck") {
                            location = 2;
                        } else if (position == "breast") {
                            location = 3;
                        } else if (position == "hands") {
                            location = 4;
                        } else if (position == "left hand") {
                            location = 5;
                        } else if (position == "right hand") {
                            location = 6;
                        } else if (position == "left finger") {
                            location = 7;
                        } else if (position == "right finger") {
                            location = 8;
                        } else if (position == "legs") {
                            location = 9;
                        } else if (position == "feet") {
                            location = 10;
                        } else if (position == "coat") {
                            location = 11;
                        } else if (position == "belt1") {
                            location = 12;
                        } else if (position == "belt2") {
                            location = 13;
                        } else if (position == "belt3") {
                            location = 14;
                        } else if (position == "belt4") {
                            location = 15;
                        } else if (position == "belt5") {
                            location = 16;
                        } else if (position == "belt6") {
                            location = 17;
                        } else {
                            std::cerr << "specified invalid itemslot: " <<  position << " for monster " << temprecord.nameEn << std::endl;
                            location = 99;
                        }

                        CommonStruct tempCommon;

                        if (location < 99 && CommonItems->find(tempitem.itemid, tempCommon)) {
                            tempitem.AgeingSpeed = tempCommon.AgeingSpeed;
                            temprecord.items[location].push_back(tempitem);
                        } else if (location < 99) {
                            std::cerr << "couldn't find item: " <<  tempitem.itemid << " for monster " << temprecord.nameEn << std::endl;
                        }
                    } // for (Database::ResultConstIterator itr2 = monItemResults...
                } // if (!monItemResults.empty())

                m_table[id] = temprecord;
                m_dataOK = true;
            } // for (Database::ResultConstIterator itr = monresults...
        } // if (!monresults.empty())

        connection->commitTransaction();
#ifdef DataConnect_DEBUG
        std::cout << "loaded " << m_table.size() << " monsters!" << std::endl;
#endif
    } catch (std::exception &e) {
        std::cerr << "exception: " << e.what() << std::endl;
        m_dataOK = false;
    }

}