aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data.MSSQL
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Data.MSSQL')
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLManager.cs24
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs2
-rw-r--r--OpenSim/Framework/Data.MSSQL/Resources/Mssql-users.sql1
3 files changed, 23 insertions, 4 deletions
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs b/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs
index 0dc3338..bf57492 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs
@@ -95,6 +95,22 @@ namespace OpenSim.Framework.Data.MSSQL
95 MainLog.Instance.Verbose("DATASTORE", "MSSQL Database doesn't exist... creating"); 95 MainLog.Instance.Verbose("DATASTORE", "MSSQL Database doesn't exist... creating");
96 InitDB(conn); 96 InitDB(conn);
97 } 97 }
98 cmd = Query("select top 1 webLoginKey from users", new Dictionary<string, string>());
99 try
100 {
101 conn.Open();
102 cmd.ExecuteNonQuery();
103 cmd.Dispose();
104 conn.Close();
105 }
106 catch (Exception)
107 {
108 conn.Open();
109 cmd = Query("alter table users add column [webLoginKey] varchar(36) default NULL", new Dictionary<string, string>());
110 cmd.ExecuteNonQuery();
111 cmd.Dispose();
112 conn.Close();
113 }
98 return true; 114 return true;
99 } 115 }
100 116
@@ -380,6 +396,7 @@ namespace OpenSim.Framework.Data.MSSQL
380 396
381 retval.profileImage = new LLUUID((string) reader["profileImage"]); 397 retval.profileImage = new LLUUID((string) reader["profileImage"]);
382 retval.profileFirstImage = new LLUUID((string) reader["profileFirstImage"]); 398 retval.profileFirstImage = new LLUUID((string) reader["profileFirstImage"]);
399 retval.webLoginKey = new LLUUID((string)reader["webLoginKey"]);
383 } 400 }
384 else 401 else
385 { 402 {
@@ -595,7 +612,7 @@ namespace OpenSim.Framework.Data.MSSQL
595 float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin, 612 float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin,
596 string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask, 613 string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask,
597 string aboutText, string firstText, 614 string aboutText, string firstText,
598 LLUUID profileImage, LLUUID firstImage) 615 LLUUID profileImage, LLUUID firstImage, LLUUID webLoginKey)
599 { 616 {
600 string sql = "INSERT INTO users "; 617 string sql = "INSERT INTO users ";
601 sql += "([UUID], [username], [lastname], [passwordHash], [passwordSalt], [homeRegion], "; 618 sql += "([UUID], [username], [lastname], [passwordHash], [passwordSalt], [homeRegion], ";
@@ -603,14 +620,14 @@ namespace OpenSim.Framework.Data.MSSQL
603 "[homeLocationX], [homeLocationY], [homeLocationZ], [homeLookAtX], [homeLookAtY], [homeLookAtZ], [created], "; 620 "[homeLocationX], [homeLocationY], [homeLocationZ], [homeLookAtX], [homeLookAtY], [homeLookAtZ], [created], ";
604 sql += 621 sql +=
605 "[lastLogin], [userInventoryURI], [userAssetURI], [profileCanDoMask], [profileWantDoMask], [profileAboutText], "; 622 "[lastLogin], [userInventoryURI], [userAssetURI], [profileCanDoMask], [profileWantDoMask], [profileAboutText], ";
606 sql += "[profileFirstText], [profileImage], [profileFirstImage]) VALUES "; 623 sql += "[profileFirstText], [profileImage], [profileFirstImage], [webLoginKey]) VALUES ";
607 624
608 sql += "(@UUID, @username, @lastname, @passwordHash, @passwordSalt, @homeRegion, "; 625 sql += "(@UUID, @username, @lastname, @passwordHash, @passwordSalt, @homeRegion, ";
609 sql += 626 sql +=
610 "@homeLocationX, @homeLocationY, @homeLocationZ, @homeLookAtX, @homeLookAtY, @homeLookAtZ, @created, "; 627 "@homeLocationX, @homeLocationY, @homeLocationZ, @homeLookAtX, @homeLookAtY, @homeLookAtZ, @created, ";
611 sql += 628 sql +=
612 "@lastLogin, @userInventoryURI, @userAssetURI, @profileCanDoMask, @profileWantDoMask, @profileAboutText, "; 629 "@lastLogin, @userInventoryURI, @userAssetURI, @profileCanDoMask, @profileWantDoMask, @profileAboutText, ";
613 sql += "@profileFirstText, @profileImage, @profileFirstImage);"; 630 sql += "@profileFirstText, @profileImage, @profileFirstImage, @webLoginKey);";
614 631
615 Dictionary<string, string> parameters = new Dictionary<string, string>(); 632 Dictionary<string, string> parameters = new Dictionary<string, string>();
616 parameters["UUID"] = uuid.ToString(); 633 parameters["UUID"] = uuid.ToString();
@@ -635,6 +652,7 @@ namespace OpenSim.Framework.Data.MSSQL
635 parameters["profileFirstText"] = ""; 652 parameters["profileFirstText"] = "";
636 parameters["profileImage"] = LLUUID.Zero.ToString(); 653 parameters["profileImage"] = LLUUID.Zero.ToString();
637 parameters["profileFirstImage"] = LLUUID.Zero.ToString(); 654 parameters["profileFirstImage"] = LLUUID.Zero.ToString();
655 parameters["webLoginKey"] = LLUUID.Random().ToString();
638 656
639 bool returnval = false; 657 bool returnval = false;
640 658
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs
index f8a951e..db3c1d6 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs
@@ -315,7 +315,7 @@ namespace OpenSim.Framework.Data.MSSQL
315 user.lastLogin, user.userInventoryURI, user.userAssetURI, 315 user.lastLogin, user.userInventoryURI, user.userAssetURI,
316 user.profileCanDoMask, user.profileWantDoMask, 316 user.profileCanDoMask, user.profileWantDoMask,
317 user.profileAboutText, user.profileFirstText, user.profileImage, 317 user.profileAboutText, user.profileFirstText, user.profileImage,
318 user.profileFirstImage); 318 user.profileFirstImage,user.webLoginKey);
319 } 319 }
320 } 320 }
321 catch (Exception e) 321 catch (Exception e)
diff --git a/OpenSim/Framework/Data.MSSQL/Resources/Mssql-users.sql b/OpenSim/Framework/Data.MSSQL/Resources/Mssql-users.sql
index 3f5f896..abcc091 100644
--- a/OpenSim/Framework/Data.MSSQL/Resources/Mssql-users.sql
+++ b/OpenSim/Framework/Data.MSSQL/Resources/Mssql-users.sql
@@ -27,6 +27,7 @@ CREATE TABLE [users] (
27 [profileFirstText] [ntext], 27 [profileFirstText] [ntext],
28 [profileImage] [varchar](36) default NULL, 28 [profileImage] [varchar](36) default NULL,
29 [profileFirstImage] [varchar](36) default NULL, 29 [profileFirstImage] [varchar](36) default NULL,
30 [webLoginKey] [varchar](36) default NULL,
30 PRIMARY KEY CLUSTERED 31 PRIMARY KEY CLUSTERED
31( 32(
32 [UUID] ASC 33 [UUID] ASC