* Consistently use dashed uuid format for sqlite region data, as was previously done for sqlite inventory data.

* This revision contains a data migration.  Please backup your sqlite region db as a precaution before using this code
* I also advise that you do a runprebuild[.sh|.bat] and a clean build ("nant clean build" if you're using the command line).
* This change is needed for future id schemes
0.6.5-rc1
Justin Clarke Casey 2009-05-07 13:20:29 +00:00
parent 547f883f74
commit e033f4028d
2 changed files with 114 additions and 38 deletions

View File

@ -0,0 +1,79 @@
BEGIN;
update terrain
set RegionUUID = substr(RegionUUID, 1, 8) || "-" || substr(RegionUUID, 9, 4) || "-" || substr(RegionUUID, 13, 4) || "-" || substr(RegionUUID, 17, 4) || "-" || substr(RegionUUID, 21, 12)
where RegionUUID not like '%-%';
update landaccesslist
set LandUUID = substr(LandUUID, 1, 8) || "-" || substr(LandUUID, 9, 4) || "-" || substr(LandUUID, 13, 4) || "-" || substr(LandUUID, 17, 4) || "-" || substr(LandUUID, 21, 12)
where LandUUID not like '%-%';
update landaccesslist
set AccessUUID = substr(AccessUUID, 1, 8) || "-" || substr(AccessUUID, 9, 4) || "-" || substr(AccessUUID, 13, 4) || "-" || substr(AccessUUID, 17, 4) || "-" || substr(AccessUUID, 21, 12)
where AccessUUID not like '%-%';
update prims
set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
where UUID not like '%-%';
update prims
set RegionUUID = substr(RegionUUID, 1, 8) || "-" || substr(RegionUUID, 9, 4) || "-" || substr(RegionUUID, 13, 4) || "-" || substr(RegionUUID, 17, 4) || "-" || substr(RegionUUID, 21, 12)
where RegionUUID not like '%-%';
update prims
set SceneGroupID = substr(SceneGroupID, 1, 8) || "-" || substr(SceneGroupID, 9, 4) || "-" || substr(SceneGroupID, 13, 4) || "-" || substr(SceneGroupID, 17, 4) || "-" || substr(SceneGroupID, 21, 12)
where SceneGroupID not like '%-%';
update prims
set CreatorID = substr(CreatorID, 1, 8) || "-" || substr(CreatorID, 9, 4) || "-" || substr(CreatorID, 13, 4) || "-" || substr(CreatorID, 17, 4) || "-" || substr(CreatorID, 21, 12)
where CreatorID not like '%-%';
update prims
set OwnerID = substr(OwnerID, 1, 8) || "-" || substr(OwnerID, 9, 4) || "-" || substr(OwnerID, 13, 4) || "-" || substr(OwnerID, 17, 4) || "-" || substr(OwnerID, 21, 12)
where OwnerID not like '%-%';
update prims
set GroupID = substr(GroupID, 1, 8) || "-" || substr(GroupID, 9, 4) || "-" || substr(GroupID, 13, 4) || "-" || substr(GroupID, 17, 4) || "-" || substr(GroupID, 21, 12)
where GroupID not like '%-%';
update prims
set LastOwnerID = substr(LastOwnerID, 1, 8) || "-" || substr(LastOwnerID, 9, 4) || "-" || substr(LastOwnerID, 13, 4) || "-" || substr(LastOwnerID, 17, 4) || "-" || substr(LastOwnerID, 21, 12)
where LastOwnerID not like '%-%';
update primshapes
set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
where UUID not like '%-%';
update land
set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
where UUID not like '%-%';
update land
set RegionUUID = substr(RegionUUID, 1, 8) || "-" || substr(RegionUUID, 9, 4) || "-" || substr(RegionUUID, 13, 4) || "-" || substr(RegionUUID, 17, 4) || "-" || substr(RegionUUID, 21, 12)
where RegionUUID not like '%-%';
update land
set OwnerUUID = substr(OwnerUUID, 1, 8) || "-" || substr(OwnerUUID, 9, 4) || "-" || substr(OwnerUUID, 13, 4) || "-" || substr(OwnerUUID, 17, 4) || "-" || substr(OwnerUUID, 21, 12)
where OwnerUUID not like '%-%';
update land
set GroupUUID = substr(GroupUUID, 1, 8) || "-" || substr(GroupUUID, 9, 4) || "-" || substr(GroupUUID, 13, 4) || "-" || substr(GroupUUID, 17, 4) || "-" || substr(GroupUUID, 21, 12)
where GroupUUID not like '%-%';
update land
set MediaTextureUUID = substr(MediaTextureUUID, 1, 8) || "-" || substr(MediaTextureUUID, 9, 4) || "-" || substr(MediaTextureUUID, 13, 4) || "-" || substr(MediaTextureUUID, 17, 4) || "-" || substr(MediaTextureUUID, 21, 12)
where MediaTextureUUID not like '%-%';
update land
set SnapshotUUID = substr(SnapshotUUID, 1, 8) || "-" || substr(SnapshotUUID, 9, 4) || "-" || substr(SnapshotUUID, 13, 4) || "-" || substr(SnapshotUUID, 17, 4) || "-" || substr(SnapshotUUID, 21, 12)
where SnapshotUUID not like '%-%';
update land
set AuthbuyerID = substr(AuthbuyerID, 1, 8) || "-" || substr(AuthbuyerID, 9, 4) || "-" || substr(AuthbuyerID, 13, 4) || "-" || substr(AuthbuyerID, 17, 4) || "-" || substr(AuthbuyerID, 21, 12)
where AuthbuyerID not like '%-%';
COMMIT;

View File

@ -321,7 +321,7 @@ namespace OpenSim.Data.SQLite
{
//m_log.Info("[DATASTORE]: " +
//"Adding stopped obj: " + obj.UUID + " to region: " + regionUUID);
//addPrim(prim, Util.ToRawUuidString(obj.UUID), Util.ToRawUuidString(regionUUID));
//addPrim(prim, obj.UUID.ToString(), regionUUID.ToString());
}
else
{
@ -346,7 +346,7 @@ namespace OpenSim.Data.SQLite
DataTable prims = ds.Tables["prims"];
DataTable shapes = ds.Tables["primshapes"];
string selectExp = "SceneGroupID = '" + Util.ToRawUuidString(obj) + "' and RegionUUID = '" + Util.ToRawUuidString(regionUUID) + "'";
string selectExp = "SceneGroupID = '" + obj + "' and RegionUUID = '" + regionUUID + "'";
lock (ds)
{
DataRow[] primRows = prims.Select(selectExp);
@ -354,7 +354,7 @@ namespace OpenSim.Data.SQLite
{
// Remove shape rows
UUID uuid = new UUID((string) row["UUID"]);
DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(uuid));
DataRow shapeRow = shapes.Rows.Find(uuid.ToString());
if (shapeRow != null)
{
shapeRow.Delete();
@ -402,7 +402,7 @@ namespace OpenSim.Data.SQLite
DataTable prims = ds.Tables["prims"];
DataTable shapes = ds.Tables["primshapes"];
string byRegion = "RegionUUID = '" + Util.ToRawUuidString(regionUUID) + "'";
string byRegion = "RegionUUID = '" + regionUUID + "'";
lock (ds)
{
@ -423,7 +423,7 @@ namespace OpenSim.Data.SQLite
{
SceneObjectGroup group = new SceneObjectGroup();
prim = buildPrim(primRow);
DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID));
DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString());
if (shapeRow != null)
{
prim.Shape = buildShape(shapeRow);
@ -464,7 +464,7 @@ namespace OpenSim.Data.SQLite
if (uuid != objID) //is new SceneObjectGroup ?
{
prim = buildPrim(primRow);
DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID));
DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString());
if (shapeRow != null)
{
prim.Shape = buildShape(shapeRow);
@ -541,7 +541,7 @@ namespace OpenSim.Data.SQLite
new SqliteCommand("delete from terrain where RegionUUID=:RegionUUID and Revision <= :Revision",
m_conn))
{
cmd.Parameters.Add(new SqliteParameter(":RegionUUID", Util.ToRawUuidString(regionID)));
cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString()));
cmd.Parameters.Add(new SqliteParameter(":Revision", revision));
cmd.ExecuteNonQuery();
}
@ -554,7 +554,7 @@ namespace OpenSim.Data.SQLite
using (SqliteCommand cmd = new SqliteCommand(sql, m_conn))
{
cmd.Parameters.Add(new SqliteParameter(":RegionUUID", Util.ToRawUuidString(regionID)));
cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString()));
cmd.Parameters.Add(new SqliteParameter(":Revision", revision));
cmd.Parameters.Add(new SqliteParameter(":Heightfield", serializeTerrain(ter)));
cmd.ExecuteNonQuery();
@ -579,7 +579,7 @@ namespace OpenSim.Data.SQLite
using (SqliteCommand cmd = new SqliteCommand(sql, m_conn))
{
cmd.Parameters.Add(new SqliteParameter(":RegionUUID", Util.ToRawUuidString(regionID)));
cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString()));
using (IDataReader row = cmd.ExecuteReader())
{
@ -621,13 +621,13 @@ namespace OpenSim.Data.SQLite
{
using (SqliteCommand cmd = new SqliteCommand("delete from land where UUID=:UUID", m_conn))
{
cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(globalID)));
cmd.Parameters.Add(new SqliteParameter(":UUID", globalID.ToString()));
cmd.ExecuteNonQuery();
}
using (SqliteCommand cmd = new SqliteCommand("delete from landaccesslist where LandUUID=:UUID", m_conn))
{
cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(globalID)));
cmd.Parameters.Add(new SqliteParameter(":UUID", globalID.ToString()));
cmd.ExecuteNonQuery();
}
}
@ -644,7 +644,7 @@ namespace OpenSim.Data.SQLite
DataTable land = ds.Tables["land"];
DataTable landaccesslist = ds.Tables["landaccesslist"];
DataRow landRow = land.Rows.Find(Util.ToRawUuidString(parcel.landData.GlobalID));
DataRow landRow = land.Rows.Find(parcel.landData.GlobalID.ToString());
if (landRow == null)
{
landRow = land.NewRow();
@ -659,7 +659,7 @@ namespace OpenSim.Data.SQLite
// I know this caused someone issues before, but OpenSim is unusable if we leave this stuff around
using (SqliteCommand cmd = new SqliteCommand("delete from landaccesslist where LandUUID=:LandUUID", m_conn))
{
cmd.Parameters.Add(new SqliteParameter(":LandUUID", Util.ToRawUuidString(parcel.landData.GlobalID)));
cmd.Parameters.Add(new SqliteParameter(":LandUUID", parcel.landData.GlobalID.ToString()));
cmd.ExecuteNonQuery();
}
@ -686,12 +686,12 @@ namespace OpenSim.Data.SQLite
{
DataTable land = ds.Tables["land"];
DataTable landaccesslist = ds.Tables["landaccesslist"];
string searchExp = "RegionUUID = '" + Util.ToRawUuidString(regionUUID) + "'";
string searchExp = "RegionUUID = '" + regionUUID + "'";
DataRow[] rawDataForRegion = land.Select(searchExp);
foreach (DataRow rawDataLand in rawDataForRegion)
{
LandData newLand = buildLandData(rawDataLand);
string accessListSearchExp = "LandUUID = '" + Util.ToRawUuidString(newLand.GlobalID) + "'";
string accessListSearchExp = "LandUUID = '" + newLand.GlobalID + "'";
DataRow[] rawDataForLandAccessList = landaccesslist.Select(accessListSearchExp);
foreach (DataRow rawDataLandAccess in rawDataForLandAccessList)
{
@ -1447,11 +1447,11 @@ namespace OpenSim.Data.SQLite
/// <param name="regionUUID"></param>
private static void fillPrimRow(DataRow row, SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID)
{
row["UUID"] = Util.ToRawUuidString(prim.UUID);
row["RegionUUID"] = Util.ToRawUuidString(regionUUID);
row["UUID"] = prim.UUID.ToString();
row["RegionUUID"] = regionUUID.ToString();
row["CreationDate"] = prim.CreationDate;
row["Name"] = prim.Name;
row["SceneGroupID"] = Util.ToRawUuidString(sceneGroupID);
row["SceneGroupID"] = sceneGroupID.ToString();
// the UUID of the root part for this SceneObjectGroup
// various text fields
row["Text"] = prim.Text;
@ -1460,10 +1460,10 @@ namespace OpenSim.Data.SQLite
row["TouchName"] = prim.TouchName;
// permissions
row["ObjectFlags"] = prim.ObjectFlags;
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["CreatorID"] = prim.CreatorID.ToString();
row["OwnerID"] = prim.OwnerID.ToString();
row["GroupID"] = prim.GroupID.ToString();
row["LastOwnerID"] = prim.LastOwnerID.ToString();
row["OwnerMask"] = prim.OwnerMask;
row["NextOwnerMask"] = prim.NextOwnerMask;
row["GroupMask"] = prim.GroupMask;
@ -1613,8 +1613,8 @@ namespace OpenSim.Data.SQLite
/// <param name="regionUUID"></param>
private static void fillLandRow(DataRow row, LandData land, UUID regionUUID)
{
row["UUID"] = Util.ToRawUuidString(land.GlobalID);
row["RegionUUID"] = Util.ToRawUuidString(regionUUID);
row["UUID"] = land.GlobalID.ToString();
row["RegionUUID"] = regionUUID.ToString();
row["LocalLandID"] = land.LocalID;
// Bitmap is a byte[512]
@ -1622,32 +1622,32 @@ namespace OpenSim.Data.SQLite
row["Name"] = land.Name;
row["Desc"] = land.Description;
row["OwnerUUID"] = Util.ToRawUuidString(land.OwnerID);
row["OwnerUUID"] = land.OwnerID.ToString();
row["IsGroupOwned"] = land.IsGroupOwned;
row["Area"] = land.Area;
row["AuctionID"] = land.AuctionID; //Unemplemented
row["Category"] = land.Category; //Enum OpenMetaverse.Parcel.ParcelCategory
row["ClaimDate"] = land.ClaimDate;
row["ClaimPrice"] = land.ClaimPrice;
row["GroupUUID"] = Util.ToRawUuidString(land.GroupID);
row["GroupUUID"] = land.GroupID.ToString();
row["SalePrice"] = land.SalePrice;
row["LandStatus"] = land.Status; //Enum. OpenMetaverse.Parcel.ParcelStatus
row["LandFlags"] = land.Flags;
row["LandingType"] = land.LandingType;
row["MediaAutoScale"] = land.MediaAutoScale;
row["MediaTextureUUID"] = Util.ToRawUuidString(land.MediaID);
row["MediaTextureUUID"] = land.MediaID.ToString();
row["MediaURL"] = land.MediaURL;
row["MusicURL"] = land.MusicURL;
row["PassHours"] = land.PassHours;
row["PassPrice"] = land.PassPrice;
row["SnapshotUUID"] = Util.ToRawUuidString(land.SnapshotID);
row["SnapshotUUID"] = land.SnapshotID.ToString();
row["UserLocationX"] = land.UserLocation.X;
row["UserLocationY"] = land.UserLocation.Y;
row["UserLocationZ"] = land.UserLocation.Z;
row["UserLookAtX"] = land.UserLookAt.X;
row["UserLookAtY"] = land.UserLookAt.Y;
row["UserLookAtZ"] = land.UserLookAt.Z;
row["AuthbuyerID"] = Util.ToRawUuidString(land.AuthBuyerID);
row["AuthbuyerID"] = land.AuthBuyerID.ToString();
row["OtherCleanTime"] = land.OtherCleanTime;
row["Dwell"] = land.Dwell;
}
@ -1660,8 +1660,8 @@ namespace OpenSim.Data.SQLite
/// <param name="parcelID"></param>
private static void fillLandAccessRow(DataRow row, ParcelManager.ParcelAccessEntry entry, UUID parcelID)
{
row["LandUUID"] = Util.ToRawUuidString(parcelID);
row["AccessUUID"] = Util.ToRawUuidString(entry.AgentID);
row["LandUUID"] = parcelID.ToString();
row["AccessUUID"] = entry.AgentID.ToString();
row["Flags"] = entry.Flags;
}
@ -1742,10 +1742,7 @@ namespace OpenSim.Data.SQLite
s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]);
s.State = Convert.ToByte(row["State"]);
// text TODO: this isn't right] = but I'm not sure the right
// way to specify this as a blob atm
byte[] textureEntry = (byte[]) row["Texture"];
byte[] textureEntry = (byte[])row["Texture"];
s.TextureEntry = textureEntry;
s.ExtraParams = (byte[]) row["ExtraParams"];
@ -1760,7 +1757,7 @@ namespace OpenSim.Data.SQLite
private static void fillShapeRow(DataRow row, SceneObjectPart prim)
{
PrimitiveBaseShape s = prim.Shape;
row["UUID"] = Util.ToRawUuidString(prim.UUID);
row["UUID"] = prim.UUID.ToString();
// shape is an enum
row["Shape"] = 0;
// vectors
@ -1805,7 +1802,7 @@ namespace OpenSim.Data.SQLite
DataTable prims = ds.Tables["prims"];
DataTable shapes = ds.Tables["primshapes"];
DataRow primRow = prims.Rows.Find(Util.ToRawUuidString(prim.UUID));
DataRow primRow = prims.Rows.Find(prim.UUID.ToString());
if (primRow == null)
{
primRow = prims.NewRow();
@ -1817,7 +1814,7 @@ namespace OpenSim.Data.SQLite
fillPrimRow(primRow, prim, sceneGroupID, regionUUID);
}
DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID));
DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString());
if (shapeRow == null)
{
shapeRow = shapes.NewRow();