diff options
Diffstat (limited to 'OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs')
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs b/OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs index 6e695ce..8f471c4 100644 --- a/OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs +++ b/OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs | |||
@@ -168,14 +168,13 @@ namespace OpenSim.Data.MSSQL | |||
168 | 168 | ||
169 | protected T[] DoQuery(SqlCommand cmd) | 169 | protected T[] DoQuery(SqlCommand cmd) |
170 | { | 170 | { |
171 | List<T> result = new List<T>(); | ||
171 | using (SqlDataReader reader = cmd.ExecuteReader()) | 172 | using (SqlDataReader reader = cmd.ExecuteReader()) |
172 | { | 173 | { |
173 | if (reader == null) | 174 | if (reader == null) |
174 | return new T[0]; | 175 | return new T[0]; |
175 | 176 | ||
176 | CheckColumnNames(reader); | 177 | CheckColumnNames(reader); |
177 | |||
178 | List<T> result = new List<T>(); | ||
179 | 178 | ||
180 | while (reader.Read()) | 179 | while (reader.Read()) |
181 | { | 180 | { |
@@ -262,6 +261,15 @@ namespace OpenSim.Data.MSSQL | |||
262 | { | 261 | { |
263 | names.Add(fi.Name); | 262 | names.Add(fi.Name); |
264 | values.Add("@" + fi.Name); | 263 | values.Add("@" + fi.Name); |
264 | // Temporarily return more information about what field is unexpectedly null for | ||
265 | // http://opensimulator.org/mantis/view.php?id=5403. This might be due to a bug in the | ||
266 | // InventoryTransferModule or we may be required to substitute a DBNull here. | ||
267 | if (fi.GetValue(row) == null) | ||
268 | throw new NullReferenceException( | ||
269 | string.Format( | ||
270 | "[MSSQL GENERIC TABLE HANDLER]: Trying to store field {0} for {1} which is unexpectedly null", | ||
271 | fi.Name, row)); | ||
272 | |||
265 | if (constraintFields.Count > 0 && constraintFields.Contains(fi.Name)) | 273 | if (constraintFields.Count > 0 && constraintFields.Contains(fi.Name)) |
266 | { | 274 | { |
267 | constraints.Add(new KeyValuePair<string, string>(fi.Name, fi.GetValue(row).ToString())); | 275 | constraints.Add(new KeyValuePair<string, string>(fi.Name, fi.GetValue(row).ToString())); |
@@ -358,12 +366,18 @@ namespace OpenSim.Data.MSSQL | |||
358 | 366 | ||
359 | string where = String.Join(" AND ", terms.ToArray()); | 367 | string where = String.Join(" AND ", terms.ToArray()); |
360 | 368 | ||
361 | string query = String.Format("DELETE * FROM {0} WHERE {1}", m_Realm, where); | 369 | string query = String.Format("DELETE FROM {0} WHERE {1}", m_Realm, where); |
362 | 370 | ||
363 | cmd.Connection = conn; | 371 | cmd.Connection = conn; |
364 | cmd.CommandText = query; | 372 | cmd.CommandText = query; |
365 | conn.Open(); | 373 | conn.Open(); |
366 | return cmd.ExecuteNonQuery() > 0; | 374 | |
375 | if (cmd.ExecuteNonQuery() > 0) | ||
376 | { | ||
377 | //m_log.Warn("[MSSQLGenericTable]: " + deleteCommand); | ||
378 | return true; | ||
379 | } | ||
380 | return false; | ||
367 | } | 381 | } |
368 | } | 382 | } |
369 | } | 383 | } |