aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data/MySQL')
-rw-r--r--OpenSim/Data/MySQL/MySQLEstateData.cs18
1 files changed, 5 insertions, 13 deletions
diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs
index 2eae2d8..e94dcda 100644
--- a/OpenSim/Data/MySQL/MySQLEstateData.cs
+++ b/OpenSim/Data/MySQL/MySQLEstateData.cs
@@ -121,7 +121,7 @@ namespace OpenSim.Data.MySQL
121 } 121 }
122 } 122 }
123 123
124 public EstateSettings LoadEstateSettings(UUID regionID) 124 public EstateSettings LoadEstateSettings(UUID regionID, bool create)
125 { 125 {
126 EstateSettings es = new EstateSettings(); 126 EstateSettings es = new EstateSettings();
127 es.OnSave += StoreEstateSettings; 127 es.OnSave += StoreEstateSettings;
@@ -129,12 +129,12 @@ namespace OpenSim.Data.MySQL
129 string sql = "select estate_settings." + String.Join(",estate_settings.", FieldList) + 129 string sql = "select estate_settings." + String.Join(",estate_settings.", FieldList) +
130 " from estate_map left join estate_settings on estate_map.EstateID = estate_settings.EstateID where estate_settings.EstateID is not null and RegionID = ?RegionID"; 130 " from estate_map left join estate_settings on estate_map.EstateID = estate_settings.EstateID where estate_settings.EstateID is not null and RegionID = ?RegionID";
131 131
132 bool migration = true;
133
134 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 132 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
135 { 133 {
136 dbcon.Open(); 134 dbcon.Open();
137 135
136 bool found = false;
137
138 using (MySqlCommand cmd = dbcon.CreateCommand()) 138 using (MySqlCommand cmd = dbcon.CreateCommand())
139 { 139 {
140 cmd.CommandText = sql; 140 cmd.CommandText = sql;
@@ -144,7 +144,7 @@ namespace OpenSim.Data.MySQL
144 { 144 {
145 if (r.Read()) 145 if (r.Read())
146 { 146 {
147 migration = false; 147 found = true;
148 148
149 foreach (string name in FieldList) 149 foreach (string name in FieldList)
150 { 150 {
@@ -172,7 +172,7 @@ namespace OpenSim.Data.MySQL
172 } 172 }
173 } 173 }
174 174
175 if (migration) 175 if (!found && create)
176 { 176 {
177 // Migration case 177 // Migration case
178 List<string> names = new List<string>(FieldList); 178 List<string> names = new List<string>(FieldList);
@@ -220,14 +220,6 @@ namespace OpenSim.Data.MySQL
220 try { cmd.ExecuteNonQuery(); } 220 try { cmd.ExecuteNonQuery(); }
221 catch (Exception) { } 221 catch (Exception) { }
222 222
223 // Munge and transfer the ban list
224 cmd.Parameters.Clear();
225 cmd.CommandText = "insert into estateban select " + es.EstateID.ToString() + ", bannedUUID, bannedIp, bannedIpHostMask, '' from regionban where regionban.regionUUID = ?UUID";
226 cmd.Parameters.AddWithValue("?UUID", regionID.ToString());
227
228 try { cmd.ExecuteNonQuery(); }
229 catch (Exception) { }
230
231 es.Save(); 223 es.Save();
232 } 224 }
233 } 225 }