diff options
author | Sean Dague | 2008-04-07 15:01:00 +0000 |
---|---|---|
committer | Sean Dague | 2008-04-07 15:01:00 +0000 |
commit | 2b23734a1646fc60658d467c7f2b5d90675b47a4 (patch) | |
tree | 67f5b554e988d31d6feb9d164ca0ad0a5f52cce4 /OpenSim/Data/SQLite | |
parent | Update svn properties. (diff) | |
download | opensim-SC_OLD-2b23734a1646fc60658d467c7f2b5d90675b47a4.zip opensim-SC_OLD-2b23734a1646fc60658d467c7f2b5d90675b47a4.tar.gz opensim-SC_OLD-2b23734a1646fc60658d467c7f2b5d90675b47a4.tar.bz2 opensim-SC_OLD-2b23734a1646fc60658d467c7f2b5d90675b47a4.tar.xz |
add some error messages for abuse of our IInventoryData interface
(i.e. using add to update, or update to add).
Diffstat (limited to 'OpenSim/Data/SQLite')
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteInventoryStore.cs | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs index aa56121..1554aa3 100644 --- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs +++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs | |||
@@ -126,7 +126,7 @@ namespace OpenSim.Data.SQLite | |||
126 | row["inventoryEveryOnePermissions"] = item.inventoryEveryOnePermissions; | 126 | row["inventoryEveryOnePermissions"] = item.inventoryEveryOnePermissions; |
127 | } | 127 | } |
128 | 128 | ||
129 | private void addFolder(InventoryFolderBase folder) | 129 | private void addFolder(InventoryFolderBase folder, bool add) |
130 | { | 130 | { |
131 | lock (ds) | 131 | lock (ds) |
132 | { | 132 | { |
@@ -135,12 +135,18 @@ namespace OpenSim.Data.SQLite | |||
135 | DataRow inventoryRow = inventoryFolderTable.Rows.Find(Util.ToRawUuidString(folder.folderID)); | 135 | DataRow inventoryRow = inventoryFolderTable.Rows.Find(Util.ToRawUuidString(folder.folderID)); |
136 | if (inventoryRow == null) | 136 | if (inventoryRow == null) |
137 | { | 137 | { |
138 | if (! add) | ||
139 | m_log.ErrorFormat("Interface Misuse: Attempting to Update non-existant inventory folder: {0}", folder.folderID); | ||
140 | |||
138 | inventoryRow = inventoryFolderTable.NewRow(); | 141 | inventoryRow = inventoryFolderTable.NewRow(); |
139 | fillFolderRow(inventoryRow, folder); | 142 | fillFolderRow(inventoryRow, folder); |
140 | inventoryFolderTable.Rows.Add(inventoryRow); | 143 | inventoryFolderTable.Rows.Add(inventoryRow); |
141 | } | 144 | } |
142 | else | 145 | else |
143 | { | 146 | { |
147 | if (add) | ||
148 | m_log.ErrorFormat("Interface Misuse: Attempting to Add inventory folder that already exists: {0}", folder.folderID); | ||
149 | |||
144 | fillFolderRow(inventoryRow, folder); | 150 | fillFolderRow(inventoryRow, folder); |
145 | } | 151 | } |
146 | 152 | ||
@@ -170,7 +176,7 @@ namespace OpenSim.Data.SQLite | |||
170 | } | 176 | } |
171 | } | 177 | } |
172 | 178 | ||
173 | private void addItem(InventoryItemBase item) | 179 | private void addItem(InventoryItemBase item, bool add) |
174 | { | 180 | { |
175 | lock (ds) | 181 | lock (ds) |
176 | { | 182 | { |
@@ -179,12 +185,18 @@ namespace OpenSim.Data.SQLite | |||
179 | DataRow inventoryRow = inventoryItemTable.Rows.Find(Util.ToRawUuidString(item.inventoryID)); | 185 | DataRow inventoryRow = inventoryItemTable.Rows.Find(Util.ToRawUuidString(item.inventoryID)); |
180 | if (inventoryRow == null) | 186 | if (inventoryRow == null) |
181 | { | 187 | { |
188 | if (! add) | ||
189 | m_log.ErrorFormat("Interface Misuse: Attempting to Update non-existant inventory item: {0}", item.inventoryID); | ||
190 | |||
182 | inventoryRow = inventoryItemTable.NewRow(); | 191 | inventoryRow = inventoryItemTable.NewRow(); |
183 | fillItemRow(inventoryRow, item); | 192 | fillItemRow(inventoryRow, item); |
184 | inventoryItemTable.Rows.Add(inventoryRow); | 193 | inventoryItemTable.Rows.Add(inventoryRow); |
185 | } | 194 | } |
186 | else | 195 | else |
187 | { | 196 | { |
197 | if (add) | ||
198 | m_log.ErrorFormat("Interface Misuse: Attempting to Add inventory item that already exists: {0}", item.inventoryID); | ||
199 | |||
188 | fillItemRow(inventoryRow, item); | 200 | fillItemRow(inventoryRow, item); |
189 | } | 201 | } |
190 | invItemsDa.Update(ds, "inventoryitems"); | 202 | invItemsDa.Update(ds, "inventoryitems"); |
@@ -385,7 +397,7 @@ namespace OpenSim.Data.SQLite | |||
385 | /// <param name="item">The item to be created</param> | 397 | /// <param name="item">The item to be created</param> |
386 | public void addInventoryItem(InventoryItemBase item) | 398 | public void addInventoryItem(InventoryItemBase item) |
387 | { | 399 | { |
388 | addItem(item); | 400 | addItem(item, true); |
389 | } | 401 | } |
390 | 402 | ||
391 | /// <summary> | 403 | /// <summary> |
@@ -394,7 +406,7 @@ namespace OpenSim.Data.SQLite | |||
394 | /// <param name="item">The updated item</param> | 406 | /// <param name="item">The updated item</param> |
395 | public void updateInventoryItem(InventoryItemBase item) | 407 | public void updateInventoryItem(InventoryItemBase item) |
396 | { | 408 | { |
397 | addItem(item); | 409 | addItem(item, false); |
398 | } | 410 | } |
399 | 411 | ||
400 | /// <summary> | 412 | /// <summary> |
@@ -436,7 +448,7 @@ namespace OpenSim.Data.SQLite | |||
436 | /// <param name="folder">The inventory folder</param> | 448 | /// <param name="folder">The inventory folder</param> |
437 | public void addInventoryFolder(InventoryFolderBase folder) | 449 | public void addInventoryFolder(InventoryFolderBase folder) |
438 | { | 450 | { |
439 | addFolder(folder); | 451 | addFolder(folder, true); |
440 | } | 452 | } |
441 | 453 | ||
442 | /// <summary> | 454 | /// <summary> |
@@ -445,7 +457,7 @@ namespace OpenSim.Data.SQLite | |||
445 | /// <param name="folder">The inventory folder</param> | 457 | /// <param name="folder">The inventory folder</param> |
446 | public void updateInventoryFolder(InventoryFolderBase folder) | 458 | public void updateInventoryFolder(InventoryFolderBase folder) |
447 | { | 459 | { |
448 | addFolder(folder); | 460 | addFolder(folder, false); |
449 | } | 461 | } |
450 | 462 | ||
451 | /// <summary> | 463 | /// <summary> |