diff options
author | Melanie Thielker | 2008-07-18 02:40:47 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-07-18 02:40:47 +0000 |
commit | 263633e274082135b21b8183b92280b768d18883 (patch) | |
tree | f6104eef3633a8b454a4e8ac09d15182970c6bae /OpenSim/Data/MySQL/MySQLDataStore.cs | |
parent | added region port number to output of "show regions" command (diff) | |
download | opensim-SC_OLD-263633e274082135b21b8183b92280b768d18883.zip opensim-SC_OLD-263633e274082135b21b8183b92280b768d18883.tar.gz opensim-SC_OLD-263633e274082135b21b8183b92280b768d18883.tar.bz2 opensim-SC_OLD-263633e274082135b21b8183b92280b768d18883.tar.xz |
Patch #9151
Makes the estate dialog fully functional. Implements all client facing functionality. Moves estate data from estate_settings.xml, which is used to provide defaults, to the region data store. Creates one estate for each region, and places the region in it. Converts all region bans to estate bans.
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLDataStore.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLDataStore.cs | 143 |
1 files changed, 3 insertions, 140 deletions
diff --git a/OpenSim/Data/MySQL/MySQLDataStore.cs b/OpenSim/Data/MySQL/MySQLDataStore.cs index 254e526..25956d5 100644 --- a/OpenSim/Data/MySQL/MySQLDataStore.cs +++ b/OpenSim/Data/MySQL/MySQLDataStore.cs | |||
@@ -53,7 +53,6 @@ namespace OpenSim.Data.MySQL | |||
53 | private const string m_terrainSelect = "select * from terrain limit 1"; | 53 | private const string m_terrainSelect = "select * from terrain limit 1"; |
54 | private const string m_landSelect = "select * from land"; | 54 | private const string m_landSelect = "select * from land"; |
55 | private const string m_landAccessListSelect = "select * from landaccesslist"; | 55 | private const string m_landAccessListSelect = "select * from landaccesslist"; |
56 | private const string m_regionBanListSelect = "select * from regionban"; | ||
57 | private const string m_regionSettingsSelect = "select * from regionsettings"; | 56 | private const string m_regionSettingsSelect = "select * from regionsettings"; |
58 | private const string m_waitTimeoutSelect = "select @@wait_timeout"; | 57 | private const string m_waitTimeoutSelect = "select @@wait_timeout"; |
59 | 58 | ||
@@ -83,7 +82,6 @@ namespace OpenSim.Data.MySQL | |||
83 | private MySqlDataAdapter m_terrainDataAdapter; | 82 | private MySqlDataAdapter m_terrainDataAdapter; |
84 | private MySqlDataAdapter m_landDataAdapter; | 83 | private MySqlDataAdapter m_landDataAdapter; |
85 | private MySqlDataAdapter m_landAccessListDataAdapter; | 84 | private MySqlDataAdapter m_landAccessListDataAdapter; |
86 | private MySqlDataAdapter m_regionBanListDataAdapter; | ||
87 | private MySqlDataAdapter m_regionSettingsDataAdapter; | 85 | private MySqlDataAdapter m_regionSettingsDataAdapter; |
88 | 86 | ||
89 | private DataTable m_primTable; | 87 | private DataTable m_primTable; |
@@ -92,7 +90,6 @@ namespace OpenSim.Data.MySQL | |||
92 | private DataTable m_terrainTable; | 90 | private DataTable m_terrainTable; |
93 | private DataTable m_landTable; | 91 | private DataTable m_landTable; |
94 | private DataTable m_landAccessListTable; | 92 | private DataTable m_landAccessListTable; |
95 | private DataTable m_regionBanListTable; | ||
96 | private DataTable m_regionSettingsTable; | 93 | private DataTable m_regionSettingsTable; |
97 | 94 | ||
98 | /// <value>Temporary attribute while this is experimental</value> | 95 | /// <value>Temporary attribute while this is experimental</value> |
@@ -150,9 +147,6 @@ namespace OpenSim.Data.MySQL | |||
150 | MySqlCommand landAccessListSelectCmd = new MySqlCommand(m_landAccessListSelect, m_connection); | 147 | MySqlCommand landAccessListSelectCmd = new MySqlCommand(m_landAccessListSelect, m_connection); |
151 | m_landAccessListDataAdapter = new MySqlDataAdapter(landAccessListSelectCmd); | 148 | m_landAccessListDataAdapter = new MySqlDataAdapter(landAccessListSelectCmd); |
152 | 149 | ||
153 | MySqlCommand regionBanListSelectCmd = new MySqlCommand(m_regionBanListSelect, m_connection); | ||
154 | m_regionBanListDataAdapter = new MySqlDataAdapter(regionBanListSelectCmd); | ||
155 | |||
156 | MySqlCommand regionSettingsSelectCmd = new MySqlCommand(m_regionSettingsSelect, m_connection); | 150 | MySqlCommand regionSettingsSelectCmd = new MySqlCommand(m_regionSettingsSelect, m_connection); |
157 | m_regionSettingsDataAdapter = new MySqlDataAdapter(regionSettingsSelectCmd); | 151 | m_regionSettingsDataAdapter = new MySqlDataAdapter(regionSettingsSelectCmd); |
158 | 152 | ||
@@ -192,11 +186,6 @@ namespace OpenSim.Data.MySQL | |||
192 | setupLandAccessCommands(m_landAccessListDataAdapter, m_connection); | 186 | setupLandAccessCommands(m_landAccessListDataAdapter, m_connection); |
193 | m_landAccessListDataAdapter.Fill(m_landAccessListTable); | 187 | m_landAccessListDataAdapter.Fill(m_landAccessListTable); |
194 | 188 | ||
195 | m_regionBanListTable = createRegionBanTable(); | ||
196 | m_dataSet.Tables.Add(m_regionBanListTable); | ||
197 | SetupRegionBanCommands(m_regionBanListDataAdapter, m_connection); | ||
198 | m_regionBanListDataAdapter.Fill(m_regionBanListTable); | ||
199 | |||
200 | m_regionSettingsTable = createRegionSettingsTable(); | 189 | m_regionSettingsTable = createRegionSettingsTable(); |
201 | m_dataSet.Tables.Add(m_regionSettingsTable); | 190 | m_dataSet.Tables.Add(m_regionSettingsTable); |
202 | SetupRegionSettingsCommands(m_regionSettingsDataAdapter, m_connection); | 191 | SetupRegionSettingsCommands(m_regionSettingsDataAdapter, m_connection); |
@@ -774,99 +763,6 @@ namespace OpenSim.Data.MySQL | |||
774 | } | 763 | } |
775 | 764 | ||
776 | /// <summary> | 765 | /// <summary> |
777 | /// Load (fetch?) a region banlist | ||
778 | /// </summary> | ||
779 | /// <param name="regionUUID">The region UUID</param> | ||
780 | /// <returns>The Region banlist</returns> | ||
781 | public List<RegionBanListItem> LoadRegionBanList(LLUUID regionUUID) | ||
782 | { | ||
783 | List<RegionBanListItem> regionbanlist = new List<RegionBanListItem>(); | ||
784 | lock (m_dataSet) | ||
785 | { | ||
786 | CheckConnection(); | ||
787 | DataTable regionban = m_regionBanListTable; | ||
788 | string searchExp = "regionUUID = '" + regionUUID.ToString() + "'"; | ||
789 | DataRow[] rawbanlist = regionban.Select(searchExp); | ||
790 | foreach (DataRow rawbanrow in rawbanlist) | ||
791 | { | ||
792 | RegionBanListItem rbli = new RegionBanListItem(); | ||
793 | LLUUID tmpvalue = LLUUID.Zero; | ||
794 | |||
795 | rbli.regionUUID = regionUUID; | ||
796 | |||
797 | if (Helpers.TryParse((string)rawbanrow["bannedUUID"], out tmpvalue)) | ||
798 | rbli.bannedUUID = tmpvalue; | ||
799 | |||
800 | rbli.bannedIP = (string)rawbanrow["bannedIp"]; | ||
801 | rbli.bannedIPHostMask = (string)rawbanrow["bannedIpHostMask"]; | ||
802 | regionbanlist.Add(rbli); | ||
803 | } | ||
804 | return regionbanlist; | ||
805 | } | ||
806 | } | ||
807 | |||
808 | /// <summary> | ||
809 | /// Add an item to region banlist | ||
810 | /// </summary> | ||
811 | /// <param name="item">The item</param> | ||
812 | public void AddToRegionBanlist(RegionBanListItem item) | ||
813 | { | ||
814 | lock (m_dataSet) | ||
815 | { | ||
816 | CheckConnection(); | ||
817 | DataTable regionban = m_regionBanListTable; | ||
818 | string searchExp = "regionUUID = '" + item.regionUUID.ToString() + "' AND bannedUUID = '" + item.bannedUUID.ToString() + "'"; | ||
819 | DataRow[] rawbanlist = regionban.Select(searchExp); | ||
820 | if (rawbanlist.Length == 0) | ||
821 | { | ||
822 | DataRow regionbanrow = regionban.NewRow(); | ||
823 | regionbanrow["regionUUID"] = item.regionUUID.ToString(); | ||
824 | regionbanrow["bannedUUID"] = item.bannedUUID.ToString(); | ||
825 | regionbanrow["bannedIp"] = item.bannedIP.ToString(); | ||
826 | regionbanrow["bannedIpHostMask"] = item.bannedIPHostMask.ToString(); | ||
827 | regionban.Rows.Add(regionbanrow); | ||
828 | } | ||
829 | Commit(); | ||
830 | } | ||
831 | } | ||
832 | |||
833 | /// <summary> | ||
834 | /// Remove an item from region banlist | ||
835 | /// </summary> | ||
836 | /// <param name="item">The item</param> | ||
837 | public void RemoveFromRegionBanlist(RegionBanListItem item) | ||
838 | { | ||
839 | lock (m_dataSet) | ||
840 | { | ||
841 | CheckConnection(); | ||
842 | DataTable regionban = m_regionBanListTable; | ||
843 | string searchExp = "regionUUID = '" + item.regionUUID.ToString() + "' AND bannedUUID = '" + item.bannedUUID.ToString() + "'"; | ||
844 | DataRow[] rawbanlist = regionban.Select(searchExp); | ||
845 | if (rawbanlist.Length > 0) | ||
846 | { | ||
847 | foreach (DataRow rbli in rawbanlist) | ||
848 | { | ||
849 | regionban.Rows.Remove(rbli); | ||
850 | } | ||
851 | } | ||
852 | Commit(); | ||
853 | } | ||
854 | |||
855 | using | ||
856 | ( | ||
857 | MySqlCommand cmd = | ||
858 | new MySqlCommand("delete from regionban where regionUUID = ?regionUUID AND bannedUUID = ?bannedUUID", m_connection) | ||
859 | ) | ||
860 | { | ||
861 | cmd.Parameters.Add(new MySqlParameter("?regionUUID", item.regionUUID.ToString())); | ||
862 | cmd.Parameters.Add(new MySqlParameter("?bannedUUID", item.bannedUUID.ToString())); | ||
863 | CheckConnection(); | ||
864 | cmd.ExecuteNonQuery(); | ||
865 | } | ||
866 | |||
867 | } | ||
868 | |||
869 | /// <summary> | ||
870 | /// | 766 | /// |
871 | /// </summary> | 767 | /// </summary> |
872 | /// <param name="regionUUID"></param> | 768 | /// <param name="regionUUID"></param> |
@@ -918,7 +814,6 @@ namespace OpenSim.Data.MySQL | |||
918 | m_terrainDataAdapter.Update(m_terrainTable); | 814 | m_terrainDataAdapter.Update(m_terrainTable); |
919 | m_landDataAdapter.Update(m_landTable); | 815 | m_landDataAdapter.Update(m_landTable); |
920 | m_landAccessListDataAdapter.Update(m_landAccessListTable); | 816 | m_landAccessListDataAdapter.Update(m_landAccessListTable); |
921 | m_regionBanListDataAdapter.Update(m_regionBanListTable); | ||
922 | m_regionSettingsDataAdapter.Update(m_regionSettingsTable); | 817 | m_regionSettingsDataAdapter.Update(m_regionSettingsTable); |
923 | 818 | ||
924 | m_dataSet.AcceptChanges(); | 819 | m_dataSet.AcceptChanges(); |
@@ -1006,6 +901,7 @@ namespace OpenSim.Data.MySQL | |||
1006 | createCol(regionsettings, "terrain_raise_limit", typeof (Double)); | 901 | createCol(regionsettings, "terrain_raise_limit", typeof (Double)); |
1007 | createCol(regionsettings, "terrain_lower_limit", typeof (Double)); | 902 | createCol(regionsettings, "terrain_lower_limit", typeof (Double)); |
1008 | createCol(regionsettings, "use_estate_sun", typeof (Int32)); | 903 | createCol(regionsettings, "use_estate_sun", typeof (Int32)); |
904 | createCol(regionsettings, "sandbox", typeof (Int32)); | ||
1009 | createCol(regionsettings, "fixed_sun", typeof (Int32)); | 905 | createCol(regionsettings, "fixed_sun", typeof (Int32)); |
1010 | createCol(regionsettings, "sun_position", typeof (Double)); | 906 | createCol(regionsettings, "sun_position", typeof (Double)); |
1011 | createCol(regionsettings, "covenant", typeof(String)); | 907 | createCol(regionsettings, "covenant", typeof(String)); |
@@ -1016,21 +912,6 @@ namespace OpenSim.Data.MySQL | |||
1016 | } | 912 | } |
1017 | 913 | ||
1018 | /// <summary> | 914 | /// <summary> |
1019 | /// Create the "regionban" table | ||
1020 | /// </summary> | ||
1021 | /// <returns></returns> | ||
1022 | private static DataTable createRegionBanTable() | ||
1023 | { | ||
1024 | DataTable regionban = new DataTable("regionban"); | ||
1025 | createCol(regionban, "regionUUID", typeof(String)); | ||
1026 | createCol(regionban, "bannedUUID", typeof(String)); | ||
1027 | createCol(regionban, "bannedIp", typeof(String)); | ||
1028 | createCol(regionban, "bannedIpHostMask", typeof(String)); | ||
1029 | return regionban; | ||
1030 | |||
1031 | } | ||
1032 | |||
1033 | /// <summary> | ||
1034 | /// Create the "prims" table | 915 | /// Create the "prims" table |
1035 | /// </summary> | 916 | /// </summary> |
1036 | /// <returns></returns> | 917 | /// <returns></returns> |
@@ -1417,6 +1298,7 @@ namespace OpenSim.Data.MySQL | |||
1417 | newSettings.TerrainRaiseLimit = Convert.ToDouble(row["terrain_raise_limit"]); | 1298 | newSettings.TerrainRaiseLimit = Convert.ToDouble(row["terrain_raise_limit"]); |
1418 | newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]); | 1299 | newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]); |
1419 | newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]); | 1300 | newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]); |
1301 | newSettings.Sandbox = Convert.ToBoolean(row["sandbox"]); | ||
1420 | newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]); | 1302 | newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]); |
1421 | newSettings.SunPosition = Convert.ToDouble(row["sun_position"]); | 1303 | newSettings.SunPosition = Convert.ToDouble(row["sun_position"]); |
1422 | newSettings.Covenant = new LLUUID((String) row["covenant"]); | 1304 | newSettings.Covenant = new LLUUID((String) row["covenant"]); |
@@ -1676,6 +1558,7 @@ namespace OpenSim.Data.MySQL | |||
1676 | row["terrain_raise_limit"] = settings.TerrainRaiseLimit; | 1558 | row["terrain_raise_limit"] = settings.TerrainRaiseLimit; |
1677 | row["terrain_lower_limit"] = settings.TerrainLowerLimit; | 1559 | row["terrain_lower_limit"] = settings.TerrainLowerLimit; |
1678 | row["use_estate_sun"] = settings.UseEstateSun; | 1560 | row["use_estate_sun"] = settings.UseEstateSun; |
1561 | row["sandbox"] = settings.Sandbox; | ||
1679 | row["fixed_sun"] = settings.FixedSun; | 1562 | row["fixed_sun"] = settings.FixedSun; |
1680 | row["sun_position"] = settings.SunPosition; | 1563 | row["sun_position"] = settings.SunPosition; |
1681 | row["covenant"] = settings.Covenant.ToString(); | 1564 | row["covenant"] = settings.Covenant.ToString(); |
@@ -2143,26 +2026,6 @@ namespace OpenSim.Data.MySQL | |||
2143 | /// </summary> | 2026 | /// </summary> |
2144 | /// <param name="da"></param> | 2027 | /// <param name="da"></param> |
2145 | /// <param name="conn"></param> | 2028 | /// <param name="conn"></param> |
2146 | private void SetupRegionBanCommands(MySqlDataAdapter da, MySqlConnection conn) | ||
2147 | { | ||
2148 | da.InsertCommand = createInsertCommand("regionban", m_regionBanListTable); | ||
2149 | da.InsertCommand.Connection = conn; | ||
2150 | |||
2151 | da.UpdateCommand = createUpdateCommand("regionban", "regionUUID = ?regionUUID AND bannedUUID = ?bannedUUID", m_regionBanListTable); | ||
2152 | da.UpdateCommand.Connection = conn; | ||
2153 | |||
2154 | MySqlCommand delete = new MySqlCommand("delete from regionban where regionUUID = ?regionUUID AND bannedUUID = ?bannedUUID"); | ||
2155 | delete.Parameters.Add(createMySqlParameter("regionUUID", typeof(String))); | ||
2156 | delete.Parameters.Add(createMySqlParameter("bannedUUID", typeof(String))); | ||
2157 | delete.Connection = conn; | ||
2158 | da.DeleteCommand = delete; | ||
2159 | } | ||
2160 | |||
2161 | /// <summary> | ||
2162 | /// | ||
2163 | /// </summary> | ||
2164 | /// <param name="da"></param> | ||
2165 | /// <param name="conn"></param> | ||
2166 | private void SetupTerrainCommands(MySqlDataAdapter da, MySqlConnection conn) | 2029 | private void SetupTerrainCommands(MySqlDataAdapter da, MySqlConnection conn) |
2167 | { | 2030 | { |
2168 | da.InsertCommand = createInsertCommand("terrain", m_dataSet.Tables["terrain"]); | 2031 | da.InsertCommand = createInsertCommand("terrain", m_dataSet.Tables["terrain"]); |