Fixing a spot I missed in assets. Switching Grid to the new naming schema with Store/Get

This commit is contained in:
Kunnis
2009-08-16 23:25:12 -05:00
committed by Melanie
parent f1287cc7af
commit b1853d9f26
11 changed files with 43 additions and 70 deletions

View File

@@ -38,9 +38,8 @@ namespace OpenSim.Data
public abstract RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax);
public abstract List<RegionProfileData> GetRegionsByName(string namePrefix, uint maxNum);
public abstract bool AuthenticateSim(UUID UUID, ulong regionHandle, string simrecvkey);
public abstract DataResponse AddProfile(RegionProfileData profile);
public abstract DataResponse StoreProfile(RegionProfileData profile);
public abstract ReservationData GetReservationAtPoint(uint x, uint y);
public abstract DataResponse UpdateProfile(RegionProfileData profile);
public abstract DataResponse DeleteProfile(string uuid);
public abstract void Initialise();

View File

@@ -99,18 +99,11 @@ namespace OpenSim.Data
bool AuthenticateSim(UUID UUID, ulong regionHandle, string simrecvkey);
/// <summary>
/// Adds a new profile to the database
/// Adds or updates a profile in the database
/// </summary>
/// <param name="profile">The profile to add</param>
/// <returns>RESPONSE_OK if successful, error if not.</returns>
DataResponse AddProfile(RegionProfileData profile);
/// <summary>
/// Updates a profile in the database
/// </summary>
/// <param name="profile"></param>
/// <returns></returns>
DataResponse UpdateProfile(RegionProfileData profile);
DataResponse StoreProfile(RegionProfileData profile);
/// <summary>
/// Remove a profile from the database

View File

@@ -272,26 +272,23 @@ namespace OpenSim.Data.MSSQL
/// </summary>
/// <param name="profile">The profile to add</param>
/// <returns>A dataresponse enum indicating success</returns>
override public DataResponse AddProfile(RegionProfileData profile)
override public DataResponse StoreProfile(RegionProfileData profile)
{
if (InsertRegionRow(profile))
if (GetProfileByUUID(profile.UUID) == null)
{
return DataResponse.RESPONSE_OK;
if (InsertRegionRow(profile))
{
return DataResponse.RESPONSE_OK;
}
}
else
{
if (UpdateRegionRow(profile))
{
return DataResponse.RESPONSE_OK;
}
}
return DataResponse.RESPONSE_ERROR;
}
/// <summary>
/// Update the specified region in the database
/// </summary>
/// <param name="profile">The profile to update</param>
/// <returns>A dataresponse enum indicating success</returns>
override public DataResponse UpdateProfile(RegionProfileData profile)
{
if (UpdateRegionRow(profile))
{
return DataResponse.RESPONSE_OK;
}
return DataResponse.RESPONSE_ERROR;
}

View File

@@ -391,7 +391,7 @@ namespace OpenSim.Data.MySQL
/// </summary>
/// <param name="profile">The profile to add</param>
/// <returns>Successful?</returns>
override public DataResponse AddProfile(RegionProfileData profile)
override public DataResponse StoreProfile(RegionProfileData profile)
{
MySQLSuperManager dbm = GetLockedConnection();
try {
@@ -407,17 +407,6 @@ namespace OpenSim.Data.MySQL
}
}
/// <summary>
/// Update a sim profile
/// </summary>
/// <param name="profile">The profile to update</param>
/// <returns>Sucessful?</returns>
/// <remarks>Same as AddProfile</remarks>
override public DataResponse UpdateProfile(RegionProfileData profile)
{
return AddProfile(profile);
}
/// <summary>
/// Deletes a sim profile from the database
/// </summary>

View File

@@ -117,7 +117,7 @@ namespace OpenSim.Data.NHibernate
throw new NotImplementedException();
}
public override DataResponse AddProfile(RegionProfileData profile)
public override DataResponse StoreProfile(RegionProfileData profile)
{
if (manager.Get(typeof(RegionProfileData), profile.Uuid) == null)
{
@@ -125,22 +125,10 @@ namespace OpenSim.Data.NHibernate
return DataResponse.RESPONSE_OK;
}
else
{
return DataResponse.RESPONSE_ERROR;
}
}
public override DataResponse UpdateProfile(RegionProfileData profile)
{
if (manager.Get(typeof(RegionProfileData), profile.Uuid) != null)
{
manager.Update(profile);
return DataResponse.RESPONSE_OK;
}
else
{
return DataResponse.RESPONSE_ERROR;
}
}
public override DataResponse DeleteProfile(string uuid)

View File

@@ -203,7 +203,7 @@ namespace OpenSim.Data.SQLite
/// </summary>
/// <param name="profile">The profile to add</param>
/// <returns>A dataresponse enum indicating success</returns>
override public DataResponse AddProfile(RegionProfileData profile)
override public DataResponse StoreProfile(RegionProfileData profile)
{
if (database.insertRow(profile))
{
@@ -215,17 +215,11 @@ namespace OpenSim.Data.SQLite
}
}
override public DataResponse UpdateProfile(RegionProfileData profile)
{
return AddProfile(profile);
}
/// <summary>
/// <summary>
/// Deletes a sim profile from the database
/// </summary>
/// <param name="uuid">the sim UUID</param>
/// <returns>Successful?</returns>
//public DataResponse DeleteProfile(RegionProfileData profile)
override public DataResponse DeleteProfile(string uuid)
{
Dictionary<string, string> param = new Dictionary<string, string>();

View File

@@ -70,7 +70,7 @@ namespace OpenSim.Data.Tests
reg.Uuid = regionUUID;
reg.RegionName = regionName;
db.AddProfile(reg);
db.StoreProfile(reg);
return reg;
}
@@ -120,7 +120,7 @@ namespace OpenSim.Data.Tests
RegionProfileData retreg = db.GetProfileByUUID(region2);
retreg.regionName = "Gotham City";
db.UpdateProfile(retreg);
db.StoreProfile(retreg);
retreg = db.GetProfileByUUID(region2);
Assert.That(retreg.RegionName, Is.EqualTo("Gotham City"), "Assert.That(retreg.RegionName, Is.EqualTo(\"Gotham City\"))");
@@ -135,13 +135,13 @@ namespace OpenSim.Data.Tests
retreg.RegionName = "Gotham Town";
retreg.Uuid = region1;
db.AddProfile(retreg);
db.StoreProfile(retreg);
retreg = db.GetProfileByUUID(region2);
retreg.RegionName = "Gothan Town";
retreg.Uuid = region3;
db.AddProfile(retreg);
db.StoreProfile(retreg);
List<RegionProfileData> listreg = db.GetRegionsByName("Gotham",10);