* Change UUIDs in SQLite user db to dashed format to match representations elsewhere

0.6.5-rc1
Justin Clarke Casey 2009-04-09 19:01:52 +00:00
parent 39c6302972
commit 67333d48fc
3 changed files with 22 additions and 11 deletions

View File

@ -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;

View File

@ -877,7 +877,7 @@ namespace OpenSim.Data.SQLite
DataTable inventoryItemTable = ds.Tables["inventoryitems"]; DataTable inventoryItemTable = ds.Tables["inventoryitems"];
string selectExp string selectExp
= "avatarID = '" + avatarID + "' AND assetType = " + (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)
{ {

View File

@ -162,7 +162,7 @@ namespace OpenSim.Data.SQLite
{ {
lock (ds) lock (ds)
{ {
DataRow row = ds.Tables["users"].Rows.Find(Util.ToRawUuidString(uuid)); DataRow row = ds.Tables["users"].Rows.Find(uuid.ToString());
if (row != null) if (row != null)
{ {
UserProfileData user = buildUserProfile(row); UserProfileData user = buildUserProfile(row);
@ -341,7 +341,7 @@ namespace OpenSim.Data.SQLite
{ {
lock (ds) lock (ds)
{ {
DataRow row = agents.Rows.Find(Util.ToRawUuidString(uuid)); DataRow row = agents.Rows.Find(uuid.ToString());
if (row == null) infos[uuid] = null; if (row == null) infos[uuid] = null;
else else
{ {
@ -422,7 +422,7 @@ namespace OpenSim.Data.SQLite
{ {
lock (ds) lock (ds)
{ {
DataRow row = ds.Tables["useragents"].Rows.Find(Util.ToRawUuidString(uuid)); DataRow row = ds.Tables["useragents"].Rows.Find(uuid.ToString());
if (row != null) if (row != null)
{ {
return buildUserAgent(row); return buildUserAgent(row);
@ -472,7 +472,7 @@ namespace OpenSim.Data.SQLite
DataTable users = ds.Tables["users"]; DataTable users = ds.Tables["users"];
lock (ds) lock (ds)
{ {
DataRow row = users.Rows.Find(Util.ToRawUuidString(AgentID)); DataRow row = users.Rows.Find(AgentID.ToString());
if (row == null) if (row == null)
{ {
m_log.Warn("[USER DB]: Unable to store new web login key for non-existant user"); 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) lock (ds)
{ {
DataRow row = users.Rows.Find(Util.ToRawUuidString(user.ID)); DataRow row = users.Rows.Find(user.ID.ToString());
if (row == null) if (row == null)
{ {
row = users.NewRow(); row = users.NewRow();
@ -560,7 +560,7 @@ namespace OpenSim.Data.SQLite
DataTable users = ds.Tables["users"]; DataTable users = ds.Tables["users"];
lock (ds) lock (ds)
{ {
DataRow row = users.Rows.Find(Util.ToRawUuidString(user.ID)); DataRow row = users.Rows.Find(user.ID.ToString());
if (row == null) if (row == null)
{ {
return false; return false;
@ -589,7 +589,7 @@ namespace OpenSim.Data.SQLite
DataTable agents = ds.Tables["useragents"]; DataTable agents = ds.Tables["useragents"];
lock (ds) lock (ds)
{ {
DataRow row = agents.Rows.Find(Util.ToRawUuidString(agent.ProfileID)); DataRow row = agents.Rows.Find(agent.ProfileID.ToString());
if (row == null) if (row == null)
{ {
row = agents.NewRow(); row = agents.NewRow();
@ -852,13 +852,13 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// /// Persist user profile data
/// </summary> /// </summary>
/// <param name="row"></param> /// <param name="row"></param>
/// <param name="user"></param> /// <param name="user"></param>
private void fillUserRow(DataRow row, UserProfileData user) private void fillUserRow(DataRow row, UserProfileData user)
{ {
row["UUID"] = Util.ToRawUuidString(user.ID); row["UUID"] = user.ID.ToString();
row["username"] = user.FirstName; row["username"] = user.FirstName;
row["surname"] = user.SurName; row["surname"] = user.SurName;
row["email"] = user.Email; row["email"] = user.Email;
@ -944,7 +944,7 @@ namespace OpenSim.Data.SQLite
/// <param name="ua"></param> /// <param name="ua"></param>
private static void fillUserAgentRow(DataRow row, UserAgentData ua) private static void fillUserAgentRow(DataRow row, UserAgentData ua)
{ {
row["UUID"] = Util.ToRawUuidString(ua.ProfileID); row["UUID"] = ua.ProfileID.ToString();
row["agentIP"] = ua.AgentIP; row["agentIP"] = ua.AgentIP;
row["agentPort"] = ua.AgentPort; row["agentPort"] = ua.AgentPort;
row["agentOnline"] = ua.AgentOnline; row["agentOnline"] = ua.AgentOnline;