* Migrate UUID representations in SQLite inventory store to dashed format
* This makes the representation consistent with that most commonly used in the other supported database layers0.6.5-rc1
parent
d2a412e94b
commit
b5ba5634fb
|
@ -0,0 +1,15 @@
|
||||||
|
BEGIN;
|
||||||
|
|
||||||
|
update inventoryitems
|
||||||
|
set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21),
|
||||||
|
assetID = substr(assetID, 1, 8) || "-" || substr(assetID, 9, 4) || "-" || substr(assetID, 13, 4) || "-" || substr(assetID, 17, 4) || "-" || substr(assetID, 21),
|
||||||
|
parentFolderID = substr(parentFolderID, 1, 8) || "-" || substr(parentFolderID, 9, 4) || "-" || substr(parentFolderID, 13, 4) || "-" || substr(parentFolderID, 17, 4) || "-" || substr(parentFolderID, 21),
|
||||||
|
avatarID = substr(avatarID, 1, 8) || "-" || substr(avatarID, 9, 4) || "-" || substr(avatarID, 13, 4) || "-" || substr(avatarID, 17, 4) || "-" || substr(avatarID, 21),
|
||||||
|
creatorsID = substr(creatorsID, 1, 8) || "-" || substr(creatorsID, 9, 4) || "-" || substr(creatorsID, 13, 4) || "-" || substr(creatorsID, 17, 4) || "-" || substr(creatorsID, 21);
|
||||||
|
|
||||||
|
update inventoryfolders
|
||||||
|
set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21),
|
||||||
|
agentID = substr(agentID, 1, 8) || "-" || substr(agentID, 9, 4) || "-" || substr(agentID, 13, 4) || "-" || substr(agentID, 17, 4) || "-" || substr(agentID, 21),
|
||||||
|
parentID = substr(parentID, 1, 8) || "-" || substr(parentID, 9, 4) || "-" || substr(parentID, 13, 4) || "-" || substr(parentID, 17, 4) || "-" || substr(parentID, 21);
|
||||||
|
|
||||||
|
COMMIT;
|
|
@ -54,7 +54,7 @@ namespace OpenSim.Data.SQLite
|
||||||
public void Initialise()
|
public void Initialise()
|
||||||
{
|
{
|
||||||
m_log.Info("[SQLiteInventoryData]: " + Name + " cannot be default-initialized!");
|
m_log.Info("[SQLiteInventoryData]: " + Name + " cannot be default-initialized!");
|
||||||
throw new PluginNotInitialisedException (Name);
|
throw new PluginNotInitialisedException(Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -182,13 +182,13 @@ namespace OpenSim.Data.SQLite
|
||||||
/// <param name="item"></param>
|
/// <param name="item"></param>
|
||||||
private static void fillItemRow(DataRow row, InventoryItemBase item)
|
private static void fillItemRow(DataRow row, InventoryItemBase item)
|
||||||
{
|
{
|
||||||
row["UUID"] = Util.ToRawUuidString(item.ID);
|
row["UUID"] = item.ID.ToString();
|
||||||
row["assetID"] = Util.ToRawUuidString(item.AssetID);
|
row["assetID"] = item.AssetID.ToString();
|
||||||
row["assetType"] = item.AssetType;
|
row["assetType"] = item.AssetType;
|
||||||
row["invType"] = item.InvType;
|
row["invType"] = item.InvType;
|
||||||
row["parentFolderID"] = Util.ToRawUuidString(item.Folder);
|
row["parentFolderID"] = item.Folder.ToString();
|
||||||
row["avatarID"] = Util.ToRawUuidString(item.Owner);
|
row["avatarID"] = item.Owner.ToString();
|
||||||
row["creatorsID"] = Util.ToRawUuidString(item.CreatorIdAsUuid);
|
row["creatorsID"] = item.CreatorId;
|
||||||
row["inventoryName"] = item.Name;
|
row["inventoryName"] = item.Name;
|
||||||
row["inventoryDescription"] = item.Description;
|
row["inventoryDescription"] = item.Description;
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ namespace OpenSim.Data.SQLite
|
||||||
{
|
{
|
||||||
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
|
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
|
||||||
|
|
||||||
DataRow inventoryRow = inventoryFolderTable.Rows.Find(Util.ToRawUuidString(folder.ID));
|
DataRow inventoryRow = inventoryFolderTable.Rows.Find(folder.ID.ToString());
|
||||||
if (inventoryRow == null)
|
if (inventoryRow == null)
|
||||||
{
|
{
|
||||||
if (! add)
|
if (! add)
|
||||||
|
@ -251,7 +251,7 @@ namespace OpenSim.Data.SQLite
|
||||||
{
|
{
|
||||||
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
|
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
|
||||||
|
|
||||||
DataRow inventoryRow = inventoryFolderTable.Rows.Find(Util.ToRawUuidString(folder.ID));
|
DataRow inventoryRow = inventoryFolderTable.Rows.Find(folder.ID.ToString());
|
||||||
if (inventoryRow == null)
|
if (inventoryRow == null)
|
||||||
{
|
{
|
||||||
inventoryRow = inventoryFolderTable.NewRow();
|
inventoryRow = inventoryFolderTable.NewRow();
|
||||||
|
@ -278,7 +278,7 @@ namespace OpenSim.Data.SQLite
|
||||||
{
|
{
|
||||||
DataTable inventoryItemTable = ds.Tables["inventoryitems"];
|
DataTable inventoryItemTable = ds.Tables["inventoryitems"];
|
||||||
|
|
||||||
DataRow inventoryRow = inventoryItemTable.Rows.Find(Util.ToRawUuidString(item.ID));
|
DataRow inventoryRow = inventoryItemTable.Rows.Find(item.ID.ToString());
|
||||||
if (inventoryRow == null)
|
if (inventoryRow == null)
|
||||||
{
|
{
|
||||||
if (!add)
|
if (!add)
|
||||||
|
@ -300,7 +300,7 @@ namespace OpenSim.Data.SQLite
|
||||||
|
|
||||||
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
|
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
|
||||||
|
|
||||||
inventoryRow = inventoryFolderTable.Rows.Find(Util.ToRawUuidString(item.Folder));
|
inventoryRow = inventoryFolderTable.Rows.Find(item.Folder.ToString());
|
||||||
inventoryRow["version"] = (int)inventoryRow["version"] + 1;
|
inventoryRow["version"] = (int)inventoryRow["version"] + 1;
|
||||||
|
|
||||||
invFoldersDa.Update(ds, "inventoryfolders");
|
invFoldersDa.Update(ds, "inventoryfolders");
|
||||||
|
@ -354,7 +354,7 @@ namespace OpenSim.Data.SQLite
|
||||||
{
|
{
|
||||||
List<InventoryItemBase> retval = new List<InventoryItemBase>();
|
List<InventoryItemBase> retval = new List<InventoryItemBase>();
|
||||||
DataTable inventoryItemTable = ds.Tables["inventoryitems"];
|
DataTable inventoryItemTable = ds.Tables["inventoryitems"];
|
||||||
string selectExp = "parentFolderID = '" + Util.ToRawUuidString(folderID) + "'";
|
string selectExp = "parentFolderID = '" + folderID + "'";
|
||||||
DataRow[] rows = inventoryItemTable.Select(selectExp);
|
DataRow[] rows = inventoryItemTable.Select(selectExp);
|
||||||
foreach (DataRow row in rows)
|
foreach (DataRow row in rows)
|
||||||
{
|
{
|
||||||
|
@ -382,8 +382,7 @@ namespace OpenSim.Data.SQLite
|
||||||
{
|
{
|
||||||
List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
|
List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
|
||||||
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
|
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
|
||||||
string selectExp = "agentID = '" + Util.ToRawUuidString(user) + "' AND parentID = '" +
|
string selectExp = "agentID = '" + user + "' AND parentID = '" + UUID.Zero + "'";
|
||||||
Util.ToRawUuidString(UUID.Zero) + "'";
|
|
||||||
DataRow[] rows = inventoryFolderTable.Select(selectExp);
|
DataRow[] rows = inventoryFolderTable.Select(selectExp);
|
||||||
foreach (DataRow row in rows)
|
foreach (DataRow row in rows)
|
||||||
{
|
{
|
||||||
|
@ -414,7 +413,7 @@ namespace OpenSim.Data.SQLite
|
||||||
lock (ds)
|
lock (ds)
|
||||||
{
|
{
|
||||||
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
|
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
|
||||||
string selectExp = "parentID = '" + Util.ToRawUuidString(parentID) + "'";
|
string selectExp = "parentID = '" + parentID + "'";
|
||||||
DataRow[] rows = inventoryFolderTable.Select(selectExp);
|
DataRow[] rows = inventoryFolderTable.Select(selectExp);
|
||||||
foreach (DataRow row in rows)
|
foreach (DataRow row in rows)
|
||||||
{
|
{
|
||||||
|
@ -467,13 +466,13 @@ namespace OpenSim.Data.SQLite
|
||||||
* Then fetch all inventory folders for that agent from the agent ID.
|
* Then fetch all inventory folders for that agent from the agent ID.
|
||||||
*/
|
*/
|
||||||
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
|
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
|
||||||
string selectExp = "UUID = '" + Util.ToRawUuidString(parentID) + "'";
|
string selectExp = "UUID = '" + parentID + "'";
|
||||||
parentRow = inventoryFolderTable.Select(selectExp); // Assume at most 1 result
|
parentRow = inventoryFolderTable.Select(selectExp); // Assume at most 1 result
|
||||||
if (parentRow.GetLength(0) >= 1) // No result means parent folder does not exist
|
if (parentRow.GetLength(0) >= 1) // No result means parent folder does not exist
|
||||||
{
|
{
|
||||||
parentFolder = buildFolder(parentRow[0]);
|
parentFolder = buildFolder(parentRow[0]);
|
||||||
UUID agentID = parentFolder.Owner;
|
UUID agentID = parentFolder.Owner;
|
||||||
selectExp = "agentID = '" + Util.ToRawUuidString(agentID) + "'";
|
selectExp = "agentID = '" + agentID + "'";
|
||||||
folderRows = inventoryFolderTable.Select(selectExp);
|
folderRows = inventoryFolderTable.Select(selectExp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -550,7 +549,7 @@ namespace OpenSim.Data.SQLite
|
||||||
{
|
{
|
||||||
lock (ds)
|
lock (ds)
|
||||||
{
|
{
|
||||||
DataRow row = ds.Tables["inventoryitems"].Rows.Find(Util.ToRawUuidString(item));
|
DataRow row = ds.Tables["inventoryitems"].Rows.Find(item.ToString());
|
||||||
if (row != null)
|
if (row != null)
|
||||||
{
|
{
|
||||||
return buildItem(row);
|
return buildItem(row);
|
||||||
|
@ -576,7 +575,7 @@ namespace OpenSim.Data.SQLite
|
||||||
// clothes and the like. :(
|
// clothes and the like. :(
|
||||||
lock (ds)
|
lock (ds)
|
||||||
{
|
{
|
||||||
DataRow row = ds.Tables["inventoryfolders"].Rows.Find(Util.ToRawUuidString(folder));
|
DataRow row = ds.Tables["inventoryfolders"].Rows.Find(folder.ToString());
|
||||||
if (row != null)
|
if (row != null)
|
||||||
{
|
{
|
||||||
return buildFolder(row);
|
return buildFolder(row);
|
||||||
|
@ -616,7 +615,7 @@ namespace OpenSim.Data.SQLite
|
||||||
{
|
{
|
||||||
DataTable inventoryItemTable = ds.Tables["inventoryitems"];
|
DataTable inventoryItemTable = ds.Tables["inventoryitems"];
|
||||||
|
|
||||||
DataRow inventoryRow = inventoryItemTable.Rows.Find(Util.ToRawUuidString(itemID));
|
DataRow inventoryRow = inventoryItemTable.Rows.Find(itemID.ToString());
|
||||||
if (inventoryRow != null)
|
if (inventoryRow != null)
|
||||||
{
|
{
|
||||||
inventoryRow.Delete();
|
inventoryRow.Delete();
|
||||||
|
@ -695,7 +694,7 @@ namespace OpenSim.Data.SQLite
|
||||||
//Delete all sub-folders
|
//Delete all sub-folders
|
||||||
foreach (InventoryFolderBase f in subFolders)
|
foreach (InventoryFolderBase f in subFolders)
|
||||||
{
|
{
|
||||||
inventoryRow = inventoryFolderTable.Rows.Find(Util.ToRawUuidString(f.ID));
|
inventoryRow = inventoryFolderTable.Rows.Find(f.ID.ToString());
|
||||||
if (inventoryRow != null)
|
if (inventoryRow != null)
|
||||||
{
|
{
|
||||||
deleteItemsInFolder(f.ID);
|
deleteItemsInFolder(f.ID);
|
||||||
|
@ -704,7 +703,7 @@ namespace OpenSim.Data.SQLite
|
||||||
}
|
}
|
||||||
|
|
||||||
//Delete the actual row
|
//Delete the actual row
|
||||||
inventoryRow = inventoryFolderTable.Rows.Find(Util.ToRawUuidString(folderID));
|
inventoryRow = inventoryFolderTable.Rows.Find(folderID.ToString());
|
||||||
if (inventoryRow != null)
|
if (inventoryRow != null)
|
||||||
{
|
{
|
||||||
deleteItemsInFolder(folderID);
|
deleteItemsInFolder(folderID);
|
||||||
|
@ -850,10 +849,10 @@ namespace OpenSim.Data.SQLite
|
||||||
/// <param name="folder"></param>
|
/// <param name="folder"></param>
|
||||||
private static void fillFolderRow(DataRow row, InventoryFolderBase folder)
|
private static void fillFolderRow(DataRow row, InventoryFolderBase folder)
|
||||||
{
|
{
|
||||||
row["UUID"] = Util.ToRawUuidString(folder.ID);
|
row["UUID"] = folder.ID.ToString();
|
||||||
row["name"] = folder.Name;
|
row["name"] = folder.Name;
|
||||||
row["agentID"] = Util.ToRawUuidString(folder.Owner);
|
row["agentID"] = folder.Owner.ToString();
|
||||||
row["parentID"] = Util.ToRawUuidString(folder.ParentID);
|
row["parentID"] = folder.ParentID.ToString();
|
||||||
row["type"] = folder.Type;
|
row["type"] = folder.Type;
|
||||||
row["version"] = folder.Version;
|
row["version"] = folder.Version;
|
||||||
}
|
}
|
||||||
|
@ -865,8 +864,8 @@ namespace OpenSim.Data.SQLite
|
||||||
/// <param name="folder"></param>
|
/// <param name="folder"></param>
|
||||||
private static void moveFolderRow(DataRow row, InventoryFolderBase folder)
|
private static void moveFolderRow(DataRow row, InventoryFolderBase folder)
|
||||||
{
|
{
|
||||||
row["UUID"] = Util.ToRawUuidString(folder.ID);
|
row["UUID"] = folder.ID.ToString();
|
||||||
row["parentID"] = Util.ToRawUuidString(folder.ParentID);
|
row["parentID"] = folder.ParentID.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<InventoryItemBase> fetchActiveGestures (UUID avatarID)
|
public List<InventoryItemBase> fetchActiveGestures (UUID avatarID)
|
||||||
|
@ -876,8 +875,8 @@ namespace OpenSim.Data.SQLite
|
||||||
List<InventoryItemBase> items = new List<InventoryItemBase>();
|
List<InventoryItemBase> items = new List<InventoryItemBase>();
|
||||||
|
|
||||||
DataTable inventoryItemTable = ds.Tables["inventoryitems"];
|
DataTable inventoryItemTable = ds.Tables["inventoryitems"];
|
||||||
string selectExp = "avatarID = '" + Util.ToRawUuidString(avatarID) + "' AND assetType = " +
|
string selectExp
|
||||||
(int)AssetType.Gesture + " AND flags = 1";
|
= "avatarID = '" + avatarID + "' AND assetType = " + (int)AssetType.Gesture + " AND flags = 1";
|
||||||
m_log.DebugFormat("[SQL]: sql = " + selectExp);
|
m_log.DebugFormat("[SQL]: sql = " + selectExp);
|
||||||
DataRow[] rows = inventoryItemTable.Select(selectExp);
|
DataRow[] rows = inventoryItemTable.Select(selectExp);
|
||||||
foreach (DataRow row in rows)
|
foreach (DataRow row in rows)
|
||||||
|
|
Loading…
Reference in New Issue