Fix up other sqlite db interactions to use non-hyphenated uuid

Inventory contents retrieval and persistent region storage standalone now appear to work as well as they did before :)
This patch will not fix grid problems.
May be bugs present due to conversions I didn't spot.
I personally probably don't have any more time for this today.  I'm also not entirely convinced this is the right way forward
so this might be a handy pause for thought.  I'll also be delighted if I wake up tommorrow and everything is fine again.
afrisby
Justin Clarke Casey 2007-12-20 19:13:34 +00:00
parent dd1e2c8eb9
commit f1ebe79824
5 changed files with 48 additions and 48 deletions

View File

@ -79,7 +79,7 @@ namespace OpenSim.Framework.Data.SQLite
public AssetBase FetchAsset(LLUUID uuid)
{
AssetBase asset = new AssetBase();
DataRow row = ds.Tables["assets"].Rows.Find(uuid);
DataRow row = ds.Tables["assets"].Rows.Find(Util.ToRawUuidString(uuid));
if (row != null)
{
return buildAsset(row);
@ -103,7 +103,7 @@ namespace OpenSim.Framework.Data.SQLite
DataTable assets = ds.Tables["assets"];
lock (ds)
{
DataRow row = assets.Rows.Find(asset.FullID);
DataRow row = assets.Rows.Find(Util.ToRawUuidString(asset.FullID));
if (row == null)
{
row = assets.NewRow();
@ -130,7 +130,7 @@ namespace OpenSim.Framework.Data.SQLite
public bool ExistsAsset(LLUUID uuid)
{
DataRow row = ds.Tables["assets"].Rows.Find(uuid);
DataRow row = ds.Tables["assets"].Rows.Find(Util.ToRawUuidString(uuid));
return (row != null);
}
@ -138,7 +138,7 @@ namespace OpenSim.Framework.Data.SQLite
{
lock (ds)
{
DataRow row = ds.Tables["assets"].Rows.Find(uuid);
DataRow row = ds.Tables["assets"].Rows.Find(Util.ToRawUuidString(uuid));
if (row != null)
{
row.Delete();
@ -210,7 +210,7 @@ namespace OpenSim.Framework.Data.SQLite
private void fillAssetRow(DataRow row, AssetBase asset)
{
row["UUID"] = asset.FullID;
row["UUID"] = Util.ToRawUuidString(asset.FullID);
row["Name"] = asset.Name;
if (asset.Description != null)
{

View File

@ -119,7 +119,7 @@ namespace OpenSim.Framework.Data.SQLite
public RegionProfileData GetProfileByLLUUID(LLUUID uuid)
{
Dictionary<string, string> param = new Dictionary<string, string>();
param["uuid"] = uuid.ToString();
param["uuid"] = Util.ToRawUuidString(uuid);
IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = @uuid", param);
IDataReader reader = result.ExecuteReader();
@ -190,7 +190,7 @@ namespace OpenSim.Framework.Data.SQLite
SHA512Managed HashProvider = new SHA512Managed();
ASCIIEncoding TextProvider = new ASCIIEncoding();
byte[] stream = TextProvider.GetBytes(uuid.ToString() + ":" + handle.ToString() + ":" + challenge);
byte[] stream = TextProvider.GetBytes(Util.ToRawUuidString(uuid) + ":" + handle.ToString() + ":" + challenge);
byte[] hash = HashProvider.ComputeHash(stream);
return false;

View File

@ -77,11 +77,11 @@ namespace OpenSim.Framework.Data.SQLite
{
lock (ds)
{
DataRow row = ds.Tables["users"].Rows.Find(uuid);
DataRow row = ds.Tables["users"].Rows.Find(Util.ToRawUuidString(uuid));
if (row != null)
{
UserProfileData user = buildUserProfile(row);
row = ds.Tables["useragents"].Rows.Find(uuid);
row = ds.Tables["useragents"].Rows.Find(Util.ToRawUuidString(uuid));
if (row != null)
{
user.currentAgent = buildUserAgent(row);
@ -105,7 +105,7 @@ namespace OpenSim.Framework.Data.SQLite
if (rows.Length > 0)
{
UserProfileData user = buildUserProfile(rows[0]);
DataRow row = ds.Tables["useragents"].Rows.Find(user.UUID);
DataRow row = ds.Tables["useragents"].Rows.Find(Util.ToRawUuidString(user.UUID));
if (row != null)
{
user.currentAgent = buildUserAgent(row);
@ -220,7 +220,7 @@ namespace OpenSim.Framework.Data.SQLite
DataTable users = ds.Tables["users"];
lock (ds)
{
DataRow row = users.Rows.Find(user.UUID);
DataRow row = users.Rows.Find(Util.ToRawUuidString(user.UUID));
if (row == null)
{
row = users.NewRow();
@ -238,7 +238,7 @@ namespace OpenSim.Framework.Data.SQLite
if (user.currentAgent != null)
{
DataTable ua = ds.Tables["useragents"];
row = ua.Rows.Find(user.UUID);
row = ua.Rows.Find(Util.ToRawUuidString(user.UUID));
if (row == null)
{
row = ua.NewRow();
@ -255,7 +255,7 @@ namespace OpenSim.Framework.Data.SQLite
// I just added this to help the standalone login situation.
//It still needs to be looked at by a Database guy
DataTable ua = ds.Tables["useragents"];
row = ua.Rows.Find(user.UUID);
row = ua.Rows.Find(Util.ToRawUuidString(user.UUID));
if (row == null)
{

View File

@ -385,7 +385,7 @@ namespace OpenSim.Framework
}
/// <summary>
/// Convert an LLUUID to a raw uuid string. This is a string without hyphens.
/// Convert an LLUUID to a raw uuid string. Right now this is a string without hyphens.
/// </summary>
/// <param name="lluuid"></param>
/// <returns></returns>

View File

@ -175,12 +175,12 @@ namespace OpenSim.DataStore.MonoSqlite
if ((prim.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) == 0)
{
MainLog.Instance.Verbose("DATASTORE", "Adding obj: " + obj.UUID + " to region: " + regionUUID);
addPrim(prim, obj.UUID, regionUUID);
addPrim(prim, Util.ToRawUuidString(obj.UUID), Util.ToRawUuidString(regionUUID));
}
else if (Stopped(prim))
{
MainLog.Instance.Verbose("DATASTORE", "Adding stopped obj: " + obj.UUID + " to region: " + regionUUID);
addPrim(prim, obj.UUID, regionUUID);
addPrim(prim, Util.ToRawUuidString(obj.UUID), Util.ToRawUuidString(regionUUID));
}
else
{
@ -199,7 +199,7 @@ namespace OpenSim.DataStore.MonoSqlite
DataTable prims = ds.Tables["prims"];
DataTable shapes = ds.Tables["primshapes"];
string selectExp = "SceneGroupID = '" + obj.ToString() + "'";
string selectExp = "SceneGroupID = '" + Util.ToRawUuidString(obj) + "'";
lock (ds)
{
DataRow[] primRows = prims.Select(selectExp);
@ -227,7 +227,7 @@ namespace OpenSim.DataStore.MonoSqlite
DataTable prims = ds.Tables["prims"];
DataTable shapes = ds.Tables["primshapes"];
string byRegion = "RegionUUID = '" + regionUUID.ToString() + "'";
string byRegion = "RegionUUID = '" + Util.ToRawUuidString(regionUUID) + "'";
string orderByParent = "ParentID ASC";
lock (ds)
@ -246,7 +246,7 @@ namespace OpenSim.DataStore.MonoSqlite
{
SceneObjectGroup group = new SceneObjectGroup();
SceneObjectPart prim = buildPrim(primRow);
DataRow shapeRow = shapes.Rows.Find(prim.UUID);
DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID));
if (shapeRow != null)
{
prim.Shape = buildShape(shapeRow);
@ -260,13 +260,13 @@ namespace OpenSim.DataStore.MonoSqlite
group.AddPart(prim);
group.RootPart = prim;
createdObjects.Add(group.UUID, group);
createdObjects.Add(Util.ToRawUuidString(group.UUID), group);
retvals.Add(group);
}
else
{
SceneObjectPart prim = buildPrim(primRow);
DataRow shapeRow = shapes.Rows.Find(prim.UUID);
DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID));
if (shapeRow != null)
{
prim.Shape = buildShape(shapeRow);
@ -310,7 +310,7 @@ namespace OpenSim.DataStore.MonoSqlite
using(SqliteCommand cmd = new SqliteCommand(sql, conn))
{
cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString()));
cmd.Parameters.Add(new SqliteParameter(":RegionUUID", Util.ToRawUuidString(regionID)));
cmd.Parameters.Add(new SqliteParameter(":Revision", revision));
cmd.Parameters.Add(new SqliteParameter(":Heightfield", serializeTerrain(ter)));
cmd.ExecuteNonQuery();
@ -325,7 +325,7 @@ namespace OpenSim.DataStore.MonoSqlite
using(SqliteCommand cmd = new SqliteCommand("delete from terrain where RegionUUID=:RegionUUID and Revision < :Revision", conn))
{
cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString()));
cmd.Parameters.Add(new SqliteParameter(":RegionUUID", Util.ToRawUuidString(regionID)));
cmd.Parameters.Add(new SqliteParameter(":Revision", revision));
cmd.ExecuteNonQuery();
}
@ -348,7 +348,7 @@ namespace OpenSim.DataStore.MonoSqlite
using (SqliteCommand cmd = new SqliteCommand(sql, conn))
{
cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString()));
cmd.Parameters.Add(new SqliteParameter(":RegionUUID", Util.ToRawUuidString(regionID)));
using (IDataReader row = cmd.ExecuteReader())
{
@ -390,13 +390,13 @@ namespace OpenSim.DataStore.MonoSqlite
using (SqliteCommand cmd = new SqliteCommand("delete from land where UUID=:UUID", conn))
{
cmd.Parameters.Add(new SqliteParameter(":UUID", globalID.ToString()));
cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(globalID)));
cmd.ExecuteNonQuery();
}
using (SqliteCommand cmd = new SqliteCommand("delete from landaccesslist where LandUUID=:UUID", conn))
{
cmd.Parameters.Add(new SqliteParameter(":UUID", globalID.ToString()));
cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(globalID)));
cmd.ExecuteNonQuery();
}
conn.Close();
@ -412,7 +412,7 @@ namespace OpenSim.DataStore.MonoSqlite
DataTable land = ds.Tables["land"];
DataTable landaccesslist = ds.Tables["landaccesslist"];
DataRow landRow = land.Rows.Find(parcel.landData.globalID.ToString());
DataRow landRow = land.Rows.Find(Util.ToRawUuidString(parcel.landData.globalID));
if (landRow == null)
{
landRow = land.NewRow();
@ -426,7 +426,7 @@ namespace OpenSim.DataStore.MonoSqlite
using (SqliteCommand cmd = new SqliteCommand("delete from landaccesslist where LandUUID=:LandUUID", conn))
{
cmd.Parameters.Add(new SqliteParameter(":LandUUID", parcel.landData.globalID.ToString()));
cmd.Parameters.Add(new SqliteParameter(":LandUUID", Util.ToRawUuidString(parcel.landData.globalID)));
cmd.ExecuteNonQuery();
}
@ -450,12 +450,12 @@ namespace OpenSim.DataStore.MonoSqlite
{
DataTable land = ds.Tables["land"];
DataTable landaccesslist = ds.Tables["landaccesslist"];
string searchExp = "RegionUUID = '" + regionUUID.ToString() + "'";
string searchExp = "RegionUUID = '" + Util.ToRawUuidString(regionUUID) + "'";
DataRow[] rawDataForRegion = land.Select(searchExp);
foreach (DataRow rawDataLand in rawDataForRegion)
{
LandData newLand = buildLandData(rawDataLand);
string accessListSearchExp = "LandUUID = '" + newLand.globalID.ToString() + "'";
string accessListSearchExp = "LandUUID = '" + Util.ToRawUuidString(newLand.globalID) + "'";
DataRow[] rawDataForLandAccessList = landaccesslist.Select(accessListSearchExp);
foreach (DataRow rawDataLandAccess in rawDataForLandAccessList)
{
@ -811,12 +811,12 @@ namespace OpenSim.DataStore.MonoSqlite
private void fillPrimRow(DataRow row, SceneObjectPart prim, LLUUID sceneGroupID, LLUUID regionUUID)
{
row["UUID"] = prim.UUID;
row["RegionUUID"] = regionUUID;
row["UUID"] = Util.ToRawUuidString(prim.UUID);
row["RegionUUID"] = Util.ToRawUuidString(regionUUID);
row["ParentID"] = prim.ParentID;
row["CreationDate"] = prim.CreationDate;
row["Name"] = prim.Name;
row["SceneGroupID"] = sceneGroupID; // the UUID of the root part for this SceneObjectGroup
row["SceneGroupID"] = Util.ToRawUuidString(sceneGroupID); // the UUID of the root part for this SceneObjectGroup
// various text fields
row["Text"] = prim.Text;
row["Description"] = prim.Description;
@ -824,10 +824,10 @@ namespace OpenSim.DataStore.MonoSqlite
row["TouchName"] = prim.TouchName;
// permissions
row["ObjectFlags"] = prim.ObjectFlags;
row["CreatorID"] = prim.CreatorID;
row["OwnerID"] = prim.OwnerID;
row["GroupID"] = prim.GroupID;
row["LastOwnerID"] = prim.LastOwnerID;
row["CreatorID"] = Util.ToRawUuidString(prim.CreatorID);
row["OwnerID"] = Util.ToRawUuidString(prim.OwnerID);
row["GroupID"] = Util.ToRawUuidString(prim.GroupID);
row["LastOwnerID"] = Util.ToRawUuidString(prim.LastOwnerID);
row["OwnerMask"] = prim.OwnerMask;
row["NextOwnerMask"] = prim.NextOwnerMask;
row["GroupMask"] = prim.GroupMask;
@ -858,8 +858,8 @@ namespace OpenSim.DataStore.MonoSqlite
private void fillLandRow(DataRow row, LandData land, LLUUID regionUUID)
{
row["UUID"] = land.globalID.ToString();
row["RegionUUID"] = regionUUID.ToString();
row["UUID"] = Util.ToRawUuidString(land.globalID);
row["RegionUUID"] = Util.ToRawUuidString(regionUUID);
row["LocalLandID"] = land.localID;
// Bitmap is a byte[512]
@ -867,25 +867,25 @@ namespace OpenSim.DataStore.MonoSqlite
row["Name"] = land.landName;
row["Desc"] = land.landDesc;
row["OwnerUUID"] = land.ownerID.ToString();
row["OwnerUUID"] = Util.ToRawUuidString(land.ownerID);
row["IsGroupOwned"] = land.isGroupOwned;
row["Area"] = land.area;
row["AuctionID"] = land.auctionID; //Unemplemented
row["Category"] = land.category; //Enum libsecondlife.Parcel.ParcelCategory
row["ClaimDate"] = land.claimDate;
row["ClaimPrice"] = land.claimPrice;
row["GroupUUID"] = land.groupID.ToString();
row["GroupUUID"] = Util.ToRawUuidString(land.groupID);
row["SalePrice"] = land.salePrice;
row["LandStatus"] = land.landStatus; //Enum. libsecondlife.Parcel.ParcelStatus
row["LandFlags"] = land.landFlags;
row["LandingType"] = land.landingType;
row["MediaAutoScale"] = land.mediaAutoScale;
row["MediaTextureUUID"] = land.mediaID.ToString();
row["MediaTextureUUID"] = Util.ToRawUuidString(land.mediaID);
row["MediaURL"] = land.mediaURL;
row["MusicURL"] = land.musicURL;
row["PassHours"] = land.passHours;
row["PassPrice"] = land.passPrice;
row["SnapshotUUID"] = land.snapshotID.ToString();
row["SnapshotUUID"] = Util.ToRawUuidString(land.snapshotID);
row["UserLocationX"] = land.userLocation.X;
row["UserLocationY"] = land.userLocation.Y;
row["UserLocationZ"] = land.userLocation.Z;
@ -896,8 +896,8 @@ namespace OpenSim.DataStore.MonoSqlite
private void fillLandAccessRow(DataRow row, ParcelManager.ParcelAccessEntry entry, LLUUID parcelID)
{
row["LandUUID"] = parcelID.ToString();
row["AccessUUID"] = entry.AgentID.ToString();
row["LandUUID"] = Util.ToRawUuidString(parcelID);
row["AccessUUID"] = Util.ToRawUuidString(entry.AgentID);
row["Flags"] = entry.Flags;
}
@ -956,7 +956,7 @@ namespace OpenSim.DataStore.MonoSqlite
private void fillShapeRow(DataRow row, SceneObjectPart prim)
{
PrimitiveBaseShape s = prim.Shape;
row["UUID"] = prim.UUID;
row["UUID"] = Util.ToRawUuidString(prim.UUID);
// shape is an enum
row["Shape"] = 0;
// vectors
@ -994,7 +994,7 @@ namespace OpenSim.DataStore.MonoSqlite
DataTable prims = ds.Tables["prims"];
DataTable shapes = ds.Tables["primshapes"];
DataRow primRow = prims.Rows.Find(prim.UUID);
DataRow primRow = prims.Rows.Find(Util.ToRawUuidString(prim.UUID));
if (primRow == null)
{
primRow = prims.NewRow();
@ -1006,7 +1006,7 @@ namespace OpenSim.DataStore.MonoSqlite
fillPrimRow(primRow, prim, sceneGroupID, regionUUID);
}
DataRow shapeRow = shapes.Rows.Find(prim.UUID);
DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID));
if (shapeRow == null)
{
shapeRow = shapes.NewRow();