|
|
@ -1,18 +1,3 @@
|
|
|
|
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
|
|
|
|
|
|
// Copyright (C) 2010 Winch Gate Property Limited
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
|
|
|
|
// it under the terms of the GNU Affero General Public License as
|
|
|
|
|
|
|
|
// published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
|
|
|
// GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
|
|
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
// WARNING : this is a generated file, don't change it !
|
|
|
|
// WARNING : this is a generated file, don't change it !
|
|
|
@ -318,7 +303,7 @@ namespace RSMGR
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (cmd == NOPE::cc_instance_count)
|
|
|
|
else if (cmd == NOPE::cc_instance_count)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return (uint32)_ObjectCache.size();
|
|
|
|
return _ObjectCache.size();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// default return value
|
|
|
|
// default return value
|
|
|
@ -336,7 +321,7 @@ namespace RSMGR
|
|
|
|
TReleasedObject::iterator first(_ReleasedObject.begin()), last(_ReleasedObject.end());
|
|
|
|
TReleasedObject::iterator first(_ReleasedObject.begin()), last(_ReleasedObject.end());
|
|
|
|
for (; first != last; ++first)
|
|
|
|
for (; first != last; ++first)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
nbReleased += (uint32)first->second.size();
|
|
|
|
nbReleased += first->second.size();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
nlinfo(" There are %u object instances in cache not referenced (waiting deletion or re-use))", nbReleased);
|
|
|
|
nlinfo(" There are %u object instances in cache not referenced (waiting deletion or re-use))", nbReleased);
|
|
|
@ -586,16 +571,16 @@ namespace RSMGR
|
|
|
|
nlstop;
|
|
|
|
nlstop;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// remove object from cache map
|
|
|
|
// remove object from cache map
|
|
|
|
if (_Prim != NOPE::INVALID_OBJECT_ID
|
|
|
|
if (_PermissionId != NOPE::INVALID_OBJECT_ID
|
|
|
|
&& _ObjectState != NOPE::os_removed
|
|
|
|
&& _ObjectState != NOPE::os_removed
|
|
|
|
&& _ObjectState != NOPE::os_transient)
|
|
|
|
&& _ObjectState != NOPE::os_transient)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
nldebug("NOPE: clearing CNelPermission @%p from cache with id %u", this, static_cast<uint32>(_Prim));
|
|
|
|
nldebug("NOPE: clearing CNelPermission @%p from cache with id %u", this, static_cast<uint32>(_PermissionId));
|
|
|
|
nlverify(_ObjectCache.erase(_Prim) == 1);
|
|
|
|
nlverify(_ObjectCache.erase(_PermissionId) == 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (_ObjectState != NOPE::os_transient)
|
|
|
|
else if (_ObjectState != NOPE::os_transient)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
nlassert(_ObjectCache.find(_Prim) == _ObjectCache.end());
|
|
|
|
nlassert(_ObjectCache.find(_PermissionId) == _ObjectCache.end());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (_ObjectState == NOPE::os_released)
|
|
|
|
if (_ObjectState == NOPE::os_released)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -626,18 +611,18 @@ namespace RSMGR
|
|
|
|
{
|
|
|
|
{
|
|
|
|
nlassert(getPersistentState() == NOPE::os_transient);
|
|
|
|
nlassert(getPersistentState() == NOPE::os_transient);
|
|
|
|
|
|
|
|
|
|
|
|
nlassert(_Prim != 0);
|
|
|
|
nlassert(_PermissionId != 0);
|
|
|
|
std::string qs;
|
|
|
|
std::string qs;
|
|
|
|
qs = "INSERT INTO permission (";
|
|
|
|
qs = "INSERT INTO permission (";
|
|
|
|
|
|
|
|
|
|
|
|
qs += "prim, UId, ClientApplication, ShardId, AccessPrivilege";
|
|
|
|
qs += "PermissionId, UId, DomainId, ShardId, AccessPrivilege";
|
|
|
|
qs += ") VALUES (";
|
|
|
|
qs += ") VALUES (";
|
|
|
|
|
|
|
|
|
|
|
|
qs += "'"+MSW::escapeString(NLMISC::toString(_Prim), connection)+"'";
|
|
|
|
qs += "'"+MSW::escapeString(NLMISC::toString(_PermissionId), connection)+"'";
|
|
|
|
qs += ", ";
|
|
|
|
qs += ", ";
|
|
|
|
qs += "'"+MSW::escapeString(NLMISC::toString(_UserId), connection)+"'";
|
|
|
|
qs += "'"+MSW::escapeString(NLMISC::toString(_UserId), connection)+"'";
|
|
|
|
qs += ", ";
|
|
|
|
qs += ", ";
|
|
|
|
qs += "'"+MSW::escapeString(NLMISC::toString(_DomainName), connection)+"'";
|
|
|
|
qs += "'"+MSW::escapeString(NLMISC::toString(_DomainId), connection)+"'";
|
|
|
|
qs += ", ";
|
|
|
|
qs += ", ";
|
|
|
|
qs += "'"+MSW::escapeString(NLMISC::toString(_ShardId), connection)+"'";
|
|
|
|
qs += "'"+MSW::escapeString(NLMISC::toString(_ShardId), connection)+"'";
|
|
|
|
qs += ", ";
|
|
|
|
qs += ", ";
|
|
|
@ -670,17 +655,17 @@ namespace RSMGR
|
|
|
|
std::string qs;
|
|
|
|
std::string qs;
|
|
|
|
qs = "UPDATE permission SET ";
|
|
|
|
qs = "UPDATE permission SET ";
|
|
|
|
|
|
|
|
|
|
|
|
qs += "prim = '"+MSW::escapeString(NLMISC::toString(_Prim), connection)+"'";
|
|
|
|
qs += "PermissionId = '"+MSW::escapeString(NLMISC::toString(_PermissionId), connection)+"'";
|
|
|
|
qs += ", ";
|
|
|
|
qs += ", ";
|
|
|
|
qs += "UId = '"+MSW::escapeString(NLMISC::toString(_UserId), connection)+"'";
|
|
|
|
qs += "UId = '"+MSW::escapeString(NLMISC::toString(_UserId), connection)+"'";
|
|
|
|
qs += ", ";
|
|
|
|
qs += ", ";
|
|
|
|
qs += "ClientApplication = '"+MSW::escapeString(NLMISC::toString(_DomainName), connection)+"'";
|
|
|
|
qs += "DomainId = '"+MSW::escapeString(NLMISC::toString(_DomainId), connection)+"'";
|
|
|
|
qs += ", ";
|
|
|
|
qs += ", ";
|
|
|
|
qs += "ShardId = '"+MSW::escapeString(NLMISC::toString(_ShardId), connection)+"'";
|
|
|
|
qs += "ShardId = '"+MSW::escapeString(NLMISC::toString(_ShardId), connection)+"'";
|
|
|
|
qs += ", ";
|
|
|
|
qs += ", ";
|
|
|
|
qs += "AccessPrivilege = '"+MSW::escapeString(NLMISC::toString(_AccessPriv), connection)+"'";
|
|
|
|
qs += "AccessPrivilege = '"+MSW::escapeString(NLMISC::toString(_AccessPriv), connection)+"'";
|
|
|
|
|
|
|
|
|
|
|
|
qs += " WHERE prim = '"+NLMISC::toString(_Prim)+"'";
|
|
|
|
qs += " WHERE PermissionId = '"+NLMISC::toString(_PermissionId)+"'";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (connection.query(qs))
|
|
|
|
if (connection.query(qs))
|
|
|
@ -702,7 +687,7 @@ namespace RSMGR
|
|
|
|
std::string qs;
|
|
|
|
std::string qs;
|
|
|
|
qs = "DELETE FROM permission ";
|
|
|
|
qs = "DELETE FROM permission ";
|
|
|
|
|
|
|
|
|
|
|
|
qs += " WHERE prim = '"+NLMISC::toString(_Prim)+"'";
|
|
|
|
qs += " WHERE PermissionId = '"+NLMISC::toString(_PermissionId)+"'";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (connection.query(qs))
|
|
|
|
if (connection.query(qs))
|
|
|
@ -736,7 +721,7 @@ namespace RSMGR
|
|
|
|
std::string qs;
|
|
|
|
std::string qs;
|
|
|
|
qs = "DELETE FROM permission ";
|
|
|
|
qs = "DELETE FROM permission ";
|
|
|
|
|
|
|
|
|
|
|
|
qs += " WHERE prim = '"+NLMISC::toString(id)+"'";
|
|
|
|
qs += " WHERE PermissionId = '"+NLMISC::toString(id)+"'";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (connection.query(qs))
|
|
|
|
if (connection.query(qs))
|
|
|
@ -796,7 +781,7 @@ namespace RSMGR
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (cmd == NOPE::cc_instance_count)
|
|
|
|
else if (cmd == NOPE::cc_instance_count)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return (uint32)_ObjectCache.size();
|
|
|
|
return _ObjectCache.size();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// default return value
|
|
|
|
// default return value
|
|
|
@ -814,7 +799,7 @@ namespace RSMGR
|
|
|
|
TReleasedObject::iterator first(_ReleasedObject.begin()), last(_ReleasedObject.end());
|
|
|
|
TReleasedObject::iterator first(_ReleasedObject.begin()), last(_ReleasedObject.end());
|
|
|
|
for (; first != last; ++first)
|
|
|
|
for (; first != last; ++first)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
nbReleased += (uint32)first->second.size();
|
|
|
|
nbReleased += first->second.size();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
nlinfo(" There are %u object instances in cache not referenced (waiting deletion or re-use))", nbReleased);
|
|
|
|
nlinfo(" There are %u object instances in cache not referenced (waiting deletion or re-use))", nbReleased);
|
|
|
@ -912,12 +897,12 @@ namespace RSMGR
|
|
|
|
|
|
|
|
|
|
|
|
if (_ObjectState == NOPE::os_transient && state != NOPE::os_transient)
|
|
|
|
if (_ObjectState == NOPE::os_transient && state != NOPE::os_transient)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
nldebug("NOPE: inserting CNelPermission @%p in cache with id %u", this, static_cast<uint32>(_Prim));
|
|
|
|
nldebug("NOPE: inserting CNelPermission @%p in cache with id %u", this, static_cast<uint32>(_PermissionId));
|
|
|
|
nlverify(_ObjectCache.insert(std::make_pair(_Prim, this)).second);
|
|
|
|
nlverify(_ObjectCache.insert(std::make_pair(_PermissionId, this)).second);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (_ObjectState != NOPE::os_transient)
|
|
|
|
if (_ObjectState != NOPE::os_transient)
|
|
|
|
nlassert(_ObjectCache.find(_Prim) != _ObjectCache.end());
|
|
|
|
nlassert(_ObjectCache.find(_PermissionId) != _ObjectCache.end());
|
|
|
|
|
|
|
|
|
|
|
|
_ObjectState = state;
|
|
|
|
_ObjectState = state;
|
|
|
|
|
|
|
|
|
|
|
@ -928,8 +913,8 @@ namespace RSMGR
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (state == NOPE::os_removed)
|
|
|
|
else if (state == NOPE::os_removed)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
nldebug("NOPE: erasing CNelPermission @%p in cache with id %u", this, static_cast<uint32>(_Prim));
|
|
|
|
nldebug("NOPE: erasing CNelPermission @%p in cache with id %u", this, static_cast<uint32>(_PermissionId));
|
|
|
|
nlverify(_ObjectCache.erase(_Prim) == 1);
|
|
|
|
nlverify(_ObjectCache.erase(_PermissionId) == 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -945,11 +930,11 @@ namespace RSMGR
|
|
|
|
std::string qs;
|
|
|
|
std::string qs;
|
|
|
|
qs = "SELECT ";
|
|
|
|
qs = "SELECT ";
|
|
|
|
|
|
|
|
|
|
|
|
qs += "prim, UId, ClientApplication, ShardId, AccessPrivilege";
|
|
|
|
qs += "PermissionId, UId, DomainId, ShardId, AccessPrivilege";
|
|
|
|
|
|
|
|
|
|
|
|
qs += " FROM permission";
|
|
|
|
qs += " FROM permission";
|
|
|
|
|
|
|
|
|
|
|
|
qs += " WHERE prim = '"+NLMISC::toString(id)+"'";
|
|
|
|
qs += " WHERE PermissionId = '"+NLMISC::toString(id)+"'";
|
|
|
|
CNelPermissionPtr ret;
|
|
|
|
CNelPermissionPtr ret;
|
|
|
|
if (!connection.query(qs))
|
|
|
|
if (!connection.query(qs))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -965,9 +950,9 @@ namespace RSMGR
|
|
|
|
// ok, we have an object
|
|
|
|
// ok, we have an object
|
|
|
|
result->fetchRow();
|
|
|
|
result->fetchRow();
|
|
|
|
|
|
|
|
|
|
|
|
result->getField(0, ret->_Prim);
|
|
|
|
result->getField(0, ret->_PermissionId);
|
|
|
|
result->getField(1, ret->_UserId);
|
|
|
|
result->getField(1, ret->_UserId);
|
|
|
|
result->getField(2, ret->_DomainName);
|
|
|
|
result->getField(2, ret->_DomainId);
|
|
|
|
result->getField(3, ret->_ShardId);
|
|
|
|
result->getField(3, ret->_ShardId);
|
|
|
|
result->getField(4, ret->_AccessPriv);
|
|
|
|
result->getField(4, ret->_AccessPriv);
|
|
|
|
|
|
|
|
|
|
|
|