public void flush(ISL.Server.Account.Account account) { //assert(account.getID() >= 0); #if !DEBUG try { #endif mDb.StartTransaction(); //PerformTransaction transaction(mDb); // Update the account string sqlUpdateAccountTable=String.Format("UPDATE {0} SET username=\"{1}\", password=\"{2}\", email=\"{3}\", level=\"{4}\", lastlogin=\"{5}\" WHERE id = {6}", ACCOUNTS_TBL_NAME, account.getName(), account.getPassword(), account.getEmail(), account.getLevel(), account.getLastLogin(), account.getID()); mDb.ExecuteNonQuery(sqlUpdateAccountTable); // Get the list of characters that belong to this account. Dictionary<uint, Character> characters=account.getCharacters(); // Insert or update the characters. foreach(KeyValuePair<uint, Character> pair in characters) { Character character=pair.Value; if(character.getDatabaseID()>=0) { updateCharacter(character); } else { // Insert the character // This assumes that the characters name has been checked for // uniqueness string sqlInsertCharactersTable=String.Format("insert into {0} (user_id, name, gender, hair_style, hair_color, level, char_pts, correct_pts, x, y, map_id, slot) values (", CHARACTERS_TBL_NAME); sqlInsertCharactersTable+=String.Format("{0}, \"{1}\", {2}, {3}, {4}, ", account.getID(), character.getName(), character.getGender(), (int)character.getHairStyle(), (int)character.getHairColor()); sqlInsertCharactersTable+=String.Format("{0}, {1}, {2}, ", (int)character.getLevel(), character.getCharacterPoints(), character.getCorrectionPoints()); sqlInsertCharactersTable+=String.Format("{0}, {1}, {2}, {3});", character.getPosition().x, character.getPosition().y, character.getMapId(), character.getCharacterSlot()); //mDb.ExecuteNonQuery(sqlInsertCharactersTable); mDb.ExecuteNonQuery(sqlInsertCharactersTable); //charID ermitteln string sqlGetCharId=String.Format("SELECT id FROM {0} WHERE user_id={1} AND name='{2}'", CHARACTERS_TBL_NAME, account.getID(), character.getName()); DataTable tmp=mDb.ExecuteQuery(sqlGetCharId); int lastID=Convert.ToInt32(tmp.Rows[0]["id"]); // Update the character ID. character.setDatabaseID(lastID); // Update all attributes. foreach(KeyValuePair<uint, AttributeValue> attributePair in character.mAttributes) { updateAttribute(character.getDatabaseID(), attributePair.Key, attributePair.Value.@base, attributePair.Value.modified); } // Update the characters skill foreach(KeyValuePair<int, int> experiencePair in character.mExperience) { updateExperience(character.getDatabaseID(), experiencePair.Key, experiencePair.Value); } } } // Existing characters in memory have been inserted // or updated in database. // Now, let's remove those who are no more in memory from database. string sqlSelectNameIdCharactersTable=String.Format("select name, id from {0} where user_id = '{1}';", CHARACTERS_TBL_NAME, account.getID()); DataTable charInMemInfo=mDb.ExecuteQuery(sqlSelectNameIdCharactersTable); // We compare chars from memory and those existing in db, // and delete those not in mem but existing in db. bool charFound; for(uint i = 0;i < charInMemInfo.Rows.Count;++i) // In database { charFound=false; foreach(Character characterInMemory in characters.Values) // In memory { if(charInMemInfo.Rows[(int)i][0].ToString()==characterInMemory.getName()) { charFound=true; break; } } if(!charFound) { // The char is in db but not in memory, // it will be removed from database. // We store the id of the char to delete, // because as deleted, the RecordSet is also emptied, // and that creates an error. uint charId=(uint)(charInMemInfo.Rows[(int)i][1]); delCharacter((int)charId); } } mDb.CommitTransaction(); #if !DEBUG } catch(Exception e) { Logger.Write(LogLevel.Error, "SQL query failure: {0}", e); } #endif }
public Character getCharacter(int id, ISL.Server.Account.Account owner) { return getCharacterBySQL(owner); }
Character getCharacterBySQL(ISL.Server.Account.Account owner) { Character character=null; string sql=String.Format("SELECT * FROM {0} WHERE user_id = {1}", CHARACTERS_TBL_NAME, owner.getID()); DataTable charInfo=mDb.ExecuteQuery(sql); // If the character is not even in the database then // we have no choice but to return nothing. if(charInfo.Rows.Count==0) return null; character=new Character(charInfo.Rows[0]["name"].ToString(), Convert.ToInt32(charInfo.Rows[0]["id"])); character.setGender(Convert.ToInt32(charInfo.Rows[0]["gender"])); character.setHairStyle(Convert.ToInt32(charInfo.Rows[0]["hair_style"])); character.setHairColor(Convert.ToInt32(charInfo.Rows[0]["hair_color"])); character.setLevel(Convert.ToInt32(charInfo.Rows[0]["level"])); character.setCharacterPoints(Convert.ToInt32(charInfo.Rows[0]["char_pts"])); character.setCorrectionPoints(Convert.ToInt32(charInfo.Rows[0]["correct_pts"])); Point pos=new Point(Convert.ToInt32(charInfo.Rows[0]["x"]), Convert.ToInt32(charInfo.Rows[0]["y"])); character.setPosition(pos); int mapId=Convert.ToInt32(charInfo.Rows[0]["map_id"]); if(mapId>0) { character.setMapId(mapId); } else { // Set character to default map and one of the default location // Default map is to be 1, as not found return value will be 0. character.setMapId(Configuration.getValue("char_defaultMap", 1)); } character.setCharacterSlot(Convert.ToUInt32(charInfo.Rows[0]["slot"])); // Fill the account-related fields. Last step, as it may require a new // SQL query. if(owner!=null) { character.setAccount(owner); } else { int id=Convert.ToInt32(charInfo.Rows[0]["user_id"]); character.setAccountID(id); string s=String.Format("SELECT level FROM {0} WHERE id = '{1}';", ACCOUNTS_TBL_NAME, id); DataTable levelInfo=mDb.ExecuteQuery(s); character.setAccountLevel(Convert.ToInt32(levelInfo.Rows[0]["level"]), true); } // Load attributes." string s2=String.Format("SELECT attr_id, attr_base, attr_mod FROM {0} WHERE char_id = {1};", CHAR_ATTR_TBL_NAME, character.getDatabaseID()); DataTable attrInfo=mDb.ExecuteQuery(s2); if(attrInfo.Rows.Count>0) { uint nRows=(uint)attrInfo.Rows.Count; for(uint row = 0;row < nRows;++row) { uint id=Convert.ToUInt32(charInfo.Rows[0]["attr_id"]); character.setAttribute(id, Convert.ToDouble(charInfo.Rows[0]["attr_base"])); character.setModAttribute(id, Convert.ToDouble(charInfo.Rows[0]["attr_mod"])); } } // Load the skills of the char from CHAR_SKILLS_TBL_NAME string s3=String.Format("SELECT status_id, status_time FROM {0} WHERE char_id = {1};", CHAR_STATUS_EFFECTS_TBL_NAME, character.getDatabaseID()); DataTable skillInfo=mDb.ExecuteQuery(s3); if(skillInfo.Rows.Count>0) { uint nRows=(uint)skillInfo.Rows.Count; for(uint row = 0;row < nRows;row++) { character.setExperience( Convert.ToInt32(skillInfo.Rows[0]["status_id"]), // Skill Id Convert.ToInt32(skillInfo.Rows[0]["status_time"])); // Experience } } // Load the status effect string s4=String.Format("SELECT status_id, status_time FROM {0} WHERE char_id = {1};", CHAR_STATUS_EFFECTS_TBL_NAME, character.getDatabaseID()); DataTable statusInfo=mDb.ExecuteQuery(s4); if(statusInfo.Rows.Count>0) { uint nRows=(uint)statusInfo.Rows.Count; for(uint row = 0;row < nRows;row++) { character.applyStatusEffect( Convert.ToInt32(statusInfo.Rows[0]["status_id"]), // Status Id Convert.ToInt32(statusInfo.Rows[0]["status_time"])); // Time } } // Load the kill stats string s5=String.Format("SELECT monster_id, kills FROM {0} WHERE char_id = {1};", CHAR_KILL_COUNT_TBL_NAME, character.getDatabaseID()); DataTable killsInfo=mDb.ExecuteQuery(s5); if(killsInfo.Rows.Count>0) { uint nRows=(uint)killsInfo.Rows.Count; for(uint row = 0;row < nRows;row++) { character.setKillCount( Convert.ToInt32(killsInfo.Rows[0]["monster_id"]), // MonsterID Convert.ToInt32(killsInfo.Rows[0]["kills"])); // Kills } } // Load the special status string s6=String.Format("SELECT special_id FROM {0} WHERE char_id = {1};", CHAR_SPECIALS_TBL_NAME, character.getDatabaseID()); DataTable specialsInfo=mDb.ExecuteQuery(s6); if(specialsInfo.Rows.Count>0) { uint nRows=(uint)specialsInfo.Rows.Count; for(uint row = 0;row < nRows;row++) { character.giveSpecial(Convert.ToInt32(specialsInfo.Rows[0]["special_id"])); } } Possessions poss=character.getPossessions(); string s7=String.Format("SELECT slot_type, item_id, item_instance FROM {0} WHERE owner_id = '{1}' ORDER BY slot_type desc;", CHAR_EQUIPS_TBL_NAME, character.getDatabaseID()); DataTable equipInfo=mDb.ExecuteQuery(s7); Dictionary< uint, EquipmentItem > equipData=new Dictionary<uint, EquipmentItem>(); if(equipInfo.Rows.Count>0) { EquipmentItem equipItem=new EquipmentItem(); for(int k = 0, size = equipInfo.Rows.Count;k < size;++k) { equipItem.itemId=Convert.ToUInt32(equipInfo.Rows[0]["item_id"]); equipItem.itemInstance=Convert.ToUInt32(equipInfo.Rows[0]["item_instance"]); equipData.Add(Convert.ToUInt32(equipInfo.Rows[0]["slot_type"]), equipItem); } } poss.setEquipment(equipData); string s8=String.Format("SELECT * FROM {0} WHERE owner_id = '{1}' ORDER by slot ASC", INVENTORIES_TBL_NAME, character.getDatabaseID()); DataTable itemInfo=mDb.ExecuteQuery(s8); Dictionary<uint, InventoryItem > inventoryData=new Dictionary<uint, InventoryItem>(); if(itemInfo.Rows.Count>0) { for(int k = 0, size = itemInfo.Rows.Count;k < size;++k) { InventoryItem item=new InventoryItem(); ushort slot=Convert.ToUInt16(itemInfo.Rows[0]["slot"]); item.itemId=Convert.ToUInt32(itemInfo.Rows[0]["class_id"]); item.amount=Convert.ToUInt32(itemInfo.Rows[0]["amount"]); inventoryData[slot]=item; } } poss.setInventory(inventoryData); return character; }
//void flushSkill(Character character, int skillId) //{ // // Note: Deprecated, use DALStorage::updateExperience instead!!! // // TODO: Remove calls of flushSkill for updateExperience instead. // //updateExperience(character.getDatabaseID(), skillId, // // character.getExperience(skillId)); //} public void addAccount(ISL.Server.Account.Account account) { string sql=String.Format("INSERT INTO {0} (username, password, email, level, banned, registration, lastlogin) ", ACCOUNTS_TBL_NAME); sql+=String.Format("VALUES (\"{0}\", \"{1}\", \"{2}\", {3}, 0, {4}, {5});", account.getName(), account.getPassword(), account.getEmail(), account.getLevel(), account.getRegistrationDate().Ticks, account.getLastLogin().Ticks); mDb.ExecuteNonQuery(sql); }
public void updateLastLogin(ISL.Server.Account.Account account) { string sql=String.Format("UPDATE {0} SET lastlogin = '******' WHERE id = '{2}';", ACCOUNTS_TBL_NAME, account.getLastLogin(), account.getID()); mDb.ExecuteNonQuery(sql); }
void delAccount(ISL.Server.Account.Account account) { // Sync the account info into the database. flush(account); string sql=String.Format("DELETE FROM {0} WHERE id = '{1}';", ACCOUNTS_TBL_NAME, account.getID()); mDb.ExecuteNonQuery(sql); // Remove the account's characters. account.setCharacters(account.getCharacters()); //TODO Überprüfen ob das so funktioniert? }
void updateLastLogin(ISL.Server.Account.Account account) { //try //{ // std::ostringstream sql; // sql << "UPDATE " << ACCOUNTS_TBL_NAME // << " SET lastlogin = '******'" // << " WHERE id = '" << account.getID() << "';"; // mDb.execSql(sql.str()); //} //catch (const dal::DbSqlQueryExecFailure &e) //{ // utils::throwError("(DALStorage::updateLastLogin) SQL query failure: ", // e); //} }
public Character getCharacter(int id, ISL.Server.Account.Account owner) { string sql=String.Format("SELECT * FROM {0}, WHERE id = {1}", CHARACTERS_TBL_NAME, id); //TODO Überprüfen was hier genau passiert return getCharacterBySQL(owner); }
Character getCharacterBySQL(ISL.Server.Account.Account owner) { //Character *character = 0; //// Specialize the string_to functor to convert //// a string to an unsigned int. //string_to< unsigned > toUint; //string_to< int > toInt; //try //{ // const dal::RecordSet &charInfo = mDb.processSql(); // // If the character is not even in the database then // // we have no choice but to return nothing. // if (charInfo.isEmpty()) // return 0; // // Specialize the string_to functor to convert // // a string to an unsigned short. // string_to< unsigned short > toUshort; // string_to< double > toDouble; // character = new Character(charInfo(0, 2), toUint(charInfo(0, 0))); // character.setGender(toUshort(charInfo(0, 3))); // character.setHairStyle(toUshort(charInfo(0, 4))); // character.setHairColor(toUshort(charInfo(0, 5))); // character.setLevel(toUshort(charInfo(0, 6))); // character.setCharacterPoints(toUshort(charInfo(0, 7))); // character.setCorrectionPoints(toUshort(charInfo(0, 8))); // Point pos(toInt(charInfo(0, 9)), toInt(charInfo(0, 10))); // character.setPosition(pos); // int mapId = toUint(charInfo(0, 11)); // if (mapId > 0) // { // character.setMapId(mapId); // } // else // { // // Set character to default map and one of the default location // // Default map is to be 1, as not found return value will be 0. // character.setMapId(Configuration::getValue("char_defaultMap", 1)); // } // character.setCharacterSlot(toUint(charInfo(0, 12))); // // Fill the account-related fields. Last step, as it may require a new // // SQL query. // if (owner) // { // character.setAccount(owner); // } // else // { // int id = toUint(charInfo(0, 1)); // character.setAccountID(id); // std::ostringstream s; // s << "select level from " << ACCOUNTS_TBL_NAME // << " where id = '" << id << "';"; // const dal::RecordSet &levelInfo = mDb.execSql(s.str()); // character.setAccountLevel(toUint(levelInfo(0, 0)), true); // } // std::ostringstream s; // // Load attributes. // s << "SELECT attr_id, attr_base, attr_mod " // << "FROM " << CHAR_ATTR_TBL_NAME << " " // << "WHERE char_id = " << character.getDatabaseID(); // const dal::RecordSet &attrInfo = mDb.execSql(s.str()); // if (!attrInfo.isEmpty()) // { // const unsigned int nRows = attrInfo.rows(); // for (unsigned int row = 0; row < nRows; ++row) // { // unsigned int id = toUint(attrInfo(row, 0)); // character.setAttribute(id, toDouble(attrInfo(row, 1))); // character.setModAttribute(id, toDouble(attrInfo(row, 2))); // } // } // s.clear(); // s.str(""); // // Load the skills of the char from CHAR_SKILLS_TBL_NAME // s << "select status_id, status_time FROM " // << CHAR_STATUS_EFFECTS_TBL_NAME // << " WHERE char_id = " << character.getDatabaseID(); // const dal::RecordSet &skillInfo = mDb.execSql(s.str()); // if (!skillInfo.isEmpty()) // { // const unsigned int nRows = skillInfo.rows(); // for (unsigned int row = 0; row < nRows; row++) // { // character.setExperience( // toUint(skillInfo(row, 0)), // Skill Id // toUint(skillInfo(row, 1))); // Experience // } // } // // Load the status effect // s.clear(); // s.str(""); // s << "select status_id, status_time FROM " // << CHAR_STATUS_EFFECTS_TBL_NAME // << " WHERE char_id = " << character.getDatabaseID(); // const dal::RecordSet &statusInfo = mDb.execSql(s.str()); // if (!statusInfo.isEmpty()) // { // const unsigned int nRows = statusInfo.rows(); // for (unsigned int row = 0; row < nRows; row++) // { // character.applyStatusEffect( // toUint(statusInfo(row, 0)), // Status Id // toUint(statusInfo(row, 1))); // Time // } // } // // Load the kill stats // s.clear(); // s.str(""); // s << "select monster_id, kills FROM " << CHAR_KILL_COUNT_TBL_NAME // << " WHERE char_id = " << character.getDatabaseID(); // const dal::RecordSet &killsInfo = mDb.execSql(s.str()); // if (!killsInfo.isEmpty()) // { // const unsigned int nRows = killsInfo.rows(); // for (unsigned int row = 0; row < nRows; row++) // { // character.setKillCount( // toUint(killsInfo(row, 0)), // MonsterID // toUint(killsInfo(row, 1))); // Kills // } // } // // Load the special status // s.clear(); // s.str(""); // s << "select special_id FROM " << CHAR_SPECIALS_TBL_NAME // << " WHERE char_id = " << character.getDatabaseID(); // const dal::RecordSet &specialsInfo = mDb.execSql(s.str()); // if (!specialsInfo.isEmpty()) // { // const unsigned int nRows = specialsInfo.rows(); // for (unsigned int row = 0; row < nRows; row++) // character.giveSpecial(toUint(specialsInfo(row, 0))); // } //} //catch (const dal::DbSqlQueryExecFailure &e) //{ // utils::throwError("DALStorage::getCharacter #1) SQL query failure: ", // e); //} //Possessions &poss = character.getPossessions(); //try //{ // std::ostringstream sql; // sql << " select slot_type, item_id, item_instance from " // << CHAR_EQUIPS_TBL_NAME // << " where owner_id = '" // << character.getDatabaseID() << "' order by slot_type desc;"; // EquipData equipData; // const dal::RecordSet &equipInfo = mDb.execSql(sql.str()); // if (!equipInfo.isEmpty()) // { // EquipmentItem equipItem; // for (int k = 0, size = equipInfo.rows(); k < size; ++k) // { // equipItem.itemId = toUint(equipInfo(k, 1)); // equipItem.itemInstance = toUint(equipInfo(k, 2)); // equipData.insert(std::pair<unsigned int, EquipmentItem>( // toUint(equipInfo(k, 0)), // equipItem)); // } // } // poss.setEquipment(equipData); //} //catch (const dal::DbSqlQueryExecFailure &e) //{ // utils::throwError("DALStorage::getCharacter #2) SQL query failure: ", // e); //} //try //{ // std::ostringstream sql; // sql << " select * from " << INVENTORIES_TBL_NAME // << " where owner_id = '" // << character.getDatabaseID() << "' order by slot asc;"; // InventoryData inventoryData; // const dal::RecordSet &itemInfo = mDb.execSql(sql.str()); // if (!itemInfo.isEmpty()) // { // for (int k = 0, size = itemInfo.rows(); k < size; ++k) // { // InventoryItem item; // unsigned short slot = toUint(itemInfo(k, 2)); // item.itemId = toUint(itemInfo(k, 3)); // item.amount = toUint(itemInfo(k, 4)); // inventoryData[slot] = item; // } // } // poss.setInventory(inventoryData); //} //catch (const dal::DbSqlQueryExecFailure &e) //{ // utils::throwError("DALStorage::getCharacter #3) SQL query failure: ", // e); //} //return character; return null; //ssk }
void flush(ISL.Server.Account.Account account) { //assert(account.getID() >= 0); //using namespace dal; //try //{ // PerformTransaction transaction(mDb); // // Update the account // std::ostringstream sqlUpdateAccountTable; // sqlUpdateAccountTable // << "update " << ACCOUNTS_TBL_NAME // << " set username = ?, password = ?, email = ?, " // << "level = ?, lastlogin = ? where id = ?;"; // if (mDb.prepareSql(sqlUpdateAccountTable.str())) // { // mDb.bindValue(1, account.getName()); // mDb.bindValue(2, account.getPassword()); // mDb.bindValue(3, account.getEmail()); // mDb.bindValue(4, account.getLevel()); // mDb.bindValue(5, account.getLastLogin()); // mDb.bindValue(6, account.getID()); // mDb.processSql(); // } // else // { // utils::throwError("(DALStorage::flush) " // "SQL preparation query failure."); // } // // Get the list of characters that belong to this account. // Characters &characters = account.getCharacters(); // // Insert or update the characters. // for (Characters::const_iterator it = characters.begin(), // it_end = characters.end(); it != it_end; ++it) // { // Character *character = (*it).second; // if (character.getDatabaseID() >= 0) // { // updateCharacter(character); // } // else // { // std::ostringstream sqlInsertCharactersTable; // // Insert the character // // This assumes that the characters name has been checked for // // uniqueness // sqlInsertCharactersTable // << "insert into " << CHARACTERS_TBL_NAME // << " (user_id, name, gender, hair_style, hair_color," // << " level, char_pts, correct_pts," // << " x, y, map_id, slot) values (" // << account.getID() << ", \"" // << character.getName() << "\", " // << character.getGender() << ", " // << (int)character.getHairStyle() << ", " // << (int)character.getHairColor() << ", " // << (int)character.getLevel() << ", " // << (int)character.getCharacterPoints() << ", " // << (int)character.getCorrectionPoints() << ", " // << character.getPosition().x << ", " // << character.getPosition().y << ", " // << character.getMapId() << ", " // << character.getCharacterSlot() // << ");"; // mDb.execSql(sqlInsertCharactersTable.str()); // // Update the character ID. // character.setDatabaseID(mDb.getLastId()); // // Update all attributes. // AttributeMap::const_iterator attr_it, attr_end; // for (attr_it = character.mAttributes.begin(), // attr_end = character.mAttributes.end(); // attr_it != attr_end; ++attr_it) // { // updateAttribute(character.getDatabaseID(), attr_it.first, // attr_it.second.base, // attr_it.second.modified); // } // // Update the characters skill // std::map<int, int>::const_iterator skill_it; // for (skill_it = character.mExperience.begin(); // skill_it != character.mExperience.end(); skill_it++) // { // updateExperience(character.getDatabaseID(), // skill_it.first, skill_it.second); // } // } // } // // Existing characters in memory have been inserted // // or updated in database. // // Now, let's remove those who are no more in memory from database. // // Specialize the string_to functor to convert // // a string to an unsigned int. // string_to<unsigned short> toUint; // std::ostringstream sqlSelectNameIdCharactersTable; // sqlSelectNameIdCharactersTable // << "select name, id from " << CHARACTERS_TBL_NAME // << " where user_id = '" << account.getID() << "';"; // const RecordSet& charInMemInfo = // mDb.execSql(sqlSelectNameIdCharactersTable.str()); // // We compare chars from memory and those existing in db, // // and delete those not in mem but existing in db. // bool charFound; // for (unsigned int i = 0; i < charInMemInfo.rows(); ++i) // In database // { // charFound = false; // for (Characters::const_iterator it = characters.begin(), // it_end = characters.end(); it != it_end; ++it) // In memory // { // if (charInMemInfo(i, 0) == (*it).second.getName()) // { // charFound = true; // break; // } // } // if (!charFound) // { // // The char is in db but not in memory, // // it will be removed from database. // // We store the id of the char to delete, // // because as deleted, the RecordSet is also emptied, // // and that creates an error. // unsigned int charId = toUint(charInMemInfo(i, 1)); // delCharacter(charId); // } // } // transaction.commit(); //} //catch (const std::exception &e) //{ // utils::throwError("(DALStorage::flush) SQL query failure: ", e); //} }
void delAccount(ISL.Server.Account.Account account) { //// Sync the account info into the database. //flush(account); //try //{ // // Delete the account. // std::ostringstream sql; // sql << "delete from " << ACCOUNTS_TBL_NAME // << " where id = '" << account.getID() << "';"; // mDb.execSql(sql.str()); // // Remove the account's characters. // account.setCharacters(Characters()); //} //catch (const std::exception &e) //{ // utils::throwError("(DALStorage::delAccount) SQL query failure: ", e); //} }
void addAccount(ISL.Server.Account.Account account) { //assert(account.getCharacters().size() == 0); //using namespace dal; //try //{ // // Insert the account // std::ostringstream sql; // sql << "insert into " << ACCOUNTS_TBL_NAME // << " (username, password, email, level, " // << "banned, registration, lastlogin)" // << " VALUES (?, ?, ?, " // << account.getLevel() << ", 0, " // << account.getRegistrationDate() << ", " // << account.getLastLogin() << ");"; // if (mDb.prepareSql(sql.str())) // { // mDb.bindValue(1, account.getName()); // mDb.bindValue(2, account.getPassword()); // mDb.bindValue(3, account.getEmail()); // mDb.processSql(); // account.setID(mDb.getLastId()); // } // else // { // utils::throwError("(DALStorage::addAccount) " // "SQL preparation query failure."); // } //} //catch (const dal::DbSqlQueryExecFailure &e) //{ // utils::throwError("(DALStorage::addAccount) SQL query failure: ", e); //} }
public void setAccount(ISL.Server.Account.Account acc) { unsetAccount(); mAccount=acc; }