aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MSSQL
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-02-19 18:09:10 +0000
committerJustin Clarke Casey2009-02-19 18:09:10 +0000
commit07609565617aa7936758acba5fd625877564a10d (patch)
tree73123e37f14fea5f171cbe04753c21758f25afc1 /OpenSim/Data/MSSQL
parent* Okay, so finally got my head around this. Problem is that upstream Prebuild... (diff)
downloadopensim-SC_OLD-07609565617aa7936758acba5fd625877564a10d.zip
opensim-SC_OLD-07609565617aa7936758acba5fd625877564a10d.tar.gz
opensim-SC_OLD-07609565617aa7936758acba5fd625877564a10d.tar.bz2
opensim-SC_OLD-07609565617aa7936758acba5fd625877564a10d.tar.xz
* Apply http://opensimulator.org/mantis/view.php?id=3142
* Changes varchar(36) columns to UUID type in MSSQL - this will be much more efficient * ===As always, please, please backup your database before applying this patch=== * Thanks Ruud Lathrop (for the patch) and StrawberryFride (for the review)
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MSSQL/MSSQLAssetData.cs8
-rw-r--r--OpenSim/Data/MSSQL/MSSQLEstateData.cs116
-rw-r--r--OpenSim/Data/MSSQL/MSSQLGridData.cs20
-rw-r--r--OpenSim/Data/MSSQL/MSSQLInventoryData.cs22
-rw-r--r--OpenSim/Data/MSSQL/MSSQLManager.cs12
-rw-r--r--OpenSim/Data/MSSQL/MSSQLRegionData.cs105
-rw-r--r--OpenSim/Data/MSSQL/MSSQLUserData.cs88
-rw-r--r--OpenSim/Data/MSSQL/Resources/003_InventoryStore.sql38
-rw-r--r--OpenSim/Data/MSSQL/Resources/004_AssetStore.sql31
-rw-r--r--OpenSim/Data/MSSQL/Resources/004_EstateStore.sql22
-rw-r--r--OpenSim/Data/MSSQL/Resources/004_GridStore.sql68
-rw-r--r--OpenSim/Data/MSSQL/Resources/004_InventoryStore.sql52
-rw-r--r--OpenSim/Data/MSSQL/Resources/005_EstateStore.sql22
-rw-r--r--OpenSim/Data/MSSQL/Resources/006_EstateStore.sql22
-rw-r--r--OpenSim/Data/MSSQL/Resources/006_UserStore.sql57
-rw-r--r--OpenSim/Data/MSSQL/Resources/007_EstateStore.sql25
-rw-r--r--OpenSim/Data/MSSQL/Resources/007_UserStore.sql42
-rw-r--r--OpenSim/Data/MSSQL/Resources/008_EstateStore.sql49
-rw-r--r--OpenSim/Data/MSSQL/Resources/008_UserStore.sql29
-rw-r--r--OpenSim/Data/MSSQL/Resources/009_EstateStore.sql24
-rw-r--r--OpenSim/Data/MSSQL/Resources/009_UserStore.sql53
-rw-r--r--OpenSim/Data/MSSQL/Resources/010_UserStore.sql24
-rw-r--r--OpenSim/Data/MSSQL/Resources/013_RegionStore.sql112
-rw-r--r--OpenSim/Data/MSSQL/Resources/014_RegionStore.sql49
-rw-r--r--OpenSim/Data/MSSQL/Resources/015_RegionStore.sql45
-rw-r--r--OpenSim/Data/MSSQL/Resources/016_RegionStore.sql19
-rw-r--r--OpenSim/Data/MSSQL/Resources/017_RegionStore.sql56
-rw-r--r--OpenSim/Data/MSSQL/Resources/018_RegionStore.sql18
-rw-r--r--OpenSim/Data/MSSQL/Resources/019_RegionStore.sql19
-rw-r--r--OpenSim/Data/MSSQL/Resources/020_RegionStore.sql58
30 files changed, 1125 insertions, 180 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs
index 0361a7d..61db8f5 100644
--- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs
@@ -28,8 +28,8 @@
28using System; 28using System;
29using System.Data; 29using System.Data;
30using System.Reflection; 30using System.Reflection;
31using log4net;
32using OpenMetaverse; 31using OpenMetaverse;
32using log4net;
33using OpenSim.Framework; 33using OpenSim.Framework;
34 34
35namespace OpenSim.Data.MSSQL 35namespace OpenSim.Data.MSSQL
@@ -71,7 +71,7 @@ namespace OpenSim.Data.MSSQL
71 /// <param name="connectionString">connect string</param> 71 /// <param name="connectionString">connect string</param>
72 override public void Initialise(string connectionString) 72 override public void Initialise(string connectionString)
73 { 73 {
74 TicksToEpoch = new DateTime(1970, 1, 1).Ticks; 74 TicksToEpoch = new System.DateTime(1970, 1, 1).Ticks;
75 75
76 if (!string.IsNullOrEmpty(connectionString)) 76 if (!string.IsNullOrEmpty(connectionString))
77 { 77 {
@@ -132,7 +132,7 @@ namespace OpenSim.Data.MSSQL
132 { 132 {
133 AssetBase asset = new AssetBase(); 133 AssetBase asset = new AssetBase();
134 // Region Main 134 // Region Main
135 asset.FullID = new UUID((string)reader["id"]); 135 asset.FullID = new UUID((Guid)reader["id"]);
136 asset.Name = (string)reader["name"]; 136 asset.Name = (string)reader["name"];
137 asset.Description = (string)reader["description"]; 137 asset.Description = (string)reader["description"];
138 asset.Type = Convert.ToSByte(reader["assetType"]); 138 asset.Type = Convert.ToSByte(reader["assetType"]);
@@ -162,7 +162,7 @@ namespace OpenSim.Data.MSSQL
162 " VALUES " + 162 " VALUES " +
163 "(@id, @name, @description, @assetType, @local, @temporary, @create_time, @access_time, @data)")) 163 "(@id, @name, @description, @assetType, @local, @temporary, @create_time, @access_time, @data)"))
164 { 164 {
165 int now = (int)((DateTime.Now.Ticks - TicksToEpoch) / 10000000); 165 int now = (int)((System.DateTime.Now.Ticks - TicksToEpoch) / 10000000);
166 command.Parameters.Add(database.CreateParameter("id", asset.FullID)); 166 command.Parameters.Add(database.CreateParameter("id", asset.FullID));
167 command.Parameters.Add(database.CreateParameter("name", asset.Name)); 167 command.Parameters.Add(database.CreateParameter("name", asset.Name));
168 command.Parameters.Add(database.CreateParameter("description", asset.Description)); 168 command.Parameters.Add(database.CreateParameter("description", asset.Description));
diff --git a/OpenSim/Data/MSSQL/MSSQLEstateData.cs b/OpenSim/Data/MSSQL/MSSQLEstateData.cs
index 815e7ff..4d5c116 100644
--- a/OpenSim/Data/MSSQL/MSSQLEstateData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLEstateData.cs
@@ -106,7 +106,7 @@ namespace OpenSim.Data.MSSQL
106 106
107 using (AutoClosingSqlCommand cmd = _Database.Query(sql)) 107 using (AutoClosingSqlCommand cmd = _Database.Query(sql))
108 { 108 {
109 cmd.Parameters.AddWithValue("@RegionID", regionID.ToString()); 109 cmd.Parameters.Add(_Database.CreateParameter("@RegionID", regionID));
110 110
111 using (IDataReader reader = cmd.ExecuteReader()) 111 using (IDataReader reader = cmd.ExecuteReader())
112 { 112 {
@@ -124,10 +124,10 @@ namespace OpenSim.Data.MSSQL
124 } 124 }
125 else if (_FieldMap[name].GetValue(es) is UUID) 125 else if (_FieldMap[name].GetValue(es) is UUID)
126 { 126 {
127 UUID uuid; 127// UUID uuid;
128 UUID.TryParse(reader[name].ToString(), out uuid); 128// UUID.TryParse(reader[name].ToString(), out uuid);
129 129
130 _FieldMap[name].SetValue(es, uuid); 130 _FieldMap[name].SetValue(es, new UUID((Guid) reader[name])); // uuid);
131 } 131 }
132 else 132 else
133 { 133 {
@@ -162,28 +162,29 @@ namespace OpenSim.Data.MSSQL
162 162
163 foreach (string name in names) 163 foreach (string name in names)
164 { 164 {
165 if (_FieldMap[name].GetValue(es) is bool) 165 insertCommand.Parameters.Add(_Database.CreateParameter("@" + name, _FieldMap[name].GetValue(es)));
166 { 166// if (_FieldMap[name].GetValue(es) is bool)
167 SqlParameter tempBool = new SqlParameter("@" + name, SqlDbType.Bit); 167// {
168 168// SqlParameter tempBool = new SqlParameter("@" + name, SqlDbType.Bit);
169 if ((bool) _FieldMap[name].GetValue(es)) 169//
170 tempBool.Value = 1; 170// if ((bool) _FieldMap[name].GetValue(es))
171 else 171// tempBool.Value = 1;
172 tempBool.Value = 0; 172// else
173 173// tempBool.Value = 0;
174 insertCommand.Parameters.Add(tempBool); 174//
175 } 175// insertCommand.Parameters.Add(tempBool);
176 else 176// }
177 { 177// else
178 //cmd.Parameters.AddWithValue("@" + name, _FieldMap[name].GetValue(es)); 178// {
179 SqlParameter tempPar = new SqlParameter("@" + name, 179// //cmd.Parameters.AddWithValue("@" + name, _FieldMap[name].GetValue(es));
180 _Database.DbtypeFromType(_FieldMap[name].FieldType)); 180// SqlParameter tempPar = new SqlParameter("@" + name,
181 tempPar.Value = _FieldMap[name].GetValue(es).ToString(); 181// _Database.DbtypeFromType(_FieldMap[name].FieldType));
182 182// tempPar.Value = _FieldMap[name].GetValue(es).ToString();
183 insertCommand.Parameters.Add(tempPar); 183//
184 } 184// insertCommand.Parameters.Add(tempPar);
185// }
185 } 186 }
186 187// insertCommand.Parameters.Add(_Database.CreateParameter("@ID", es.EstateID, true));
187 SqlParameter idParameter = new SqlParameter("@ID", SqlDbType.Int); 188 SqlParameter idParameter = new SqlParameter("@ID", SqlDbType.Int);
188 idParameter.Direction = ParameterDirection.Output; 189 idParameter.Direction = ParameterDirection.Output;
189 insertCommand.Parameters.Add(idParameter); 190 insertCommand.Parameters.Add(idParameter);
@@ -196,7 +197,7 @@ namespace OpenSim.Data.MSSQL
196 197
197 using (AutoClosingSqlCommand cmd = _Database.Query("INSERT INTO [estate_map] ([RegionID] ,[EstateID]) VALUES (@RegionID, @EstateID)")) 198 using (AutoClosingSqlCommand cmd = _Database.Query("INSERT INTO [estate_map] ([RegionID] ,[EstateID]) VALUES (@RegionID, @EstateID)"))
198 { 199 {
199 cmd.Parameters.Add(_Database.CreateParameter("@RegionID", regionID.ToString())); 200 cmd.Parameters.Add(_Database.CreateParameter("@RegionID", regionID));
200 cmd.Parameters.Add(_Database.CreateParameter("@EstateID", es.EstateID)); 201 cmd.Parameters.Add(_Database.CreateParameter("@EstateID", es.EstateID));
201 // This will throw on dupe key 202 // This will throw on dupe key
202 try 203 try
@@ -264,32 +265,33 @@ namespace OpenSim.Data.MSSQL
264 { 265 {
265 foreach (string name in names) 266 foreach (string name in names)
266 { 267 {
267 if (_FieldMap[name].GetValue(es) is bool) 268 cmd.Parameters.Add(_Database.CreateParameter("@" + name, _FieldMap[name].GetValue(es)));
268 { 269// if (_FieldMap[name].GetValue(es) is bool)
269 SqlParameter tempBool = new SqlParameter("@" + name, SqlDbType.Bit); 270// {
270 271// SqlParameter tempBool = new SqlParameter("@" + name, SqlDbType.Bit);
271 if ((bool)_FieldMap[name].GetValue(es)) 272//
272 tempBool.Value = 1; 273// if ((bool)_FieldMap[name].GetValue(es))
273 else 274// tempBool.Value = 1;
274 tempBool.Value = 0; 275// else
275 276// tempBool.Value = 0;
276 cmd.Parameters.Add(tempBool); 277//
277 } 278// cmd.Parameters.Add(tempBool);
278 else 279// }
279 { 280// else
280 //cmd.Parameters.AddWithValue("@" + name, _FieldMap[name].GetValue(es)); 281// {
281 SqlParameter tempPar = new SqlParameter("@" + name, 282// //cmd.Parameters.AddWithValue("@" + name, _FieldMap[name].GetValue(es));
282 _Database.DbtypeFromType(_FieldMap[name].FieldType)); 283// SqlParameter tempPar = new SqlParameter("@" + name,
283 tempPar.Value = _FieldMap[name].GetValue(es).ToString(); 284// _Database.DbtypeFromType(_FieldMap[name].FieldType));
284 285// tempPar.Value = _FieldMap[name].GetValue(es).ToString();
285 cmd.Parameters.Add(tempPar); 286//
286 } 287// cmd.Parameters.Add(tempPar);
288// }
287 } 289 }
288 290
289 291 cmd.Parameters.Add(_Database.CreateParameter("@EstateID", es.EstateID));
290 SqlParameter idParameter = new SqlParameter("@EstateID", SqlDbType.Int); 292// SqlParameter idParameter = new SqlParameter("@EstateID", SqlDbType.Int);
291 idParameter.Value = es.EstateID; 293// idParameter.Value = es.EstateID;
292 cmd.Parameters.Add(idParameter); 294// cmd.Parameters.Add(idParameter);
293 295
294 cmd.ExecuteNonQuery(); 296 cmd.ExecuteNonQuery();
295 } 297 }
@@ -327,10 +329,10 @@ namespace OpenSim.Data.MSSQL
327 { 329 {
328 EstateBan eb = new EstateBan(); 330 EstateBan eb = new EstateBan();
329 331
330 UUID uuid; 332// UUID uuid;
331 UUID.TryParse(reader["bannedUUID"].ToString(), out uuid); 333// UUID.TryParse(reader["bannedUUID"].ToString(), out uuid);
332 334
333 eb.bannedUUID = uuid; 335 eb.bannedUUID = new UUID((Guid)reader["bannedUUID"]); //uuid;
334 eb.bannedIP = "0.0.0.0"; 336 eb.bannedIP = "0.0.0.0";
335 eb.bannedIPHostMask = "0.0.0.0"; 337 eb.bannedIPHostMask = "0.0.0.0";
336 es.AddBan(eb); 338 es.AddBan(eb);
@@ -355,10 +357,10 @@ namespace OpenSim.Data.MSSQL
355 { 357 {
356 // EstateBan eb = new EstateBan(); 358 // EstateBan eb = new EstateBan();
357 359
358 UUID uuid; 360// UUID uuid;
359 UUID.TryParse(reader["uuid"].ToString(), out uuid); 361// UUID.TryParse(reader["uuid"].ToString(), out uuid);
360 362
361 uuids.Add(uuid); 363 uuids.Add(new UUID((Guid)reader["uuid"])); //uuid);
362 } 364 }
363 } 365 }
364 } 366 }
@@ -418,7 +420,7 @@ namespace OpenSim.Data.MSSQL
418 createParamOnce = false; 420 createParamOnce = false;
419 } 421 }
420 else 422 else
421 cmd.Parameters["@uuid"].Value = uuid.ToString(); 423 cmd.Parameters["@uuid"].Value = uuid.Guid; //.ToString(); //TODO check if this works
422 424
423 cmd.ExecuteNonQuery(); 425 cmd.ExecuteNonQuery();
424 } 426 }
diff --git a/OpenSim/Data/MSSQL/MSSQLGridData.cs b/OpenSim/Data/MSSQL/MSSQLGridData.cs
index eec2091..027796a 100644
--- a/OpenSim/Data/MSSQL/MSSQLGridData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLGridData.cs
@@ -395,17 +395,17 @@ namespace OpenSim.Data.MSSQL
395 395
396 retval.regionHandle = tmp64; 396 retval.regionHandle = tmp64;
397 397
398 UUID tmp_uuid; 398// UUID tmp_uuid;
399 if (!UUID.TryParse((string)reader["uuid"], out tmp_uuid)) 399// if (!UUID.TryParse((string)reader["uuid"], out tmp_uuid))
400 { 400// {
401 return null; 401// return null;
402 } 402// }
403 403
404 retval.UUID = tmp_uuid; 404 retval.UUID = new UUID((Guid)reader["uuid"]); // tmp_uuid;
405 405
406 // non-critical parts 406 // non-critical parts
407 retval.regionName = reader["regionName"].ToString(); 407 retval.regionName = reader["regionName"].ToString();
408 retval.originUUID = new UUID((string)reader["originUUID"]); 408 retval.originUUID = new UUID((Guid)reader["originUUID"]);
409 409
410 // Secrets 410 // Secrets
411 retval.regionRecvKey = reader["regionRecvKey"].ToString(); 411 retval.regionRecvKey = reader["regionRecvKey"].ToString();
@@ -443,8 +443,10 @@ namespace OpenSim.Data.MSSQL
443 retval.regionUserSendKey = reader["regionUserSendKey"].ToString(); 443 retval.regionUserSendKey = reader["regionUserSendKey"].ToString();
444 444
445 // World Map Addition 445 // World Map Addition
446 UUID.TryParse((string)reader["regionMapTexture"], out retval.regionMapTextureID); 446 retval.regionMapTextureID = new UUID((Guid)reader["regionMapTexture"]);
447 UUID.TryParse((string)reader["owner_uuid"], out retval.owner_uuid); 447 retval.owner_uuid = new UUID((Guid)reader["owner_uuid"]);
448// UUID.TryParse((string)reader["regionMapTexture"], out retval.regionMapTextureID);
449// UUID.TryParse((string)reader["owner_uuid"], out retval.owner_uuid);
448 450
449 return retval; 451 return retval;
450 } 452 }
diff --git a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
index f367d78..4e7e322 100644
--- a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
@@ -317,7 +317,7 @@ namespace OpenSim.Data.MSSQL
317 List<InventoryFolderBase> subFolders; 317 List<InventoryFolderBase> subFolders;
318 using (SqlCommand command = new SqlCommand("SELECT * FROM inventoryfolders WHERE parentFolderID = @parentID", connection)) 318 using (SqlCommand command = new SqlCommand("SELECT * FROM inventoryfolders WHERE parentFolderID = @parentID", connection))
319 { 319 {
320 command.Parameters.Add(database.CreateParameter("@parentID", string.Empty)); 320 command.Parameters.Add(database.CreateParameter("@parentID", UUID.Zero));
321 321
322 AutoClosingSqlCommand autoCommand = new AutoClosingSqlCommand(command); 322 AutoClosingSqlCommand autoCommand = new AutoClosingSqlCommand(command);
323 323
@@ -589,7 +589,7 @@ namespace OpenSim.Data.MSSQL
589 /// <returns></returns> 589 /// <returns></returns>
590 private static List<InventoryFolderBase> getFolderHierarchy(UUID parentID, AutoClosingSqlCommand command) 590 private static List<InventoryFolderBase> getFolderHierarchy(UUID parentID, AutoClosingSqlCommand command)
591 { 591 {
592 command.Parameters["@parentID"].Value = parentID.ToString(); 592 command.Parameters["@parentID"].Value = parentID.Guid; //.ToString();
593 593
594 List<InventoryFolderBase> folders = getInventoryFolders(command); 594 List<InventoryFolderBase> folders = getInventoryFolders(command);
595 595
@@ -663,9 +663,9 @@ namespace OpenSim.Data.MSSQL
663 try 663 try
664 { 664 {
665 InventoryFolderBase folder = new InventoryFolderBase(); 665 InventoryFolderBase folder = new InventoryFolderBase();
666 folder.Owner = new UUID((string)reader["agentID"]); 666 folder.Owner = new UUID((Guid)reader["agentID"]);
667 folder.ParentID = new UUID((string)reader["parentFolderID"]); 667 folder.ParentID = new UUID((Guid)reader["parentFolderID"]);
668 folder.ID = new UUID((string)reader["folderID"]); 668 folder.ID = new UUID((Guid)reader["folderID"]);
669 folder.Name = (string)reader["folderName"]; 669 folder.Name = (string)reader["folderName"];
670 folder.Type = (short)reader["type"]; 670 folder.Type = (short)reader["type"];
671 folder.Version = Convert.ToUInt16(reader["version"]); 671 folder.Version = Convert.ToUInt16(reader["version"]);
@@ -691,24 +691,24 @@ namespace OpenSim.Data.MSSQL
691 { 691 {
692 InventoryItemBase item = new InventoryItemBase(); 692 InventoryItemBase item = new InventoryItemBase();
693 693
694 item.ID = new UUID(reader["inventoryID"].ToString()); 694 item.ID = new UUID((Guid)reader["inventoryID"]);
695 item.AssetID = new UUID(reader["assetID"].ToString()); 695 item.AssetID = new UUID((Guid)reader["assetID"]);
696 item.AssetType = Convert.ToInt32(reader["assetType"].ToString()); 696 item.AssetType = Convert.ToInt32(reader["assetType"].ToString());
697 item.Folder = new UUID(reader["parentFolderID"].ToString()); 697 item.Folder = new UUID((Guid)reader["parentFolderID"]);
698 item.Owner = new UUID(reader["avatarID"].ToString()); 698 item.Owner = new UUID((Guid)reader["avatarID"]);
699 item.Name = reader["inventoryName"].ToString(); 699 item.Name = reader["inventoryName"].ToString();
700 item.Description = reader["inventoryDescription"].ToString(); 700 item.Description = reader["inventoryDescription"].ToString();
701 item.NextPermissions = Convert.ToUInt32(reader["inventoryNextPermissions"]); 701 item.NextPermissions = Convert.ToUInt32(reader["inventoryNextPermissions"]);
702 item.CurrentPermissions = Convert.ToUInt32(reader["inventoryCurrentPermissions"]); 702 item.CurrentPermissions = Convert.ToUInt32(reader["inventoryCurrentPermissions"]);
703 item.InvType = Convert.ToInt32(reader["invType"].ToString()); 703 item.InvType = Convert.ToInt32(reader["invType"].ToString());
704 item.Creator = new UUID(reader["creatorID"].ToString()); 704 item.Creator = new UUID((Guid)reader["creatorID"]);
705 item.BasePermissions = Convert.ToUInt32(reader["inventoryBasePermissions"]); 705 item.BasePermissions = Convert.ToUInt32(reader["inventoryBasePermissions"]);
706 item.EveryOnePermissions = Convert.ToUInt32(reader["inventoryEveryOnePermissions"]); 706 item.EveryOnePermissions = Convert.ToUInt32(reader["inventoryEveryOnePermissions"]);
707 item.GroupPermissions = Convert.ToUInt32(reader["inventoryGroupPermissions"]); 707 item.GroupPermissions = Convert.ToUInt32(reader["inventoryGroupPermissions"]);
708 item.SalePrice = Convert.ToInt32(reader["salePrice"]); 708 item.SalePrice = Convert.ToInt32(reader["salePrice"]);
709 item.SaleType = Convert.ToByte(reader["saleType"]); 709 item.SaleType = Convert.ToByte(reader["saleType"]);
710 item.CreationDate = Convert.ToInt32(reader["creationDate"]); 710 item.CreationDate = Convert.ToInt32(reader["creationDate"]);
711 item.GroupID = new UUID(reader["groupID"].ToString()); 711 item.GroupID = new UUID((Guid)reader["groupID"]);
712 item.GroupOwned = Convert.ToBoolean(reader["groupOwned"]); 712 item.GroupOwned = Convert.ToBoolean(reader["groupOwned"]);
713 item.Flags = Convert.ToUInt32(reader["flags"]); 713 item.Flags = Convert.ToUInt32(reader["flags"]);
714 714
diff --git a/OpenSim/Data/MSSQL/MSSQLManager.cs b/OpenSim/Data/MSSQL/MSSQLManager.cs
index c687c89..d60c444 100644
--- a/OpenSim/Data/MSSQL/MSSQLManager.cs
+++ b/OpenSim/Data/MSSQL/MSSQLManager.cs
@@ -102,6 +102,7 @@ namespace OpenSim.Data.MSSQL
102 /// </summary> 102 /// </summary>
103 /// <param name="dt"></param> 103 /// <param name="dt"></param>
104 /// <returns></returns> 104 /// <returns></returns>
105/*
105 [Obsolete("Do not use!")] 106 [Obsolete("Do not use!")]
106 protected static string defineTable(DataTable dt) 107 protected static string defineTable(DataTable dt)
107 { 108 {
@@ -125,6 +126,7 @@ namespace OpenSim.Data.MSSQL
125 sql += ")"; 126 sql += ")";
126 return sql; 127 return sql;
127 } 128 }
129*/
128 130
129 #endregion 131 #endregion
130 132
@@ -134,6 +136,7 @@ namespace OpenSim.Data.MSSQL
134 /// <param name="type">a type</param> 136 /// <param name="type">a type</param>
135 /// <returns>a sqltype</returns> 137 /// <returns>a sqltype</returns>
136 /// <remarks>this is something we'll need to implement for each db slightly differently.</remarks> 138 /// <remarks>this is something we'll need to implement for each db slightly differently.</remarks>
139/*
137 [Obsolete("Used by a obsolete methods")] 140 [Obsolete("Used by a obsolete methods")]
138 public static string SqlType(Type type) 141 public static string SqlType(Type type)
139 { 142 {
@@ -155,6 +158,7 @@ namespace OpenSim.Data.MSSQL
155 } 158 }
156 return "varchar(255)"; 159 return "varchar(255)";
157 } 160 }
161*/
158 162
159 /// <summary> 163 /// <summary>
160 /// Type conversion to a SQLDbType functions 164 /// Type conversion to a SQLDbType functions
@@ -185,7 +189,7 @@ namespace OpenSim.Data.MSSQL
185 } 189 }
186 if (type == typeof(UUID)) 190 if (type == typeof(UUID))
187 { 191 {
188 return SqlDbType.VarChar; 192 return SqlDbType.UniqueIdentifier;
189 } 193 }
190 if (type == typeof(sbyte)) 194 if (type == typeof(sbyte))
191 { 195 {
@@ -215,13 +219,13 @@ namespace OpenSim.Data.MSSQL
215 { 219 {
216 Type valueType = value.GetType(); 220 Type valueType = value.GetType();
217 221
218 if (valueType == typeof(UUID)) 222 if (valueType == typeof(UUID)) //TODO check if this works
219 { 223 {
220 return value.ToString(); 224 return ((UUID) value).Guid;
221 } 225 }
222 if (valueType == typeof(UUID)) 226 if (valueType == typeof(UUID))
223 { 227 {
224 return value.ToString(); 228 return ((UUID)value).Guid;
225 } 229 }
226 if (valueType == typeof(bool)) 230 if (valueType == typeof(bool))
227 { 231 {
diff --git a/OpenSim/Data/MSSQL/MSSQLRegionData.cs b/OpenSim/Data/MSSQL/MSSQLRegionData.cs
index 44b042e..d9565d4 100644
--- a/OpenSim/Data/MSSQL/MSSQLRegionData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLRegionData.cs
@@ -128,7 +128,7 @@ namespace OpenSim.Data.MSSQL
128 sceneObjectPart.FolderID = sceneObjectPart.UUID; 128 sceneObjectPart.FolderID = sceneObjectPart.UUID;
129 sceneObjectParts.Add(sceneObjectPart); 129 sceneObjectParts.Add(sceneObjectPart);
130 130
131 UUID groupID = new UUID(reader["SceneGroupID"].ToString()); 131 UUID groupID = new UUID((Guid)reader["SceneGroupID"]);
132 132
133 if (groupID != lastGroupID) // New SOG 133 if (groupID != lastGroupID) // New SOG
134 { 134 {
@@ -198,7 +198,7 @@ namespace OpenSim.Data.MSSQL
198 } 198 }
199 else 199 else
200 { 200 {
201 command.Parameters["@PrimID"].Value = objectPart.UUID.ToString(); 201 command.Parameters["@PrimID"].Value = objectPart.UUID.Guid; //.ToString(); //TODO check if this works
202 } 202 }
203 203
204 List<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); 204 List<TaskInventoryItem> inventory = new List<TaskInventoryItem>();
@@ -418,15 +418,16 @@ ELSE
418 _Log.InfoFormat("[MSSQL]: Removing obj: {0} from region: {1}", objectID, regionUUID); 418 _Log.InfoFormat("[MSSQL]: Removing obj: {0} from region: {1}", objectID, regionUUID);
419 419
420 //Remove from prims and primsitem table 420 //Remove from prims and primsitem table
421 string sqlPrims = string.Format("DELETE FROM PRIMS WHERE SceneGroupID = '{0}'", objectID); 421 string sqlPrims = "DELETE FROM PRIMS WHERE SceneGroupID = @objectID";
422 string sqlPrimItems = string.Format("DELETE FROM PRIMITEMS WHERE primID in (SELECT UUID FROM PRIMS WHERE SceneGroupID = '{0}')", objectID); 422 string sqlPrimItems = "DELETE FROM PRIMITEMS WHERE primID in (SELECT UUID FROM PRIMS WHERE SceneGroupID = @objectID)";
423 string sqlPrimShapes = string.Format("DELETE FROM PRIMSHAPES WHERE uuid in (SELECT UUID FROM PRIMS WHERE SceneGroupID = '{0}')", objectID); 423 string sqlPrimShapes = "DELETE FROM PRIMSHAPES WHERE uuid in (SELECT UUID FROM PRIMS WHERE SceneGroupID = @objectID)";
424 424
425 lock (_Database) 425 lock (_Database)
426 { 426 {
427 //Using the non transaction mode. 427 //Using the non transaction mode.
428 using (AutoClosingSqlCommand cmd = _Database.Query(sqlPrimShapes)) 428 using (AutoClosingSqlCommand cmd = _Database.Query(sqlPrimShapes))
429 { 429 {
430 cmd.Parameters.Add(_Database.CreateParameter("objectID", objectID));
430 cmd.ExecuteNonQuery(); 431 cmd.ExecuteNonQuery();
431 432
432 cmd.CommandText = sqlPrimItems; 433 cmd.CommandText = sqlPrimItems;
@@ -495,7 +496,7 @@ ELSE
495 using (AutoClosingSqlCommand cmd = _Database.Query(sql)) 496 using (AutoClosingSqlCommand cmd = _Database.Query(sql))
496 { 497 {
497 // MySqlParameter param = new MySqlParameter(); 498 // MySqlParameter param = new MySqlParameter();
498 cmd.Parameters.AddWithValue("@RegionUUID", regionID.ToString()); 499 cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", regionID));
499 500
500 using (SqlDataReader reader = cmd.ExecuteReader()) 501 using (SqlDataReader reader = cmd.ExecuteReader())
501 { 502 {
@@ -805,7 +806,7 @@ VALUES
805 //TODO change this is some more generic code so we doesnt have to change it every time a new field is added? 806 //TODO change this is some more generic code so we doesnt have to change it every time a new field is added?
806 RegionSettings newSettings = new RegionSettings(); 807 RegionSettings newSettings = new RegionSettings();
807 808
808 newSettings.RegionUUID = new UUID((string)row["regionUUID"]); 809 newSettings.RegionUUID = new UUID((Guid)row["regionUUID"]);
809 newSettings.BlockTerraform = Convert.ToBoolean(row["block_terraform"]); 810 newSettings.BlockTerraform = Convert.ToBoolean(row["block_terraform"]);
810 newSettings.AllowDamage = Convert.ToBoolean(row["allow_damage"]); 811 newSettings.AllowDamage = Convert.ToBoolean(row["allow_damage"]);
811 newSettings.BlockFly = Convert.ToBoolean(row["block_fly"]); 812 newSettings.BlockFly = Convert.ToBoolean(row["block_fly"]);
@@ -819,10 +820,10 @@ VALUES
819 newSettings.DisableScripts = Convert.ToBoolean(row["disable_scripts"]); 820 newSettings.DisableScripts = Convert.ToBoolean(row["disable_scripts"]);
820 newSettings.DisableCollisions = Convert.ToBoolean(row["disable_collisions"]); 821 newSettings.DisableCollisions = Convert.ToBoolean(row["disable_collisions"]);
821 newSettings.DisablePhysics = Convert.ToBoolean(row["disable_physics"]); 822 newSettings.DisablePhysics = Convert.ToBoolean(row["disable_physics"]);
822 newSettings.TerrainTexture1 = new UUID((String)row["terrain_texture_1"]); 823 newSettings.TerrainTexture1 = new UUID((Guid)row["terrain_texture_1"]);
823 newSettings.TerrainTexture2 = new UUID((String)row["terrain_texture_2"]); 824 newSettings.TerrainTexture2 = new UUID((Guid)row["terrain_texture_2"]);
824 newSettings.TerrainTexture3 = new UUID((String)row["terrain_texture_3"]); 825 newSettings.TerrainTexture3 = new UUID((Guid)row["terrain_texture_3"]);
825 newSettings.TerrainTexture4 = new UUID((String)row["terrain_texture_4"]); 826 newSettings.TerrainTexture4 = new UUID((Guid)row["terrain_texture_4"]);
826 newSettings.Elevation1NW = Convert.ToDouble(row["elevation_1_nw"]); 827 newSettings.Elevation1NW = Convert.ToDouble(row["elevation_1_nw"]);
827 newSettings.Elevation2NW = Convert.ToDouble(row["elevation_2_nw"]); 828 newSettings.Elevation2NW = Convert.ToDouble(row["elevation_2_nw"]);
828 newSettings.Elevation1NE = Convert.ToDouble(row["elevation_1_ne"]); 829 newSettings.Elevation1NE = Convert.ToDouble(row["elevation_1_ne"]);
@@ -843,7 +844,7 @@ VALUES
843 Convert.ToSingle(row["sunvectory"]), 844 Convert.ToSingle(row["sunvectory"]),
844 Convert.ToSingle(row["sunvectorz"]) 845 Convert.ToSingle(row["sunvectorz"])
845 ); 846 );
846 newSettings.Covenant = new UUID((String)row["covenant"]); 847 newSettings.Covenant = new UUID((Guid)row["covenant"]);
847 848
848 return newSettings; 849 return newSettings;
849 } 850 }
@@ -857,15 +858,15 @@ VALUES
857 { 858 {
858 LandData newData = new LandData(); 859 LandData newData = new LandData();
859 860
860 newData.GlobalID = new UUID((String)row["UUID"]); 861 newData.GlobalID = new UUID((Guid)row["UUID"]);
861 newData.LocalID = Convert.ToInt32(row["LocalLandID"]); 862 newData.LocalID = Convert.ToInt32(row["LocalLandID"]);
862 863
863 // Bitmap is a byte[512] 864 // Bitmap is a byte[512]
864 newData.Bitmap = (Byte[])row["Bitmap"]; 865 newData.Bitmap = (Byte[])row["Bitmap"];
865 866
866 newData.Name = (String)row["Name"]; 867 newData.Name = (string)row["Name"];
867 newData.Description = (String)row["Description"]; 868 newData.Description = (string)row["Description"];
868 newData.OwnerID = (UUID)(String)row["OwnerUUID"]; 869 newData.OwnerID = new UUID((Guid)row["OwnerUUID"]);
869 newData.IsGroupOwned = Convert.ToBoolean(row["IsGroupOwned"]); 870 newData.IsGroupOwned = Convert.ToBoolean(row["IsGroupOwned"]);
870 newData.Area = Convert.ToInt32(row["Area"]); 871 newData.Area = Convert.ToInt32(row["Area"]);
871 newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented 872 newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented
@@ -873,27 +874,29 @@ VALUES
873 //Enum libsecondlife.Parcel.ParcelCategory 874 //Enum libsecondlife.Parcel.ParcelCategory
874 newData.ClaimDate = Convert.ToInt32(row["ClaimDate"]); 875 newData.ClaimDate = Convert.ToInt32(row["ClaimDate"]);
875 newData.ClaimPrice = Convert.ToInt32(row["ClaimPrice"]); 876 newData.ClaimPrice = Convert.ToInt32(row["ClaimPrice"]);
876 newData.GroupID = new UUID((String)row["GroupUUID"]); 877 newData.GroupID = new UUID((Guid)row["GroupUUID"]);
877 newData.SalePrice = Convert.ToInt32(row["SalePrice"]); 878 newData.SalePrice = Convert.ToInt32(row["SalePrice"]);
878 newData.Status = (Parcel.ParcelStatus)Convert.ToInt32(row["LandStatus"]); 879 newData.Status = (Parcel.ParcelStatus)Convert.ToInt32(row["LandStatus"]);
879 //Enum. libsecondlife.Parcel.ParcelStatus 880 //Enum. libsecondlife.Parcel.ParcelStatus
880 newData.Flags = Convert.ToUInt32(row["LandFlags"]); 881 newData.Flags = Convert.ToUInt32(row["LandFlags"]);
881 newData.LandingType = Convert.ToByte(row["LandingType"]); 882 newData.LandingType = Convert.ToByte(row["LandingType"]);
882 newData.MediaAutoScale = Convert.ToByte(row["MediaAutoScale"]); 883 newData.MediaAutoScale = Convert.ToByte(row["MediaAutoScale"]);
883 newData.MediaID = new UUID((String)row["MediaTextureUUID"]); 884 newData.MediaID = new UUID((Guid)row["MediaTextureUUID"]);
884 newData.MediaURL = (String)row["MediaURL"]; 885 newData.MediaURL = (string)row["MediaURL"];
885 newData.MusicURL = (String)row["MusicURL"]; 886 newData.MusicURL = (string)row["MusicURL"];
886 newData.PassHours = Convert.ToSingle(row["PassHours"]); 887 newData.PassHours = Convert.ToSingle(row["PassHours"]);
887 newData.PassPrice = Convert.ToInt32(row["PassPrice"]); 888 newData.PassPrice = Convert.ToInt32(row["PassPrice"]);
888 889
889 UUID authedbuyer; 890// UUID authedbuyer;
890 UUID snapshotID; 891// UUID snapshotID;
891 892//
892 if (UUID.TryParse((string)row["AuthBuyerID"], out authedbuyer)) 893// if (UUID.TryParse((string)row["AuthBuyerID"], out authedbuyer))
893 newData.AuthBuyerID = authedbuyer; 894// newData.AuthBuyerID = authedbuyer;
894 895//
895 if (UUID.TryParse((string)row["SnapshotUUID"], out snapshotID)) 896// if (UUID.TryParse((string)row["SnapshotUUID"], out snapshotID))
896 newData.SnapshotID = snapshotID; 897// newData.SnapshotID = snapshotID;
898 newData.AuthBuyerID = new UUID((Guid) row["AuthBuyerID"]);
899 newData.SnapshotID = new UUID((Guid)row["SnapshotUUID"]);
897 900
898 newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); 901 newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
899 newData.Dwell = Convert.ToInt32(row["Dwell"]); 902 newData.Dwell = Convert.ToInt32(row["Dwell"]);
@@ -927,7 +930,7 @@ VALUES
927 private static ParcelManager.ParcelAccessEntry BuildLandAccessData(IDataRecord row) 930 private static ParcelManager.ParcelAccessEntry BuildLandAccessData(IDataRecord row)
928 { 931 {
929 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 932 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
930 entry.AgentID = new UUID((string)row["AccessUUID"]); 933 entry.AgentID = new UUID((Guid)row["AccessUUID"]);
931 entry.Flags = (AccessList)Convert.ToInt32(row["Flags"]); 934 entry.Flags = (AccessList)Convert.ToInt32(row["Flags"]);
932 entry.Time = new DateTime(); 935 entry.Time = new DateTime();
933 return entry; 936 return entry;
@@ -942,26 +945,26 @@ VALUES
942 { 945 {
943 SceneObjectPart prim = new SceneObjectPart(); 946 SceneObjectPart prim = new SceneObjectPart();
944 947
945 prim.UUID = new UUID((String)primRow["UUID"]); 948 prim.UUID = new UUID((Guid)primRow["UUID"]);
946 // explicit conversion of integers is required, which sort 949 // explicit conversion of integers is required, which sort
947 // of sucks. No idea if there is a shortcut here or not. 950 // of sucks. No idea if there is a shortcut here or not.
948 prim.CreationDate = Convert.ToInt32(primRow["CreationDate"]); 951 prim.CreationDate = Convert.ToInt32(primRow["CreationDate"]);
949 prim.Name = (String)primRow["Name"]; 952 prim.Name = (string)primRow["Name"];
950 // various text fields 953 // various text fields
951 prim.Text = (String)primRow["Text"]; 954 prim.Text = (string)primRow["Text"];
952 prim.Color = Color.FromArgb(Convert.ToInt32(primRow["ColorA"]), 955 prim.Color = Color.FromArgb(Convert.ToInt32(primRow["ColorA"]),
953 Convert.ToInt32(primRow["ColorR"]), 956 Convert.ToInt32(primRow["ColorR"]),
954 Convert.ToInt32(primRow["ColorG"]), 957 Convert.ToInt32(primRow["ColorG"]),
955 Convert.ToInt32(primRow["ColorB"])); 958 Convert.ToInt32(primRow["ColorB"]));
956 prim.Description = (String)primRow["Description"]; 959 prim.Description = (string)primRow["Description"];
957 prim.SitName = (String)primRow["SitName"]; 960 prim.SitName = (string)primRow["SitName"];
958 prim.TouchName = (String)primRow["TouchName"]; 961 prim.TouchName = (string)primRow["TouchName"];
959 // permissions 962 // permissions
960 prim.ObjectFlags = Convert.ToUInt32(primRow["ObjectFlags"]); 963 prim.ObjectFlags = Convert.ToUInt32(primRow["ObjectFlags"]);
961 prim.CreatorID = new UUID((String)primRow["CreatorID"]); 964 prim.CreatorID = new UUID((Guid)primRow["CreatorID"]);
962 prim.OwnerID = new UUID((String)primRow["OwnerID"]); 965 prim.OwnerID = new UUID((Guid)primRow["OwnerID"]);
963 prim.GroupID = new UUID((String)primRow["GroupID"]); 966 prim.GroupID = new UUID((Guid)primRow["GroupID"]);
964 prim.LastOwnerID = new UUID((String)primRow["LastOwnerID"]); 967 prim.LastOwnerID = new UUID((Guid)primRow["LastOwnerID"]);
965 prim.OwnerMask = Convert.ToUInt32(primRow["OwnerMask"]); 968 prim.OwnerMask = Convert.ToUInt32(primRow["OwnerMask"]);
966 prim.NextOwnerMask = Convert.ToUInt32(primRow["NextOwnerMask"]); 969 prim.NextOwnerMask = Convert.ToUInt32(primRow["NextOwnerMask"]);
967 prim.GroupMask = Convert.ToUInt32(primRow["GroupMask"]); 970 prim.GroupMask = Convert.ToUInt32(primRow["GroupMask"]);
@@ -1017,7 +1020,7 @@ VALUES
1017 prim.PayPrice[3] = Convert.ToInt32(primRow["PayButton3"]); 1020 prim.PayPrice[3] = Convert.ToInt32(primRow["PayButton3"]);
1018 prim.PayPrice[4] = Convert.ToInt32(primRow["PayButton4"]); 1021 prim.PayPrice[4] = Convert.ToInt32(primRow["PayButton4"]);
1019 1022
1020 prim.Sound = new UUID(primRow["LoopedSound"].ToString()); 1023 prim.Sound = new UUID((Guid)primRow["LoopedSound"]);
1021 prim.SoundGain = Convert.ToSingle(primRow["LoopedSoundGain"]); 1024 prim.SoundGain = Convert.ToSingle(primRow["LoopedSoundGain"]);
1022 prim.SoundFlags = 1; // If it's persisted at all, it's looped 1025 prim.SoundFlags = 1; // If it's persisted at all, it's looped
1023 1026
@@ -1062,7 +1065,7 @@ VALUES
1062 if (!(primRow["ClickAction"] is DBNull)) 1065 if (!(primRow["ClickAction"] is DBNull))
1063 prim.ClickAction = Convert.ToByte(primRow["ClickAction"]); 1066 prim.ClickAction = Convert.ToByte(primRow["ClickAction"]);
1064 1067
1065 prim.CollisionSound = new UUID(primRow["CollisionSound"].ToString()); 1068 prim.CollisionSound = new UUID((Guid)primRow["CollisionSound"]);
1066 prim.CollisionSoundVolume = Convert.ToSingle(primRow["CollisionSoundVolume"]); 1069 prim.CollisionSoundVolume = Convert.ToSingle(primRow["CollisionSoundVolume"]);
1067 1070
1068 prim.LinkNum = Convert.ToInt32(primRow["LinkNumber"]); 1071 prim.LinkNum = Convert.ToInt32(primRow["LinkNumber"]);
@@ -1131,21 +1134,21 @@ VALUES
1131 { 1134 {
1132 TaskInventoryItem taskItem = new TaskInventoryItem(); 1135 TaskInventoryItem taskItem = new TaskInventoryItem();
1133 1136
1134 taskItem.ItemID = new UUID((String)inventoryRow["itemID"]); 1137 taskItem.ItemID = new UUID((Guid)inventoryRow["itemID"]);
1135 taskItem.ParentPartID = new UUID((String)inventoryRow["primID"]); 1138 taskItem.ParentPartID = new UUID((Guid)inventoryRow["primID"]);
1136 taskItem.AssetID = new UUID((String)inventoryRow["assetID"]); 1139 taskItem.AssetID = new UUID((Guid)inventoryRow["assetID"]);
1137 taskItem.ParentID = new UUID((String)inventoryRow["parentFolderID"]); 1140 taskItem.ParentID = new UUID((Guid)inventoryRow["parentFolderID"]);
1138 1141
1139 taskItem.InvType = Convert.ToInt32(inventoryRow["invType"]); 1142 taskItem.InvType = Convert.ToInt32(inventoryRow["invType"]);
1140 taskItem.Type = Convert.ToInt32(inventoryRow["assetType"]); 1143 taskItem.Type = Convert.ToInt32(inventoryRow["assetType"]);
1141 1144
1142 taskItem.Name = (String)inventoryRow["name"]; 1145 taskItem.Name = (string)inventoryRow["name"];
1143 taskItem.Description = (String)inventoryRow["description"]; 1146 taskItem.Description = (string)inventoryRow["description"];
1144 taskItem.CreationDate = Convert.ToUInt32(inventoryRow["creationDate"]); 1147 taskItem.CreationDate = Convert.ToUInt32(inventoryRow["creationDate"]);
1145 taskItem.CreatorID = new UUID((String)inventoryRow["creatorID"]); 1148 taskItem.CreatorID = new UUID((Guid)inventoryRow["creatorID"]);
1146 taskItem.OwnerID = new UUID((String)inventoryRow["ownerID"]); 1149 taskItem.OwnerID = new UUID((Guid)inventoryRow["ownerID"]);
1147 taskItem.LastOwnerID = new UUID((String)inventoryRow["lastOwnerID"]); 1150 taskItem.LastOwnerID = new UUID((Guid)inventoryRow["lastOwnerID"]);
1148 taskItem.GroupID = new UUID((String)inventoryRow["groupID"]); 1151 taskItem.GroupID = new UUID((Guid)inventoryRow["groupID"]);
1149 1152
1150 taskItem.NextPermissions = Convert.ToUInt32(inventoryRow["nextPermissions"]); 1153 taskItem.NextPermissions = Convert.ToUInt32(inventoryRow["nextPermissions"]);
1151 taskItem.CurrentPermissions = Convert.ToUInt32(inventoryRow["currentPermissions"]); 1154 taskItem.CurrentPermissions = Convert.ToUInt32(inventoryRow["currentPermissions"]);
diff --git a/OpenSim/Data/MSSQL/MSSQLUserData.cs b/OpenSim/Data/MSSQL/MSSQLUserData.cs
index 453941f..e0db622 100644
--- a/OpenSim/Data/MSSQL/MSSQLUserData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLUserData.cs
@@ -445,8 +445,8 @@ namespace OpenSim.Data.MSSQL
445 while (reader.Read()) 445 while (reader.Read())
446 { 446 {
447 FriendListItem fli = new FriendListItem(); 447 FriendListItem fli = new FriendListItem();
448 fli.FriendListOwner = new UUID((string)reader["ownerID"]); 448 fli.FriendListOwner = new UUID((Guid)reader["ownerID"]);
449 fli.Friend = new UUID((string)reader["friendID"]); 449 fli.Friend = new UUID((Guid)reader["friendID"]);
450 fli.FriendPerms = (uint)Convert.ToInt32(reader["friendPerms"]); 450 fli.FriendPerms = (uint)Convert.ToInt32(reader["friendPerms"]);
451 451
452 // This is not a real column in the database table, it's a joined column from the opposite record 452 // This is not a real column in the database table, it's a joined column from the opposite record
@@ -703,14 +703,14 @@ namespace OpenSim.Data.MSSQL
703 { 703 {
704 command.Parameters.Add(database.CreateParameter("@uuid", agentID)); 704 command.Parameters.Add(database.CreateParameter("@uuid", agentID));
705 command.Parameters.Add(database.CreateParameter("@attachpoint", attachpoint)); 705 command.Parameters.Add(database.CreateParameter("@attachpoint", attachpoint));
706 command.Parameters.Add(database.CreateParameter("@item", item["item"].ToString())); 706 command.Parameters.Add(database.CreateParameter("@item", new UUID(item["item"].ToString())));
707 command.Parameters.Add(database.CreateParameter("@asset", item["asset"].ToString())); 707 command.Parameters.Add(database.CreateParameter("@asset", new UUID(item["asset"].ToString())));
708 firstTime = false; 708 firstTime = false;
709 } 709 }
710 command.Parameters["@uuid"].Value = agentID.ToString(); 710 command.Parameters["@uuid"].Value = agentID.Guid; //.ToString();
711 command.Parameters["@attachpoint"].Value = attachpoint; 711 command.Parameters["@attachpoint"].Value = attachpoint;
712 command.Parameters["@item"].Value = item["item"].ToString(); 712 command.Parameters["@item"].Value = new Guid(item["item"].ToString());
713 command.Parameters["@asset"].Value = item["asset"].ToString(); 713 command.Parameters["@asset"].Value = new Guid(item["asset"].ToString());
714 714
715 try 715 try
716 { 716 {
@@ -769,7 +769,7 @@ namespace OpenSim.Data.MSSQL
769 while (reader.Read()) 769 while (reader.Read())
770 { 770 {
771 AvatarPickerAvatar user = new AvatarPickerAvatar(); 771 AvatarPickerAvatar user = new AvatarPickerAvatar();
772 user.AvatarID = new UUID((string)reader["UUID"]); 772 user.AvatarID = new UUID((Guid)reader["UUID"]);
773 user.firstName = (string)reader["username"]; 773 user.firstName = (string)reader["username"];
774 user.lastName = (string)reader["lastname"]; 774 user.lastName = (string)reader["lastname"];
775 returnlist.Add(user); 775 returnlist.Add(user);
@@ -795,7 +795,7 @@ namespace OpenSim.Data.MSSQL
795 while (reader.Read()) 795 while (reader.Read())
796 { 796 {
797 AvatarPickerAvatar user = new AvatarPickerAvatar(); 797 AvatarPickerAvatar user = new AvatarPickerAvatar();
798 user.AvatarID = new UUID((string)reader["UUID"]); 798 user.AvatarID = new UUID((Guid)reader["UUID"]);
799 user.firstName = (string)reader["username"]; 799 user.firstName = (string)reader["username"];
800 user.lastName = (string)reader["lastname"]; 800 user.lastName = (string)reader["lastname"];
801 returnlist.Add(user); 801 returnlist.Add(user);
@@ -858,37 +858,37 @@ namespace OpenSim.Data.MSSQL
858 { 858 {
859 AvatarAppearance appearance = new AvatarAppearance(); 859 AvatarAppearance appearance = new AvatarAppearance();
860 860
861 appearance.Owner = new UUID((string)reader["owner"]); 861 appearance.Owner = new UUID((Guid)reader["owner"]);
862 appearance.Serial = Convert.ToInt32(reader["serial"]); 862 appearance.Serial = Convert.ToInt32(reader["serial"]);
863 appearance.VisualParams = (byte[])reader["visual_params"]; 863 appearance.VisualParams = (byte[])reader["visual_params"];
864 appearance.Texture = new Primitive.TextureEntry((byte[])reader["texture"], 0, ((byte[])reader["texture"]).Length); 864 appearance.Texture = new Primitive.TextureEntry((byte[])reader["texture"], 0, ((byte[])reader["texture"]).Length);
865 appearance.AvatarHeight = (float)Convert.ToDouble(reader["avatar_height"]); 865 appearance.AvatarHeight = (float)Convert.ToDouble(reader["avatar_height"]);
866 appearance.BodyItem = new UUID((string)reader["body_item"]); 866 appearance.BodyItem = new UUID((Guid)reader["body_item"]);
867 appearance.BodyAsset = new UUID((string)reader["body_asset"]); 867 appearance.BodyAsset = new UUID((Guid)reader["body_asset"]);
868 appearance.SkinItem = new UUID((string)reader["skin_item"]); 868 appearance.SkinItem = new UUID((Guid)reader["skin_item"]);
869 appearance.SkinAsset = new UUID((string)reader["skin_asset"]); 869 appearance.SkinAsset = new UUID((Guid)reader["skin_asset"]);
870 appearance.HairItem = new UUID((string)reader["hair_item"]); 870 appearance.HairItem = new UUID((Guid)reader["hair_item"]);
871 appearance.HairAsset = new UUID((string)reader["hair_asset"]); 871 appearance.HairAsset = new UUID((Guid)reader["hair_asset"]);
872 appearance.EyesItem = new UUID((string)reader["eyes_item"]); 872 appearance.EyesItem = new UUID((Guid)reader["eyes_item"]);
873 appearance.EyesAsset = new UUID((string)reader["eyes_asset"]); 873 appearance.EyesAsset = new UUID((Guid)reader["eyes_asset"]);
874 appearance.ShirtItem = new UUID((string)reader["shirt_item"]); 874 appearance.ShirtItem = new UUID((Guid)reader["shirt_item"]);
875 appearance.ShirtAsset = new UUID((string)reader["shirt_asset"]); 875 appearance.ShirtAsset = new UUID((Guid)reader["shirt_asset"]);
876 appearance.PantsItem = new UUID((string)reader["pants_item"]); 876 appearance.PantsItem = new UUID((Guid)reader["pants_item"]);
877 appearance.PantsAsset = new UUID((string)reader["pants_asset"]); 877 appearance.PantsAsset = new UUID((Guid)reader["pants_asset"]);
878 appearance.ShoesItem = new UUID((string)reader["shoes_item"]); 878 appearance.ShoesItem = new UUID((Guid)reader["shoes_item"]);
879 appearance.ShoesAsset = new UUID((string)reader["shoes_asset"]); 879 appearance.ShoesAsset = new UUID((Guid)reader["shoes_asset"]);
880 appearance.SocksItem = new UUID((string)reader["socks_item"]); 880 appearance.SocksItem = new UUID((Guid)reader["socks_item"]);
881 appearance.SocksAsset = new UUID((string)reader["socks_asset"]); 881 appearance.SocksAsset = new UUID((Guid)reader["socks_asset"]);
882 appearance.JacketItem = new UUID((string)reader["jacket_item"]); 882 appearance.JacketItem = new UUID((Guid)reader["jacket_item"]);
883 appearance.JacketAsset = new UUID((string)reader["jacket_asset"]); 883 appearance.JacketAsset = new UUID((Guid)reader["jacket_asset"]);
884 appearance.GlovesItem = new UUID((string)reader["gloves_item"]); 884 appearance.GlovesItem = new UUID((Guid)reader["gloves_item"]);
885 appearance.GlovesAsset = new UUID((string)reader["gloves_asset"]); 885 appearance.GlovesAsset = new UUID((Guid)reader["gloves_asset"]);
886 appearance.UnderShirtItem = new UUID((string)reader["undershirt_item"]); 886 appearance.UnderShirtItem = new UUID((Guid)reader["undershirt_item"]);
887 appearance.UnderShirtAsset = new UUID((string)reader["undershirt_asset"]); 887 appearance.UnderShirtAsset = new UUID((Guid)reader["undershirt_asset"]);
888 appearance.UnderPantsItem = new UUID((string)reader["underpants_item"]); 888 appearance.UnderPantsItem = new UUID((Guid)reader["underpants_item"]);
889 appearance.UnderPantsAsset = new UUID((string)reader["underpants_asset"]); 889 appearance.UnderPantsAsset = new UUID((Guid)reader["underpants_asset"]);
890 appearance.SkirtItem = new UUID((string)reader["skirt_item"]); 890 appearance.SkirtItem = new UUID((Guid)reader["skirt_item"]);
891 appearance.SkirtAsset = new UUID((string)reader["skirt_asset"]); 891 appearance.SkirtAsset = new UUID((Guid)reader["skirt_asset"]);
892 892
893 return appearance; 893 return appearance;
894 } 894 }
@@ -969,9 +969,9 @@ ELSE
969 if (reader.Read()) 969 if (reader.Read())
970 { 970 {
971 // Agent IDs 971 // Agent IDs
972 retval.ProfileID = new UUID((string)reader["UUID"]); 972 retval.ProfileID = new UUID((Guid)reader["UUID"]);
973 retval.SessionID = new UUID((string)reader["sessionID"]); 973 retval.SessionID = new UUID((Guid)reader["sessionID"]);
974 retval.SecureSessionID = new UUID((string)reader["secureSessionID"]); 974 retval.SecureSessionID = new UUID((Guid)reader["secureSessionID"]);
975 975
976 // Agent Who? 976 // Agent Who?
977 retval.AgentIP = (string)reader["agentIP"]; 977 retval.AgentIP = (string)reader["agentIP"];
@@ -983,7 +983,7 @@ ELSE
983 retval.LogoutTime = Convert.ToInt32(reader["logoutTime"].ToString()); 983 retval.LogoutTime = Convert.ToInt32(reader["logoutTime"].ToString());
984 984
985 // Current position 985 // Current position
986 retval.Region = (UUID)(string)reader["currentRegion"]; 986 retval.Region = new UUID((Guid)reader["currentRegion"]);
987 retval.Handle = Convert.ToUInt64(reader["currentHandle"].ToString()); 987 retval.Handle = Convert.ToUInt64(reader["currentHandle"].ToString());
988 Vector3 tmp_v; 988 Vector3 tmp_v;
989 Vector3.TryParse((string)reader["currentPos"], out tmp_v); 989 Vector3.TryParse((string)reader["currentPos"], out tmp_v);
@@ -1110,7 +1110,7 @@ ELSE
1110 1110
1111 if (reader.Read()) 1111 if (reader.Read())
1112 { 1112 {
1113 retval.ID = new UUID((string)reader["UUID"]); 1113 retval.ID = new UUID((Guid)reader["UUID"]);
1114 retval.FirstName = (string)reader["username"]; 1114 retval.FirstName = (string)reader["username"];
1115 retval.SurName = (string)reader["lastname"]; 1115 retval.SurName = (string)reader["lastname"];
1116 1116
@@ -1139,9 +1139,9 @@ ELSE
1139 retval.AboutText = (string)reader["profileAboutText"]; 1139 retval.AboutText = (string)reader["profileAboutText"];
1140 retval.FirstLifeAboutText = (string)reader["profileFirstText"]; 1140 retval.FirstLifeAboutText = (string)reader["profileFirstText"];
1141 1141
1142 retval.Image = new UUID((string)reader["profileImage"]); 1142 retval.Image = new UUID((Guid)reader["profileImage"]);
1143 retval.FirstLifeImage = new UUID((string)reader["profileFirstImage"]); 1143 retval.FirstLifeImage = new UUID((Guid)reader["profileFirstImage"]);
1144 retval.WebLoginKey = new UUID((string)reader["webLoginKey"]); 1144 retval.WebLoginKey = new UUID((Guid)reader["webLoginKey"]);
1145 } 1145 }
1146 else 1146 else
1147 { 1147 {
diff --git a/OpenSim/Data/MSSQL/Resources/003_InventoryStore.sql b/OpenSim/Data/MSSQL/Resources/003_InventoryStore.sql
new file mode 100644
index 0000000..2f623ec
--- /dev/null
+++ b/OpenSim/Data/MSSQL/Resources/003_InventoryStore.sql
@@ -0,0 +1,38 @@
1/* To prevent any potential data loss issues, you should review this script in detail before running it outside the context of the database designer.*/
2BEGIN TRANSACTION
3
4CREATE TABLE dbo.Tmp_inventoryfolders
5 (
6 folderID uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'),
7 agentID uniqueidentifier NULL DEFAULT (NULL),
8 parentFolderID uniqueidentifier NULL DEFAULT (NULL),
9 folderName varchar(64) NULL DEFAULT (NULL),
10 type smallint NOT NULL DEFAULT ((0)),
11 version int NOT NULL DEFAULT ((0))
12 ) ON [PRIMARY]
13
14IF EXISTS(SELECT * FROM dbo.inventoryfolders)
15 EXEC('INSERT INTO dbo.Tmp_inventoryfolders (folderID, agentID, parentFolderID, folderName, type, version)
16 SELECT CONVERT(uniqueidentifier, folderID), CONVERT(uniqueidentifier, agentID), CONVERT(uniqueidentifier, parentFolderID), folderName, type, version FROM dbo.inventoryfolders WITH (HOLDLOCK TABLOCKX)')
17
18DROP TABLE dbo.inventoryfolders
19
20EXECUTE sp_rename N'dbo.Tmp_inventoryfolders', N'inventoryfolders', 'OBJECT'
21
22ALTER TABLE dbo.inventoryfolders ADD CONSTRAINT
23 PK__inventor__C2FABFB3173876EA PRIMARY KEY CLUSTERED
24 (
25 folderID
26 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
27
28CREATE NONCLUSTERED INDEX owner ON dbo.inventoryfolders
29 (
30 agentID
31 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
32
33CREATE NONCLUSTERED INDEX parent ON dbo.inventoryfolders
34 (
35 parentFolderID
36 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
37
38COMMIT
diff --git a/OpenSim/Data/MSSQL/Resources/004_AssetStore.sql b/OpenSim/Data/MSSQL/Resources/004_AssetStore.sql
new file mode 100644
index 0000000..215cf3a
--- /dev/null
+++ b/OpenSim/Data/MSSQL/Resources/004_AssetStore.sql
@@ -0,0 +1,31 @@
1BEGIN TRANSACTION
2
3CREATE TABLE dbo.Tmp_assets
4 (
5 id uniqueidentifier NOT NULL,
6 name varchar(64) NOT NULL,
7 description varchar(64) NOT NULL,
8 assetType tinyint NOT NULL,
9 local bit NOT NULL,
10 temporary bit NOT NULL,
11 data image NOT NULL,
12 create_time int NULL,
13 access_time int NULL
14 ) ON [PRIMARY]
15 TEXTIMAGE_ON [PRIMARY]
16
17IF EXISTS(SELECT * FROM dbo.assets)
18 EXEC('INSERT INTO dbo.Tmp_assets (id, name, description, assetType, local, temporary, data, create_time, access_time)
19 SELECT CONVERT(uniqueidentifier, id), name, description, assetType, local, temporary, data, create_time, access_time FROM dbo.assets WITH (HOLDLOCK TABLOCKX)')
20
21DROP TABLE assets
22
23EXECUTE sp_rename N'Tmp_assets', N'assets', 'OBJECT'
24
25ALTER TABLE dbo.assets ADD CONSTRAINT
26 PK__assets__id PRIMARY KEY CLUSTERED
27 (
28 id
29 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
30
31COMMIT
diff --git a/OpenSim/Data/MSSQL/Resources/004_EstateStore.sql b/OpenSim/Data/MSSQL/Resources/004_EstateStore.sql
new file mode 100644
index 0000000..0a132c1
--- /dev/null
+++ b/OpenSim/Data/MSSQL/Resources/004_EstateStore.sql
@@ -0,0 +1,22 @@
1BEGIN TRANSACTION
2
3CREATE TABLE dbo.Tmp_estate_managers
4 (
5 EstateID int NOT NULL,
6 uuid uniqueidentifier NOT NULL
7 ) ON [PRIMARY]
8
9IF EXISTS(SELECT * FROM dbo.estate_managers)
10 EXEC('INSERT INTO dbo.Tmp_estate_managers (EstateID, uuid)
11 SELECT EstateID, CONVERT(uniqueidentifier, uuid) FROM dbo.estate_managers WITH (HOLDLOCK TABLOCKX)')
12
13DROP TABLE dbo.estate_managers
14
15EXECUTE sp_rename N'dbo.Tmp_estate_managers', N'estate_managers', 'OBJECT'
16
17CREATE NONCLUSTERED INDEX IX_estate_managers ON dbo.estate_managers
18 (
19 EstateID
20 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
21
22COMMIT
diff --git a/OpenSim/Data/MSSQL/Resources/004_GridStore.sql b/OpenSim/Data/MSSQL/Resources/004_GridStore.sql
new file mode 100644
index 0000000..6456c95
--- /dev/null
+++ b/OpenSim/Data/MSSQL/Resources/004_GridStore.sql
@@ -0,0 +1,68 @@
1/* To prevent any potential data loss issues, you should review this script in detail before running it outside the context of the database designer.*/
2BEGIN TRANSACTION
3
4CREATE TABLE dbo.Tmp_regions
5 (
6 uuid uniqueidentifier NOT NULL,
7 regionHandle bigint NULL,
8 regionName varchar(20) NULL,
9 regionRecvKey varchar(128) NULL,
10 regionSendKey varchar(128) NULL,
11 regionSecret varchar(128) NULL,
12 regionDataURI varchar(128) NULL,
13 serverIP varchar(64) NULL,
14 serverPort int NULL,
15 serverURI varchar(255) NULL,
16 locX int NULL,
17 locY int NULL,
18 locZ int NULL,
19 eastOverrideHandle bigint NULL,
20 westOverrideHandle bigint NULL,
21 southOverrideHandle bigint NULL,
22 northOverrideHandle bigint NULL,
23 regionAssetURI varchar(255) NULL,
24 regionAssetRecvKey varchar(128) NULL,
25 regionAssetSendKey varchar(128) NULL,
26 regionUserURI varchar(255) NULL,
27 regionUserRecvKey varchar(128) NULL,
28 regionUserSendKey varchar(128) NULL,
29 regionMapTexture uniqueidentifier NULL,
30 serverHttpPort int NULL,
31 serverRemotingPort int NULL,
32 owner_uuid uniqueidentifier NOT NULL,
33 originUUID uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000')
34 ) ON [PRIMARY]
35
36IF EXISTS(SELECT * FROM dbo.regions)
37 EXEC('INSERT INTO dbo.Tmp_regions (uuid, regionHandle, regionName, regionRecvKey, regionSendKey, regionSecret, regionDataURI, serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey, regionMapTexture, serverHttpPort, serverRemotingPort, owner_uuid, originUUID)
38 SELECT CONVERT(uniqueidentifier, uuid), regionHandle, regionName, regionRecvKey, regionSendKey, regionSecret, regionDataURI, serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey, CONVERT(uniqueidentifier, regionMapTexture), serverHttpPort, serverRemotingPort, CONVERT(uniqueidentifier, owner_uuid), CONVERT(uniqueidentifier, originUUID) FROM dbo.regions WITH (HOLDLOCK TABLOCKX)')
39
40DROP TABLE dbo.regions
41
42EXECUTE sp_rename N'dbo.Tmp_regions', N'regions', 'OBJECT'
43
44ALTER TABLE dbo.regions ADD CONSTRAINT
45 PK__regions__uuid PRIMARY KEY CLUSTERED
46 (
47 uuid
48 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
49
50CREATE NONCLUSTERED INDEX IX_regions_name ON dbo.regions
51 (
52 regionName
53 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
54
55CREATE NONCLUSTERED INDEX IX_regions_handle ON dbo.regions
56 (
57 regionHandle
58 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
59
60CREATE NONCLUSTERED INDEX IX_regions_override ON dbo.regions
61 (
62 eastOverrideHandle,
63 westOverrideHandle,
64 southOverrideHandle,
65 northOverrideHandle
66 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
67
68COMMIT
diff --git a/OpenSim/Data/MSSQL/Resources/004_InventoryStore.sql b/OpenSim/Data/MSSQL/Resources/004_InventoryStore.sql
new file mode 100644
index 0000000..96ef1c0
--- /dev/null
+++ b/OpenSim/Data/MSSQL/Resources/004_InventoryStore.sql
@@ -0,0 +1,52 @@
1BEGIN TRANSACTION
2
3CREATE TABLE dbo.Tmp_inventoryitems
4 (
5 inventoryID uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'),
6 assetID uniqueidentifier NULL DEFAULT (NULL),
7 assetType int NULL DEFAULT (NULL),
8 parentFolderID uniqueidentifier NULL DEFAULT (NULL),
9 avatarID uniqueidentifier NULL DEFAULT (NULL),
10 inventoryName varchar(64) NULL DEFAULT (NULL),
11 inventoryDescription varchar(128) NULL DEFAULT (NULL),
12 inventoryNextPermissions int NULL DEFAULT (NULL),
13 inventoryCurrentPermissions int NULL DEFAULT (NULL),
14 invType int NULL DEFAULT (NULL),
15 creatorID uniqueidentifier NULL DEFAULT (NULL),
16 inventoryBasePermissions int NOT NULL DEFAULT ((0)),
17 inventoryEveryOnePermissions int NOT NULL DEFAULT ((0)),
18 salePrice int NULL DEFAULT (NULL),
19 saleType tinyint NULL DEFAULT (NULL),
20 creationDate int NULL DEFAULT (NULL),
21 groupID uniqueidentifier NULL DEFAULT (NULL),
22 groupOwned bit NULL DEFAULT (NULL),
23 flags int NULL DEFAULT (NULL),
24 inventoryGroupPermissions int NOT NULL DEFAULT ((0))
25 ) ON [PRIMARY]
26
27IF EXISTS(SELECT * FROM dbo.inventoryitems)
28 EXEC('INSERT INTO dbo.Tmp_inventoryitems (inventoryID, assetID, assetType, parentFolderID, avatarID, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType, creatorID, inventoryBasePermissions, inventoryEveryOnePermissions, salePrice, saleType, creationDate, groupID, groupOwned, flags, inventoryGroupPermissions)
29 SELECT CONVERT(uniqueidentifier, inventoryID), CONVERT(uniqueidentifier, assetID), assetType, CONVERT(uniqueidentifier, parentFolderID), CONVERT(uniqueidentifier, avatarID), inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType, CONVERT(uniqueidentifier, creatorID), inventoryBasePermissions, inventoryEveryOnePermissions, salePrice, saleType, creationDate, CONVERT(uniqueidentifier, groupID), groupOwned, flags, inventoryGroupPermissions FROM dbo.inventoryitems WITH (HOLDLOCK TABLOCKX)')
30
31DROP TABLE dbo.inventoryitems
32
33EXECUTE sp_rename N'dbo.Tmp_inventoryitems', N'inventoryitems', 'OBJECT'
34
35ALTER TABLE dbo.inventoryitems ADD CONSTRAINT
36 PK__inventor__C4B7BC2220C1E124 PRIMARY KEY CLUSTERED
37 (
38 inventoryID
39 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
40
41
42CREATE NONCLUSTERED INDEX owner ON dbo.inventoryitems
43 (
44 avatarID
45 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
46
47CREATE NONCLUSTERED INDEX folder ON dbo.inventoryitems
48 (
49 parentFolderID
50 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
51
52COMMIT
diff --git a/OpenSim/Data/MSSQL/Resources/005_EstateStore.sql b/OpenSim/Data/MSSQL/Resources/005_EstateStore.sql
new file mode 100644
index 0000000..ba93b39
--- /dev/null
+++ b/OpenSim/Data/MSSQL/Resources/005_EstateStore.sql
@@ -0,0 +1,22 @@
1BEGIN TRANSACTION
2
3CREATE TABLE dbo.Tmp_estate_groups
4 (
5 EstateID int NOT NULL,
6 uuid uniqueidentifier NOT NULL
7 ) ON [PRIMARY]
8
9IF EXISTS(SELECT * FROM dbo.estate_groups)
10 EXEC('INSERT INTO dbo.Tmp_estate_groups (EstateID, uuid)
11 SELECT EstateID, CONVERT(uniqueidentifier, uuid) FROM dbo.estate_groups WITH (HOLDLOCK TABLOCKX)')
12
13DROP TABLE dbo.estate_groups
14
15EXECUTE sp_rename N'dbo.Tmp_estate_groups', N'estate_groups', 'OBJECT'
16
17CREATE NONCLUSTERED INDEX IX_estate_groups ON dbo.estate_groups
18 (
19 EstateID
20 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
21
22COMMIT
diff --git a/OpenSim/Data/MSSQL/Resources/006_EstateStore.sql b/OpenSim/Data/MSSQL/Resources/006_EstateStore.sql
new file mode 100644
index 0000000..f7df8fd
--- /dev/null
+++ b/OpenSim/Data/MSSQL/Resources/006_EstateStore.sql
@@ -0,0 +1,22 @@
1BEGIN TRANSACTION
2
3CREATE TABLE dbo.Tmp_estate_users
4 (
5 EstateID int NOT NULL,
6 uuid uniqueidentifier NOT NULL
7 ) ON [PRIMARY]
8
9IF EXISTS(SELECT * FROM dbo.estate_users)
10 EXEC('INSERT INTO dbo.Tmp_estate_users (EstateID, uuid)
11 SELECT EstateID, CONVERT(uniqueidentifier, uuid) FROM dbo.estate_users WITH (HOLDLOCK TABLOCKX)')
12
13DROP TABLE dbo.estate_users
14
15EXECUTE sp_rename N'dbo.Tmp_estate_users', N'estate_users', 'OBJECT'
16
17CREATE NONCLUSTERED INDEX IX_estate_users ON dbo.estate_users
18 (
19 EstateID
20 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
21
22COMMIT
diff --git a/OpenSim/Data/MSSQL/Resources/006_UserStore.sql b/OpenSim/Data/MSSQL/Resources/006_UserStore.sql
new file mode 100644
index 0000000..67fe581
--- /dev/null
+++ b/OpenSim/Data/MSSQL/Resources/006_UserStore.sql
@@ -0,0 +1,57 @@
1BEGIN TRANSACTION
2
3CREATE TABLE dbo.Tmp_users
4 (
5 UUID uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'),
6 username varchar(32) NOT NULL,
7 lastname varchar(32) NOT NULL,
8 passwordHash varchar(32) NOT NULL,
9 passwordSalt varchar(32) NOT NULL,
10 homeRegion bigint NULL DEFAULT (NULL),
11 homeLocationX float(53) NULL DEFAULT (NULL),
12 homeLocationY float(53) NULL DEFAULT (NULL),
13 homeLocationZ float(53) NULL DEFAULT (NULL),
14 homeLookAtX float(53) NULL DEFAULT (NULL),
15 homeLookAtY float(53) NULL DEFAULT (NULL),
16 homeLookAtZ float(53) NULL DEFAULT (NULL),
17 created int NOT NULL,
18 lastLogin int NOT NULL,
19 userInventoryURI varchar(255) NULL DEFAULT (NULL),
20 userAssetURI varchar(255) NULL DEFAULT (NULL),
21 profileCanDoMask int NULL DEFAULT (NULL),
22 profileWantDoMask int NULL DEFAULT (NULL),
23 profileAboutText ntext NULL,
24 profileFirstText ntext NULL,
25 profileImage uniqueidentifier NULL DEFAULT (NULL),
26 profileFirstImage uniqueidentifier NULL DEFAULT (NULL),
27 webLoginKey uniqueidentifier NULL DEFAULT (NULL),
28 homeRegionID uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'),
29 userFlags int NOT NULL DEFAULT ((0)),
30 godLevel int NOT NULL DEFAULT ((0)),
31 customType varchar(32) NOT NULL DEFAULT (''),
32 partner uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'),
33 email varchar(250) NULL
34 ) ON [PRIMARY]
35 TEXTIMAGE_ON [PRIMARY]
36
37IF EXISTS(SELECT * FROM dbo.users)
38 EXEC('INSERT INTO dbo.Tmp_users (UUID, username, lastname, passwordHash, passwordSalt, homeRegion, homeLocationX, homeLocationY, homeLocationZ, homeLookAtX, homeLookAtY, homeLookAtZ, created, lastLogin, userInventoryURI, userAssetURI, profileCanDoMask, profileWantDoMask, profileAboutText, profileFirstText, profileImage, profileFirstImage, webLoginKey, homeRegionID, userFlags, godLevel, customType, partner, email)
39 SELECT CONVERT(uniqueidentifier, UUID), username, lastname, passwordHash, passwordSalt, homeRegion, homeLocationX, homeLocationY, homeLocationZ, homeLookAtX, homeLookAtY, homeLookAtZ, created, lastLogin, userInventoryURI, userAssetURI, profileCanDoMask, profileWantDoMask, profileAboutText, profileFirstText, CONVERT(uniqueidentifier, profileImage), CONVERT(uniqueidentifier, profileFirstImage), CONVERT(uniqueidentifier, webLoginKey), CONVERT(uniqueidentifier, homeRegionID), userFlags, godLevel, customType, CONVERT(uniqueidentifier, partner), email FROM dbo.users WITH (HOLDLOCK TABLOCKX)')
40
41DROP TABLE dbo.users
42
43EXECUTE sp_rename N'dbo.Tmp_users', N'users', 'OBJECT'
44
45ALTER TABLE dbo.users ADD CONSTRAINT
46 PK__users__65A475E737A5467C PRIMARY KEY CLUSTERED
47 (
48 UUID
49 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
50
51CREATE NONCLUSTERED INDEX usernames ON dbo.users
52 (
53 username,
54 lastname
55 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
56
57COMMIT
diff --git a/OpenSim/Data/MSSQL/Resources/007_EstateStore.sql b/OpenSim/Data/MSSQL/Resources/007_EstateStore.sql
new file mode 100644
index 0000000..c9165b0
--- /dev/null
+++ b/OpenSim/Data/MSSQL/Resources/007_EstateStore.sql
@@ -0,0 +1,25 @@
1BEGIN TRANSACTION
2
3CREATE TABLE dbo.Tmp_estateban
4 (
5 EstateID int NOT NULL,
6 bannedUUID uniqueidentifier NOT NULL,
7 bannedIp varchar(16) NULL,
8 bannedIpHostMask varchar(16) NULL,
9 bannedNameMask varchar(64) NULL
10 ) ON [PRIMARY]
11
12IF EXISTS(SELECT * FROM dbo.estateban)
13 EXEC('INSERT INTO dbo.Tmp_estateban (EstateID, bannedUUID, bannedIp, bannedIpHostMask, bannedNameMask)
14 SELECT EstateID, CONVERT(uniqueidentifier, bannedUUID), bannedIp, bannedIpHostMask, bannedNameMask FROM dbo.estateban WITH (HOLDLOCK TABLOCKX)')
15
16DROP TABLE dbo.estateban
17
18EXECUTE sp_rename N'dbo.Tmp_estateban', N'estateban', 'OBJECT'
19
20CREATE NONCLUSTERED INDEX IX_estateban ON dbo.estateban
21 (
22 EstateID
23 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
24
25COMMIT
diff --git a/OpenSim/Data/MSSQL/Resources/007_UserStore.sql b/OpenSim/Data/MSSQL/Resources/007_UserStore.sql
new file mode 100644
index 0000000..92a8fc5
--- /dev/null
+++ b/OpenSim/Data/MSSQL/Resources/007_UserStore.sql
@@ -0,0 +1,42 @@
1BEGIN TRANSACTION
2
3CREATE TABLE dbo.Tmp_agents
4 (
5 UUID uniqueidentifier NOT NULL,
6 sessionID uniqueidentifier NOT NULL,
7 secureSessionID uniqueidentifier NOT NULL,
8 agentIP varchar(16) NOT NULL,
9 agentPort int NOT NULL,
10 agentOnline tinyint NOT NULL,
11 loginTime int NOT NULL,
12 logoutTime int NOT NULL,
13 currentRegion uniqueidentifier NOT NULL,
14 currentHandle bigint NOT NULL,
15 currentPos varchar(64) NOT NULL
16 ) ON [PRIMARY]
17
18IF EXISTS(SELECT * FROM dbo.agents)
19 EXEC('INSERT INTO dbo.Tmp_agents (UUID, sessionID, secureSessionID, agentIP, agentPort, agentOnline, loginTime, logoutTime, currentRegion, currentHandle, currentPos)
20 SELECT CONVERT(uniqueidentifier, UUID), CONVERT(uniqueidentifier, sessionID), CONVERT(uniqueidentifier, secureSessionID), agentIP, agentPort, agentOnline, loginTime, logoutTime, CONVERT(uniqueidentifier, currentRegion), currentHandle, currentPos FROM dbo.agents WITH (HOLDLOCK TABLOCKX)')
21
22DROP TABLE dbo.agents
23
24EXECUTE sp_rename N'dbo.Tmp_agents', N'agents', 'OBJECT'
25
26ALTER TABLE dbo.agents ADD CONSTRAINT
27 PK__agents__65A475E749C3F6B7 PRIMARY KEY CLUSTERED
28 (
29 UUID
30 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
31
32CREATE NONCLUSTERED INDEX session ON dbo.agents
33 (
34 sessionID
35 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
36
37CREATE NONCLUSTERED INDEX ssession ON dbo.agents
38 (
39 secureSessionID
40 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
41
42COMMIT
diff --git a/OpenSim/Data/MSSQL/Resources/008_EstateStore.sql b/OpenSim/Data/MSSQL/Resources/008_EstateStore.sql
new file mode 100644
index 0000000..9c5355e
--- /dev/null
+++ b/OpenSim/Data/MSSQL/Resources/008_EstateStore.sql
@@ -0,0 +1,49 @@
1BEGIN TRANSACTION
2
3CREATE TABLE dbo.Tmp_estate_settings
4 (
5 EstateID int NOT NULL IDENTITY (1, 100),
6 EstateName varchar(64) NULL DEFAULT (NULL),
7 AbuseEmailToEstateOwner bit NOT NULL,
8 DenyAnonymous bit NOT NULL,
9 ResetHomeOnTeleport bit NOT NULL,
10 FixedSun bit NOT NULL,
11 DenyTransacted bit NOT NULL,
12 BlockDwell bit NOT NULL,
13 DenyIdentified bit NOT NULL,
14 AllowVoice bit NOT NULL,
15 UseGlobalTime bit NOT NULL,
16 PricePerMeter int NOT NULL,
17 TaxFree bit NOT NULL,
18 AllowDirectTeleport bit NOT NULL,
19 RedirectGridX int NOT NULL,
20 RedirectGridY int NOT NULL,
21 ParentEstateID int NOT NULL,
22 SunPosition float(53) NOT NULL,
23 EstateSkipScripts bit NOT NULL,
24 BillableFactor float(53) NOT NULL,
25 PublicAccess bit NOT NULL,
26 AbuseEmail varchar(255) NOT NULL,
27 EstateOwner uniqueidentifier NOT NULL,
28 DenyMinors bit NOT NULL
29 ) ON [PRIMARY]
30
31SET IDENTITY_INSERT dbo.Tmp_estate_settings ON
32
33IF EXISTS(SELECT * FROM dbo.estate_settings)
34 EXEC('INSERT INTO dbo.Tmp_estate_settings (EstateID, EstateName, AbuseEmailToEstateOwner, DenyAnonymous, ResetHomeOnTeleport, FixedSun, DenyTransacted, BlockDwell, DenyIdentified, AllowVoice, UseGlobalTime, PricePerMeter, TaxFree, AllowDirectTeleport, RedirectGridX, RedirectGridY, ParentEstateID, SunPosition, EstateSkipScripts, BillableFactor, PublicAccess, AbuseEmail, EstateOwner, DenyMinors)
35 SELECT EstateID, EstateName, AbuseEmailToEstateOwner, DenyAnonymous, ResetHomeOnTeleport, FixedSun, DenyTransacted, BlockDwell, DenyIdentified, AllowVoice, UseGlobalTime, PricePerMeter, TaxFree, AllowDirectTeleport, RedirectGridX, RedirectGridY, ParentEstateID, SunPosition, EstateSkipScripts, BillableFactor, PublicAccess, AbuseEmail, CONVERT(uniqueidentifier, EstateOwner), DenyMinors FROM dbo.estate_settings WITH (HOLDLOCK TABLOCKX)')
36
37SET IDENTITY_INSERT dbo.Tmp_estate_settings OFF
38
39DROP TABLE dbo.estate_settings
40
41EXECUTE sp_rename N'dbo.Tmp_estate_settings', N'estate_settings', 'OBJECT'
42
43ALTER TABLE dbo.estate_settings ADD CONSTRAINT
44 PK_estate_settings PRIMARY KEY CLUSTERED
45 (
46 EstateID
47 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
48
49COMMIT
diff --git a/OpenSim/Data/MSSQL/Resources/008_UserStore.sql b/OpenSim/Data/MSSQL/Resources/008_UserStore.sql
new file mode 100644
index 0000000..505252b
--- /dev/null
+++ b/OpenSim/Data/MSSQL/Resources/008_UserStore.sql
@@ -0,0 +1,29 @@
1BEGIN TRANSACTION
2
3CREATE TABLE dbo.Tmp_userfriends
4 (
5 ownerID uniqueidentifier NOT NULL,
6 friendID uniqueidentifier NOT NULL,
7 friendPerms int NOT NULL,
8 datetimestamp int NOT NULL
9 ) ON [PRIMARY]
10
11IF EXISTS(SELECT * FROM dbo.userfriends)
12 EXEC('INSERT INTO dbo.Tmp_userfriends (ownerID, friendID, friendPerms, datetimestamp)
13 SELECT CONVERT(uniqueidentifier, ownerID), CONVERT(uniqueidentifier, friendID), friendPerms, datetimestamp FROM dbo.userfriends WITH (HOLDLOCK TABLOCKX)')
14
15DROP TABLE dbo.userfriends
16
17EXECUTE sp_rename N'dbo.Tmp_userfriends', N'userfriends', 'OBJECT'
18
19CREATE NONCLUSTERED INDEX IX_userfriends_ownerID ON dbo.userfriends
20 (
21 ownerID
22 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
23
24CREATE NONCLUSTERED INDEX IX_userfriends_friendID ON dbo.userfriends
25 (
26 friendID
27 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
28
29COMMIT
diff --git a/OpenSim/Data/MSSQL/Resources/009_EstateStore.sql b/OpenSim/Data/MSSQL/Resources/009_EstateStore.sql
new file mode 100644
index 0000000..f91557c
--- /dev/null
+++ b/OpenSim/Data/MSSQL/Resources/009_EstateStore.sql
@@ -0,0 +1,24 @@
1BEGIN TRANSACTION
2
3CREATE TABLE dbo.Tmp_estate_map
4 (
5 RegionID uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'),
6 EstateID int NOT NULL
7 ) ON [PRIMARY]
8
9IF EXISTS(SELECT * FROM dbo.estate_map)
10 EXEC('INSERT INTO dbo.Tmp_estate_map (RegionID, EstateID)
11 SELECT CONVERT(uniqueidentifier, RegionID), EstateID FROM dbo.estate_map WITH (HOLDLOCK TABLOCKX)')
12
13DROP TABLE dbo.estate_map
14
15EXECUTE sp_rename N'dbo.Tmp_estate_map', N'estate_map', 'OBJECT'
16
17ALTER TABLE dbo.estate_map ADD CONSTRAINT
18 PK_estate_map PRIMARY KEY CLUSTERED
19 (
20 RegionID
21 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
22
23
24COMMIT
diff --git a/OpenSim/Data/MSSQL/Resources/009_UserStore.sql b/OpenSim/Data/MSSQL/Resources/009_UserStore.sql
new file mode 100644
index 0000000..b1ab8ba
--- /dev/null
+++ b/OpenSim/Data/MSSQL/Resources/009_UserStore.sql
@@ -0,0 +1,53 @@
1BEGIN TRANSACTION
2
3CREATE TABLE dbo.Tmp_avatarappearance
4 (
5 Owner uniqueidentifier NOT NULL,
6 Serial int NOT NULL,
7 Visual_Params image NOT NULL,
8 Texture image NOT NULL,
9 Avatar_Height float(53) NOT NULL,
10 Body_Item uniqueidentifier NOT NULL,
11 Body_Asset uniqueidentifier NOT NULL,
12 Skin_Item uniqueidentifier NOT NULL,
13 Skin_Asset uniqueidentifier NOT NULL,
14 Hair_Item uniqueidentifier NOT NULL,
15 Hair_Asset uniqueidentifier NOT NULL,
16 Eyes_Item uniqueidentifier NOT NULL,
17 Eyes_Asset uniqueidentifier NOT NULL,
18 Shirt_Item uniqueidentifier NOT NULL,
19 Shirt_Asset uniqueidentifier NOT NULL,
20 Pants_Item uniqueidentifier NOT NULL,
21 Pants_Asset uniqueidentifier NOT NULL,
22 Shoes_Item uniqueidentifier NOT NULL,
23 Shoes_Asset uniqueidentifier NOT NULL,
24 Socks_Item uniqueidentifier NOT NULL,
25 Socks_Asset uniqueidentifier NOT NULL,
26 Jacket_Item uniqueidentifier NOT NULL,
27 Jacket_Asset uniqueidentifier NOT NULL,
28 Gloves_Item uniqueidentifier NOT NULL,
29 Gloves_Asset uniqueidentifier NOT NULL,
30 Undershirt_Item uniqueidentifier NOT NULL,
31 Undershirt_Asset uniqueidentifier NOT NULL,
32 Underpants_Item uniqueidentifier NOT NULL,
33 Underpants_Asset uniqueidentifier NOT NULL,
34 Skirt_Item uniqueidentifier NOT NULL,
35 Skirt_Asset uniqueidentifier NOT NULL
36 ) ON [PRIMARY]
37 TEXTIMAGE_ON [PRIMARY]
38
39IF EXISTS(SELECT * FROM dbo.avatarappearance)
40 EXEC('INSERT INTO dbo.Tmp_avatarappearance (Owner, Serial, Visual_Params, Texture, Avatar_Height, Body_Item, Body_Asset, Skin_Item, Skin_Asset, Hair_Item, Hair_Asset, Eyes_Item, Eyes_Asset, Shirt_Item, Shirt_Asset, Pants_Item, Pants_Asset, Shoes_Item, Shoes_Asset, Socks_Item, Socks_Asset, Jacket_Item, Jacket_Asset, Gloves_Item, Gloves_Asset, Undershirt_Item, Undershirt_Asset, Underpants_Item, Underpants_Asset, Skirt_Item, Skirt_Asset)
41 SELECT CONVERT(uniqueidentifier, Owner), Serial, Visual_Params, Texture, Avatar_Height, CONVERT(uniqueidentifier, Body_Item), CONVERT(uniqueidentifier, Body_Asset), CONVERT(uniqueidentifier, Skin_Item), CONVERT(uniqueidentifier, Skin_Asset), CONVERT(uniqueidentifier, Hair_Item), CONVERT(uniqueidentifier, Hair_Asset), CONVERT(uniqueidentifier, Eyes_Item), CONVERT(uniqueidentifier, Eyes_Asset), CONVERT(uniqueidentifier, Shirt_Item), CONVERT(uniqueidentifier, Shirt_Asset), CONVERT(uniqueidentifier, Pants_Item), CONVERT(uniqueidentifier, Pants_Asset), CONVERT(uniqueidentifier, Shoes_Item), CONVERT(uniqueidentifier, Shoes_Asset), CONVERT(uniqueidentifier, Socks_Item), CONVERT(uniqueidentifier, Socks_Asset), CONVERT(uniqueidentifier, Jacket_Item), CONVERT(uniqueidentifier, Jacket_Asset), CONVERT(uniqueidentifier, Gloves_Item), CONVERT(uniqueidentifier, Gloves_Asset), CONVERT(uniqueidentifier, Undershirt_Item), CONVERT(uniqueidentifier, Undershirt_Asset), CONVERT(uniqueidentifier, Underpants_Item), CONVERT(uniqueidentifier, Underpants_Asset), CONVERT(uniqueidentifier, Skirt_Item), CONVERT(uniqueidentifier, Skirt_Asset) FROM dbo.avatarappearance WITH (HOLDLOCK TABLOCKX)')
42
43DROP TABLE dbo.avatarappearance
44
45EXECUTE sp_rename N'dbo.Tmp_avatarappearance', N'avatarappearance', 'OBJECT'
46
47ALTER TABLE dbo.avatarappearance ADD CONSTRAINT
48 PK__avatarap__7DD115CC4E88ABD4 PRIMARY KEY CLUSTERED
49 (
50 Owner
51 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
52
53COMMIT
diff --git a/OpenSim/Data/MSSQL/Resources/010_UserStore.sql b/OpenSim/Data/MSSQL/Resources/010_UserStore.sql
new file mode 100644
index 0000000..0af008a
--- /dev/null
+++ b/OpenSim/Data/MSSQL/Resources/010_UserStore.sql
@@ -0,0 +1,24 @@
1BEGIN TRANSACTION
2
3CREATE TABLE dbo.Tmp_avatarattachments
4 (
5 UUID uniqueidentifier NOT NULL,
6 attachpoint int NOT NULL,
7 item uniqueidentifier NOT NULL,
8 asset uniqueidentifier NOT NULL
9 ) ON [PRIMARY]
10
11IF EXISTS(SELECT * FROM dbo.avatarattachments)
12 EXEC('INSERT INTO dbo.Tmp_avatarattachments (UUID, attachpoint, item, asset)
13 SELECT CONVERT(uniqueidentifier, UUID), attachpoint, CONVERT(uniqueidentifier, item), CONVERT(uniqueidentifier, asset) FROM dbo.avatarattachments WITH (HOLDLOCK TABLOCKX)')
14
15DROP TABLE dbo.avatarattachments
16
17EXECUTE sp_rename N'dbo.Tmp_avatarattachments', N'avatarattachments', 'OBJECT'
18
19CREATE NONCLUSTERED INDEX IX_avatarattachments ON dbo.avatarattachments
20 (
21 UUID
22 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
23
24COMMIT
diff --git a/OpenSim/Data/MSSQL/Resources/013_RegionStore.sql b/OpenSim/Data/MSSQL/Resources/013_RegionStore.sql
new file mode 100644
index 0000000..ef5d4c0
--- /dev/null
+++ b/OpenSim/Data/MSSQL/Resources/013_RegionStore.sql
@@ -0,0 +1,112 @@
1BEGIN TRANSACTION
2
3CREATE TABLE dbo.Tmp_prims
4 (
5 UUID uniqueidentifier NOT NULL,
6 RegionUUID uniqueidentifier NULL,
7 ParentID int NULL,
8 CreationDate int NULL,
9 Name varchar(255) NULL,
10 SceneGroupID uniqueidentifier NULL,
11 Text varchar(255) NULL,
12 Description varchar(255) NULL,
13 SitName varchar(255) NULL,
14 TouchName varchar(255) NULL,
15 ObjectFlags int NULL,
16 CreatorID uniqueidentifier NULL,
17 OwnerID uniqueidentifier NULL,
18 GroupID uniqueidentifier NULL,
19 LastOwnerID uniqueidentifier NULL,
20 OwnerMask int NULL,
21 NextOwnerMask int NULL,
22 GroupMask int NULL,
23 EveryoneMask int NULL,
24 BaseMask int NULL,
25 PositionX float(53) NULL,
26 PositionY float(53) NULL,
27 PositionZ float(53) NULL,
28 GroupPositionX float(53) NULL,
29 GroupPositionY float(53) NULL,
30 GroupPositionZ float(53) NULL,
31 VelocityX float(53) NULL,
32 VelocityY float(53) NULL,
33 VelocityZ float(53) NULL,
34 AngularVelocityX float(53) NULL,
35 AngularVelocityY float(53) NULL,
36 AngularVelocityZ float(53) NULL,
37 AccelerationX float(53) NULL,
38 AccelerationY float(53) NULL,
39 AccelerationZ float(53) NULL,
40 RotationX float(53) NULL,
41 RotationY float(53) NULL,
42 RotationZ float(53) NULL,
43 RotationW float(53) NULL,
44 SitTargetOffsetX float(53) NULL,
45 SitTargetOffsetY float(53) NULL,
46 SitTargetOffsetZ float(53) NULL,
47 SitTargetOrientW float(53) NULL,
48 SitTargetOrientX float(53) NULL,
49 SitTargetOrientY float(53) NULL,
50 SitTargetOrientZ float(53) NULL,
51 PayPrice int NOT NULL DEFAULT ((0)),
52 PayButton1 int NOT NULL DEFAULT ((0)),
53 PayButton2 int NOT NULL DEFAULT ((0)),
54 PayButton3 int NOT NULL DEFAULT ((0)),
55 PayButton4 int NOT NULL DEFAULT ((0)),
56 LoopedSound uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'),
57 LoopedSoundGain float(53) NOT NULL DEFAULT ((0.0)),
58 TextureAnimation image NULL,
59 OmegaX float(53) NOT NULL DEFAULT ((0.0)),
60 OmegaY float(53) NOT NULL DEFAULT ((0.0)),
61 OmegaZ float(53) NOT NULL DEFAULT ((0.0)),
62 CameraEyeOffsetX float(53) NOT NULL DEFAULT ((0.0)),
63 CameraEyeOffsetY float(53) NOT NULL DEFAULT ((0.0)),
64 CameraEyeOffsetZ float(53) NOT NULL DEFAULT ((0.0)),
65 CameraAtOffsetX float(53) NOT NULL DEFAULT ((0.0)),
66 CameraAtOffsetY float(53) NOT NULL DEFAULT ((0.0)),
67 CameraAtOffsetZ float(53) NOT NULL DEFAULT ((0.0)),
68 ForceMouselook tinyint NOT NULL DEFAULT ((0)),
69 ScriptAccessPin int NOT NULL DEFAULT ((0)),
70 AllowedDrop tinyint NOT NULL DEFAULT ((0)),
71 DieAtEdge tinyint NOT NULL DEFAULT ((0)),
72 SalePrice int NOT NULL DEFAULT ((10)),
73 SaleType tinyint NOT NULL DEFAULT ((0)),
74 ColorR int NOT NULL DEFAULT ((0)),
75 ColorG int NOT NULL DEFAULT ((0)),
76 ColorB int NOT NULL DEFAULT ((0)),
77 ColorA int NOT NULL DEFAULT ((0)),
78 ParticleSystem image NULL,
79 ClickAction tinyint NOT NULL DEFAULT ((0)),
80 Material tinyint NOT NULL DEFAULT ((3)),
81 CollisionSound uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'),
82 CollisionSoundVolume float(53) NOT NULL DEFAULT ((0.0)),
83 LinkNumber int NOT NULL DEFAULT ((0))
84 ) ON [PRIMARY]
85 TEXTIMAGE_ON [PRIMARY]
86
87IF EXISTS(SELECT * FROM dbo.prims)
88 EXEC('INSERT INTO dbo.Tmp_prims (UUID, RegionUUID, ParentID, CreationDate, Name, SceneGroupID, Text, Description, SitName, TouchName, ObjectFlags, CreatorID, OwnerID, GroupID, LastOwnerID, OwnerMask, NextOwnerMask, GroupMask, EveryoneMask, BaseMask, PositionX, PositionY, PositionZ, GroupPositionX, GroupPositionY, GroupPositionZ, VelocityX, VelocityY, VelocityZ, AngularVelocityX, AngularVelocityY, AngularVelocityZ, AccelerationX, AccelerationY, AccelerationZ, RotationX, RotationY, RotationZ, RotationW, SitTargetOffsetX, SitTargetOffsetY, SitTargetOffsetZ, SitTargetOrientW, SitTargetOrientX, SitTargetOrientY, SitTargetOrientZ, PayPrice, PayButton1, PayButton2, PayButton3, PayButton4, LoopedSound, LoopedSoundGain, TextureAnimation, OmegaX, OmegaY, OmegaZ, CameraEyeOffsetX, CameraEyeOffsetY, CameraEyeOffsetZ, CameraAtOffsetX, CameraAtOffsetY, CameraAtOffsetZ, ForceMouselook, ScriptAccessPin, AllowedDrop, DieAtEdge, SalePrice, SaleType, ColorR, ColorG, ColorB, ColorA, ParticleSystem, ClickAction, Material, CollisionSound, CollisionSoundVolume, LinkNumber)
89 SELECT CONVERT(uniqueidentifier, UUID), CONVERT(uniqueidentifier, RegionUUID), ParentID, CreationDate, Name, CONVERT(uniqueidentifier, SceneGroupID), Text, Description, SitName, TouchName, ObjectFlags, CONVERT(uniqueidentifier, CreatorID), CONVERT(uniqueidentifier, OwnerID), CONVERT(uniqueidentifier, GroupID), CONVERT(uniqueidentifier, LastOwnerID), OwnerMask, NextOwnerMask, GroupMask, EveryoneMask, BaseMask, PositionX, PositionY, PositionZ, GroupPositionX, GroupPositionY, GroupPositionZ, VelocityX, VelocityY, VelocityZ, AngularVelocityX, AngularVelocityY, AngularVelocityZ, AccelerationX, AccelerationY, AccelerationZ, RotationX, RotationY, RotationZ, RotationW, SitTargetOffsetX, SitTargetOffsetY, SitTargetOffsetZ, SitTargetOrientW, SitTargetOrientX, SitTargetOrientY, SitTargetOrientZ, PayPrice, PayButton1, PayButton2, PayButton3, PayButton4, CONVERT(uniqueidentifier, LoopedSound), LoopedSoundGain, TextureAnimation, OmegaX, OmegaY, OmegaZ, CameraEyeOffsetX, CameraEyeOffsetY, CameraEyeOffsetZ, CameraAtOffsetX, CameraAtOffsetY, CameraAtOffsetZ, ForceMouselook, ScriptAccessPin, AllowedDrop, DieAtEdge, SalePrice, SaleType, ColorR, ColorG, ColorB, ColorA, ParticleSystem, ClickAction, Material, CONVERT(uniqueidentifier, CollisionSound), CollisionSoundVolume, LinkNumber FROM dbo.prims WITH (HOLDLOCK TABLOCKX)')
90
91DROP TABLE dbo.prims
92
93EXECUTE sp_rename N'dbo.Tmp_prims', N'prims', 'OBJECT'
94
95ALTER TABLE dbo.prims ADD CONSTRAINT
96 PK__prims__10566F31 PRIMARY KEY CLUSTERED
97 (
98 UUID
99 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
100
101
102CREATE NONCLUSTERED INDEX prims_regionuuid ON dbo.prims
103 (
104 RegionUUID
105 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
106
107CREATE NONCLUSTERED INDEX prims_parentid ON dbo.prims
108 (
109 ParentID
110 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
111
112COMMIT
diff --git a/OpenSim/Data/MSSQL/Resources/014_RegionStore.sql b/OpenSim/Data/MSSQL/Resources/014_RegionStore.sql
new file mode 100644
index 0000000..02f6f55
--- /dev/null
+++ b/OpenSim/Data/MSSQL/Resources/014_RegionStore.sql
@@ -0,0 +1,49 @@
1BEGIN TRANSACTION
2
3CREATE TABLE dbo.Tmp_primshapes
4 (
5 UUID uniqueidentifier NOT NULL,
6 Shape int NULL,
7 ScaleX float(53) NULL,
8 ScaleY float(53) NULL,
9 ScaleZ float(53) NULL,
10 PCode int NULL,
11 PathBegin int NULL,
12 PathEnd int NULL,
13 PathScaleX int NULL,
14 PathScaleY int NULL,
15 PathShearX int NULL,
16 PathShearY int NULL,
17 PathSkew int NULL,
18 PathCurve int NULL,
19 PathRadiusOffset int NULL,
20 PathRevolutions int NULL,
21 PathTaperX int NULL,
22 PathTaperY int NULL,
23 PathTwist int NULL,
24 PathTwistBegin int NULL,
25 ProfileBegin int NULL,
26 ProfileEnd int NULL,
27 ProfileCurve int NULL,
28 ProfileHollow int NULL,
29 State int NULL,
30 Texture image NULL,
31 ExtraParams image NULL
32 ) ON [PRIMARY]
33 TEXTIMAGE_ON [PRIMARY]
34
35IF EXISTS(SELECT * FROM dbo.primshapes)
36 EXEC('INSERT INTO dbo.Tmp_primshapes (UUID, Shape, ScaleX, ScaleY, ScaleZ, PCode, PathBegin, PathEnd, PathScaleX, PathScaleY, PathShearX, PathShearY, PathSkew, PathCurve, PathRadiusOffset, PathRevolutions, PathTaperX, PathTaperY, PathTwist, PathTwistBegin, ProfileBegin, ProfileEnd, ProfileCurve, ProfileHollow, State, Texture, ExtraParams)
37 SELECT CONVERT(uniqueidentifier, UUID), Shape, ScaleX, ScaleY, ScaleZ, PCode, PathBegin, PathEnd, PathScaleX, PathScaleY, PathShearX, PathShearY, PathSkew, PathCurve, PathRadiusOffset, PathRevolutions, PathTaperX, PathTaperY, PathTwist, PathTwistBegin, ProfileBegin, ProfileEnd, ProfileCurve, ProfileHollow, State, Texture, ExtraParams FROM dbo.primshapes WITH (HOLDLOCK TABLOCKX)')
38
39DROP TABLE dbo.primshapes
40
41EXECUTE sp_rename N'dbo.Tmp_primshapes', N'primshapes', 'OBJECT'
42
43ALTER TABLE dbo.primshapes ADD CONSTRAINT
44 PK__primshapes__0880433F PRIMARY KEY CLUSTERED
45 (
46 UUID
47 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
48
49COMMIT
diff --git a/OpenSim/Data/MSSQL/Resources/015_RegionStore.sql b/OpenSim/Data/MSSQL/Resources/015_RegionStore.sql
new file mode 100644
index 0000000..cbaaf88
--- /dev/null
+++ b/OpenSim/Data/MSSQL/Resources/015_RegionStore.sql
@@ -0,0 +1,45 @@
1BEGIN TRANSACTION
2
3CREATE TABLE dbo.Tmp_primitems
4 (
5 itemID uniqueidentifier NOT NULL,
6 primID uniqueidentifier NULL,
7 assetID uniqueidentifier NULL,
8 parentFolderID uniqueidentifier NULL,
9 invType int NULL,
10 assetType int NULL,
11 name varchar(255) NULL,
12 description varchar(255) NULL,
13 creationDate varchar(255) NULL,
14 creatorID uniqueidentifier NULL,
15 ownerID uniqueidentifier NULL,
16 lastOwnerID uniqueidentifier NULL,
17 groupID uniqueidentifier NULL,
18 nextPermissions int NULL,
19 currentPermissions int NULL,
20 basePermissions int NULL,
21 everyonePermissions int NULL,
22 groupPermissions int NULL,
23 flags int NOT NULL DEFAULT ((0))
24 ) ON [PRIMARY]
25
26IF EXISTS(SELECT * FROM dbo.primitems)
27 EXEC('INSERT INTO dbo.Tmp_primitems (itemID, primID, assetID, parentFolderID, invType, assetType, name, description, creationDate, creatorID, ownerID, lastOwnerID, groupID, nextPermissions, currentPermissions, basePermissions, everyonePermissions, groupPermissions, flags)
28 SELECT CONVERT(uniqueidentifier, itemID), CONVERT(uniqueidentifier, primID), CONVERT(uniqueidentifier, assetID), CONVERT(uniqueidentifier, parentFolderID), invType, assetType, name, description, creationDate, CONVERT(uniqueidentifier, creatorID), CONVERT(uniqueidentifier, ownerID), CONVERT(uniqueidentifier, lastOwnerID), CONVERT(uniqueidentifier, groupID), nextPermissions, currentPermissions, basePermissions, everyonePermissions, groupPermissions, flags FROM dbo.primitems WITH (HOLDLOCK TABLOCKX)')
29
30DROP TABLE dbo.primitems
31
32EXECUTE sp_rename N'dbo.Tmp_primitems', N'primitems', 'OBJECT'
33
34ALTER TABLE dbo.primitems ADD CONSTRAINT
35 PK__primitems__0A688BB1 PRIMARY KEY CLUSTERED
36 (
37 itemID
38 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
39
40CREATE NONCLUSTERED INDEX primitems_primid ON dbo.primitems
41 (
42 primID
43 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
44
45COMMIT
diff --git a/OpenSim/Data/MSSQL/Resources/016_RegionStore.sql b/OpenSim/Data/MSSQL/Resources/016_RegionStore.sql
new file mode 100644
index 0000000..e91da19
--- /dev/null
+++ b/OpenSim/Data/MSSQL/Resources/016_RegionStore.sql
@@ -0,0 +1,19 @@
1BEGIN TRANSACTION
2
3CREATE TABLE dbo.Tmp_terrain
4 (
5 RegionUUID uniqueidentifier NULL,
6 Revision int NULL,
7 Heightfield image NULL
8 ) ON [PRIMARY]
9 TEXTIMAGE_ON [PRIMARY]
10
11IF EXISTS(SELECT * FROM dbo.terrain)
12 EXEC('INSERT INTO dbo.Tmp_terrain (RegionUUID, Revision, Heightfield)
13 SELECT CONVERT(uniqueidentifier, RegionUUID), Revision, Heightfield FROM dbo.terrain WITH (HOLDLOCK TABLOCKX)')
14
15DROP TABLE dbo.terrain
16
17EXECUTE sp_rename N'dbo.Tmp_terrain', N'terrain', 'OBJECT'
18
19COMMIT
diff --git a/OpenSim/Data/MSSQL/Resources/017_RegionStore.sql b/OpenSim/Data/MSSQL/Resources/017_RegionStore.sql
new file mode 100644
index 0000000..3d3dbc0
--- /dev/null
+++ b/OpenSim/Data/MSSQL/Resources/017_RegionStore.sql
@@ -0,0 +1,56 @@
1BEGIN TRANSACTION
2
3CREATE TABLE dbo.Tmp_land
4 (
5 UUID uniqueidentifier NOT NULL,
6 RegionUUID uniqueidentifier NULL,
7 LocalLandID int NULL,
8 Bitmap image NULL,
9 Name varchar(255) NULL,
10 Description varchar(255) NULL,
11 OwnerUUID uniqueidentifier NULL,
12 IsGroupOwned int NULL,
13 Area int NULL,
14 AuctionID int NULL,
15 Category int NULL,
16 ClaimDate int NULL,
17 ClaimPrice int NULL,
18 GroupUUID uniqueidentifier NULL,
19 SalePrice int NULL,
20 LandStatus int NULL,
21 LandFlags int NULL,
22 LandingType int NULL,
23 MediaAutoScale int NULL,
24 MediaTextureUUID uniqueidentifier NULL,
25 MediaURL varchar(255) NULL,
26 MusicURL varchar(255) NULL,
27 PassHours float(53) NULL,
28 PassPrice int NULL,
29 SnapshotUUID uniqueidentifier NULL,
30 UserLocationX float(53) NULL,
31 UserLocationY float(53) NULL,
32 UserLocationZ float(53) NULL,
33 UserLookAtX float(53) NULL,
34 UserLookAtY float(53) NULL,
35 UserLookAtZ float(53) NULL,
36 AuthbuyerID uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'),
37 OtherCleanTime int NOT NULL DEFAULT ((0)),
38 Dwell int NOT NULL DEFAULT ((0))
39 ) ON [PRIMARY]
40 TEXTIMAGE_ON [PRIMARY]
41
42IF EXISTS(SELECT * FROM dbo.land)
43 EXEC('INSERT INTO dbo.Tmp_land (UUID, RegionUUID, LocalLandID, Bitmap, Name, Description, OwnerUUID, IsGroupOwned, Area, AuctionID, Category, ClaimDate, ClaimPrice, GroupUUID, SalePrice, LandStatus, LandFlags, LandingType, MediaAutoScale, MediaTextureUUID, MediaURL, MusicURL, PassHours, PassPrice, SnapshotUUID, UserLocationX, UserLocationY, UserLocationZ, UserLookAtX, UserLookAtY, UserLookAtZ, AuthbuyerID, OtherCleanTime, Dwell)
44 SELECT CONVERT(uniqueidentifier, UUID), CONVERT(uniqueidentifier, RegionUUID), LocalLandID, Bitmap, Name, Description, CONVERT(uniqueidentifier, OwnerUUID), IsGroupOwned, Area, AuctionID, Category, ClaimDate, ClaimPrice, CONVERT(uniqueidentifier, GroupUUID), SalePrice, LandStatus, LandFlags, LandingType, MediaAutoScale, CONVERT(uniqueidentifier, MediaTextureUUID), MediaURL, MusicURL, PassHours, PassPrice, CONVERT(uniqueidentifier, SnapshotUUID), UserLocationX, UserLocationY, UserLocationZ, UserLookAtX, UserLookAtY, UserLookAtZ, CONVERT(uniqueidentifier, AuthbuyerID), OtherCleanTime, Dwell FROM dbo.land WITH (HOLDLOCK TABLOCKX)')
45
46DROP TABLE dbo.land
47
48EXECUTE sp_rename N'dbo.Tmp_land', N'land', 'OBJECT'
49
50ALTER TABLE dbo.land ADD CONSTRAINT
51 PK__land__65A475E71BFD2C07 PRIMARY KEY CLUSTERED
52 (
53 UUID
54 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
55
56COMMIT
diff --git a/OpenSim/Data/MSSQL/Resources/018_RegionStore.sql b/OpenSim/Data/MSSQL/Resources/018_RegionStore.sql
new file mode 100644
index 0000000..6157e35
--- /dev/null
+++ b/OpenSim/Data/MSSQL/Resources/018_RegionStore.sql
@@ -0,0 +1,18 @@
1BEGIN TRANSACTION
2
3CREATE TABLE dbo.Tmp_landaccesslist
4 (
5 LandUUID uniqueidentifier NULL,
6 AccessUUID uniqueidentifier NULL,
7 Flags int NULL
8 ) ON [PRIMARY]
9
10IF EXISTS(SELECT * FROM dbo.landaccesslist)
11 EXEC('INSERT INTO dbo.Tmp_landaccesslist (LandUUID, AccessUUID, Flags)
12 SELECT CONVERT(uniqueidentifier, LandUUID), CONVERT(uniqueidentifier, AccessUUID), Flags FROM dbo.landaccesslist WITH (HOLDLOCK TABLOCKX)')
13
14DROP TABLE dbo.landaccesslist
15
16EXECUTE sp_rename N'dbo.Tmp_landaccesslist', N'landaccesslist', 'OBJECT'
17
18COMMIT
diff --git a/OpenSim/Data/MSSQL/Resources/019_RegionStore.sql b/OpenSim/Data/MSSQL/Resources/019_RegionStore.sql
new file mode 100644
index 0000000..8e613b9
--- /dev/null
+++ b/OpenSim/Data/MSSQL/Resources/019_RegionStore.sql
@@ -0,0 +1,19 @@
1BEGIN TRANSACTION
2
3CREATE TABLE dbo.Tmp_regionban
4 (
5 regionUUID uniqueidentifier NOT NULL,
6 bannedUUID uniqueidentifier NOT NULL,
7 bannedIp varchar(16) NOT NULL,
8 bannedIpHostMask varchar(16) NOT NULL
9 ) ON [PRIMARY]
10
11IF EXISTS(SELECT * FROM dbo.regionban)
12 EXEC('INSERT INTO dbo.Tmp_regionban (regionUUID, bannedUUID, bannedIp, bannedIpHostMask)
13 SELECT CONVERT(uniqueidentifier, regionUUID), CONVERT(uniqueidentifier, bannedUUID), bannedIp, bannedIpHostMask FROM dbo.regionban WITH (HOLDLOCK TABLOCKX)')
14
15DROP TABLE dbo.regionban
16
17EXECUTE sp_rename N'dbo.Tmp_regionban', N'regionban', 'OBJECT'
18
19COMMIT
diff --git a/OpenSim/Data/MSSQL/Resources/020_RegionStore.sql b/OpenSim/Data/MSSQL/Resources/020_RegionStore.sql
new file mode 100644
index 0000000..2ce91f6
--- /dev/null
+++ b/OpenSim/Data/MSSQL/Resources/020_RegionStore.sql
@@ -0,0 +1,58 @@
1BEGIN TRANSACTION
2
3CREATE TABLE dbo.Tmp_regionsettings
4 (
5 regionUUID uniqueidentifier NOT NULL,
6 block_terraform bit NOT NULL,
7 block_fly bit NOT NULL,
8 allow_damage bit NOT NULL,
9 restrict_pushing bit NOT NULL,
10 allow_land_resell bit NOT NULL,
11 allow_land_join_divide bit NOT NULL,
12 block_show_in_search bit NOT NULL,
13 agent_limit int NOT NULL,
14 object_bonus float(53) NOT NULL,
15 maturity int NOT NULL,
16 disable_scripts bit NOT NULL,
17 disable_collisions bit NOT NULL,
18 disable_physics bit NOT NULL,
19 terrain_texture_1 uniqueidentifier NOT NULL,
20 terrain_texture_2 uniqueidentifier NOT NULL,
21 terrain_texture_3 uniqueidentifier NOT NULL,
22 terrain_texture_4 uniqueidentifier NOT NULL,
23 elevation_1_nw float(53) NOT NULL,
24 elevation_2_nw float(53) NOT NULL,
25 elevation_1_ne float(53) NOT NULL,
26 elevation_2_ne float(53) NOT NULL,
27 elevation_1_se float(53) NOT NULL,
28 elevation_2_se float(53) NOT NULL,
29 elevation_1_sw float(53) NOT NULL,
30 elevation_2_sw float(53) NOT NULL,
31 water_height float(53) NOT NULL,
32 terrain_raise_limit float(53) NOT NULL,
33 terrain_lower_limit float(53) NOT NULL,
34 use_estate_sun bit NOT NULL,
35 fixed_sun bit NOT NULL,
36 sun_position float(53) NOT NULL,
37 covenant uniqueidentifier NULL DEFAULT (NULL),
38 Sandbox bit NOT NULL,
39 sunvectorx float(53) NOT NULL DEFAULT ((0)),
40 sunvectory float(53) NOT NULL DEFAULT ((0)),
41 sunvectorz float(53) NOT NULL DEFAULT ((0))
42 ) ON [PRIMARY]
43
44IF EXISTS(SELECT * FROM dbo.regionsettings)
45 EXEC('INSERT INTO dbo.Tmp_regionsettings (regionUUID, block_terraform, block_fly, allow_damage, restrict_pushing, allow_land_resell, allow_land_join_divide, block_show_in_search, agent_limit, object_bonus, maturity, disable_scripts, disable_collisions, disable_physics, terrain_texture_1, terrain_texture_2, terrain_texture_3, terrain_texture_4, elevation_1_nw, elevation_2_nw, elevation_1_ne, elevation_2_ne, elevation_1_se, elevation_2_se, elevation_1_sw, elevation_2_sw, water_height, terrain_raise_limit, terrain_lower_limit, use_estate_sun, fixed_sun, sun_position, covenant, Sandbox, sunvectorx, sunvectory, sunvectorz)
46 SELECT CONVERT(uniqueidentifier, regionUUID), block_terraform, block_fly, allow_damage, restrict_pushing, allow_land_resell, allow_land_join_divide, block_show_in_search, agent_limit, object_bonus, maturity, disable_scripts, disable_collisions, disable_physics, CONVERT(uniqueidentifier, terrain_texture_1), CONVERT(uniqueidentifier, terrain_texture_2), CONVERT(uniqueidentifier, terrain_texture_3), CONVERT(uniqueidentifier, terrain_texture_4), elevation_1_nw, elevation_2_nw, elevation_1_ne, elevation_2_ne, elevation_1_se, elevation_2_se, elevation_1_sw, elevation_2_sw, water_height, terrain_raise_limit, terrain_lower_limit, use_estate_sun, fixed_sun, sun_position, CONVERT(uniqueidentifier, covenant), Sandbox, sunvectorx, sunvectory, sunvectorz FROM dbo.regionsettings WITH (HOLDLOCK TABLOCKX)')
47
48DROP TABLE dbo.regionsettings
49
50EXECUTE sp_rename N'dbo.Tmp_regionsettings', N'regionsettings', 'OBJECT'
51
52ALTER TABLE dbo.regionsettings ADD CONSTRAINT
53 PK__regionse__5B35159D21B6055D PRIMARY KEY CLUSTERED
54 (
55 regionUUID
56 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
57
58COMMIT