diff options
Diffstat (limited to 'OpenSim/Data/MySQL')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLAssetData.cs | 4 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLSimulationData.cs | 41 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLUserAccountData.cs | 41 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/Resources/RegionStore.migrations | 2 |
4 files changed, 57 insertions, 31 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index e740232..94e2da4 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 | { |
@@ -203,12 +203,14 @@ namespace OpenSim.Data.MySQL | |||
203 | cmd.Parameters.AddWithValue("?data", asset.Data); | 203 | cmd.Parameters.AddWithValue("?data", asset.Data); |
204 | cmd.ExecuteNonQuery(); | 204 | cmd.ExecuteNonQuery(); |
205 | cmd.Dispose(); | 205 | cmd.Dispose(); |
206 | return true; | ||
206 | } | 207 | } |
207 | } | 208 | } |
208 | catch (Exception e) | 209 | catch (Exception e) |
209 | { | 210 | { |
210 | m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}", | 211 | m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}", |
211 | asset.FullID, asset.Name, e.Message); | 212 | asset.FullID, asset.Name, e.Message); |
213 | return false; | ||
212 | } | 214 | } |
213 | } | 215 | } |
214 | } | 216 | } |
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index e14d775..cdaf5b7 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 | ||
@@ -130,7 +130,7 @@ namespace OpenSim.Data.MySQL | |||
130 | 130 | ||
131 | public void Dispose() {} | 131 | public void Dispose() {} |
132 | 132 | ||
133 | public void StoreObject(SceneObjectGroup obj, UUID regionUUID) | 133 | public virtual void StoreObject(SceneObjectGroup obj, UUID regionUUID) |
134 | { | 134 | { |
135 | uint flags = obj.RootPart.GetEffectiveObjectFlags(); | 135 | uint flags = obj.RootPart.GetEffectiveObjectFlags(); |
136 | 136 | ||
@@ -258,7 +258,7 @@ namespace OpenSim.Data.MySQL | |||
258 | } | 258 | } |
259 | } | 259 | } |
260 | 260 | ||
261 | public void RemoveObject(UUID obj, UUID regionUUID) | 261 | public virtual void RemoveObject(UUID obj, UUID regionUUID) |
262 | { | 262 | { |
263 | // m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID); | 263 | // m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID); |
264 | 264 | ||
@@ -407,7 +407,7 @@ namespace OpenSim.Data.MySQL | |||
407 | } | 407 | } |
408 | } | 408 | } |
409 | 409 | ||
410 | public List<SceneObjectGroup> LoadObjects(UUID regionID) | 410 | public virtual List<SceneObjectGroup> LoadObjects(UUID regionID) |
411 | { | 411 | { |
412 | const int ROWS_PER_QUERY = 5000; | 412 | const int ROWS_PER_QUERY = 5000; |
413 | 413 | ||
@@ -576,7 +576,7 @@ namespace OpenSim.Data.MySQL | |||
576 | } | 576 | } |
577 | } | 577 | } |
578 | 578 | ||
579 | public void StoreTerrain(double[,] ter, UUID regionID) | 579 | public virtual void StoreTerrain(double[,] ter, UUID regionID) |
580 | { | 580 | { |
581 | m_log.Info("[REGION DB]: Storing terrain"); | 581 | m_log.Info("[REGION DB]: Storing terrain"); |
582 | 582 | ||
@@ -605,7 +605,7 @@ namespace OpenSim.Data.MySQL | |||
605 | } | 605 | } |
606 | } | 606 | } |
607 | 607 | ||
608 | public double[,] LoadTerrain(UUID regionID) | 608 | public virtual double[,] LoadTerrain(UUID regionID) |
609 | { | 609 | { |
610 | double[,] terrain = null; | 610 | double[,] terrain = null; |
611 | 611 | ||
@@ -655,7 +655,7 @@ namespace OpenSim.Data.MySQL | |||
655 | return terrain; | 655 | return terrain; |
656 | } | 656 | } |
657 | 657 | ||
658 | public void RemoveLandObject(UUID globalID) | 658 | public virtual void RemoveLandObject(UUID globalID) |
659 | { | 659 | { |
660 | lock (m_dbLock) | 660 | lock (m_dbLock) |
661 | { | 661 | { |
@@ -674,7 +674,7 @@ namespace OpenSim.Data.MySQL | |||
674 | } | 674 | } |
675 | } | 675 | } |
676 | 676 | ||
677 | public void StoreLandObject(ILandObject parcel) | 677 | public virtual void StoreLandObject(ILandObject parcel) |
678 | { | 678 | { |
679 | lock (m_dbLock) | 679 | lock (m_dbLock) |
680 | { | 680 | { |
@@ -731,7 +731,7 @@ namespace OpenSim.Data.MySQL | |||
731 | } | 731 | } |
732 | } | 732 | } |
733 | 733 | ||
734 | public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) | 734 | public virtual RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) |
735 | { | 735 | { |
736 | RegionLightShareData nWP = new RegionLightShareData(); | 736 | RegionLightShareData nWP = new RegionLightShareData(); |
737 | nWP.OnSave += StoreRegionWindlightSettings; | 737 | nWP.OnSave += StoreRegionWindlightSettings; |
@@ -753,7 +753,7 @@ namespace OpenSim.Data.MySQL | |||
753 | { | 753 | { |
754 | //No result, so store our default windlight profile and return it | 754 | //No result, so store our default windlight profile and return it |
755 | nWP.regionID = regionUUID; | 755 | nWP.regionID = regionUUID; |
756 | StoreRegionWindlightSettings(nWP); | 756 | // StoreRegionWindlightSettings(nWP); |
757 | return nWP; | 757 | return nWP; |
758 | } | 758 | } |
759 | else | 759 | else |
@@ -828,7 +828,7 @@ namespace OpenSim.Data.MySQL | |||
828 | return nWP; | 828 | return nWP; |
829 | } | 829 | } |
830 | 830 | ||
831 | public RegionSettings LoadRegionSettings(UUID regionUUID) | 831 | public virtual RegionSettings LoadRegionSettings(UUID regionUUID) |
832 | { | 832 | { |
833 | RegionSettings rs = null; | 833 | RegionSettings rs = null; |
834 | 834 | ||
@@ -866,7 +866,7 @@ namespace OpenSim.Data.MySQL | |||
866 | return rs; | 866 | return rs; |
867 | } | 867 | } |
868 | 868 | ||
869 | public void StoreRegionWindlightSettings(RegionLightShareData wl) | 869 | public virtual void StoreRegionWindlightSettings(RegionLightShareData wl) |
870 | { | 870 | { |
871 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 871 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
872 | { | 872 | { |
@@ -969,7 +969,7 @@ namespace OpenSim.Data.MySQL | |||
969 | } | 969 | } |
970 | } | 970 | } |
971 | 971 | ||
972 | public void RemoveRegionWindlightSettings(UUID regionID) | 972 | public virtual void RemoveRegionWindlightSettings(UUID regionID) |
973 | { | 973 | { |
974 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 974 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
975 | { | 975 | { |
@@ -984,7 +984,7 @@ namespace OpenSim.Data.MySQL | |||
984 | } | 984 | } |
985 | } | 985 | } |
986 | 986 | ||
987 | public void StoreRegionSettings(RegionSettings rs) | 987 | public virtual void StoreRegionSettings(RegionSettings rs) |
988 | { | 988 | { |
989 | lock (m_dbLock) | 989 | lock (m_dbLock) |
990 | { | 990 | { |
@@ -1011,7 +1011,7 @@ namespace OpenSim.Data.MySQL | |||
1011 | "use_estate_sun, fixed_sun, sun_position, " + | 1011 | "use_estate_sun, fixed_sun, sun_position, " + |
1012 | "covenant, Sandbox, sunvectorx, sunvectory, " + | 1012 | "covenant, Sandbox, sunvectorx, sunvectory, " + |
1013 | "sunvectorz, loaded_creation_datetime, " + | 1013 | "sunvectorz, loaded_creation_datetime, " + |
1014 | "loaded_creation_id, map_tile_ID) values (?RegionUUID, ?BlockTerraform, " + | 1014 | "loaded_creation_id, map_tile_ID, block_search, casino) values (?RegionUUID, ?BlockTerraform, " + |
1015 | "?BlockFly, ?AllowDamage, ?RestrictPushing, " + | 1015 | "?BlockFly, ?AllowDamage, ?RestrictPushing, " + |
1016 | "?AllowLandResell, ?AllowLandJoinDivide, " + | 1016 | "?AllowLandResell, ?AllowLandJoinDivide, " + |
1017 | "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " + | 1017 | "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " + |
@@ -1026,7 +1026,7 @@ namespace OpenSim.Data.MySQL | |||
1026 | "?SunPosition, ?Covenant, ?Sandbox, " + | 1026 | "?SunPosition, ?Covenant, ?Sandbox, " + |
1027 | "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + | 1027 | "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + |
1028 | "?LoadedCreationDateTime, ?LoadedCreationID, " + | 1028 | "?LoadedCreationDateTime, ?LoadedCreationID, " + |
1029 | "?TerrainImageID)"; | 1029 | "?TerrainImageID, ?block_search, ?casino)"; |
1030 | 1030 | ||
1031 | FillRegionSettingsCommand(cmd, rs); | 1031 | FillRegionSettingsCommand(cmd, rs); |
1032 | 1032 | ||
@@ -1036,7 +1036,7 @@ namespace OpenSim.Data.MySQL | |||
1036 | } | 1036 | } |
1037 | } | 1037 | } |
1038 | 1038 | ||
1039 | public List<LandData> LoadLandObjects(UUID regionUUID) | 1039 | public virtual List<LandData> LoadLandObjects(UUID regionUUID) |
1040 | { | 1040 | { |
1041 | List<LandData> landData = new List<LandData>(); | 1041 | List<LandData> landData = new List<LandData>(); |
1042 | 1042 | ||
@@ -1315,6 +1315,9 @@ namespace OpenSim.Data.MySQL | |||
1315 | 1315 | ||
1316 | newSettings.TerrainImageID = DBGuid.FromDB(row["map_tile_ID"]); | 1316 | newSettings.TerrainImageID = DBGuid.FromDB(row["map_tile_ID"]); |
1317 | 1317 | ||
1318 | newSettings.GodBlockSearch = Convert.ToBoolean(row["block_search"]); | ||
1319 | newSettings.Casino = Convert.ToBoolean(row["casino"]); | ||
1320 | |||
1318 | return newSettings; | 1321 | return newSettings; |
1319 | } | 1322 | } |
1320 | 1323 | ||
@@ -1644,6 +1647,8 @@ namespace OpenSim.Data.MySQL | |||
1644 | cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); | 1647 | cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); |
1645 | cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); | 1648 | cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); |
1646 | cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); | 1649 | cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); |
1650 | cmd.Parameters.AddWithValue("block_search", settings.GodBlockSearch); | ||
1651 | cmd.Parameters.AddWithValue("casino", settings.Casino); | ||
1647 | 1652 | ||
1648 | } | 1653 | } |
1649 | 1654 | ||
@@ -1802,7 +1807,7 @@ namespace OpenSim.Data.MySQL | |||
1802 | cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); | 1807 | cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); |
1803 | } | 1808 | } |
1804 | 1809 | ||
1805 | public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) | 1810 | public virtual void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) |
1806 | { | 1811 | { |
1807 | lock (m_dbLock) | 1812 | lock (m_dbLock) |
1808 | { | 1813 | { |
diff --git a/OpenSim/Data/MySQL/MySQLUserAccountData.cs b/OpenSim/Data/MySQL/MySQLUserAccountData.cs index aa69d68..a621d84 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) |
@@ -67,17 +71,32 @@ namespace OpenSim.Data.MySQL | |||
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)", 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)", 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] + "%"); |
82 | cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); | ||
83 | } | ||
84 | |||
85 | return DoQuery(cmd); | ||
86 | } | ||
87 | |||
88 | public UserAccountData[] GetUsersWhere(UUID scopeID, string where) | ||
89 | { | ||
90 | MySqlCommand cmd = new MySqlCommand(); | ||
91 | |||
92 | if (scopeID != UUID.Zero) | ||
93 | { | ||
94 | where = "(ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (" + where + ")"; | ||
78 | cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); | 95 | cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); |
79 | } | 96 | } |
80 | 97 | ||
98 | cmd.CommandText = String.Format("select * from {0} where " + where, m_Realm); | ||
99 | |||
81 | return DoQuery(cmd); | 100 | return DoQuery(cmd); |
82 | } | 101 | } |
83 | } | 102 | } |
diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations index 987625b..c2b130c 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` ( |