diff options
author | Justin Clarke Casey | 2009-03-09 18:04:23 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-03-09 18:04:23 +0000 |
commit | ee73d72f1df4773ce08c14e64d157b836671e6d9 (patch) | |
tree | f49d6c7955372f4bc9284d7807743e19cbf5f3a5 | |
parent | * Address http://opensimulator.org/mantis/view.php?id=3207 (diff) | |
download | opensim-SC-ee73d72f1df4773ce08c14e64d157b836671e6d9.zip opensim-SC-ee73d72f1df4773ce08c14e64d157b836671e6d9.tar.gz opensim-SC-ee73d72f1df4773ce08c14e64d157b836671e6d9.tar.bz2 opensim-SC-ee73d72f1df4773ce08c14e64d157b836671e6d9.tar.xz |
* Apply http://opensimulator.org/mantis/view.php?id=3280
* Some small syntax and refactoring tweaks for asset and inventory MSSQL
* This means the MSSQL db plugin now requires SQL Server 2005
-rw-r--r-- | CONTRIBUTORS.txt | 1 | ||||
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLAssetData.cs | 2 | ||||
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLInventoryData.cs | 85 |
3 files changed, 45 insertions, 43 deletions
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index d4c3cd9..c409abf 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt | |||
@@ -79,6 +79,7 @@ Patches | |||
79 | * SachaMagne | 79 | * SachaMagne |
80 | * Salahzar Stenvaag | 80 | * Salahzar Stenvaag |
81 | * sempuki | 81 | * sempuki |
82 | * Strawberry Fride | ||
82 | * tglion | 83 | * tglion |
83 | * tlaukkan/Tommil (Tommi S. E. Laukkanen, Bubble Cloud) | 84 | * tlaukkan/Tommil (Tommi S. E. Laukkanen, Bubble Cloud) |
84 | * tyre | 85 | * tyre |
diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs index edacf08..54578bc 100644 --- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs +++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs | |||
@@ -258,7 +258,7 @@ namespace OpenSim.Data.MSSQL | |||
258 | { | 258 | { |
259 | List<AssetMetadata> retList = new List<AssetMetadata>(count); | 259 | List<AssetMetadata> retList = new List<AssetMetadata>(count); |
260 | 260 | ||
261 | using (AutoClosingSqlCommand command = database.Query("SELECT name,description,assetType,temporary,id FROM assets LIMIT @start, @count")) | 261 | using (AutoClosingSqlCommand command = database.Query("SELECT (name,description,assetType,temporary,id), Row = ROW_NUMBER() OVER (ORDER BY (some column to order by)) WHERE Row >= @Start AND Row < @Start + @Count")) |
262 | { | 262 | { |
263 | command.Parameters.Add(database.CreateParameter("start", start)); | 263 | command.Parameters.Add(database.CreateParameter("start", start)); |
264 | command.Parameters.Add(database.CreateParameter("count", count)); | 264 | command.Parameters.Add(database.CreateParameter("count", count)); |
diff --git a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs index 4e7e322..348682c 100644 --- a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs +++ b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs | |||
@@ -224,9 +224,8 @@ namespace OpenSim.Data.MSSQL | |||
224 | /// <param name="folder">Folder to create</param> | 224 | /// <param name="folder">Folder to create</param> |
225 | public void addInventoryFolder(InventoryFolderBase folder) | 225 | public void addInventoryFolder(InventoryFolderBase folder) |
226 | { | 226 | { |
227 | string sql = | 227 | string sql = @"INSERT INTO inventoryfolders ([folderID], [agentID], [parentFolderID], [folderName], [type], [version]) |
228 | "INSERT INTO inventoryfolders ([folderID], [agentID], [parentFolderID], [folderName], [type], [version]) VALUES "; | 228 | VALUES (@folderID, @agentID, @parentFolderID, @folderName, @type, @version);"; |
229 | sql += "(@folderID, @agentID, @parentFolderID, @folderName, @type, @version);"; | ||
230 | 229 | ||
231 | 230 | ||
232 | using (AutoClosingSqlCommand command = database.Query(sql)) | 231 | using (AutoClosingSqlCommand command = database.Query(sql)) |
@@ -256,13 +255,14 @@ namespace OpenSim.Data.MSSQL | |||
256 | /// <param name="folder">Folder to update</param> | 255 | /// <param name="folder">Folder to update</param> |
257 | public void updateInventoryFolder(InventoryFolderBase folder) | 256 | public void updateInventoryFolder(InventoryFolderBase folder) |
258 | { | 257 | { |
259 | using (AutoClosingSqlCommand command = database.Query("UPDATE inventoryfolders set folderID = @folderID, " + | 258 | string sql = @"UPDATE inventoryfolders SET folderID = @folderID, |
260 | "agentID = @agentID, " + | 259 | agentID = @agentID, |
261 | "parentFolderID = @parentFolderID," + | 260 | parentFolderID = @parentFolderID, |
262 | "folderName = @folderName," + | 261 | folderName = @folderName, |
263 | "type = @type," + | 262 | type = @type, |
264 | "version = @version where " + | 263 | version = @version |
265 | "folderID = @keyFolderID;")) | 264 | WHERE folderID = @keyFolderID"; |
265 | using (AutoClosingSqlCommand command = database.Query(sql)) | ||
266 | { | 266 | { |
267 | command.Parameters.Add(database.CreateParameter("folderID", folder.ID)); | 267 | command.Parameters.Add(database.CreateParameter("folderID", folder.ID)); |
268 | command.Parameters.Add(database.CreateParameter("agentID", folder.Owner)); | 268 | command.Parameters.Add(database.CreateParameter("agentID", folder.Owner)); |
@@ -288,9 +288,8 @@ namespace OpenSim.Data.MSSQL | |||
288 | /// <param name="folder">Folder to update</param> | 288 | /// <param name="folder">Folder to update</param> |
289 | public void moveInventoryFolder(InventoryFolderBase folder) | 289 | public void moveInventoryFolder(InventoryFolderBase folder) |
290 | { | 290 | { |
291 | using (IDbCommand command = database.Query("UPDATE inventoryfolders set " + | 291 | string sql = @"UPDATE inventoryfolders SET parentFolderID = @parentFolderID WHERE folderID = @folderID"; |
292 | "parentFolderID = @parentFolderID where " + | 292 | using (IDbCommand command = database.Query(sql)) |
293 | "folderID = @folderID;")) | ||
294 | { | 293 | { |
295 | command.Parameters.Add(database.CreateParameter("parentFolderID", folder.ParentID)); | 294 | command.Parameters.Add(database.CreateParameter("parentFolderID", folder.ParentID)); |
296 | command.Parameters.Add(database.CreateParameter("@folderID", folder.ID)); | 295 | command.Parameters.Add(database.CreateParameter("@folderID", folder.ID)); |
@@ -402,15 +401,16 @@ namespace OpenSim.Data.MSSQL | |||
402 | return; | 401 | return; |
403 | } | 402 | } |
404 | 403 | ||
405 | string sql = "INSERT INTO inventoryitems"; | 404 | string sql = @"INSERT INTO inventoryitems |
406 | sql += "([inventoryID], [assetID], [assetType], [parentFolderID], [avatarID], [inventoryName]" | 405 | ([inventoryID], [assetID], [assetType], [parentFolderID], [avatarID], [inventoryName], |
407 | + ", [inventoryDescription], [inventoryNextPermissions], [inventoryCurrentPermissions]" | 406 | [inventoryDescription], [inventoryNextPermissions], [inventoryCurrentPermissions], |
408 | + ", [invType], [creatorID], [inventoryBasePermissions], [inventoryEveryOnePermissions], [inventoryGroupPermissions]" | 407 | [invType], [creatorID], [inventoryBasePermissions], [inventoryEveryOnePermissions], [inventoryGroupPermissions], |
409 | + ", [salePrice], [saleType], [creationDate], [groupID], [groupOwned], [flags]) VALUES "; | 408 | [salePrice], [saleType], [creationDate], [groupID], [groupOwned], [flags]) |
410 | sql += "(@inventoryID, @assetID, @assetType, @parentFolderID, @avatarID, @inventoryName, @inventoryDescription" | 409 | VALUES |
411 | + ", @inventoryNextPermissions, @inventoryCurrentPermissions, @invType, @creatorID" | 410 | (@inventoryID, @assetID, @assetType, @parentFolderID, @avatarID, @inventoryName, @inventoryDescription, |
412 | + ", @inventoryBasePermissions, @inventoryEveryOnePermissions, @inventoryGroupPermissions, @salePrice, @saleType" | 411 | @inventoryNextPermissions, @inventoryCurrentPermissions, @invType, @creatorID, |
413 | + ", @creationDate, @groupID, @groupOwned, @flags);"; | 412 | @inventoryBasePermissions, @inventoryEveryOnePermissions, @inventoryGroupPermissions, @salePrice, @saleType, |
413 | @creationDate, @groupID, @groupOwned, @flags)"; | ||
414 | 414 | ||
415 | using (AutoClosingSqlCommand command = database.Query(sql)) | 415 | using (AutoClosingSqlCommand command = database.Query(sql)) |
416 | { | 416 | { |
@@ -453,26 +453,27 @@ namespace OpenSim.Data.MSSQL | |||
453 | /// <param name="item">Inventory item to update</param> | 453 | /// <param name="item">Inventory item to update</param> |
454 | public void updateInventoryItem(InventoryItemBase item) | 454 | public void updateInventoryItem(InventoryItemBase item) |
455 | { | 455 | { |
456 | using (AutoClosingSqlCommand command = database.Query("UPDATE inventoryitems set inventoryID = @inventoryID, " + | 456 | string sql = @"UPDATE inventoryitems SET inventoryID = @inventoryID, |
457 | "assetID = @assetID, " + | 457 | assetID = @assetID, |
458 | "assetType = @assetType," + | 458 | assetType = @assetType, |
459 | "parentFolderID = @parentFolderID," + | 459 | parentFolderID = @parentFolderID, |
460 | "avatarID = @avatarID," + | 460 | avatarID = @avatarID, |
461 | "inventoryName = @inventoryName," + | 461 | inventoryName = @inventoryName, |
462 | "inventoryDescription = @inventoryDescription," + | 462 | inventoryDescription = @inventoryDescription, |
463 | "inventoryNextPermissions = @inventoryNextPermissions," + | 463 | inventoryNextPermissions = @inventoryNextPermissions, |
464 | "inventoryCurrentPermissions = @inventoryCurrentPermissions," + | 464 | inventoryCurrentPermissions = @inventoryCurrentPermissions, |
465 | "invType = @invType," + | 465 | invType = @invType, |
466 | "creatorID = @creatorID," + | 466 | creatorID = @creatorID, |
467 | "inventoryBasePermissions = @inventoryBasePermissions," + | 467 | inventoryBasePermissions = @inventoryBasePermissions, |
468 | "inventoryEveryOnePermissions = @inventoryEveryOnePermissions," + | 468 | inventoryEveryOnePermissions = @inventoryEveryOnePermissions, |
469 | "salePrice = @salePrice," + | 469 | salePrice = @salePrice, |
470 | "saleType = @saleType," + | 470 | saleType = @saleType, |
471 | "creationDate = @creationDate," + | 471 | creationDate = @creationDate, |
472 | "groupID = @groupID," + | 472 | groupID = @groupID, |
473 | "groupOwned = @groupOwned," + | 473 | groupOwned = @groupOwned, |
474 | "flags = @flags where " + | 474 | flags = @flags |
475 | "inventoryID = @keyInventoryID;")) | 475 | WHERE inventoryID = @keyInventoryID"; |
476 | using (AutoClosingSqlCommand command = database.Query(sql)) | ||
476 | { | 477 | { |
477 | command.Parameters.Add(database.CreateParameter("inventoryID", item.ID)); | 478 | command.Parameters.Add(database.CreateParameter("inventoryID", item.ID)); |
478 | command.Parameters.Add(database.CreateParameter("assetID", item.AssetID)); | 479 | command.Parameters.Add(database.CreateParameter("assetID", item.AssetID)); |