aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data/MySQL')
-rw-r--r--OpenSim/Data/MySQL/MySQLAssetData.cs6
-rw-r--r--OpenSim/Data/MySQL/MySQLGenericTableHandler.cs7
-rw-r--r--OpenSim/Data/MySQL/MySQLSimulationData.cs276
-rw-r--r--OpenSim/Data/MySQL/MySQLUserAccountData.cs46
-rw-r--r--OpenSim/Data/MySQL/MySQLXAssetData.cs2
-rw-r--r--OpenSim/Data/MySQL/Resources/RegionStore.migrations2
6 files changed, 246 insertions, 93 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs
index 73de64b..20df234 100644
--- a/OpenSim/Data/MySQL/MySQLAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLAssetData.cs
@@ -155,7 +155,7 @@ namespace OpenSim.Data.MySQL
155 /// </summary> 155 /// </summary>
156 /// <param name="asset">Asset UUID to create</param> 156 /// <param name="asset">Asset UUID to create</param>
157 /// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks> 157 /// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks>
158 override public void StoreAsset(AssetBase asset) 158 override public bool StoreAsset(AssetBase asset)
159 { 159 {
160 lock (m_dbLock) 160 lock (m_dbLock)
161 { 161 {
@@ -201,12 +201,14 @@ namespace OpenSim.Data.MySQL
201 cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags); 201 cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags);
202 cmd.Parameters.AddWithValue("?data", asset.Data); 202 cmd.Parameters.AddWithValue("?data", asset.Data);
203 cmd.ExecuteNonQuery(); 203 cmd.ExecuteNonQuery();
204 return true;
204 } 205 }
205 } 206 }
206 catch (Exception e) 207 catch (Exception e)
207 { 208 {
208 m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}", 209 m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}",
209 asset.FullID, asset.Name, e.Message); 210 asset.FullID, asset.Name, e.Message);
211 return false;
210 } 212 }
211 } 213 }
212 } 214 }
@@ -370,4 +372,4 @@ namespace OpenSim.Data.MySQL
370 372
371 #endregion 373 #endregion
372 } 374 }
373} \ No newline at end of file 375}
diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
index 995c6a5..f6731c0 100644
--- a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
+++ b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
@@ -175,6 +175,11 @@ namespace OpenSim.Data.MySQL
175 int v = Convert.ToInt32(reader[name]); 175 int v = Convert.ToInt32(reader[name]);
176 m_Fields[name].SetValue(row, v); 176 m_Fields[name].SetValue(row, v);
177 } 177 }
178 else if (m_Fields[name].FieldType == typeof(uint))
179 {
180 uint v = Convert.ToUInt32(reader[name]);
181 m_Fields[name].SetValue(row, v);
182 }
178 else 183 else
179 { 184 {
180 m_Fields[name].SetValue(row, reader[name]); 185 m_Fields[name].SetValue(row, reader[name]);
@@ -302,4 +307,4 @@ namespace OpenSim.Data.MySQL
302 } 307 }
303 } 308 }
304 } 309 }
305} \ No newline at end of file 310}
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index c95311e..3fab27a 100644
--- a/OpenSim/Data/MySQL/MySQLSimulationData.cs
+++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs
@@ -66,7 +66,7 @@ namespace OpenSim.Data.MySQL
66 Initialise(connectionString); 66 Initialise(connectionString);
67 } 67 }
68 68
69 public void Initialise(string connectionString) 69 public virtual void Initialise(string connectionString)
70 { 70 {
71 m_connectionString = connectionString; 71 m_connectionString = connectionString;
72 72
@@ -113,14 +113,16 @@ namespace OpenSim.Data.MySQL
113 113
114 public void Dispose() {} 114 public void Dispose() {}
115 115
116 public void StoreObject(SceneObjectGroup obj, UUID regionUUID) 116 public virtual void StoreObject(SceneObjectGroup obj, UUID regionUUID)
117 { 117 {
118 uint flags = obj.RootPart.GetEffectiveObjectFlags(); 118 uint flags = obj.RootPart.GetEffectiveObjectFlags();
119 119
120 // Eligibility check 120 // Eligibility check
121 // 121 //
122 if ((flags & (uint)PrimFlags.Temporary) != 0) 122 // PrimFlags.Temporary is not used in OpenSim code and cannot
123 return; 123 // be guaranteed to always be clear. Don't check it.
124// if ((flags & (uint)PrimFlags.Temporary) != 0)
125// return;
124 if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0) 126 if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0)
125 return; 127 return;
126 128
@@ -135,7 +137,7 @@ namespace OpenSim.Data.MySQL
135 foreach (SceneObjectPart prim in obj.Parts) 137 foreach (SceneObjectPart prim in obj.Parts)
136 { 138 {
137 cmd.Parameters.Clear(); 139 cmd.Parameters.Clear();
138 140
139 cmd.CommandText = "replace into prims (" + 141 cmd.CommandText = "replace into prims (" +
140 "UUID, CreationDate, " + 142 "UUID, CreationDate, " +
141 "Name, Text, Description, " + 143 "Name, Text, Description, " +
@@ -171,8 +173,11 @@ namespace OpenSim.Data.MySQL
171 "ParticleSystem, ClickAction, Material, " + 173 "ParticleSystem, ClickAction, Material, " +
172 "CollisionSound, CollisionSoundVolume, " + 174 "CollisionSound, CollisionSoundVolume, " +
173 "PassTouches, " + 175 "PassTouches, " +
174 "LinkNumber, MediaURL, DynAttrs) " + 176 "PassCollisions, " +
175 "values (?UUID, " + 177 "LinkNumber, MediaURL, KeyframeMotion, " +
178 "PhysicsShapeType, Density, GravityModifier, " +
179 "Friction, Restitution, Vehicle, DynAttrs " +
180 ") values (" + "?UUID, " +
176 "?CreationDate, ?Name, ?Text, " + 181 "?CreationDate, ?Name, ?Text, " +
177 "?Description, ?SitName, ?TouchName, " + 182 "?Description, ?SitName, ?TouchName, " +
178 "?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " + 183 "?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " +
@@ -203,15 +208,17 @@ namespace OpenSim.Data.MySQL
203 "?SaleType, ?ColorR, ?ColorG, " + 208 "?SaleType, ?ColorR, ?ColorG, " +
204 "?ColorB, ?ColorA, ?ParticleSystem, " + 209 "?ColorB, ?ColorA, ?ParticleSystem, " +
205 "?ClickAction, ?Material, ?CollisionSound, " + 210 "?ClickAction, ?Material, ?CollisionSound, " +
206 "?CollisionSoundVolume, ?PassTouches, ?LinkNumber, " + 211 "?CollisionSoundVolume, ?PassTouches, ?PassCollisions, " +
207 "?MediaURL, ?DynAttrs)"; 212 "?LinkNumber, ?MediaURL, ?KeyframeMotion, " +
208 213 "?PhysicsShapeType, ?Density, ?GravityModifier, " +
214 "?Friction, ?Restitution, ?Vehicle, ?DynAttrs)";
215
209 FillPrimCommand(cmd, prim, obj.UUID, regionUUID); 216 FillPrimCommand(cmd, prim, obj.UUID, regionUUID);
210 217
211 ExecuteNonQuery(cmd); 218 ExecuteNonQuery(cmd);
212 219
213 cmd.Parameters.Clear(); 220 cmd.Parameters.Clear();
214 221
215 cmd.CommandText = "replace into primshapes (" + 222 cmd.CommandText = "replace into primshapes (" +
216 "UUID, Shape, ScaleX, ScaleY, " + 223 "UUID, Shape, ScaleX, ScaleY, " +
217 "ScaleZ, PCode, PathBegin, PathEnd, " + 224 "ScaleZ, PCode, PathBegin, PathEnd, " +
@@ -234,9 +241,9 @@ namespace OpenSim.Data.MySQL
234 "?ProfileEnd, ?ProfileCurve, " + 241 "?ProfileEnd, ?ProfileCurve, " +
235 "?ProfileHollow, ?Texture, ?ExtraParams, " + 242 "?ProfileHollow, ?Texture, ?ExtraParams, " +
236 "?State, ?Media)"; 243 "?State, ?Media)";
237 244
238 FillShapeCommand(cmd, prim); 245 FillShapeCommand(cmd, prim);
239 246
240 ExecuteNonQuery(cmd); 247 ExecuteNonQuery(cmd);
241 } 248 }
242 } 249 }
@@ -244,7 +251,7 @@ namespace OpenSim.Data.MySQL
244 } 251 }
245 } 252 }
246 253
247 public void RemoveObject(UUID obj, UUID regionUUID) 254 public virtual void RemoveObject(UUID obj, UUID regionUUID)
248 { 255 {
249// m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID); 256// m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID);
250 257
@@ -393,7 +400,7 @@ namespace OpenSim.Data.MySQL
393 } 400 }
394 } 401 }
395 402
396 public List<SceneObjectGroup> LoadObjects(UUID regionID) 403 public virtual List<SceneObjectGroup> LoadObjects(UUID regionID)
397 { 404 {
398 const int ROWS_PER_QUERY = 5000; 405 const int ROWS_PER_QUERY = 5000;
399 406
@@ -449,7 +456,11 @@ namespace OpenSim.Data.MySQL
449 foreach (SceneObjectPart prim in prims.Values) 456 foreach (SceneObjectPart prim in prims.Values)
450 { 457 {
451 if (prim.ParentUUID == UUID.Zero) 458 if (prim.ParentUUID == UUID.Zero)
459 {
452 objects[prim.UUID] = new SceneObjectGroup(prim); 460 objects[prim.UUID] = new SceneObjectGroup(prim);
461 if (prim.KeyframeMotion != null)
462 prim.KeyframeMotion.UpdateSceneObject(objects[prim.UUID]);
463 }
453 } 464 }
454 465
455 // Add all of the children objects to the SOGs 466 // Add all of the children objects to the SOGs
@@ -562,36 +573,51 @@ namespace OpenSim.Data.MySQL
562 } 573 }
563 } 574 }
564 575
565 public void StoreTerrain(double[,] ter, UUID regionID) 576 public virtual void StoreTerrain(double[,] ter, UUID regionID)
566 { 577 {
567 m_log.Info("[REGION DB]: Storing terrain"); 578 Util.FireAndForget(delegate(object x)
568
569 lock (m_dbLock)
570 { 579 {
571 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 580 double[,] oldTerrain = LoadTerrain(regionID);
572 {
573 dbcon.Open();
574 581
575 using (MySqlCommand cmd = dbcon.CreateCommand()) 582 m_log.Info("[REGION DB]: Storing terrain");
583
584 lock (m_dbLock)
585 {
586 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
576 { 587 {
577 cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID"; 588 dbcon.Open();
578 cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString());
579 589
580 ExecuteNonQuery(cmd); 590 using (MySqlCommand cmd = dbcon.CreateCommand())
591 {
592 cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID";
593 cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString());
581 594
582 cmd.CommandText = "insert into terrain (RegionUUID, " + 595 using (MySqlCommand cmd2 = dbcon.CreateCommand())
583 "Revision, Heightfield) values (?RegionUUID, " + 596 {
584 "1, ?Heightfield)"; 597 try
598 {
599 cmd2.CommandText = "insert into terrain (RegionUUID, " +
600 "Revision, Heightfield) values (?RegionUUID, " +
601 "1, ?Heightfield)";
585 602
586 cmd.Parameters.AddWithValue("Heightfield", SerializeTerrain(ter)); 603 cmd2.Parameters.AddWithValue("RegionUUID", regionID.ToString());
604 cmd2.Parameters.AddWithValue("Heightfield", SerializeTerrain(ter, oldTerrain));
587 605
588 ExecuteNonQuery(cmd); 606 ExecuteNonQuery(cmd);
607 ExecuteNonQuery(cmd2);
608 }
609 catch (Exception e)
610 {
611 m_log.ErrorFormat(e.ToString());
612 }
613 }
614 }
589 } 615 }
590 } 616 }
591 } 617 });
592 } 618 }
593 619
594 public double[,] LoadTerrain(UUID regionID) 620 public virtual double[,] LoadTerrain(UUID regionID)
595 { 621 {
596 double[,] terrain = null; 622 double[,] terrain = null;
597 623
@@ -641,7 +667,7 @@ namespace OpenSim.Data.MySQL
641 return terrain; 667 return terrain;
642 } 668 }
643 669
644 public void RemoveLandObject(UUID globalID) 670 public virtual void RemoveLandObject(UUID globalID)
645 { 671 {
646 lock (m_dbLock) 672 lock (m_dbLock)
647 { 673 {
@@ -660,7 +686,7 @@ namespace OpenSim.Data.MySQL
660 } 686 }
661 } 687 }
662 688
663 public void StoreLandObject(ILandObject parcel) 689 public virtual void StoreLandObject(ILandObject parcel)
664 { 690 {
665 lock (m_dbLock) 691 lock (m_dbLock)
666 { 692 {
@@ -717,7 +743,7 @@ namespace OpenSim.Data.MySQL
717 } 743 }
718 } 744 }
719 745
720 public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) 746 public virtual RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
721 { 747 {
722 RegionLightShareData nWP = new RegionLightShareData(); 748 RegionLightShareData nWP = new RegionLightShareData();
723 nWP.OnSave += StoreRegionWindlightSettings; 749 nWP.OnSave += StoreRegionWindlightSettings;
@@ -741,7 +767,7 @@ namespace OpenSim.Data.MySQL
741 { 767 {
742 //No result, so store our default windlight profile and return it 768 //No result, so store our default windlight profile and return it
743 nWP.regionID = regionUUID; 769 nWP.regionID = regionUUID;
744 StoreRegionWindlightSettings(nWP); 770// StoreRegionWindlightSettings(nWP);
745 return nWP; 771 return nWP;
746 } 772 }
747 else 773 else
@@ -818,7 +844,7 @@ namespace OpenSim.Data.MySQL
818 return nWP; 844 return nWP;
819 } 845 }
820 846
821 public RegionSettings LoadRegionSettings(UUID regionUUID) 847 public virtual RegionSettings LoadRegionSettings(UUID regionUUID)
822 { 848 {
823 RegionSettings rs = null; 849 RegionSettings rs = null;
824 850
@@ -858,7 +884,7 @@ namespace OpenSim.Data.MySQL
858 return rs; 884 return rs;
859 } 885 }
860 886
861 public void StoreRegionWindlightSettings(RegionLightShareData wl) 887 public virtual void StoreRegionWindlightSettings(RegionLightShareData wl)
862 { 888 {
863 lock (m_dbLock) 889 lock (m_dbLock)
864 { 890 {
@@ -964,7 +990,7 @@ namespace OpenSim.Data.MySQL
964 } 990 }
965 } 991 }
966 992
967 public void RemoveRegionWindlightSettings(UUID regionID) 993 public virtual void RemoveRegionWindlightSettings(UUID regionID)
968 { 994 {
969 lock (m_dbLock) 995 lock (m_dbLock)
970 { 996 {
@@ -1053,7 +1079,7 @@ namespace OpenSim.Data.MySQL
1053 } 1079 }
1054 #endregion 1080 #endregion
1055 1081
1056 public void StoreRegionSettings(RegionSettings rs) 1082 public virtual void StoreRegionSettings(RegionSettings rs)
1057 { 1083 {
1058 lock (m_dbLock) 1084 lock (m_dbLock)
1059 { 1085 {
@@ -1080,7 +1106,7 @@ namespace OpenSim.Data.MySQL
1080 "use_estate_sun, fixed_sun, sun_position, " + 1106 "use_estate_sun, fixed_sun, sun_position, " +
1081 "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " + 1107 "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " +
1082 "sunvectorz, loaded_creation_datetime, " + 1108 "sunvectorz, loaded_creation_datetime, " +
1083 "loaded_creation_id, map_tile_ID, " + 1109 "loaded_creation_id, map_tile_ID, block_search, casino, " +
1084 "TelehubObject, parcel_tile_ID) " + 1110 "TelehubObject, parcel_tile_ID) " +
1085 "values (?RegionUUID, ?BlockTerraform, " + 1111 "values (?RegionUUID, ?BlockTerraform, " +
1086 "?BlockFly, ?AllowDamage, ?RestrictPushing, " + 1112 "?BlockFly, ?AllowDamage, ?RestrictPushing, " +
@@ -1097,7 +1123,8 @@ namespace OpenSim.Data.MySQL
1097 "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " + 1123 "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " +
1098 "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + 1124 "?SunVectorX, ?SunVectorY, ?SunVectorZ, " +
1099 "?LoadedCreationDateTime, ?LoadedCreationID, " + 1125 "?LoadedCreationDateTime, ?LoadedCreationID, " +
1100 "?TerrainImageID, ?TelehubObject, ?ParcelImageID) "; 1126 "?TerrainImageID, ?block_search, ?casino, " +
1127 "?TelehubObject, ?ParcelImageID)";
1101 1128
1102 FillRegionSettingsCommand(cmd, rs); 1129 FillRegionSettingsCommand(cmd, rs);
1103 1130
@@ -1108,7 +1135,7 @@ namespace OpenSim.Data.MySQL
1108 SaveSpawnPoints(rs); 1135 SaveSpawnPoints(rs);
1109 } 1136 }
1110 1137
1111 public List<LandData> LoadLandObjects(UUID regionUUID) 1138 public virtual List<LandData> LoadLandObjects(UUID regionUUID)
1112 { 1139 {
1113 List<LandData> landData = new List<LandData>(); 1140 List<LandData> landData = new List<LandData>();
1114 1141
@@ -1290,6 +1317,7 @@ namespace OpenSim.Data.MySQL
1290 prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"]; 1317 prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"];
1291 1318
1292 prim.PassTouches = ((sbyte)row["PassTouches"] != 0); 1319 prim.PassTouches = ((sbyte)row["PassTouches"] != 0);
1320 prim.PassCollisions = ((sbyte)row["PassCollisions"] != 0);
1293 prim.LinkNum = (int)row["LinkNumber"]; 1321 prim.LinkNum = (int)row["LinkNumber"];
1294 1322
1295 if (!(row["MediaURL"] is System.DBNull)) 1323 if (!(row["MediaURL"] is System.DBNull))
@@ -1300,6 +1328,34 @@ namespace OpenSim.Data.MySQL
1300 else 1328 else
1301 prim.DynAttrs = new DAMap(); 1329 prim.DynAttrs = new DAMap();
1302 1330
1331 if (!(row["KeyframeMotion"] is DBNull))
1332 {
1333 Byte[] data = (byte[])row["KeyframeMotion"];
1334 if (data.Length > 0)
1335 prim.KeyframeMotion = KeyframeMotion.FromData(null, data);
1336 else
1337 prim.KeyframeMotion = null;
1338 }
1339 else
1340 {
1341 prim.KeyframeMotion = null;
1342 }
1343
1344 prim.PhysicsShapeType = (byte)Convert.ToInt32(row["PhysicsShapeType"].ToString());
1345 prim.Density = (float)(double)row["Density"];
1346 prim.GravityModifier = (float)(double)row["GravityModifier"];
1347 prim.Friction = (float)(double)row["Friction"];
1348 prim.Bounciness = (float)(double)row["Restitution"];
1349
1350 SOPVehicle vehicle = null;
1351
1352 if (row["Vehicle"].ToString() != String.Empty)
1353 {
1354 vehicle = SOPVehicle.FromXml2(row["Vehicle"].ToString());
1355 if (vehicle != null)
1356 prim.VehicleParams = vehicle;
1357 }
1358
1303 return prim; 1359 return prim;
1304 } 1360 }
1305 1361
@@ -1310,32 +1366,40 @@ namespace OpenSim.Data.MySQL
1310 /// <returns></returns> 1366 /// <returns></returns>
1311 private static TaskInventoryItem BuildItem(IDataReader row) 1367 private static TaskInventoryItem BuildItem(IDataReader row)
1312 { 1368 {
1313 TaskInventoryItem taskItem = new TaskInventoryItem(); 1369 try
1314 1370 {
1315 taskItem.ItemID = DBGuid.FromDB(row["itemID"]); 1371 TaskInventoryItem taskItem = new TaskInventoryItem();
1316 taskItem.ParentPartID = DBGuid.FromDB(row["primID"]); 1372
1317 taskItem.AssetID = DBGuid.FromDB(row["assetID"]); 1373 taskItem.ItemID = DBGuid.FromDB(row["itemID"]);
1318 taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]); 1374 taskItem.ParentPartID = DBGuid.FromDB(row["primID"]);
1319 1375 taskItem.AssetID = DBGuid.FromDB(row["assetID"]);
1320 taskItem.InvType = Convert.ToInt32(row["invType"]); 1376 taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]);
1321 taskItem.Type = Convert.ToInt32(row["assetType"]); 1377
1322 1378 taskItem.InvType = Convert.ToInt32(row["invType"]);
1323 taskItem.Name = (String)row["name"]; 1379 taskItem.Type = Convert.ToInt32(row["assetType"]);
1324 taskItem.Description = (String)row["description"]; 1380
1325 taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); 1381 taskItem.Name = (String)row["name"];
1326 taskItem.CreatorIdentification = (String)row["creatorID"]; 1382 taskItem.Description = (String)row["description"];
1327 taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]); 1383 taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]);
1328 taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]); 1384 taskItem.CreatorIdentification = (String)row["creatorID"];
1329 taskItem.GroupID = DBGuid.FromDB(row["groupID"]); 1385 taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]);
1330 1386 taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]);
1331 taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]); 1387 taskItem.GroupID = DBGuid.FromDB(row["groupID"]);
1332 taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]); 1388
1333 taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]); 1389 taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]);
1334 taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]); 1390 taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]);
1335 taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]); 1391 taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]);
1336 taskItem.Flags = Convert.ToUInt32(row["flags"]); 1392 taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]);
1337 1393 taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]);
1338 return taskItem; 1394 taskItem.Flags = Convert.ToUInt32(row["flags"]);
1395
1396 return taskItem;
1397 }
1398 catch
1399 {
1400 m_log.ErrorFormat("[MYSQL DB]: Error reading task inventory: itemID was {0}, primID was {1}", row["itemID"].ToString(), row["primID"].ToString());
1401 throw;
1402 }
1339 } 1403 }
1340 1404
1341 private static RegionSettings BuildRegionSettings(IDataReader row) 1405 private static RegionSettings BuildRegionSettings(IDataReader row)
@@ -1393,6 +1457,9 @@ namespace OpenSim.Data.MySQL
1393 newSettings.ParcelImageID = DBGuid.FromDB(row["parcel_tile_ID"]); 1457 newSettings.ParcelImageID = DBGuid.FromDB(row["parcel_tile_ID"]);
1394 newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]); 1458 newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]);
1395 1459
1460 newSettings.GodBlockSearch = Convert.ToBoolean(row["block_search"]);
1461 newSettings.Casino = Convert.ToBoolean(row["casino"]);
1462
1396 return newSettings; 1463 return newSettings;
1397 } 1464 }
1398 1465
@@ -1490,7 +1557,7 @@ namespace OpenSim.Data.MySQL
1490 /// </summary> 1557 /// </summary>
1491 /// <param name="val"></param> 1558 /// <param name="val"></param>
1492 /// <returns></returns> 1559 /// <returns></returns>
1493 private static Array SerializeTerrain(double[,] val) 1560 private static Array SerializeTerrain(double[,] val, double[,] oldTerrain)
1494 { 1561 {
1495 MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double)); 1562 MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double));
1496 BinaryWriter bw = new BinaryWriter(str); 1563 BinaryWriter bw = new BinaryWriter(str);
@@ -1499,7 +1566,11 @@ namespace OpenSim.Data.MySQL
1499 for (int x = 0; x < (int)Constants.RegionSize; x++) 1566 for (int x = 0; x < (int)Constants.RegionSize; x++)
1500 for (int y = 0; y < (int)Constants.RegionSize; y++) 1567 for (int y = 0; y < (int)Constants.RegionSize; y++)
1501 { 1568 {
1502 double height = val[x, y]; 1569 double height = 20.0;
1570 if (oldTerrain != null)
1571 height = oldTerrain[x, y];
1572 if (!double.IsNaN(val[x, y]))
1573 height = val[x, y];
1503 if (height == 0.0) 1574 if (height == 0.0)
1504 height = double.Epsilon; 1575 height = double.Epsilon;
1505 1576
@@ -1643,9 +1714,30 @@ namespace OpenSim.Data.MySQL
1643 else 1714 else
1644 cmd.Parameters.AddWithValue("PassTouches", 0); 1715 cmd.Parameters.AddWithValue("PassTouches", 0);
1645 1716
1717 if (prim.PassCollisions)
1718 cmd.Parameters.AddWithValue("PassCollisions", 1);
1719 else
1720 cmd.Parameters.AddWithValue("PassCollisions", 0);
1721
1646 cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); 1722 cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum);
1647 cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); 1723 cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl);
1648 1724
1725 if (prim.KeyframeMotion != null)
1726 cmd.Parameters.AddWithValue("KeyframeMotion", prim.KeyframeMotion.Serialize());
1727 else
1728 cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]);
1729
1730 cmd.Parameters.AddWithValue("PhysicsShapeType", prim.PhysicsShapeType);
1731 cmd.Parameters.AddWithValue("Density", (double)prim.Density);
1732 cmd.Parameters.AddWithValue("GravityModifier", (double)prim.GravityModifier);
1733 cmd.Parameters.AddWithValue("Friction", (double)prim.Friction);
1734 cmd.Parameters.AddWithValue("Restitution", (double)prim.Bounciness);
1735
1736 if (prim.VehicleParams != null)
1737 cmd.Parameters.AddWithValue("Vehicle", prim.VehicleParams.ToXml2());
1738 else
1739 cmd.Parameters.AddWithValue("Vehicle", String.Empty);
1740
1649 if (prim.DynAttrs.Count > 0) 1741 if (prim.DynAttrs.Count > 0)
1650 cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml()); 1742 cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml());
1651 else 1743 else
@@ -1728,6 +1820,9 @@ namespace OpenSim.Data.MySQL
1728 cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); 1820 cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime);
1729 cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); 1821 cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID);
1730 cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); 1822 cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID);
1823 cmd.Parameters.AddWithValue("block_search", settings.GodBlockSearch);
1824 cmd.Parameters.AddWithValue("casino", settings.Casino);
1825
1731 cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID); 1826 cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID);
1732 cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject); 1827 cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject);
1733 } 1828 }
@@ -1888,7 +1983,7 @@ namespace OpenSim.Data.MySQL
1888 cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); 1983 cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml());
1889 } 1984 }
1890 1985
1891 public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) 1986 public virtual void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
1892 { 1987 {
1893 lock (m_dbLock) 1988 lock (m_dbLock)
1894 { 1989 {
@@ -1932,6 +2027,37 @@ namespace OpenSim.Data.MySQL
1932 } 2027 }
1933 } 2028 }
1934 2029
2030 public UUID[] GetObjectIDs(UUID regionID)
2031 {
2032 List<UUID> uuids = new List<UUID>();
2033
2034 lock (m_dbLock)
2035 {
2036 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
2037 {
2038 dbcon.Open();
2039
2040 using (MySqlCommand cmd = dbcon.CreateCommand())
2041 {
2042 cmd.CommandText = "select UUID from prims where RegionUUID = ?RegionUUID and SceneGroupID = UUID";
2043 cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString());
2044
2045 using (IDataReader reader = ExecuteReader(cmd))
2046 {
2047 while (reader.Read())
2048 {
2049 UUID id = new UUID(reader["UUID"].ToString());
2050
2051 uuids.Add(id);
2052 }
2053 }
2054 }
2055 }
2056 }
2057
2058 return uuids.ToArray();
2059 }
2060
1935 private void LoadSpawnPoints(RegionSettings rs) 2061 private void LoadSpawnPoints(RegionSettings rs)
1936 { 2062 {
1937 rs.ClearSpawnPoints(); 2063 rs.ClearSpawnPoints();
diff --git a/OpenSim/Data/MySQL/MySQLUserAccountData.cs b/OpenSim/Data/MySQL/MySQLUserAccountData.cs
index e964295..4ff3175 100644
--- a/OpenSim/Data/MySQL/MySQLUserAccountData.cs
+++ b/OpenSim/Data/MySQL/MySQLUserAccountData.cs
@@ -46,17 +46,21 @@ namespace OpenSim.Data.MySQL
46 { 46 {
47 string[] words = query.Split(new char[] {' '}); 47 string[] words = query.Split(new char[] {' '});
48 48
49 bool valid = false;
50
49 for (int i = 0 ; i < words.Length ; i++) 51 for (int i = 0 ; i < words.Length ; i++)
50 { 52 {
51 if (words[i].Length < 3) 53 if (words[i].Length > 2)
52 { 54 valid = true;
53 if (i != words.Length - 1) 55// if (words[i].Length < 3)
54 Array.Copy(words, i + 1, words, i, words.Length - i - 1); 56// {
55 Array.Resize(ref words, words.Length - 1); 57// if (i != words.Length - 1)
56 } 58// Array.Copy(words, i + 1, words, i, words.Length - i - 1);
59// Array.Resize(ref words, words.Length - 1);
60// }
57 } 61 }
58 62
59 if (words.Length == 0) 63 if ((!valid) || words.Length == 0)
60 return new UserAccountData[0]; 64 return new UserAccountData[0];
61 65
62 if (words.Length > 2) 66 if (words.Length > 2)
@@ -66,20 +70,36 @@ namespace OpenSim.Data.MySQL
66 { 70 {
67 if (words.Length == 1) 71 if (words.Length == 1)
68 { 72 {
69 cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?search or LastName like ?search)", m_Realm); 73 cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?search or LastName like ?search) and active=1", m_Realm);
70 cmd.Parameters.AddWithValue("?search", "%" + words[0] + "%"); 74 cmd.Parameters.AddWithValue("?search", words[0] + "%");
71 cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); 75 cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
72 } 76 }
73 else 77 else
74 { 78 {
75 cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst or LastName like ?searchLast)", m_Realm); 79 cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst and LastName like ?searchLast) and active=1", m_Realm);
76 cmd.Parameters.AddWithValue("?searchFirst", "%" + words[0] + "%"); 80 cmd.Parameters.AddWithValue("?searchFirst", words[0] + "%");
77 cmd.Parameters.AddWithValue("?searchLast", "%" + words[1] + "%"); 81 cmd.Parameters.AddWithValue("?searchLast", words[1] + "%");
78 cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); 82 cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
79 } 83 }
80 84
81 return DoQuery(cmd); 85 return DoQuery(cmd);
82 } 86 }
83 } 87 }
88
89 public UserAccountData[] GetUsersWhere(UUID scopeID, string where)
90 {
91 using (MySqlCommand cmd = new MySqlCommand())
92 {
93 if (scopeID != UUID.Zero)
94 {
95 where = "(ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (" + where + ")";
96 cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
97 }
98
99 cmd.CommandText = String.Format("select * from {0} where " + where, m_Realm);
100
101 return DoQuery(cmd);
102 }
103 }
84 } 104 }
85} \ No newline at end of file 105}
diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs
index e6ac22e..9a50373 100644
--- a/OpenSim/Data/MySQL/MySQLXAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs
@@ -497,4 +497,4 @@ namespace OpenSim.Data.MySQL
497 497
498 #endregion 498 #endregion
499 } 499 }
500} \ No newline at end of file 500}
diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations
index c48aec2..0be5587 100644
--- a/OpenSim/Data/MySQL/Resources/RegionStore.migrations
+++ b/OpenSim/Data/MySQL/Resources/RegionStore.migrations
@@ -717,7 +717,7 @@ ALTER TABLE regionsettings ADD COLUMN loaded_creation_datetime int unsigned NOT
717 717
718COMMIT; 718COMMIT;
719 719
720:VERSION 32 720:VERSION 32 #---------------------
721 721
722BEGIN; 722BEGIN;
723CREATE TABLE `regionwindlight` ( 723CREATE TABLE `regionwindlight` (