mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-14 15:41:30 +00:00
SetGroupID converted to QueryDatabase
This commit is contained in:
parent
61abdeb3f7
commit
819de185ef
@ -1791,18 +1791,27 @@ void Database::AddReport(std::string who, std::string against, std::string lines
|
|||||||
LogFile->write(EQEMuLog::Error, "Error adding a report for %s: %s", who.c_str(), results.ErrorMessage().c_str());
|
LogFile->write(EQEMuLog::Error, "Error adding a report for %s: %s", who.c_str(), results.ErrorMessage().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::SetGroupID(const char* name,uint32 id, uint32 charid, uint32 ismerc){
|
void Database::SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ismerc){
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
char *query = nullptr;
|
||||||
char *query = 0;
|
|
||||||
if(id == 0){ //removing you from table
|
if (id == 0)
|
||||||
if (!RunQuery(query, MakeAnyLenString(&query, "delete from group_id where charid=%i and name='%s' and ismerc=%i",charid, name, ismerc), errbuf))
|
{
|
||||||
LogFile->write(EQEMuLog::Error, "Error deleting character from group id: %s", errbuf);
|
// removing from group
|
||||||
}
|
auto results = QueryDatabase(query, MakeAnyLenString(&query, "delete from group_id where charid=%i and name='%s' and ismerc=%i",charid, name, ismerc));
|
||||||
else{
|
safe_delete_array(query);
|
||||||
if (!RunQuery(query, MakeAnyLenString(&query, "replace into group_id set charid=%i, groupid=%i, name='%s', ismerc='%i'",charid, id, name, ismerc), errbuf))
|
|
||||||
LogFile->write(EQEMuLog::Error, "Error adding character to group id: %s", errbuf);
|
if (!results.Success())
|
||||||
|
LogFile->write(EQEMuLog::Error, "Error deleting character from group id: %s", results.ErrorMessage().c_str());
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// adding to group
|
||||||
|
auto results = QueryDatabase(query, MakeAnyLenString(&query, "replace into group_id set charid=%i, groupid=%i, name='%s', ismerc='%i'",charid, id, name, ismerc));
|
||||||
safe_delete_array(query);
|
safe_delete_array(query);
|
||||||
|
|
||||||
|
if (!results.Success())
|
||||||
|
LogFile->write(EQEMuLog::Error, "Error adding character to group id: %s", results.ErrorMessage().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::ClearGroup(uint32 gid) {
|
void Database::ClearGroup(uint32 gid) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user