diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs b/OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs index ab9df4c..4145d95 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())); |
@@ -363,7 +371,13 @@ namespace OpenSim.Data.MSSQL | |||
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 | } |