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 | 222 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLUserAccountData.cs | 46 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLUserProfilesData.cs | 43 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLXAssetData.cs | 2 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/Resources/RegionStore.migrations | 3 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/Resources/UserProfiles.migrations | 10 |
8 files changed, 223 insertions, 123 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 b03a904..1b3e81e 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,10 +173,11 @@ namespace OpenSim.Data.MySQL | |||
173 | "ParticleSystem, ClickAction, Material, " + | 173 | "ParticleSystem, ClickAction, Material, " + |
174 | "CollisionSound, CollisionSoundVolume, " + | 174 | "CollisionSound, CollisionSoundVolume, " + |
175 | "PassTouches, " + | 175 | "PassTouches, " + |
176 | "LinkNumber, MediaURL, AttachedPosX, " + | 176 | "PassCollisions, " + |
177 | "AttachedPosY, AttachedPosZ, KeyframeMotion, " + | 177 | "LinkNumber, MediaURL, KeyframeMotion, AttachedPosX, " + |
178 | "AttachedPosY, AttachedPosZ, " + | ||
178 | "PhysicsShapeType, Density, GravityModifier, " + | 179 | "PhysicsShapeType, Density, GravityModifier, " + |
179 | "Friction, Restitution, DynAttrs " + | 180 | "Friction, Restitution, Vehicle, DynAttrs " + |
180 | ") values (" + "?UUID, " + | 181 | ") values (" + "?UUID, " + |
181 | "?CreationDate, ?Name, ?Text, " + | 182 | "?CreationDate, ?Name, ?Text, " + |
182 | "?Description, ?SitName, ?TouchName, " + | 183 | "?Description, ?SitName, ?TouchName, " + |
@@ -208,11 +209,11 @@ namespace OpenSim.Data.MySQL | |||
208 | "?SaleType, ?ColorR, ?ColorG, " + | 209 | "?SaleType, ?ColorR, ?ColorG, " + |
209 | "?ColorB, ?ColorA, ?ParticleSystem, " + | 210 | "?ColorB, ?ColorA, ?ParticleSystem, " + |
210 | "?ClickAction, ?Material, ?CollisionSound, " + | 211 | "?ClickAction, ?Material, ?CollisionSound, " + |
211 | "?CollisionSoundVolume, ?PassTouches, " + | 212 | "?CollisionSoundVolume, ?PassTouches, ?PassCollisions, " + |
212 | "?LinkNumber, ?MediaURL, ?AttachedPosX, " + | 213 | "?LinkNumber, ?MediaURL, ?KeyframeMotion, ?AttachedPosX, " + |
213 | "?AttachedPosY, ?AttachedPosZ, ?KeyframeMotion, " + | 214 | "?AttachedPosY, ?AttachedPosZ, " + |
214 | "?PhysicsShapeType, ?Density, ?GravityModifier, " + | 215 | "?PhysicsShapeType, ?Density, ?GravityModifier, " + |
215 | "?Friction, ?Restitution, ?DynAttrs)"; | 216 | "?Friction, ?Restitution, ?Vehicle, ?DynAttrs)"; |
216 | 217 | ||
217 | FillPrimCommand(cmd, prim, obj.UUID, regionUUID); | 218 | FillPrimCommand(cmd, prim, obj.UUID, regionUUID); |
218 | 219 | ||
@@ -252,7 +253,7 @@ namespace OpenSim.Data.MySQL | |||
252 | } | 253 | } |
253 | } | 254 | } |
254 | 255 | ||
255 | public void RemoveObject(UUID obj, UUID regionUUID) | 256 | public virtual void RemoveObject(UUID obj, UUID regionUUID) |
256 | { | 257 | { |
257 | // m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID); | 258 | // m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID); |
258 | 259 | ||
@@ -401,7 +402,7 @@ namespace OpenSim.Data.MySQL | |||
401 | } | 402 | } |
402 | } | 403 | } |
403 | 404 | ||
404 | public List<SceneObjectGroup> LoadObjects(UUID regionID) | 405 | public virtual List<SceneObjectGroup> LoadObjects(UUID regionID) |
405 | { | 406 | { |
406 | const int ROWS_PER_QUERY = 5000; | 407 | const int ROWS_PER_QUERY = 5000; |
407 | 408 | ||
@@ -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)) |
@@ -1339,6 +1356,15 @@ namespace OpenSim.Data.MySQL | |||
1339 | prim.Friction = (float)(double)row["Friction"]; | 1356 | prim.Friction = (float)(double)row["Friction"]; |
1340 | prim.Restitution = (float)(double)row["Restitution"]; | 1357 | prim.Restitution = (float)(double)row["Restitution"]; |
1341 | 1358 | ||
1359 | SOPVehicle vehicle = null; | ||
1360 | |||
1361 | if (row["Vehicle"].ToString() != String.Empty) | ||
1362 | { | ||
1363 | vehicle = SOPVehicle.FromXml2(row["Vehicle"].ToString()); | ||
1364 | if (vehicle != null) | ||
1365 | prim.VehicleParams = vehicle; | ||
1366 | } | ||
1367 | |||
1342 | return prim; | 1368 | return prim; |
1343 | } | 1369 | } |
1344 | 1370 | ||
@@ -1349,32 +1375,40 @@ namespace OpenSim.Data.MySQL | |||
1349 | /// <returns></returns> | 1375 | /// <returns></returns> |
1350 | private static TaskInventoryItem BuildItem(IDataReader row) | 1376 | private static TaskInventoryItem BuildItem(IDataReader row) |
1351 | { | 1377 | { |
1352 | TaskInventoryItem taskItem = new TaskInventoryItem(); | 1378 | try |
1353 | 1379 | { | |
1354 | taskItem.ItemID = DBGuid.FromDB(row["itemID"]); | 1380 | TaskInventoryItem taskItem = new TaskInventoryItem(); |
1355 | taskItem.ParentPartID = DBGuid.FromDB(row["primID"]); | 1381 | |
1356 | taskItem.AssetID = DBGuid.FromDB(row["assetID"]); | 1382 | taskItem.ItemID = DBGuid.FromDB(row["itemID"]); |
1357 | taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]); | 1383 | taskItem.ParentPartID = DBGuid.FromDB(row["primID"]); |
1358 | 1384 | taskItem.AssetID = DBGuid.FromDB(row["assetID"]); | |
1359 | taskItem.InvType = Convert.ToInt32(row["invType"]); | 1385 | taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]); |
1360 | taskItem.Type = Convert.ToInt32(row["assetType"]); | 1386 | |
1361 | 1387 | taskItem.InvType = Convert.ToInt32(row["invType"]); | |
1362 | taskItem.Name = (String)row["name"]; | 1388 | taskItem.Type = Convert.ToInt32(row["assetType"]); |
1363 | taskItem.Description = (String)row["description"]; | 1389 | |
1364 | taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); | 1390 | taskItem.Name = (String)row["name"]; |
1365 | taskItem.CreatorIdentification = (String)row["creatorID"]; | 1391 | taskItem.Description = (String)row["description"]; |
1366 | taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]); | 1392 | taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); |
1367 | taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]); | 1393 | taskItem.CreatorIdentification = (String)row["creatorID"]; |
1368 | taskItem.GroupID = DBGuid.FromDB(row["groupID"]); | 1394 | taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]); |
1369 | 1395 | taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]); | |
1370 | taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]); | 1396 | taskItem.GroupID = DBGuid.FromDB(row["groupID"]); |
1371 | taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]); | 1397 | |
1372 | taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]); | 1398 | taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]); |
1373 | taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]); | 1399 | taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]); |
1374 | taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]); | 1400 | taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]); |
1375 | taskItem.Flags = Convert.ToUInt32(row["flags"]); | 1401 | taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]); |
1376 | 1402 | taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]); | |
1377 | return taskItem; | 1403 | taskItem.Flags = Convert.ToUInt32(row["flags"]); |
1404 | |||
1405 | return taskItem; | ||
1406 | } | ||
1407 | catch | ||
1408 | { | ||
1409 | m_log.ErrorFormat("[MYSQL DB]: Error reading task inventory: itemID was {0}, primID was {1}", row["itemID"].ToString(), row["primID"].ToString()); | ||
1410 | throw; | ||
1411 | } | ||
1378 | } | 1412 | } |
1379 | 1413 | ||
1380 | private static RegionSettings BuildRegionSettings(IDataReader row) | 1414 | private static RegionSettings BuildRegionSettings(IDataReader row) |
@@ -1432,6 +1466,9 @@ namespace OpenSim.Data.MySQL | |||
1432 | newSettings.ParcelImageID = DBGuid.FromDB(row["parcel_tile_ID"]); | 1466 | newSettings.ParcelImageID = DBGuid.FromDB(row["parcel_tile_ID"]); |
1433 | newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]); | 1467 | newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]); |
1434 | 1468 | ||
1469 | newSettings.GodBlockSearch = Convert.ToBoolean(row["block_search"]); | ||
1470 | newSettings.Casino = Convert.ToBoolean(row["casino"]); | ||
1471 | |||
1435 | return newSettings; | 1472 | return newSettings; |
1436 | } | 1473 | } |
1437 | 1474 | ||
@@ -1529,7 +1566,7 @@ namespace OpenSim.Data.MySQL | |||
1529 | /// </summary> | 1566 | /// </summary> |
1530 | /// <param name="val"></param> | 1567 | /// <param name="val"></param> |
1531 | /// <returns></returns> | 1568 | /// <returns></returns> |
1532 | private static Array SerializeTerrain(double[,] val) | 1569 | private static Array SerializeTerrain(double[,] val, double[,] oldTerrain) |
1533 | { | 1570 | { |
1534 | MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double)); | 1571 | MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double)); |
1535 | BinaryWriter bw = new BinaryWriter(str); | 1572 | BinaryWriter bw = new BinaryWriter(str); |
@@ -1538,7 +1575,11 @@ namespace OpenSim.Data.MySQL | |||
1538 | for (int x = 0; x < (int)Constants.RegionSize; x++) | 1575 | for (int x = 0; x < (int)Constants.RegionSize; x++) |
1539 | for (int y = 0; y < (int)Constants.RegionSize; y++) | 1576 | for (int y = 0; y < (int)Constants.RegionSize; y++) |
1540 | { | 1577 | { |
1541 | double height = val[x, y]; | 1578 | double height = 20.0; |
1579 | if (oldTerrain != null) | ||
1580 | height = oldTerrain[x, y]; | ||
1581 | if (!double.IsNaN(val[x, y])) | ||
1582 | height = val[x, y]; | ||
1542 | if (height == 0.0) | 1583 | if (height == 0.0) |
1543 | height = double.Epsilon; | 1584 | height = double.Epsilon; |
1544 | 1585 | ||
@@ -1682,6 +1723,11 @@ namespace OpenSim.Data.MySQL | |||
1682 | else | 1723 | else |
1683 | cmd.Parameters.AddWithValue("PassTouches", 0); | 1724 | cmd.Parameters.AddWithValue("PassTouches", 0); |
1684 | 1725 | ||
1726 | if (prim.PassCollisions) | ||
1727 | cmd.Parameters.AddWithValue("PassCollisions", 1); | ||
1728 | else | ||
1729 | cmd.Parameters.AddWithValue("PassCollisions", 0); | ||
1730 | |||
1685 | cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); | 1731 | cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); |
1686 | cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); | 1732 | cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); |
1687 | if (prim.AttachedPos != null) | 1733 | if (prim.AttachedPos != null) |
@@ -1696,6 +1742,11 @@ namespace OpenSim.Data.MySQL | |||
1696 | else | 1742 | else |
1697 | cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]); | 1743 | cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]); |
1698 | 1744 | ||
1745 | if (prim.VehicleParams != null) | ||
1746 | cmd.Parameters.AddWithValue("Vehicle", prim.VehicleParams.ToXml2()); | ||
1747 | else | ||
1748 | cmd.Parameters.AddWithValue("Vehicle", String.Empty); | ||
1749 | |||
1699 | if (prim.DynAttrs.CountNamespaces > 0) | 1750 | if (prim.DynAttrs.CountNamespaces > 0) |
1700 | cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml()); | 1751 | cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml()); |
1701 | else | 1752 | else |
@@ -1784,6 +1835,8 @@ namespace OpenSim.Data.MySQL | |||
1784 | cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); | 1835 | cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); |
1785 | cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); | 1836 | cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); |
1786 | cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); | 1837 | cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); |
1838 | cmd.Parameters.AddWithValue("block_search", settings.GodBlockSearch); | ||
1839 | cmd.Parameters.AddWithValue("casino", settings.Casino); | ||
1787 | 1840 | ||
1788 | cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID); | 1841 | cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID); |
1789 | cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject); | 1842 | cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject); |
@@ -1947,7 +2000,7 @@ namespace OpenSim.Data.MySQL | |||
1947 | cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); | 2000 | cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); |
1948 | } | 2001 | } |
1949 | 2002 | ||
1950 | public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) | 2003 | public virtual void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) |
1951 | { | 2004 | { |
1952 | lock (m_dbLock) | 2005 | lock (m_dbLock) |
1953 | { | 2006 | { |
@@ -1991,6 +2044,37 @@ namespace OpenSim.Data.MySQL | |||
1991 | } | 2044 | } |
1992 | } | 2045 | } |
1993 | 2046 | ||
2047 | public UUID[] GetObjectIDs(UUID regionID) | ||
2048 | { | ||
2049 | List<UUID> uuids = new List<UUID>(); | ||
2050 | |||
2051 | lock (m_dbLock) | ||
2052 | { | ||
2053 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
2054 | { | ||
2055 | dbcon.Open(); | ||
2056 | |||
2057 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
2058 | { | ||
2059 | cmd.CommandText = "select UUID from prims where RegionUUID = ?RegionUUID and SceneGroupID = UUID"; | ||
2060 | cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
2061 | |||
2062 | using (IDataReader reader = ExecuteReader(cmd)) | ||
2063 | { | ||
2064 | while (reader.Read()) | ||
2065 | { | ||
2066 | UUID id = new UUID(reader["UUID"].ToString()); | ||
2067 | |||
2068 | uuids.Add(id); | ||
2069 | } | ||
2070 | } | ||
2071 | } | ||
2072 | } | ||
2073 | } | ||
2074 | |||
2075 | return uuids.ToArray(); | ||
2076 | } | ||
2077 | |||
1994 | private void LoadSpawnPoints(RegionSettings rs) | 2078 | private void LoadSpawnPoints(RegionSettings rs) |
1995 | { | 2079 | { |
1996 | rs.ClearSpawnPoints(); | 2080 | 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/MySQLUserProfilesData.cs b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs index 6ed3b06..8b50c54 100644 --- a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs +++ b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs | |||
@@ -899,7 +899,7 @@ namespace OpenSim.Data.MySQL | |||
899 | } | 899 | } |
900 | 900 | ||
901 | #region User Preferences | 901 | #region User Preferences |
902 | public bool GetUserPreferences(ref UserPreferences pref, ref string result) | 902 | public OSDArray GetUserPreferences(UUID avatarId) |
903 | { | 903 | { |
904 | string query = string.Empty; | 904 | string query = string.Empty; |
905 | 905 | ||
@@ -916,16 +916,19 @@ namespace OpenSim.Data.MySQL | |||
916 | dbcon.Open(); | 916 | dbcon.Open(); |
917 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) | 917 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) |
918 | { | 918 | { |
919 | cmd.Parameters.AddWithValue("?Id", pref.UserId.ToString()); | 919 | cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); |
920 | 920 | ||
921 | using (MySqlDataReader reader = cmd.ExecuteReader()) | 921 | using (MySqlDataReader reader = cmd.ExecuteReader()) |
922 | { | 922 | { |
923 | if(reader.HasRows) | 923 | if(reader.HasRows) |
924 | { | 924 | { |
925 | reader.Read(); | 925 | reader.Read(); |
926 | bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail); | 926 | OSDMap record = new OSDMap(); |
927 | bool.TryParse((string)reader["visible"], out pref.Visible); | 927 | |
928 | pref.EMail = (string)reader["email"]; | 928 | record.Add("imviaemail",OSD.FromString((string)reader["imviaemail"])); |
929 | record.Add("visible",OSD.FromString((string)reader["visible"])); | ||
930 | record.Add("email",OSD.FromString((string)reader["email"])); | ||
931 | data.Add(record); | ||
929 | } | 932 | } |
930 | else | 933 | else |
931 | { | 934 | { |
@@ -938,8 +941,8 @@ namespace OpenSim.Data.MySQL | |||
938 | using (MySqlCommand put = new MySqlCommand(query, dbcon)) | 941 | using (MySqlCommand put = new MySqlCommand(query, dbcon)) |
939 | { | 942 | { |
940 | 943 | ||
941 | put.Parameters.AddWithValue("?Email", pref.EMail); | 944 | // put.Parameters.AddWithValue("?Email", pref.EMail); |
942 | put.Parameters.AddWithValue("?uuid", pref.UserId.ToString()); | 945 | // put.Parameters.AddWithValue("?uuid", pref.UserId.ToString()); |
943 | 946 | ||
944 | put.ExecuteNonQuery(); | 947 | put.ExecuteNonQuery(); |
945 | } | 948 | } |
@@ -952,19 +955,17 @@ namespace OpenSim.Data.MySQL | |||
952 | { | 955 | { |
953 | m_log.DebugFormat("[PROFILES_DATA]" + | 956 | m_log.DebugFormat("[PROFILES_DATA]" + |
954 | ": Get preferences exception {0}", e.Message); | 957 | ": Get preferences exception {0}", e.Message); |
955 | result = e.Message; | ||
956 | return false; | ||
957 | } | 958 | } |
958 | return true; | 959 | return data; |
959 | } | 960 | } |
960 | 961 | ||
961 | public bool UpdateUserPreferences(ref UserPreferences pref, ref string result) | 962 | public bool UpdateUserPreferences(bool emailIm, bool visible, UUID avatarId ) |
962 | { | 963 | { |
963 | string query = string.Empty; | 964 | string query = string.Empty; |
964 | 965 | ||
965 | query += "UPDATE usersettings SET "; | 966 | query += "UPDATE userpsettings SET "; |
966 | query += "imviaemail=?ImViaEmail, "; | 967 | query += "imviaemail=?ImViaEmail, "; |
967 | query += "visible=?Visible "; | 968 | query += "visible=?Visible,"; |
968 | query += "WHERE useruuid=?uuid"; | 969 | query += "WHERE useruuid=?uuid"; |
969 | 970 | ||
970 | try | 971 | try |
@@ -974,11 +975,14 @@ namespace OpenSim.Data.MySQL | |||
974 | dbcon.Open(); | 975 | dbcon.Open(); |
975 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) | 976 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) |
976 | { | 977 | { |
977 | cmd.Parameters.AddWithValue("?ImViaEmail", pref.IMViaEmail); | 978 | cmd.Parameters.AddWithValue("?ImViaEmail", emailIm.ToString().ToLower ()); |
978 | cmd.Parameters.AddWithValue("?Visible", pref.Visible); | 979 | cmd.Parameters.AddWithValue("?WantText", visible.ToString().ToLower ()); |
979 | cmd.Parameters.AddWithValue("?uuid", pref.UserId.ToString()); | 980 | cmd.Parameters.AddWithValue("?uuid", avatarId.ToString()); |
980 | 981 | ||
981 | cmd.ExecuteNonQuery(); | 982 | lock(Lock) |
983 | { | ||
984 | cmd.ExecuteNonQuery(); | ||
985 | } | ||
982 | } | 986 | } |
983 | } | 987 | } |
984 | } | 988 | } |
@@ -986,7 +990,6 @@ namespace OpenSim.Data.MySQL | |||
986 | { | 990 | { |
987 | m_log.DebugFormat("[PROFILES_DATA]" + | 991 | m_log.DebugFormat("[PROFILES_DATA]" + |
988 | ": AgentInterestsUpdate exception {0}", e.Message); | 992 | ": AgentInterestsUpdate exception {0}", e.Message); |
989 | result = e.Message; | ||
990 | return false; | 993 | return false; |
991 | } | 994 | } |
992 | return true; | 995 | return true; |
diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs index 91389ce..5f1d2ee 100644 --- a/OpenSim/Data/MySQL/MySQLXAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs | |||
@@ -520,4 +520,4 @@ namespace OpenSim.Data.MySQL | |||
520 | 520 | ||
521 | #endregion | 521 | #endregion |
522 | } | 522 | } |
523 | } \ No newline at end of file | 523 | } |
diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations index a77e44d..c2e3afe 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` ( |
@@ -939,4 +939,3 @@ ALTER TABLE prims ADD COLUMN AttachedPosY double default 0; | |||
939 | ALTER TABLE prims ADD COLUMN AttachedPosZ double default 0; | 939 | ALTER TABLE prims ADD COLUMN AttachedPosZ double default 0; |
940 | ALTER TABLE primshapes ADD COLUMN LastAttachPoint int(4) not null default '0'; | 940 | ALTER TABLE primshapes ADD COLUMN LastAttachPoint int(4) not null default '0'; |
941 | COMMIT; | 941 | COMMIT; |
942 | |||
diff --git a/OpenSim/Data/MySQL/Resources/UserProfiles.migrations b/OpenSim/Data/MySQL/Resources/UserProfiles.migrations index bd325da..c29f1ab 100644 --- a/OpenSim/Data/MySQL/Resources/UserProfiles.migrations +++ b/OpenSim/Data/MySQL/Resources/UserProfiles.migrations | |||
@@ -81,13 +81,3 @@ CREATE TABLE IF NOT EXISTS `userdata` ( | |||
81 | 81 | ||
82 | commit; | 82 | commit; |
83 | 83 | ||
84 | :VERSION 3 # ------------------------------- | ||
85 | begin; | ||
86 | CREATE TABLE IF NOT EXISTS `usersettings` ( | ||
87 | `useruuid` varchar(36) NOT NULL, | ||
88 | `imviaemail` enum('true','false') NOT NULL, | ||
89 | `visible` enum('true','false') NOT NULL, | ||
90 | `email` varchar(254) NOT NULL, | ||
91 | PRIMARY KEY (`useruuid`) | ||
92 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | ||
93 | commit; \ No newline at end of file | ||