From 67333d48fc0b9e70804b7ceef80494484b2a247c Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Thu, 9 Apr 2009 19:01:52 +0000 Subject: * Change UUIDs in SQLite user db to dashed format to match representations elsewhere --- OpenSim/Data/SQLite/Resources/009_UserStore.sql | 11 +++++++++++ OpenSim/Data/SQLite/SQLiteInventoryStore.cs | 2 +- OpenSim/Data/SQLite/SQLiteUserData.cs | 20 ++++++++++---------- 3 files changed, 22 insertions(+), 11 deletions(-) create mode 100644 OpenSim/Data/SQLite/Resources/009_UserStore.sql (limited to 'OpenSim/Data/SQLite') diff --git a/OpenSim/Data/SQLite/Resources/009_UserStore.sql b/OpenSim/Data/SQLite/Resources/009_UserStore.sql new file mode 100644 index 0000000..b4cc00c --- /dev/null +++ b/OpenSim/Data/SQLite/Resources/009_UserStore.sql @@ -0,0 +1,11 @@ +BEGIN; + +update users + set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21) + where UUID not like '%-%'; + +update useragents + set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21) + where UUID not like '%-%'; + +COMMIT; diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs index e84eed5..d6f41fd 100644 --- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs +++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs @@ -877,7 +877,7 @@ namespace OpenSim.Data.SQLite DataTable inventoryItemTable = ds.Tables["inventoryitems"]; string selectExp = "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); foreach (DataRow row in rows) { diff --git a/OpenSim/Data/SQLite/SQLiteUserData.cs b/OpenSim/Data/SQLite/SQLiteUserData.cs index 788a9ea..5f9f979 100644 --- a/OpenSim/Data/SQLite/SQLiteUserData.cs +++ b/OpenSim/Data/SQLite/SQLiteUserData.cs @@ -162,7 +162,7 @@ namespace OpenSim.Data.SQLite { lock (ds) { - DataRow row = ds.Tables["users"].Rows.Find(Util.ToRawUuidString(uuid)); + DataRow row = ds.Tables["users"].Rows.Find(uuid.ToString()); if (row != null) { UserProfileData user = buildUserProfile(row); @@ -341,7 +341,7 @@ namespace OpenSim.Data.SQLite { lock (ds) { - DataRow row = agents.Rows.Find(Util.ToRawUuidString(uuid)); + DataRow row = agents.Rows.Find(uuid.ToString()); if (row == null) infos[uuid] = null; else { @@ -422,7 +422,7 @@ namespace OpenSim.Data.SQLite { lock (ds) { - DataRow row = ds.Tables["useragents"].Rows.Find(Util.ToRawUuidString(uuid)); + DataRow row = ds.Tables["useragents"].Rows.Find(uuid.ToString()); if (row != null) { return buildUserAgent(row); @@ -472,7 +472,7 @@ namespace OpenSim.Data.SQLite DataTable users = ds.Tables["users"]; lock (ds) { - DataRow row = users.Rows.Find(Util.ToRawUuidString(AgentID)); + DataRow row = users.Rows.Find(AgentID.ToString()); if (row == null) { m_log.Warn("[USER DB]: Unable to store new web login key for non-existant user"); @@ -531,7 +531,7 @@ namespace OpenSim.Data.SQLite lock (ds) { - DataRow row = users.Rows.Find(Util.ToRawUuidString(user.ID)); + DataRow row = users.Rows.Find(user.ID.ToString()); if (row == null) { row = users.NewRow(); @@ -560,7 +560,7 @@ namespace OpenSim.Data.SQLite DataTable users = ds.Tables["users"]; lock (ds) { - DataRow row = users.Rows.Find(Util.ToRawUuidString(user.ID)); + DataRow row = users.Rows.Find(user.ID.ToString()); if (row == null) { return false; @@ -589,7 +589,7 @@ namespace OpenSim.Data.SQLite DataTable agents = ds.Tables["useragents"]; lock (ds) { - DataRow row = agents.Rows.Find(Util.ToRawUuidString(agent.ProfileID)); + DataRow row = agents.Rows.Find(agent.ProfileID.ToString()); if (row == null) { row = agents.NewRow(); @@ -852,13 +852,13 @@ namespace OpenSim.Data.SQLite } /// - /// + /// Persist user profile data /// /// /// private void fillUserRow(DataRow row, UserProfileData user) { - row["UUID"] = Util.ToRawUuidString(user.ID); + row["UUID"] = user.ID.ToString(); row["username"] = user.FirstName; row["surname"] = user.SurName; row["email"] = user.Email; @@ -944,7 +944,7 @@ namespace OpenSim.Data.SQLite /// private static void fillUserAgentRow(DataRow row, UserAgentData ua) { - row["UUID"] = Util.ToRawUuidString(ua.ProfileID); + row["UUID"] = ua.ProfileID.ToString(); row["agentIP"] = ua.AgentIP; row["agentPort"] = ua.AgentPort; row["agentOnline"] = ua.AgentOnline; -- cgit v1.1