diff options
Diffstat (limited to 'OpenSim/Data/MySQL')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLAssetData.cs | 13 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLGenericTableHandler.cs | 7 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLSimulationData.cs | 214 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLUserAccountData.cs | 46 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLXAssetData.cs | 2 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/Resources/RegionStore.migrations | 10 |
6 files changed, 196 insertions, 96 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index 21362b9..59cc22a 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs | |||
@@ -156,7 +156,7 @@ namespace OpenSim.Data.MySQL | |||
156 | /// </summary> | 156 | /// </summary> |
157 | /// <param name="asset">Asset UUID to create</param> | 157 | /// <param name="asset">Asset UUID to create</param> |
158 | /// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks> | 158 | /// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks> |
159 | override public void StoreAsset(AssetBase asset) | 159 | override public bool StoreAsset(AssetBase asset) |
160 | { | 160 | { |
161 | lock (m_dbLock) | 161 | lock (m_dbLock) |
162 | { | 162 | { |
@@ -206,15 +206,14 @@ namespace OpenSim.Data.MySQL | |||
206 | cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags); | 206 | cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags); |
207 | cmd.Parameters.AddWithValue("?data", asset.Data); | 207 | cmd.Parameters.AddWithValue("?data", asset.Data); |
208 | cmd.ExecuteNonQuery(); | 208 | cmd.ExecuteNonQuery(); |
209 | return true; | ||
209 | } | 210 | } |
210 | } | 211 | } |
211 | catch (Exception e) | 212 | catch (Exception e) |
212 | { | 213 | { |
213 | m_log.Error( | 214 | m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}", |
214 | string.Format( | 215 | asset.FullID, asset.Name, e.Message); |
215 | "[ASSET DB]: MySQL failure creating asset {0} with name {1}. Exception ", | 216 | return false; |
216 | asset.FullID, asset.Name) | ||
217 | , e); | ||
218 | } | 217 | } |
219 | } | 218 | } |
220 | } | 219 | } |
@@ -383,4 +382,4 @@ namespace OpenSim.Data.MySQL | |||
383 | 382 | ||
384 | #endregion | 383 | #endregion |
385 | } | 384 | } |
386 | } \ No newline at end of file | 385 | } |
diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs index 35fa89f..dc657c8 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]); |
@@ -362,4 +367,4 @@ namespace OpenSim.Data.MySQL | |||
362 | } | 367 | } |
363 | 368 | ||
364 | } | 369 | } |
365 | } \ No newline at end of file | 370 | } |
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 448962a..5320543 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,7 +113,7 @@ 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 | ||
@@ -173,9 +173,10 @@ namespace OpenSim.Data.MySQL | |||
173 | "ParticleSystem, ClickAction, Material, " + | 173 | "ParticleSystem, ClickAction, Material, " + |
174 | "CollisionSound, CollisionSoundVolume, " + | 174 | "CollisionSound, CollisionSoundVolume, " + |
175 | "PassTouches, " + | 175 | "PassTouches, " + |
176 | "PassCollisions, " + | ||
176 | "LinkNumber, MediaURL, KeyframeMotion, " + | 177 | "LinkNumber, MediaURL, KeyframeMotion, " + |
177 | "PhysicsShapeType, Density, GravityModifier, " + | 178 | "PhysicsShapeType, Density, GravityModifier, " + |
178 | "Friction, Restitution, DynAttrs " + | 179 | "Friction, Restitution, Vehicle, DynAttrs " + |
179 | ") values (" + "?UUID, " + | 180 | ") values (" + "?UUID, " + |
180 | "?CreationDate, ?Name, ?Text, " + | 181 | "?CreationDate, ?Name, ?Text, " + |
181 | "?Description, ?SitName, ?TouchName, " + | 182 | "?Description, ?SitName, ?TouchName, " + |
@@ -207,10 +208,10 @@ namespace OpenSim.Data.MySQL | |||
207 | "?SaleType, ?ColorR, ?ColorG, " + | 208 | "?SaleType, ?ColorR, ?ColorG, " + |
208 | "?ColorB, ?ColorA, ?ParticleSystem, " + | 209 | "?ColorB, ?ColorA, ?ParticleSystem, " + |
209 | "?ClickAction, ?Material, ?CollisionSound, " + | 210 | "?ClickAction, ?Material, ?CollisionSound, " + |
210 | "?CollisionSoundVolume, ?PassTouches, " + | 211 | "?CollisionSoundVolume, ?PassTouches, ?PassCollisions, " + |
211 | "?LinkNumber, ?MediaURL, ?KeyframeMotion, " + | 212 | "?LinkNumber, ?MediaURL, ?KeyframeMotion, " + |
212 | "?PhysicsShapeType, ?Density, ?GravityModifier, " + | 213 | "?PhysicsShapeType, ?Density, ?GravityModifier, " + |
213 | "?Friction, ?Restitution, ?DynAttrs)"; | 214 | "?Friction, ?Restitution, ?Vehicle, ?DynAttrs)"; |
214 | 215 | ||
215 | FillPrimCommand(cmd, prim, obj.UUID, regionUUID); | 216 | FillPrimCommand(cmd, prim, obj.UUID, regionUUID); |
216 | 217 | ||
@@ -250,7 +251,7 @@ namespace OpenSim.Data.MySQL | |||
250 | } | 251 | } |
251 | } | 252 | } |
252 | 253 | ||
253 | public void RemoveObject(UUID obj, UUID regionUUID) | 254 | public virtual void RemoveObject(UUID obj, UUID regionUUID) |
254 | { | 255 | { |
255 | // 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); |
256 | 257 | ||
@@ -399,7 +400,7 @@ namespace OpenSim.Data.MySQL | |||
399 | } | 400 | } |
400 | } | 401 | } |
401 | 402 | ||
402 | public List<SceneObjectGroup> LoadObjects(UUID regionID) | 403 | public virtual List<SceneObjectGroup> LoadObjects(UUID regionID) |
403 | { | 404 | { |
404 | const int ROWS_PER_QUERY = 5000; | 405 | const int ROWS_PER_QUERY = 5000; |
405 | 406 | ||
@@ -572,36 +573,51 @@ namespace OpenSim.Data.MySQL | |||
572 | } | 573 | } |
573 | } | 574 | } |
574 | 575 | ||
575 | public void StoreTerrain(double[,] ter, UUID regionID) | 576 | public virtual void StoreTerrain(double[,] ter, UUID regionID) |
576 | { | 577 | { |
577 | m_log.Info("[REGION DB]: Storing terrain"); | 578 | Util.FireAndForget(delegate(object x) |
578 | |||
579 | lock (m_dbLock) | ||
580 | { | 579 | { |
581 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 580 | double[,] oldTerrain = LoadTerrain(regionID); |
582 | { | ||
583 | dbcon.Open(); | ||
584 | 581 | ||
585 | 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)) | ||
586 | { | 587 | { |
587 | cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID"; | 588 | dbcon.Open(); |
588 | cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
589 | 589 | ||
590 | 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()); | ||
594 | |||
595 | using (MySqlCommand cmd2 = dbcon.CreateCommand()) | ||
596 | { | ||
597 | try | ||
598 | { | ||
599 | cmd2.CommandText = "insert into terrain (RegionUUID, " + | ||
600 | "Revision, Heightfield) values (?RegionUUID, " + | ||
601 | "1, ?Heightfield)"; | ||
591 | 602 | ||
592 | cmd.CommandText = "insert into terrain (RegionUUID, " + | 603 | cmd2.Parameters.AddWithValue("RegionUUID", regionID.ToString()); |
593 | "Revision, Heightfield) values (?RegionUUID, " + | 604 | cmd2.Parameters.AddWithValue("Heightfield", SerializeTerrain(ter, oldTerrain)); |
594 | "1, ?Heightfield)"; | ||
595 | |||
596 | cmd.Parameters.AddWithValue("Heightfield", SerializeTerrain(ter)); | ||
597 | 605 | ||
598 | ExecuteNonQuery(cmd); | 606 | ExecuteNonQuery(cmd); |
607 | ExecuteNonQuery(cmd2); | ||
608 | } | ||
609 | catch (Exception e) | ||
610 | { | ||
611 | m_log.ErrorFormat(e.ToString()); | ||
612 | } | ||
613 | } | ||
614 | } | ||
599 | } | 615 | } |
600 | } | 616 | } |
601 | } | 617 | }); |
602 | } | 618 | } |
603 | 619 | ||
604 | public double[,] LoadTerrain(UUID regionID) | 620 | public virtual double[,] LoadTerrain(UUID regionID) |
605 | { | 621 | { |
606 | double[,] terrain = null; | 622 | double[,] terrain = null; |
607 | 623 | ||
@@ -651,7 +667,7 @@ namespace OpenSim.Data.MySQL | |||
651 | return terrain; | 667 | return terrain; |
652 | } | 668 | } |
653 | 669 | ||
654 | public void RemoveLandObject(UUID globalID) | 670 | public virtual void RemoveLandObject(UUID globalID) |
655 | { | 671 | { |
656 | lock (m_dbLock) | 672 | lock (m_dbLock) |
657 | { | 673 | { |
@@ -670,7 +686,7 @@ namespace OpenSim.Data.MySQL | |||
670 | } | 686 | } |
671 | } | 687 | } |
672 | 688 | ||
673 | public void StoreLandObject(ILandObject parcel) | 689 | public virtual void StoreLandObject(ILandObject parcel) |
674 | { | 690 | { |
675 | lock (m_dbLock) | 691 | lock (m_dbLock) |
676 | { | 692 | { |
@@ -727,7 +743,7 @@ namespace OpenSim.Data.MySQL | |||
727 | } | 743 | } |
728 | } | 744 | } |
729 | 745 | ||
730 | public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) | 746 | public virtual RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) |
731 | { | 747 | { |
732 | RegionLightShareData nWP = new RegionLightShareData(); | 748 | RegionLightShareData nWP = new RegionLightShareData(); |
733 | nWP.OnSave += StoreRegionWindlightSettings; | 749 | nWP.OnSave += StoreRegionWindlightSettings; |
@@ -828,7 +844,7 @@ namespace OpenSim.Data.MySQL | |||
828 | return nWP; | 844 | return nWP; |
829 | } | 845 | } |
830 | 846 | ||
831 | public RegionSettings LoadRegionSettings(UUID regionUUID) | 847 | public virtual RegionSettings LoadRegionSettings(UUID regionUUID) |
832 | { | 848 | { |
833 | RegionSettings rs = null; | 849 | RegionSettings rs = null; |
834 | 850 | ||
@@ -868,7 +884,7 @@ namespace OpenSim.Data.MySQL | |||
868 | return rs; | 884 | return rs; |
869 | } | 885 | } |
870 | 886 | ||
871 | public void StoreRegionWindlightSettings(RegionLightShareData wl) | 887 | public virtual void StoreRegionWindlightSettings(RegionLightShareData wl) |
872 | { | 888 | { |
873 | lock (m_dbLock) | 889 | lock (m_dbLock) |
874 | { | 890 | { |
@@ -974,7 +990,7 @@ namespace OpenSim.Data.MySQL | |||
974 | } | 990 | } |
975 | } | 991 | } |
976 | 992 | ||
977 | public void RemoveRegionWindlightSettings(UUID regionID) | 993 | public virtual void RemoveRegionWindlightSettings(UUID regionID) |
978 | { | 994 | { |
979 | lock (m_dbLock) | 995 | lock (m_dbLock) |
980 | { | 996 | { |
@@ -1063,7 +1079,7 @@ namespace OpenSim.Data.MySQL | |||
1063 | } | 1079 | } |
1064 | #endregion | 1080 | #endregion |
1065 | 1081 | ||
1066 | public void StoreRegionSettings(RegionSettings rs) | 1082 | public virtual void StoreRegionSettings(RegionSettings rs) |
1067 | { | 1083 | { |
1068 | lock (m_dbLock) | 1084 | lock (m_dbLock) |
1069 | { | 1085 | { |
@@ -1090,7 +1106,7 @@ namespace OpenSim.Data.MySQL | |||
1090 | "use_estate_sun, fixed_sun, sun_position, " + | 1106 | "use_estate_sun, fixed_sun, sun_position, " + |
1091 | "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " + | 1107 | "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " + |
1092 | "sunvectorz, loaded_creation_datetime, " + | 1108 | "sunvectorz, loaded_creation_datetime, " + |
1093 | "loaded_creation_id, map_tile_ID, " + | 1109 | "loaded_creation_id, map_tile_ID, block_search, casino, " + |
1094 | "TelehubObject, parcel_tile_ID) " + | 1110 | "TelehubObject, parcel_tile_ID) " + |
1095 | "values (?RegionUUID, ?BlockTerraform, " + | 1111 | "values (?RegionUUID, ?BlockTerraform, " + |
1096 | "?BlockFly, ?AllowDamage, ?RestrictPushing, " + | 1112 | "?BlockFly, ?AllowDamage, ?RestrictPushing, " + |
@@ -1107,7 +1123,7 @@ namespace OpenSim.Data.MySQL | |||
1107 | "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " + | 1123 | "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " + |
1108 | "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + | 1124 | "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + |
1109 | "?LoadedCreationDateTime, ?LoadedCreationID, " + | 1125 | "?LoadedCreationDateTime, ?LoadedCreationID, " + |
1110 | "?TerrainImageID, " + | 1126 | "?TerrainImageID, ?block_search, ?casino, " + |
1111 | "?TelehubObject, ?ParcelImageID)"; | 1127 | "?TelehubObject, ?ParcelImageID)"; |
1112 | 1128 | ||
1113 | FillRegionSettingsCommand(cmd, rs); | 1129 | FillRegionSettingsCommand(cmd, rs); |
@@ -1119,7 +1135,7 @@ namespace OpenSim.Data.MySQL | |||
1119 | SaveSpawnPoints(rs); | 1135 | SaveSpawnPoints(rs); |
1120 | } | 1136 | } |
1121 | 1137 | ||
1122 | public List<LandData> LoadLandObjects(UUID regionUUID) | 1138 | public virtual List<LandData> LoadLandObjects(UUID regionUUID) |
1123 | { | 1139 | { |
1124 | List<LandData> landData = new List<LandData>(); | 1140 | List<LandData> landData = new List<LandData>(); |
1125 | 1141 | ||
@@ -1301,6 +1317,7 @@ namespace OpenSim.Data.MySQL | |||
1301 | prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"]; | 1317 | prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"]; |
1302 | 1318 | ||
1303 | prim.PassTouches = ((sbyte)row["PassTouches"] != 0); | 1319 | prim.PassTouches = ((sbyte)row["PassTouches"] != 0); |
1320 | prim.PassCollisions = ((sbyte)row["PassCollisions"] != 0); | ||
1304 | prim.LinkNum = (int)row["LinkNumber"]; | 1321 | prim.LinkNum = (int)row["LinkNumber"]; |
1305 | 1322 | ||
1306 | if (!(row["MediaURL"] is System.DBNull)) | 1323 | if (!(row["MediaURL"] is System.DBNull)) |
@@ -1330,6 +1347,15 @@ namespace OpenSim.Data.MySQL | |||
1330 | prim.Friction = (float)(double)row["Friction"]; | 1347 | prim.Friction = (float)(double)row["Friction"]; |
1331 | prim.Restitution = (float)(double)row["Restitution"]; | 1348 | prim.Restitution = (float)(double)row["Restitution"]; |
1332 | 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 | |||
1333 | return prim; | 1359 | return prim; |
1334 | } | 1360 | } |
1335 | 1361 | ||
@@ -1340,32 +1366,40 @@ namespace OpenSim.Data.MySQL | |||
1340 | /// <returns></returns> | 1366 | /// <returns></returns> |
1341 | private static TaskInventoryItem BuildItem(IDataReader row) | 1367 | private static TaskInventoryItem BuildItem(IDataReader row) |
1342 | { | 1368 | { |
1343 | TaskInventoryItem taskItem = new TaskInventoryItem(); | 1369 | try |
1344 | 1370 | { | |
1345 | taskItem.ItemID = DBGuid.FromDB(row["itemID"]); | 1371 | TaskInventoryItem taskItem = new TaskInventoryItem(); |
1346 | taskItem.ParentPartID = DBGuid.FromDB(row["primID"]); | 1372 | |
1347 | taskItem.AssetID = DBGuid.FromDB(row["assetID"]); | 1373 | taskItem.ItemID = DBGuid.FromDB(row["itemID"]); |
1348 | taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]); | 1374 | taskItem.ParentPartID = DBGuid.FromDB(row["primID"]); |
1349 | 1375 | taskItem.AssetID = DBGuid.FromDB(row["assetID"]); | |
1350 | taskItem.InvType = Convert.ToInt32(row["invType"]); | 1376 | taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]); |
1351 | taskItem.Type = Convert.ToInt32(row["assetType"]); | 1377 | |
1352 | 1378 | taskItem.InvType = Convert.ToInt32(row["invType"]); | |
1353 | taskItem.Name = (String)row["name"]; | 1379 | taskItem.Type = Convert.ToInt32(row["assetType"]); |
1354 | taskItem.Description = (String)row["description"]; | 1380 | |
1355 | taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); | 1381 | taskItem.Name = (String)row["name"]; |
1356 | taskItem.CreatorIdentification = (String)row["creatorID"]; | 1382 | taskItem.Description = (String)row["description"]; |
1357 | taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]); | 1383 | taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); |
1358 | taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]); | 1384 | taskItem.CreatorIdentification = (String)row["creatorID"]; |
1359 | taskItem.GroupID = DBGuid.FromDB(row["groupID"]); | 1385 | taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]); |
1360 | 1386 | taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]); | |
1361 | taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]); | 1387 | taskItem.GroupID = DBGuid.FromDB(row["groupID"]); |
1362 | taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]); | 1388 | |
1363 | taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]); | 1389 | taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]); |
1364 | taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]); | 1390 | taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]); |
1365 | taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]); | 1391 | taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]); |
1366 | taskItem.Flags = Convert.ToUInt32(row["flags"]); | 1392 | taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]); |
1367 | 1393 | taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]); | |
1368 | 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 | } | ||
1369 | } | 1403 | } |
1370 | 1404 | ||
1371 | private static RegionSettings BuildRegionSettings(IDataReader row) | 1405 | private static RegionSettings BuildRegionSettings(IDataReader row) |
@@ -1423,6 +1457,9 @@ namespace OpenSim.Data.MySQL | |||
1423 | newSettings.ParcelImageID = DBGuid.FromDB(row["parcel_tile_ID"]); | 1457 | newSettings.ParcelImageID = DBGuid.FromDB(row["parcel_tile_ID"]); |
1424 | newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]); | 1458 | newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]); |
1425 | 1459 | ||
1460 | newSettings.GodBlockSearch = Convert.ToBoolean(row["block_search"]); | ||
1461 | newSettings.Casino = Convert.ToBoolean(row["casino"]); | ||
1462 | |||
1426 | return newSettings; | 1463 | return newSettings; |
1427 | } | 1464 | } |
1428 | 1465 | ||
@@ -1520,7 +1557,7 @@ namespace OpenSim.Data.MySQL | |||
1520 | /// </summary> | 1557 | /// </summary> |
1521 | /// <param name="val"></param> | 1558 | /// <param name="val"></param> |
1522 | /// <returns></returns> | 1559 | /// <returns></returns> |
1523 | private static Array SerializeTerrain(double[,] val) | 1560 | private static Array SerializeTerrain(double[,] val, double[,] oldTerrain) |
1524 | { | 1561 | { |
1525 | 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)); |
1526 | BinaryWriter bw = new BinaryWriter(str); | 1563 | BinaryWriter bw = new BinaryWriter(str); |
@@ -1529,7 +1566,11 @@ namespace OpenSim.Data.MySQL | |||
1529 | for (int x = 0; x < (int)Constants.RegionSize; x++) | 1566 | for (int x = 0; x < (int)Constants.RegionSize; x++) |
1530 | for (int y = 0; y < (int)Constants.RegionSize; y++) | 1567 | for (int y = 0; y < (int)Constants.RegionSize; y++) |
1531 | { | 1568 | { |
1532 | 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]; | ||
1533 | if (height == 0.0) | 1574 | if (height == 0.0) |
1534 | height = double.Epsilon; | 1575 | height = double.Epsilon; |
1535 | 1576 | ||
@@ -1673,6 +1714,11 @@ namespace OpenSim.Data.MySQL | |||
1673 | else | 1714 | else |
1674 | cmd.Parameters.AddWithValue("PassTouches", 0); | 1715 | cmd.Parameters.AddWithValue("PassTouches", 0); |
1675 | 1716 | ||
1717 | if (prim.PassCollisions) | ||
1718 | cmd.Parameters.AddWithValue("PassCollisions", 1); | ||
1719 | else | ||
1720 | cmd.Parameters.AddWithValue("PassCollisions", 0); | ||
1721 | |||
1676 | cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); | 1722 | cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); |
1677 | cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); | 1723 | cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); |
1678 | 1724 | ||
@@ -1681,6 +1727,11 @@ namespace OpenSim.Data.MySQL | |||
1681 | else | 1727 | else |
1682 | cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]); | 1728 | cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]); |
1683 | 1729 | ||
1730 | if (prim.VehicleParams != null) | ||
1731 | cmd.Parameters.AddWithValue("Vehicle", prim.VehicleParams.ToXml2()); | ||
1732 | else | ||
1733 | cmd.Parameters.AddWithValue("Vehicle", String.Empty); | ||
1734 | |||
1684 | if (prim.DynAttrs.Count > 0) | 1735 | if (prim.DynAttrs.Count > 0) |
1685 | cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml()); | 1736 | cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml()); |
1686 | else | 1737 | else |
@@ -1769,6 +1820,8 @@ namespace OpenSim.Data.MySQL | |||
1769 | cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); | 1820 | cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); |
1770 | cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); | 1821 | cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); |
1771 | 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); | ||
1772 | 1825 | ||
1773 | cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID); | 1826 | cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID); |
1774 | cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject); | 1827 | cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject); |
@@ -1930,7 +1983,7 @@ namespace OpenSim.Data.MySQL | |||
1930 | cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); | 1983 | cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); |
1931 | } | 1984 | } |
1932 | 1985 | ||
1933 | public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) | 1986 | public virtual void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) |
1934 | { | 1987 | { |
1935 | lock (m_dbLock) | 1988 | lock (m_dbLock) |
1936 | { | 1989 | { |
@@ -1974,6 +2027,37 @@ namespace OpenSim.Data.MySQL | |||
1974 | } | 2027 | } |
1975 | } | 2028 | } |
1976 | 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 | |||
1977 | private void LoadSpawnPoints(RegionSettings rs) | 2061 | private void LoadSpawnPoints(RegionSettings rs) |
1978 | { | 2062 | { |
1979 | 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 8c93825..15ac921 100644 --- a/OpenSim/Data/MySQL/MySQLXAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs | |||
@@ -518,4 +518,4 @@ namespace OpenSim.Data.MySQL | |||
518 | 518 | ||
519 | #endregion | 519 | #endregion |
520 | } | 520 | } |
521 | } \ No newline at end of file | 521 | } |
diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations index 70b9558..bda1b6a 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 | ||
718 | COMMIT; | 718 | COMMIT; |
719 | 719 | ||
720 | :VERSION 32 | 720 | :VERSION 32 #--------------------- |
721 | 721 | ||
722 | BEGIN; | 722 | BEGIN; |
723 | CREATE TABLE `regionwindlight` ( | 723 | CREATE TABLE `regionwindlight` ( |
@@ -922,11 +922,3 @@ ALTER TABLE prims ADD COLUMN `Friction` double NOT NULL default '0.6'; | |||
922 | ALTER TABLE prims ADD COLUMN `Restitution` double NOT NULL default '0.5'; | 922 | ALTER TABLE prims ADD COLUMN `Restitution` double NOT NULL default '0.5'; |
923 | 923 | ||
924 | COMMIT; | 924 | COMMIT; |
925 | |||
926 | :VERSION 48 #---------------- Keyframes | ||
927 | |||
928 | BEGIN; | ||
929 | |||
930 | ALTER TABLE prims ADD COLUMN `KeyframeMotion` blob; | ||
931 | |||
932 | COMMIT; | ||