diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLAssetData.cs | 6 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLGenericTableHandler.cs | 7 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLSimulationData.cs | 259 | ||||
-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 | 2 |
6 files changed, 231 insertions, 91 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 da8e958..86367a1 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]); |
@@ -296,4 +301,4 @@ namespace OpenSim.Data.MySQL | |||
296 | } | 301 | } |
297 | } | 302 | } |
298 | } | 303 | } |
299 | } \ No newline at end of file | 304 | } |
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 1a2e113..31c80c1 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,7 +173,10 @@ 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) values (" + "?UUID, " + | 176 | "PassCollisions, " + |
177 | "LinkNumber, MediaURL, KeyframeMotion, " + | ||
178 | "PhysicsShapeType, Density, GravityModifier, " + | ||
179 | "Friction, Restitution) values (" + "?UUID, " + | ||
175 | "?CreationDate, ?Name, ?Text, " + | 180 | "?CreationDate, ?Name, ?Text, " + |
176 | "?Description, ?SitName, ?TouchName, " + | 181 | "?Description, ?SitName, ?TouchName, " + |
177 | "?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " + | 182 | "?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " + |
@@ -202,14 +207,17 @@ namespace OpenSim.Data.MySQL | |||
202 | "?SaleType, ?ColorR, ?ColorG, " + | 207 | "?SaleType, ?ColorR, ?ColorG, " + |
203 | "?ColorB, ?ColorA, ?ParticleSystem, " + | 208 | "?ColorB, ?ColorA, ?ParticleSystem, " + |
204 | "?ClickAction, ?Material, ?CollisionSound, " + | 209 | "?ClickAction, ?Material, ?CollisionSound, " + |
205 | "?CollisionSoundVolume, ?PassTouches, ?LinkNumber, ?MediaURL)"; | 210 | "?CollisionSoundVolume, ?PassTouches, ?PassCollisions, " + |
206 | 211 | "?LinkNumber, ?MediaURL, ?KeyframeMotion, " + | |
212 | "?PhysicsShapeType, ?Density, ?GravityModifier, " + | ||
213 | "?Friction, ?Restitution)"; | ||
214 | |||
207 | FillPrimCommand(cmd, prim, obj.UUID, regionUUID); | 215 | FillPrimCommand(cmd, prim, obj.UUID, regionUUID); |
208 | 216 | ||
209 | ExecuteNonQuery(cmd); | 217 | ExecuteNonQuery(cmd); |
210 | 218 | ||
211 | cmd.Parameters.Clear(); | 219 | cmd.Parameters.Clear(); |
212 | 220 | ||
213 | cmd.CommandText = "replace into primshapes (" + | 221 | cmd.CommandText = "replace into primshapes (" + |
214 | "UUID, Shape, ScaleX, ScaleY, " + | 222 | "UUID, Shape, ScaleX, ScaleY, " + |
215 | "ScaleZ, PCode, PathBegin, PathEnd, " + | 223 | "ScaleZ, PCode, PathBegin, PathEnd, " + |
@@ -231,9 +239,9 @@ namespace OpenSim.Data.MySQL | |||
231 | "?ProfileEnd, ?ProfileCurve, " + | 239 | "?ProfileEnd, ?ProfileCurve, " + |
232 | "?ProfileHollow, ?Texture, ?ExtraParams, " + | 240 | "?ProfileHollow, ?Texture, ?ExtraParams, " + |
233 | "?State, ?Media)"; | 241 | "?State, ?Media)"; |
234 | 242 | ||
235 | FillShapeCommand(cmd, prim); | 243 | FillShapeCommand(cmd, prim); |
236 | 244 | ||
237 | ExecuteNonQuery(cmd); | 245 | ExecuteNonQuery(cmd); |
238 | } | 246 | } |
239 | } | 247 | } |
@@ -241,7 +249,7 @@ namespace OpenSim.Data.MySQL | |||
241 | } | 249 | } |
242 | } | 250 | } |
243 | 251 | ||
244 | public void RemoveObject(UUID obj, UUID regionUUID) | 252 | public virtual void RemoveObject(UUID obj, UUID regionUUID) |
245 | { | 253 | { |
246 | // m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID); | 254 | // m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID); |
247 | 255 | ||
@@ -390,7 +398,7 @@ namespace OpenSim.Data.MySQL | |||
390 | } | 398 | } |
391 | } | 399 | } |
392 | 400 | ||
393 | public List<SceneObjectGroup> LoadObjects(UUID regionID) | 401 | public virtual List<SceneObjectGroup> LoadObjects(UUID regionID) |
394 | { | 402 | { |
395 | const int ROWS_PER_QUERY = 5000; | 403 | const int ROWS_PER_QUERY = 5000; |
396 | 404 | ||
@@ -446,7 +454,11 @@ namespace OpenSim.Data.MySQL | |||
446 | foreach (SceneObjectPart prim in prims.Values) | 454 | foreach (SceneObjectPart prim in prims.Values) |
447 | { | 455 | { |
448 | if (prim.ParentUUID == UUID.Zero) | 456 | if (prim.ParentUUID == UUID.Zero) |
457 | { | ||
449 | objects[prim.UUID] = new SceneObjectGroup(prim); | 458 | objects[prim.UUID] = new SceneObjectGroup(prim); |
459 | if (prim.KeyframeMotion != null) | ||
460 | prim.KeyframeMotion.UpdateSceneObject(objects[prim.UUID]); | ||
461 | } | ||
450 | } | 462 | } |
451 | 463 | ||
452 | // Add all of the children objects to the SOGs | 464 | // Add all of the children objects to the SOGs |
@@ -559,36 +571,51 @@ namespace OpenSim.Data.MySQL | |||
559 | } | 571 | } |
560 | } | 572 | } |
561 | 573 | ||
562 | public void StoreTerrain(double[,] ter, UUID regionID) | 574 | public virtual void StoreTerrain(double[,] ter, UUID regionID) |
563 | { | 575 | { |
564 | m_log.Info("[REGION DB]: Storing terrain"); | 576 | Util.FireAndForget(delegate(object x) |
565 | |||
566 | lock (m_dbLock) | ||
567 | { | 577 | { |
568 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 578 | double[,] oldTerrain = LoadTerrain(regionID); |
569 | { | ||
570 | dbcon.Open(); | ||
571 | 579 | ||
572 | using (MySqlCommand cmd = dbcon.CreateCommand()) | 580 | m_log.Info("[REGION DB]: Storing terrain"); |
581 | |||
582 | lock (m_dbLock) | ||
583 | { | ||
584 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
573 | { | 585 | { |
574 | cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID"; | 586 | dbcon.Open(); |
575 | cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
576 | 587 | ||
577 | ExecuteNonQuery(cmd); | 588 | using (MySqlCommand cmd = dbcon.CreateCommand()) |
589 | { | ||
590 | cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID"; | ||
591 | cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
578 | 592 | ||
579 | cmd.CommandText = "insert into terrain (RegionUUID, " + | 593 | using (MySqlCommand cmd2 = dbcon.CreateCommand()) |
580 | "Revision, Heightfield) values (?RegionUUID, " + | 594 | { |
581 | "1, ?Heightfield)"; | 595 | try |
596 | { | ||
597 | cmd2.CommandText = "insert into terrain (RegionUUID, " + | ||
598 | "Revision, Heightfield) values (?RegionUUID, " + | ||
599 | "1, ?Heightfield)"; | ||
582 | 600 | ||
583 | cmd.Parameters.AddWithValue("Heightfield", SerializeTerrain(ter)); | 601 | cmd2.Parameters.AddWithValue("RegionUUID", regionID.ToString()); |
602 | cmd2.Parameters.AddWithValue("Heightfield", SerializeTerrain(ter, oldTerrain)); | ||
584 | 603 | ||
585 | ExecuteNonQuery(cmd); | 604 | ExecuteNonQuery(cmd); |
605 | ExecuteNonQuery(cmd2); | ||
606 | } | ||
607 | catch (Exception e) | ||
608 | { | ||
609 | m_log.ErrorFormat(e.ToString()); | ||
610 | } | ||
611 | } | ||
612 | } | ||
586 | } | 613 | } |
587 | } | 614 | } |
588 | } | 615 | }); |
589 | } | 616 | } |
590 | 617 | ||
591 | public double[,] LoadTerrain(UUID regionID) | 618 | public virtual double[,] LoadTerrain(UUID regionID) |
592 | { | 619 | { |
593 | double[,] terrain = null; | 620 | double[,] terrain = null; |
594 | 621 | ||
@@ -638,7 +665,7 @@ namespace OpenSim.Data.MySQL | |||
638 | return terrain; | 665 | return terrain; |
639 | } | 666 | } |
640 | 667 | ||
641 | public void RemoveLandObject(UUID globalID) | 668 | public virtual void RemoveLandObject(UUID globalID) |
642 | { | 669 | { |
643 | lock (m_dbLock) | 670 | lock (m_dbLock) |
644 | { | 671 | { |
@@ -657,7 +684,7 @@ namespace OpenSim.Data.MySQL | |||
657 | } | 684 | } |
658 | } | 685 | } |
659 | 686 | ||
660 | public void StoreLandObject(ILandObject parcel) | 687 | public virtual void StoreLandObject(ILandObject parcel) |
661 | { | 688 | { |
662 | lock (m_dbLock) | 689 | lock (m_dbLock) |
663 | { | 690 | { |
@@ -714,7 +741,7 @@ namespace OpenSim.Data.MySQL | |||
714 | } | 741 | } |
715 | } | 742 | } |
716 | 743 | ||
717 | public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) | 744 | public virtual RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) |
718 | { | 745 | { |
719 | RegionLightShareData nWP = new RegionLightShareData(); | 746 | RegionLightShareData nWP = new RegionLightShareData(); |
720 | nWP.OnSave += StoreRegionWindlightSettings; | 747 | nWP.OnSave += StoreRegionWindlightSettings; |
@@ -736,7 +763,7 @@ namespace OpenSim.Data.MySQL | |||
736 | { | 763 | { |
737 | //No result, so store our default windlight profile and return it | 764 | //No result, so store our default windlight profile and return it |
738 | nWP.regionID = regionUUID; | 765 | nWP.regionID = regionUUID; |
739 | StoreRegionWindlightSettings(nWP); | 766 | // StoreRegionWindlightSettings(nWP); |
740 | return nWP; | 767 | return nWP; |
741 | } | 768 | } |
742 | else | 769 | else |
@@ -811,7 +838,7 @@ namespace OpenSim.Data.MySQL | |||
811 | return nWP; | 838 | return nWP; |
812 | } | 839 | } |
813 | 840 | ||
814 | public RegionSettings LoadRegionSettings(UUID regionUUID) | 841 | public virtual RegionSettings LoadRegionSettings(UUID regionUUID) |
815 | { | 842 | { |
816 | RegionSettings rs = null; | 843 | RegionSettings rs = null; |
817 | 844 | ||
@@ -851,7 +878,7 @@ namespace OpenSim.Data.MySQL | |||
851 | return rs; | 878 | return rs; |
852 | } | 879 | } |
853 | 880 | ||
854 | public void StoreRegionWindlightSettings(RegionLightShareData wl) | 881 | public virtual void StoreRegionWindlightSettings(RegionLightShareData wl) |
855 | { | 882 | { |
856 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 883 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
857 | { | 884 | { |
@@ -954,7 +981,7 @@ namespace OpenSim.Data.MySQL | |||
954 | } | 981 | } |
955 | } | 982 | } |
956 | 983 | ||
957 | public void RemoveRegionWindlightSettings(UUID regionID) | 984 | public virtual void RemoveRegionWindlightSettings(UUID regionID) |
958 | { | 985 | { |
959 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 986 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
960 | { | 987 | { |
@@ -1031,7 +1058,7 @@ namespace OpenSim.Data.MySQL | |||
1031 | } | 1058 | } |
1032 | #endregion | 1059 | #endregion |
1033 | 1060 | ||
1034 | public void StoreRegionSettings(RegionSettings rs) | 1061 | public virtual void StoreRegionSettings(RegionSettings rs) |
1035 | { | 1062 | { |
1036 | lock (m_dbLock) | 1063 | lock (m_dbLock) |
1037 | { | 1064 | { |
@@ -1058,7 +1085,7 @@ namespace OpenSim.Data.MySQL | |||
1058 | "use_estate_sun, fixed_sun, sun_position, " + | 1085 | "use_estate_sun, fixed_sun, sun_position, " + |
1059 | "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " + | 1086 | "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " + |
1060 | "sunvectorz, loaded_creation_datetime, " + | 1087 | "sunvectorz, loaded_creation_datetime, " + |
1061 | "loaded_creation_id, map_tile_ID, " + | 1088 | "loaded_creation_id, map_tile_ID, block_search, casino, " + |
1062 | "TelehubObject, parcel_tile_ID) " + | 1089 | "TelehubObject, parcel_tile_ID) " + |
1063 | "values (?RegionUUID, ?BlockTerraform, " + | 1090 | "values (?RegionUUID, ?BlockTerraform, " + |
1064 | "?BlockFly, ?AllowDamage, ?RestrictPushing, " + | 1091 | "?BlockFly, ?AllowDamage, ?RestrictPushing, " + |
@@ -1075,7 +1102,8 @@ namespace OpenSim.Data.MySQL | |||
1075 | "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " + | 1102 | "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " + |
1076 | "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + | 1103 | "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + |
1077 | "?LoadedCreationDateTime, ?LoadedCreationID, " + | 1104 | "?LoadedCreationDateTime, ?LoadedCreationID, " + |
1078 | "?TerrainImageID, ?TelehubObject, ?ParcelImageID) "; | 1105 | "?TerrainImageID, ?block_search, ?casino, " + |
1106 | "?TelehubObject, ?ParcelImageID)"; | ||
1079 | 1107 | ||
1080 | FillRegionSettingsCommand(cmd, rs); | 1108 | FillRegionSettingsCommand(cmd, rs); |
1081 | 1109 | ||
@@ -1086,7 +1114,7 @@ namespace OpenSim.Data.MySQL | |||
1086 | SaveSpawnPoints(rs); | 1114 | SaveSpawnPoints(rs); |
1087 | } | 1115 | } |
1088 | 1116 | ||
1089 | public List<LandData> LoadLandObjects(UUID regionUUID) | 1117 | public virtual List<LandData> LoadLandObjects(UUID regionUUID) |
1090 | { | 1118 | { |
1091 | List<LandData> landData = new List<LandData>(); | 1119 | List<LandData> landData = new List<LandData>(); |
1092 | 1120 | ||
@@ -1268,11 +1296,31 @@ namespace OpenSim.Data.MySQL | |||
1268 | prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"]; | 1296 | prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"]; |
1269 | 1297 | ||
1270 | prim.PassTouches = ((sbyte)row["PassTouches"] != 0); | 1298 | prim.PassTouches = ((sbyte)row["PassTouches"] != 0); |
1299 | prim.PassCollisions = ((sbyte)row["PassCollisions"] != 0); | ||
1271 | prim.LinkNum = (int)row["LinkNumber"]; | 1300 | prim.LinkNum = (int)row["LinkNumber"]; |
1272 | 1301 | ||
1273 | if (!(row["MediaURL"] is System.DBNull)) | 1302 | if (!(row["MediaURL"] is System.DBNull)) |
1274 | prim.MediaUrl = (string)row["MediaURL"]; | 1303 | prim.MediaUrl = (string)row["MediaURL"]; |
1275 | 1304 | ||
1305 | if (!(row["KeyframeMotion"] is DBNull)) | ||
1306 | { | ||
1307 | Byte[] data = (byte[])row["KeyframeMotion"]; | ||
1308 | if (data.Length > 0) | ||
1309 | prim.KeyframeMotion = KeyframeMotion.FromData(null, data); | ||
1310 | else | ||
1311 | prim.KeyframeMotion = null; | ||
1312 | } | ||
1313 | else | ||
1314 | { | ||
1315 | prim.KeyframeMotion = null; | ||
1316 | } | ||
1317 | |||
1318 | prim.PhysicsShapeType = (byte)Convert.ToInt32(row["PhysicsShapeType"].ToString()); | ||
1319 | prim.Density = (float)(double)row["Density"]; | ||
1320 | prim.GravityModifier = (float)(double)row["GravityModifier"]; | ||
1321 | prim.Friction = (float)(double)row["Friction"]; | ||
1322 | prim.Bounciness = (float)(double)row["Restitution"]; | ||
1323 | |||
1276 | return prim; | 1324 | return prim; |
1277 | } | 1325 | } |
1278 | 1326 | ||
@@ -1283,32 +1331,40 @@ namespace OpenSim.Data.MySQL | |||
1283 | /// <returns></returns> | 1331 | /// <returns></returns> |
1284 | private static TaskInventoryItem BuildItem(IDataReader row) | 1332 | private static TaskInventoryItem BuildItem(IDataReader row) |
1285 | { | 1333 | { |
1286 | TaskInventoryItem taskItem = new TaskInventoryItem(); | 1334 | try |
1287 | 1335 | { | |
1288 | taskItem.ItemID = DBGuid.FromDB(row["itemID"]); | 1336 | TaskInventoryItem taskItem = new TaskInventoryItem(); |
1289 | taskItem.ParentPartID = DBGuid.FromDB(row["primID"]); | 1337 | |
1290 | taskItem.AssetID = DBGuid.FromDB(row["assetID"]); | 1338 | taskItem.ItemID = DBGuid.FromDB(row["itemID"]); |
1291 | taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]); | 1339 | taskItem.ParentPartID = DBGuid.FromDB(row["primID"]); |
1292 | 1340 | taskItem.AssetID = DBGuid.FromDB(row["assetID"]); | |
1293 | taskItem.InvType = Convert.ToInt32(row["invType"]); | 1341 | taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]); |
1294 | taskItem.Type = Convert.ToInt32(row["assetType"]); | 1342 | |
1295 | 1343 | taskItem.InvType = Convert.ToInt32(row["invType"]); | |
1296 | taskItem.Name = (String)row["name"]; | 1344 | taskItem.Type = Convert.ToInt32(row["assetType"]); |
1297 | taskItem.Description = (String)row["description"]; | 1345 | |
1298 | taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); | 1346 | taskItem.Name = (String)row["name"]; |
1299 | taskItem.CreatorIdentification = (String)row["creatorID"]; | 1347 | taskItem.Description = (String)row["description"]; |
1300 | taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]); | 1348 | taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); |
1301 | taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]); | 1349 | taskItem.CreatorIdentification = (String)row["creatorID"]; |
1302 | taskItem.GroupID = DBGuid.FromDB(row["groupID"]); | 1350 | taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]); |
1303 | 1351 | taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]); | |
1304 | taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]); | 1352 | taskItem.GroupID = DBGuid.FromDB(row["groupID"]); |
1305 | taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]); | 1353 | |
1306 | taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]); | 1354 | taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]); |
1307 | taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]); | 1355 | taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]); |
1308 | taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]); | 1356 | taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]); |
1309 | taskItem.Flags = Convert.ToUInt32(row["flags"]); | 1357 | taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]); |
1310 | 1358 | taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]); | |
1311 | return taskItem; | 1359 | taskItem.Flags = Convert.ToUInt32(row["flags"]); |
1360 | |||
1361 | return taskItem; | ||
1362 | } | ||
1363 | catch | ||
1364 | { | ||
1365 | m_log.ErrorFormat("[MYSQL DB]: Error reading task inventory: itemID was {0}, primID was {1}", row["itemID"].ToString(), row["primID"].ToString()); | ||
1366 | throw; | ||
1367 | } | ||
1312 | } | 1368 | } |
1313 | 1369 | ||
1314 | private static RegionSettings BuildRegionSettings(IDataReader row) | 1370 | private static RegionSettings BuildRegionSettings(IDataReader row) |
@@ -1366,6 +1422,9 @@ namespace OpenSim.Data.MySQL | |||
1366 | newSettings.ParcelImageID = DBGuid.FromDB(row["parcel_tile_ID"]); | 1422 | newSettings.ParcelImageID = DBGuid.FromDB(row["parcel_tile_ID"]); |
1367 | newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]); | 1423 | newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]); |
1368 | 1424 | ||
1425 | newSettings.GodBlockSearch = Convert.ToBoolean(row["block_search"]); | ||
1426 | newSettings.Casino = Convert.ToBoolean(row["casino"]); | ||
1427 | |||
1369 | return newSettings; | 1428 | return newSettings; |
1370 | } | 1429 | } |
1371 | 1430 | ||
@@ -1463,7 +1522,7 @@ namespace OpenSim.Data.MySQL | |||
1463 | /// </summary> | 1522 | /// </summary> |
1464 | /// <param name="val"></param> | 1523 | /// <param name="val"></param> |
1465 | /// <returns></returns> | 1524 | /// <returns></returns> |
1466 | private static Array SerializeTerrain(double[,] val) | 1525 | private static Array SerializeTerrain(double[,] val, double[,] oldTerrain) |
1467 | { | 1526 | { |
1468 | MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double)); | 1527 | MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double)); |
1469 | BinaryWriter bw = new BinaryWriter(str); | 1528 | BinaryWriter bw = new BinaryWriter(str); |
@@ -1472,7 +1531,11 @@ namespace OpenSim.Data.MySQL | |||
1472 | for (int x = 0; x < (int)Constants.RegionSize; x++) | 1531 | for (int x = 0; x < (int)Constants.RegionSize; x++) |
1473 | for (int y = 0; y < (int)Constants.RegionSize; y++) | 1532 | for (int y = 0; y < (int)Constants.RegionSize; y++) |
1474 | { | 1533 | { |
1475 | double height = val[x, y]; | 1534 | double height = 20.0; |
1535 | if (oldTerrain != null) | ||
1536 | height = oldTerrain[x, y]; | ||
1537 | if (!double.IsNaN(val[x, y])) | ||
1538 | height = val[x, y]; | ||
1476 | if (height == 0.0) | 1539 | if (height == 0.0) |
1477 | height = double.Epsilon; | 1540 | height = double.Epsilon; |
1478 | 1541 | ||
@@ -1616,8 +1679,24 @@ namespace OpenSim.Data.MySQL | |||
1616 | else | 1679 | else |
1617 | cmd.Parameters.AddWithValue("PassTouches", 0); | 1680 | cmd.Parameters.AddWithValue("PassTouches", 0); |
1618 | 1681 | ||
1682 | if (prim.PassCollisions) | ||
1683 | cmd.Parameters.AddWithValue("PassCollisions", 1); | ||
1684 | else | ||
1685 | cmd.Parameters.AddWithValue("PassCollisions", 0); | ||
1686 | |||
1619 | cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); | 1687 | cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); |
1620 | cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); | 1688 | cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); |
1689 | |||
1690 | if (prim.KeyframeMotion != null) | ||
1691 | cmd.Parameters.AddWithValue("KeyframeMotion", prim.KeyframeMotion.Serialize()); | ||
1692 | else | ||
1693 | cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]); | ||
1694 | |||
1695 | cmd.Parameters.AddWithValue("PhysicsShapeType", prim.PhysicsShapeType); | ||
1696 | cmd.Parameters.AddWithValue("Density", (double)prim.Density); | ||
1697 | cmd.Parameters.AddWithValue("GravityModifier", (double)prim.GravityModifier); | ||
1698 | cmd.Parameters.AddWithValue("Friction", (double)prim.Friction); | ||
1699 | cmd.Parameters.AddWithValue("Restitution", (double)prim.Bounciness); | ||
1621 | } | 1700 | } |
1622 | 1701 | ||
1623 | /// <summary> | 1702 | /// <summary> |
@@ -1696,6 +1775,9 @@ namespace OpenSim.Data.MySQL | |||
1696 | cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); | 1775 | cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); |
1697 | cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); | 1776 | cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); |
1698 | cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); | 1777 | cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); |
1778 | cmd.Parameters.AddWithValue("block_search", settings.GodBlockSearch); | ||
1779 | cmd.Parameters.AddWithValue("casino", settings.Casino); | ||
1780 | |||
1699 | cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID); | 1781 | cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID); |
1700 | cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject); | 1782 | cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject); |
1701 | } | 1783 | } |
@@ -1856,7 +1938,7 @@ namespace OpenSim.Data.MySQL | |||
1856 | cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); | 1938 | cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); |
1857 | } | 1939 | } |
1858 | 1940 | ||
1859 | public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) | 1941 | public virtual void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) |
1860 | { | 1942 | { |
1861 | lock (m_dbLock) | 1943 | lock (m_dbLock) |
1862 | { | 1944 | { |
@@ -1900,6 +1982,37 @@ namespace OpenSim.Data.MySQL | |||
1900 | } | 1982 | } |
1901 | } | 1983 | } |
1902 | 1984 | ||
1985 | public UUID[] GetObjectIDs(UUID regionID) | ||
1986 | { | ||
1987 | List<UUID> uuids = new List<UUID>(); | ||
1988 | |||
1989 | lock (m_dbLock) | ||
1990 | { | ||
1991 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
1992 | { | ||
1993 | dbcon.Open(); | ||
1994 | |||
1995 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
1996 | { | ||
1997 | cmd.CommandText = "select UUID from prims where RegionUUID = ?RegionUUID"; | ||
1998 | cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
1999 | |||
2000 | using (IDataReader reader = ExecuteReader(cmd)) | ||
2001 | { | ||
2002 | while (reader.Read()) | ||
2003 | { | ||
2004 | UUID id = new UUID(reader["UUID"].ToString()); | ||
2005 | |||
2006 | uuids.Add(id); | ||
2007 | } | ||
2008 | } | ||
2009 | } | ||
2010 | } | ||
2011 | } | ||
2012 | |||
2013 | return uuids.ToArray(); | ||
2014 | } | ||
2015 | |||
1903 | private void LoadSpawnPoints(RegionSettings rs) | 2016 | private void LoadSpawnPoints(RegionSettings rs) |
1904 | { | 2017 | { |
1905 | rs.ClearSpawnPoints(); | 2018 | 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 4a925fb..db0d0ec 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` ( |