aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data
diff options
context:
space:
mode:
authorSean Dague2008-04-07 23:27:05 +0000
committerSean Dague2008-04-07 23:27:05 +0000
commit5ee75998ce4d941efd937848d28f3a4dac6ba6cc (patch)
treef29a100cb8ab3715c82f0aec4fee9f968f210405 /OpenSim/Data
parentRefactor InventoryItemBase to do the following: (diff)
downloadopensim-SC_OLD-5ee75998ce4d941efd937848d28f3a4dac6ba6cc.zip
opensim-SC_OLD-5ee75998ce4d941efd937848d28f3a4dac6ba6cc.tar.gz
opensim-SC_OLD-5ee75998ce4d941efd937848d28f3a4dac6ba6cc.tar.bz2
opensim-SC_OLD-5ee75998ce4d941efd937848d28f3a4dac6ba6cc.tar.xz
more refactoring, this time on InventoryFolderBase
* wrap attributes in properties * clean up names a little bit * clean up name styles
Diffstat (limited to 'OpenSim/Data')
-rw-r--r--OpenSim/Data/MSSQL/MSSQLInventoryData.cs50
-rw-r--r--OpenSim/Data/MySQL/MySQLInventoryData.cs34
-rw-r--r--OpenSim/Data/NHibernate/NHibernateInventoryData.cs10
-rw-r--r--OpenSim/Data/SQLite/SQLiteInventoryStore.cs42
4 files changed, 68 insertions, 68 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
index 15078aa..f53d9f9 100644
--- a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
@@ -370,12 +370,12 @@ namespace OpenSim.Data.MSSQL
370 try 370 try
371 { 371 {
372 InventoryFolderBase folder = new InventoryFolderBase(); 372 InventoryFolderBase folder = new InventoryFolderBase();
373 folder.agentID = new LLUUID((string) reader["agentID"]); 373 folder.AgentID = new LLUUID((string) reader["agentID"]);
374 folder.parentID = new LLUUID((string) reader["parentFolderID"]); 374 folder.ParentID = new LLUUID((string) reader["parentFolderID"]);
375 folder.folderID = new LLUUID((string) reader["folderID"]); 375 folder.ID = new LLUUID((string) reader["folderID"]);
376 folder.name = (string) reader["folderName"]; 376 folder.Name = (string) reader["folderName"];
377 folder.type = (short) reader["type"]; 377 folder.Type = (short) reader["type"];
378 folder.version = (ushort) ((int) reader["version"]); 378 folder.Version = (ushort) ((int) reader["version"]);
379 return folder; 379 return folder;
380 } 380 }
381 catch (Exception e) 381 catch (Exception e)
@@ -557,12 +557,12 @@ namespace OpenSim.Data.MSSQL
557 557
558 558
559 Dictionary<string, string> param = new Dictionary<string, string>(); 559 Dictionary<string, string> param = new Dictionary<string, string>();
560 param["folderID"] = folder.folderID.ToString(); 560 param["folderID"] = folder.ID.ToString();
561 param["agentID"] = folder.agentID.ToString(); 561 param["agentID"] = folder.AgentID.ToString();
562 param["parentFolderID"] = folder.parentID.ToString(); 562 param["parentFolderID"] = folder.ParentID.ToString();
563 param["folderName"] = folder.name; 563 param["folderName"] = folder.Name;
564 param["type"] = Convert.ToString(folder.type); 564 param["type"] = Convert.ToString(folder.Type);
565 param["version"] = Convert.ToString(folder.version); 565 param["version"] = Convert.ToString(folder.Version);
566 566
567 try 567 try
568 { 568 {
@@ -589,13 +589,13 @@ namespace OpenSim.Data.MSSQL
589 "type = @type," + 589 "type = @type," +
590 "version = @version where " + 590 "version = @version where " +
591 "folderID = @keyFolderID;", database.getConnection()); 591 "folderID = @keyFolderID;", database.getConnection());
592 SqlParameter param1 = new SqlParameter("@folderID", folder.folderID.ToString()); 592 SqlParameter param1 = new SqlParameter("@folderID", folder.ID.ToString());
593 SqlParameter param2 = new SqlParameter("@agentID", folder.agentID.ToString()); 593 SqlParameter param2 = new SqlParameter("@agentID", folder.AgentID.ToString());
594 SqlParameter param3 = new SqlParameter("@parentFolderID", folder.parentID.ToString()); 594 SqlParameter param3 = new SqlParameter("@parentFolderID", folder.ParentID.ToString());
595 SqlParameter param4 = new SqlParameter("@folderName", folder.name); 595 SqlParameter param4 = new SqlParameter("@folderName", folder.Name);
596 SqlParameter param5 = new SqlParameter("@type", folder.type); 596 SqlParameter param5 = new SqlParameter("@type", folder.Type);
597 SqlParameter param6 = new SqlParameter("@version", folder.version); 597 SqlParameter param6 = new SqlParameter("@version", folder.Version);
598 SqlParameter param7 = new SqlParameter("@keyFolderID", folder.folderID.ToString()); 598 SqlParameter param7 = new SqlParameter("@keyFolderID", folder.ID.ToString());
599 command.Parameters.Add(param1); 599 command.Parameters.Add(param1);
600 command.Parameters.Add(param2); 600 command.Parameters.Add(param2);
601 command.Parameters.Add(param3); 601 command.Parameters.Add(param3);
@@ -623,9 +623,9 @@ namespace OpenSim.Data.MSSQL
623 SqlCommand command = new SqlCommand("UPDATE inventoryfolders set folderID = @folderID, " + 623 SqlCommand command = new SqlCommand("UPDATE inventoryfolders set folderID = @folderID, " +
624 "parentFolderID = @parentFolderID," + 624 "parentFolderID = @parentFolderID," +
625 "folderID = @keyFolderID;", database.getConnection()); 625 "folderID = @keyFolderID;", database.getConnection());
626 SqlParameter param1 = new SqlParameter("@folderID", folder.folderID.ToString()); 626 SqlParameter param1 = new SqlParameter("@folderID", folder.ID.ToString());
627 SqlParameter param2 = new SqlParameter("@parentFolderID", folder.parentID.ToString()); 627 SqlParameter param2 = new SqlParameter("@parentFolderID", folder.ParentID.ToString());
628 SqlParameter param3 = new SqlParameter("@keyFolderID", folder.folderID.ToString()); 628 SqlParameter param3 = new SqlParameter("@keyFolderID", folder.ID.ToString());
629 command.Parameters.Add(param1); 629 command.Parameters.Add(param1);
630 command.Parameters.Add(param2); 630 command.Parameters.Add(param2);
631 command.Parameters.Add(param3); 631 command.Parameters.Add(param3);
@@ -660,7 +660,7 @@ namespace OpenSim.Data.MSSQL
660 getInventoryFolders(ref folders, parentID); 660 getInventoryFolders(ref folders, parentID);
661 661
662 for (int i = 0; i < folders.Count; i++) 662 for (int i = 0; i < folders.Count; i++)
663 getInventoryFolders(ref folders, folders[i].folderID); 663 getInventoryFolders(ref folders, folders[i].ID);
664 664
665 return folders; 665 return folders;
666 } 666 }
@@ -716,8 +716,8 @@ namespace OpenSim.Data.MSSQL
716 //Delete all sub-folders 716 //Delete all sub-folders
717 foreach (InventoryFolderBase f in subFolders) 717 foreach (InventoryFolderBase f in subFolders)
718 { 718 {
719 deleteOneFolder(f.folderID); 719 deleteOneFolder(f.ID);
720 deleteItemsInFolder(f.folderID); 720 deleteItemsInFolder(f.ID);
721 } 721 }
722 722
723 //Delete the actual row 723 //Delete the actual row
diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs
index 6bb7a53..6cc8998 100644
--- a/OpenSim/Data/MySQL/MySQLInventoryData.cs
+++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs
@@ -381,12 +381,12 @@ namespace OpenSim.Data.MySQL
381 try 381 try
382 { 382 {
383 InventoryFolderBase folder = new InventoryFolderBase(); 383 InventoryFolderBase folder = new InventoryFolderBase();
384 folder.agentID = new LLUUID((string) reader["agentID"]); 384 folder.AgentID = new LLUUID((string) reader["agentID"]);
385 folder.parentID = new LLUUID((string) reader["parentFolderID"]); 385 folder.ParentID = new LLUUID((string) reader["parentFolderID"]);
386 folder.folderID = new LLUUID((string) reader["folderID"]); 386 folder.ID = new LLUUID((string) reader["folderID"]);
387 folder.name = (string) reader["folderName"]; 387 folder.Name = (string) reader["folderName"];
388 folder.type = (short) reader["type"]; 388 folder.Type = (short) reader["type"];
389 folder.version = (ushort) ((int) reader["version"]); 389 folder.Version = (ushort) ((int) reader["version"]);
390 return folder; 390 return folder;
391 } 391 }
392 catch (Exception e) 392 catch (Exception e)
@@ -507,12 +507,12 @@ namespace OpenSim.Data.MySQL
507 sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName, ?type, ?version)"; 507 sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName, ?type, ?version)";
508 508
509 MySqlCommand cmd = new MySqlCommand(sql, database.Connection); 509 MySqlCommand cmd = new MySqlCommand(sql, database.Connection);
510 cmd.Parameters.AddWithValue("?folderID", folder.folderID.ToString()); 510 cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString());
511 cmd.Parameters.AddWithValue("?agentID", folder.agentID.ToString()); 511 cmd.Parameters.AddWithValue("?agentID", folder.AgentID.ToString());
512 cmd.Parameters.AddWithValue("?parentFolderID", folder.parentID.ToString()); 512 cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString());
513 cmd.Parameters.AddWithValue("?folderName", folder.name); 513 cmd.Parameters.AddWithValue("?folderName", folder.Name);
514 cmd.Parameters.AddWithValue("?type", (short) folder.type); 514 cmd.Parameters.AddWithValue("?type", (short) folder.Type);
515 cmd.Parameters.AddWithValue("?version", folder.version); 515 cmd.Parameters.AddWithValue("?version", folder.Version);
516 516
517 try 517 try
518 { 518 {
@@ -545,8 +545,8 @@ namespace OpenSim.Data.MySQL
545 "UPDATE inventoryfolders SET parentFolderID=?parentFolderID WHERE folderID=?folderID"; 545 "UPDATE inventoryfolders SET parentFolderID=?parentFolderID WHERE folderID=?folderID";
546 546
547 MySqlCommand cmd = new MySqlCommand(sql, database.Connection); 547 MySqlCommand cmd = new MySqlCommand(sql, database.Connection);
548 cmd.Parameters.AddWithValue("?folderID", folder.folderID.ToString()); 548 cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString());
549 cmd.Parameters.AddWithValue("?parentFolderID", folder.parentID.ToString()); 549 cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString());
550 550
551 try 551 try
552 { 552 {
@@ -581,7 +581,7 @@ namespace OpenSim.Data.MySQL
581 getInventoryFolders(ref folders, parentID); 581 getInventoryFolders(ref folders, parentID);
582 582
583 for (int i = 0; i < folders.Count; i++) 583 for (int i = 0; i < folders.Count; i++)
584 getInventoryFolders(ref folders, folders[i].folderID); 584 getInventoryFolders(ref folders, folders[i].ID);
585 585
586 return folders; 586 return folders;
587 } 587 }
@@ -637,8 +637,8 @@ namespace OpenSim.Data.MySQL
637 //Delete all sub-folders 637 //Delete all sub-folders
638 foreach (InventoryFolderBase f in subFolders) 638 foreach (InventoryFolderBase f in subFolders)
639 { 639 {
640 deleteOneFolder(f.folderID); 640 deleteOneFolder(f.ID);
641 deleteItemsInFolder(f.folderID); 641 deleteItemsInFolder(f.ID);
642 } 642 }
643 643
644 //Delete the actual row 644 //Delete the actual row
diff --git a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
index ba1d3e9..6bc2e62 100644
--- a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
@@ -180,7 +180,7 @@ namespace OpenSim.Data.NHibernate
180 /// <param name="folder">The folder to be created</param> 180 /// <param name="folder">The folder to be created</param>
181 public void addInventoryFolder(InventoryFolderBase folder) 181 public void addInventoryFolder(InventoryFolderBase folder)
182 { 182 {
183 if (!ExistsFolder(folder.folderID)) { 183 if (!ExistsFolder(folder.ID)) {
184 using(ISession session = factory.OpenSession()) { 184 using(ISession session = factory.OpenSession()) {
185 using(ITransaction transaction = session.BeginTransaction()) { 185 using(ITransaction transaction = session.BeginTransaction()) {
186 session.Save(folder); 186 session.Save(folder);
@@ -188,7 +188,7 @@ namespace OpenSim.Data.NHibernate
188 } 188 }
189 } 189 }
190 } else { 190 } else {
191 m_log.ErrorFormat("Attempted to add Inventory Folder {0} that already exists, updating instead", folder.folderID); 191 m_log.ErrorFormat("Attempted to add Inventory Folder {0} that already exists, updating instead", folder.ID);
192 updateInventoryFolder(folder); 192 updateInventoryFolder(folder);
193 } 193 }
194 } 194 }
@@ -199,7 +199,7 @@ namespace OpenSim.Data.NHibernate
199 /// <param name="folder">The updated folder</param> 199 /// <param name="folder">The updated folder</param>
200 public void updateInventoryFolder(InventoryFolderBase folder) 200 public void updateInventoryFolder(InventoryFolderBase folder)
201 { 201 {
202 if (ExistsFolder(folder.folderID)) { 202 if (ExistsFolder(folder.ID)) {
203 using(ISession session = factory.OpenSession()) { 203 using(ISession session = factory.OpenSession()) {
204 using(ITransaction transaction = session.BeginTransaction()) { 204 using(ITransaction transaction = session.BeginTransaction()) {
205 session.Update(folder); 205 session.Update(folder);
@@ -207,7 +207,7 @@ namespace OpenSim.Data.NHibernate
207 } 207 }
208 } 208 }
209 } else { 209 } else {
210 m_log.ErrorFormat("Attempted to add Inventory Folder {0} that already exists", folder.folderID); 210 m_log.ErrorFormat("Attempted to add Inventory Folder {0} that already exists", folder.ID);
211 } 211 }
212 } 212 }
213 213
@@ -375,7 +375,7 @@ namespace OpenSim.Data.NHibernate
375 getInventoryFolders(ref folders, Util.ToRawUuidString(parentID)); 375 getInventoryFolders(ref folders, Util.ToRawUuidString(parentID));
376 376
377 for (int i = 0; i < folders.Count; i++) 377 for (int i = 0; i < folders.Count; i++)
378 getInventoryFolders(ref folders, Util.ToRawUuidString(folders[i].folderID)); 378 getInventoryFolders(ref folders, Util.ToRawUuidString(folders[i].ID));
379 379
380 return folders; 380 return folders;
381 } 381 }
diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
index f0ff7c9..e8663b4 100644
--- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
+++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
@@ -132,11 +132,11 @@ namespace OpenSim.Data.SQLite
132 { 132 {
133 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; 133 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
134 134
135 DataRow inventoryRow = inventoryFolderTable.Rows.Find(Util.ToRawUuidString(folder.folderID)); 135 DataRow inventoryRow = inventoryFolderTable.Rows.Find(Util.ToRawUuidString(folder.ID));
136 if (inventoryRow == null) 136 if (inventoryRow == null)
137 { 137 {
138 if (! add) 138 if (! add)
139 m_log.ErrorFormat("Interface Misuse: Attempting to Update non-existant inventory folder: {0}", folder.folderID); 139 m_log.ErrorFormat("Interface Misuse: Attempting to Update non-existant inventory folder: {0}", folder.ID);
140 140
141 inventoryRow = inventoryFolderTable.NewRow(); 141 inventoryRow = inventoryFolderTable.NewRow();
142 fillFolderRow(inventoryRow, folder); 142 fillFolderRow(inventoryRow, folder);
@@ -145,7 +145,7 @@ namespace OpenSim.Data.SQLite
145 else 145 else
146 { 146 {
147 if (add) 147 if (add)
148 m_log.ErrorFormat("Interface Misuse: Attempting to Add inventory folder that already exists: {0}", folder.folderID); 148 m_log.ErrorFormat("Interface Misuse: Attempting to Add inventory folder that already exists: {0}", folder.ID);
149 149
150 fillFolderRow(inventoryRow, folder); 150 fillFolderRow(inventoryRow, folder);
151 } 151 }
@@ -160,7 +160,7 @@ namespace OpenSim.Data.SQLite
160 { 160 {
161 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; 161 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
162 162
163 DataRow inventoryRow = inventoryFolderTable.Rows.Find(Util.ToRawUuidString(folder.folderID)); 163 DataRow inventoryRow = inventoryFolderTable.Rows.Find(Util.ToRawUuidString(folder.ID));
164 if (inventoryRow == null) 164 if (inventoryRow == null)
165 { 165 {
166 inventoryRow = inventoryFolderTable.NewRow(); 166 inventoryRow = inventoryFolderTable.NewRow();
@@ -339,7 +339,7 @@ namespace OpenSim.Data.SQLite
339 getInventoryFolders(ref folders, Util.ToRawUuidString(parentID)); 339 getInventoryFolders(ref folders, Util.ToRawUuidString(parentID));
340 340
341 for (int i = 0; i < folders.Count; i++) 341 for (int i = 0; i < folders.Count; i++)
342 getInventoryFolders(ref folders, Util.ToRawUuidString(folders[i].folderID)); 342 getInventoryFolders(ref folders, Util.ToRawUuidString(folders[i].ID));
343 343
344 return folders; 344 return folders;
345 } 345 }
@@ -488,10 +488,10 @@ namespace OpenSim.Data.SQLite
488 //Delete all sub-folders 488 //Delete all sub-folders
489 foreach (InventoryFolderBase f in subFolders) 489 foreach (InventoryFolderBase f in subFolders)
490 { 490 {
491 inventoryRow = inventoryFolderTable.Rows.Find(Util.ToRawUuidString(f.folderID)); 491 inventoryRow = inventoryFolderTable.Rows.Find(Util.ToRawUuidString(f.ID));
492 if (inventoryRow != null) 492 if (inventoryRow != null)
493 { 493 {
494 deleteItemsInFolder(Util.ToRawUuidString(f.folderID)); 494 deleteItemsInFolder(Util.ToRawUuidString(f.ID));
495 inventoryRow.Delete(); 495 inventoryRow.Delete();
496 } 496 }
497 } 497 }
@@ -590,29 +590,29 @@ namespace OpenSim.Data.SQLite
590 private InventoryFolderBase buildFolder(DataRow row) 590 private InventoryFolderBase buildFolder(DataRow row)
591 { 591 {
592 InventoryFolderBase folder = new InventoryFolderBase(); 592 InventoryFolderBase folder = new InventoryFolderBase();
593 folder.folderID = new LLUUID((string) row["UUID"]); 593 folder.ID = new LLUUID((string) row["UUID"]);
594 folder.name = (string) row["name"]; 594 folder.Name = (string) row["name"];
595 folder.agentID = new LLUUID((string) row["agentID"]); 595 folder.AgentID = new LLUUID((string) row["agentID"]);
596 folder.parentID = new LLUUID((string) row["parentID"]); 596 folder.ParentID = new LLUUID((string) row["parentID"]);
597 folder.type = Convert.ToInt16(row["type"]); 597 folder.Type = Convert.ToInt16(row["type"]);
598 folder.version = Convert.ToUInt16(row["version"]); 598 folder.Version = Convert.ToUInt16(row["version"]);
599 return folder; 599 return folder;
600 } 600 }
601 601
602 private void fillFolderRow(DataRow row, InventoryFolderBase folder) 602 private void fillFolderRow(DataRow row, InventoryFolderBase folder)
603 { 603 {
604 row["UUID"] = Util.ToRawUuidString(folder.folderID); 604 row["UUID"] = Util.ToRawUuidString(folder.ID);
605 row["name"] = folder.name; 605 row["name"] = folder.Name;
606 row["agentID"] = Util.ToRawUuidString(folder.agentID); 606 row["agentID"] = Util.ToRawUuidString(folder.AgentID);
607 row["parentID"] = Util.ToRawUuidString(folder.parentID); 607 row["parentID"] = Util.ToRawUuidString(folder.ParentID);
608 row["type"] = folder.type; 608 row["type"] = folder.Type;
609 row["version"] = folder.version; 609 row["version"] = folder.Version;
610 } 610 }
611 611
612 private void moveFolderRow(DataRow row, InventoryFolderBase folder) 612 private void moveFolderRow(DataRow row, InventoryFolderBase folder)
613 { 613 {
614 row["UUID"] = Util.ToRawUuidString(folder.folderID); 614 row["UUID"] = Util.ToRawUuidString(folder.ID);
615 row["parentID"] = Util.ToRawUuidString(folder.parentID); 615 row["parentID"] = Util.ToRawUuidString(folder.ParentID);
616 } 616 }
617 617
618 /*********************************************************************** 618 /***********************************************************************