aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLRegionData.cs
diff options
context:
space:
mode:
authorUbitUmarov2012-07-17 00:54:23 +0100
committerUbitUmarov2012-07-17 00:54:23 +0100
commitd5f4fb7b50fb7c594b018f8241399e22f88fc951 (patch)
tree8f3dab3d170596f02b1d1d836a0bc08a3e6b8ebd /OpenSim/Data/MySQL/MySQLRegionData.cs
parentUbitOde: remove useless water collider from active code. (diff)
parentMerge branch 'avination' into careminster (diff)
downloadopensim-SC-d5f4fb7b50fb7c594b018f8241399e22f88fc951.zip
opensim-SC-d5f4fb7b50fb7c594b018f8241399e22f88fc951.tar.gz
opensim-SC-d5f4fb7b50fb7c594b018f8241399e22f88fc951.tar.bz2
opensim-SC-d5f4fb7b50fb7c594b018f8241399e22f88fc951.tar.xz
Merge branch 'avination' into ubitwork
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLRegionData.cs')
-rw-r--r--OpenSim/Data/MySQL/MySQLRegionData.cs48
1 files changed, 30 insertions, 18 deletions
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs
index c20c392..0614879 100644
--- a/OpenSim/Data/MySQL/MySQLRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLRegionData.cs
@@ -162,17 +162,7 @@ namespace OpenSim.Data.MySQL
162 ret.sizeX = Convert.ToInt32(result["sizeX"]); 162 ret.sizeX = Convert.ToInt32(result["sizeX"]);
163 ret.sizeY = Convert.ToInt32(result["sizeY"]); 163 ret.sizeY = Convert.ToInt32(result["sizeY"]);
164 164
165 if (m_ColumnNames == null) 165 CheckColumnNames(result);
166 {
167 m_ColumnNames = new List<string>();
168
169 DataTable schemaTable = result.GetSchemaTable();
170 foreach (DataRow row in schemaTable.Rows)
171 {
172 if (row["ColumnName"] != null)
173 m_ColumnNames.Add(row["ColumnName"].ToString());
174 }
175 }
176 166
177 foreach (string s in m_ColumnNames) 167 foreach (string s in m_ColumnNames)
178 { 168 {
@@ -187,7 +177,11 @@ namespace OpenSim.Data.MySQL
187 if (s == "locY") 177 if (s == "locY")
188 continue; 178 continue;
189 179
190 ret.Data[s] = result[s].ToString(); 180 object value = result[s];
181 if (value is DBNull)
182 ret.Data[s] = null;
183 else
184 ret.Data[s] = result[s].ToString();
191 } 185 }
192 186
193 retList.Add(ret); 187 retList.Add(ret);
@@ -198,6 +192,23 @@ namespace OpenSim.Data.MySQL
198 return retList; 192 return retList;
199 } 193 }
200 194
195 private void CheckColumnNames(IDataReader result)
196 {
197 if (m_ColumnNames != null)
198 return;
199
200 List<string> columnNames = new List<string>();
201
202 DataTable schemaTable = result.GetSchemaTable();
203 foreach (DataRow row in schemaTable.Rows)
204 {
205 if (row["ColumnName"] != null)
206 columnNames.Add(row["ColumnName"].ToString());
207 }
208
209 m_ColumnNames = columnNames;
210 }
211
201 public bool Store(RegionData data) 212 public bool Store(RegionData data)
202 { 213 {
203 if (data.Data.ContainsKey("uuid")) 214 if (data.Data.ContainsKey("uuid"))
@@ -318,11 +329,12 @@ namespace OpenSim.Data.MySQL
318 if (scopeID != UUID.Zero) 329 if (scopeID != UUID.Zero)
319 command += " and ScopeID = ?scopeID"; 330 command += " and ScopeID = ?scopeID";
320 331
321 MySqlCommand cmd = new MySqlCommand(command); 332 using (MySqlCommand cmd = new MySqlCommand(command))
322 333 {
323 cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); 334 cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
324 335
325 return RunCommand(cmd); 336 return RunCommand(cmd);
337 }
326 } 338 }
327 } 339 }
328} 340} \ No newline at end of file