aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLInventoryData.cs10
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs65
2 files changed, 73 insertions, 2 deletions
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLInventoryData.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLInventoryData.cs
index 48d8e93..50ffbb0 100644
--- a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLInventoryData.cs
+++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLInventoryData.cs
@@ -194,7 +194,10 @@ namespace OpenGrid.Framework.Data.MySQL
194 194
195 public void addInventoryItem(InventoryItemBase item) 195 public void addInventoryItem(InventoryItemBase item)
196 { 196 {
197 197 lock (database)
198 {
199 database.insertItem(item);
200 }
198 } 201 }
199 202
200 public void updateInventoryItem(InventoryItemBase item) 203 public void updateInventoryItem(InventoryItemBase item)
@@ -204,7 +207,10 @@ namespace OpenGrid.Framework.Data.MySQL
204 207
205 public void addInventoryFolder(InventoryFolderBase folder) 208 public void addInventoryFolder(InventoryFolderBase folder)
206 { 209 {
207 210 lock (database)
211 {
212 database.insertFolder(folder);
213 }
208 } 214 }
209 215
210 public void updateInventoryFolder(InventoryFolderBase folder) 216 public void updateInventoryFolder(InventoryFolderBase folder)
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs
index 0538bd3..9fbdffb 100644
--- a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs
+++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs
@@ -377,6 +377,71 @@ namespace OpenGrid.Framework.Data.MySQL
377 return returnval; 377 return returnval;
378 } 378 }
379 379
380 public bool insertItem(InventoryItemBase item)
381 {
382 string sql = "REPLACE INTO inventoryitems (inventoryID, assetID, type, parentFolderID, avatarID, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions) VALUES ";
383 sql += "(?inventoryID, ?assetID, ?type, ?parentFolderID, ?avatarID, ?inventoryName, ?inventoryDescription, ?inventoryNextPermissions, ?inventoryCurrentPermissions)";
384
385 Dictionary<string, string> parameters = new Dictionary<string, string>();
386 parameters["?inventoryID"] = item.inventoryID.ToStringHyphenated();
387 parameters["?assetID"] = item.assetID.ToStringHyphenated();
388 parameters["?type"] = item.type.ToString();
389 parameters["?parentFolderID"] = item.parentFolderID.ToStringHyphenated();
390 parameters["?avatarID"] = item.avatarID.ToStringHyphenated();
391 parameters["?inventoryName"] = item.inventoryName;
392 parameters["?inventoryDescription"] = item.inventoryDescription;
393 parameters["?inventoryNextPermissions"] = item.inventoryNextPermissions.ToString();
394 parameters["?inventoryCurrentPermissions"] = item.inventoryCurrentPermissions.ToString();
395
396 bool returnval = false;
397
398 try
399 {
400 IDbCommand result = Query(sql, parameters);
401
402 if (result.ExecuteNonQuery() == 1)
403 returnval = true;
404
405 result.Dispose();
406 }
407 catch (Exception e)
408 {
409 Console.WriteLine(e.ToString());
410 return false;
411 }
412
413 return returnval;
414 }
415
416 public bool insertFolder(InventoryFolderBase folder)
417 {
418 string sql = "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName) VALUES ";
419 sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName)";
420
421 Dictionary<string, string> parameters = new Dictionary<string, string>();
422 parameters["?folderID"] = folder.folderID.ToStringHyphenated();
423 parameters["?agentID"] = folder.agentID.ToStringHyphenated();
424 parameters["?parentFolderID"] = folder.parentID.ToStringHyphenated();
425 parameters["?folderName"] = folder.name;
426
427 bool returnval = false;
428 try
429 {
430 IDbCommand result = Query(sql, parameters);
431
432 if (result.ExecuteNonQuery() == 1)
433 returnval = true;
434
435 result.Dispose();
436 }
437 catch (Exception e)
438 {
439 Console.WriteLine(e.ToString());
440 return false;
441 }
442 return returnval;
443 }
444
380 public bool insertRow(SimProfileData profile) 445 public bool insertRow(SimProfileData profile)
381 { 446 {
382 string sql = "REPLACE INTO regions (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; 447 string sql = "REPLACE INTO regions (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, ";