From 5ee75998ce4d941efd937848d28f3a4dac6ba6cc Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Mon, 7 Apr 2008 23:27:05 +0000 Subject: more refactoring, this time on InventoryFolderBase * wrap attributes in properties * clean up names a little bit * clean up name styles --- OpenSim/Data/MSSQL/MSSQLInventoryData.cs | 50 +++++++++++----------- OpenSim/Data/MySQL/MySQLInventoryData.cs | 34 +++++++-------- OpenSim/Data/NHibernate/NHibernateInventoryData.cs | 10 ++--- OpenSim/Data/SQLite/SQLiteInventoryStore.cs | 42 +++++++++--------- 4 files changed, 68 insertions(+), 68 deletions(-) (limited to 'OpenSim/Data') 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 try { InventoryFolderBase folder = new InventoryFolderBase(); - folder.agentID = new LLUUID((string) reader["agentID"]); - folder.parentID = new LLUUID((string) reader["parentFolderID"]); - folder.folderID = new LLUUID((string) reader["folderID"]); - folder.name = (string) reader["folderName"]; - folder.type = (short) reader["type"]; - folder.version = (ushort) ((int) reader["version"]); + folder.AgentID = new LLUUID((string) reader["agentID"]); + folder.ParentID = new LLUUID((string) reader["parentFolderID"]); + folder.ID = new LLUUID((string) reader["folderID"]); + folder.Name = (string) reader["folderName"]; + folder.Type = (short) reader["type"]; + folder.Version = (ushort) ((int) reader["version"]); return folder; } catch (Exception e) @@ -557,12 +557,12 @@ namespace OpenSim.Data.MSSQL Dictionary param = new Dictionary(); - param["folderID"] = folder.folderID.ToString(); - param["agentID"] = folder.agentID.ToString(); - param["parentFolderID"] = folder.parentID.ToString(); - param["folderName"] = folder.name; - param["type"] = Convert.ToString(folder.type); - param["version"] = Convert.ToString(folder.version); + param["folderID"] = folder.ID.ToString(); + param["agentID"] = folder.AgentID.ToString(); + param["parentFolderID"] = folder.ParentID.ToString(); + param["folderName"] = folder.Name; + param["type"] = Convert.ToString(folder.Type); + param["version"] = Convert.ToString(folder.Version); try { @@ -589,13 +589,13 @@ namespace OpenSim.Data.MSSQL "type = @type," + "version = @version where " + "folderID = @keyFolderID;", database.getConnection()); - SqlParameter param1 = new SqlParameter("@folderID", folder.folderID.ToString()); - SqlParameter param2 = new SqlParameter("@agentID", folder.agentID.ToString()); - SqlParameter param3 = new SqlParameter("@parentFolderID", folder.parentID.ToString()); - SqlParameter param4 = new SqlParameter("@folderName", folder.name); - SqlParameter param5 = new SqlParameter("@type", folder.type); - SqlParameter param6 = new SqlParameter("@version", folder.version); - SqlParameter param7 = new SqlParameter("@keyFolderID", folder.folderID.ToString()); + SqlParameter param1 = new SqlParameter("@folderID", folder.ID.ToString()); + SqlParameter param2 = new SqlParameter("@agentID", folder.AgentID.ToString()); + SqlParameter param3 = new SqlParameter("@parentFolderID", folder.ParentID.ToString()); + SqlParameter param4 = new SqlParameter("@folderName", folder.Name); + SqlParameter param5 = new SqlParameter("@type", folder.Type); + SqlParameter param6 = new SqlParameter("@version", folder.Version); + SqlParameter param7 = new SqlParameter("@keyFolderID", folder.ID.ToString()); command.Parameters.Add(param1); command.Parameters.Add(param2); command.Parameters.Add(param3); @@ -623,9 +623,9 @@ namespace OpenSim.Data.MSSQL SqlCommand command = new SqlCommand("UPDATE inventoryfolders set folderID = @folderID, " + "parentFolderID = @parentFolderID," + "folderID = @keyFolderID;", database.getConnection()); - SqlParameter param1 = new SqlParameter("@folderID", folder.folderID.ToString()); - SqlParameter param2 = new SqlParameter("@parentFolderID", folder.parentID.ToString()); - SqlParameter param3 = new SqlParameter("@keyFolderID", folder.folderID.ToString()); + SqlParameter param1 = new SqlParameter("@folderID", folder.ID.ToString()); + SqlParameter param2 = new SqlParameter("@parentFolderID", folder.ParentID.ToString()); + SqlParameter param3 = new SqlParameter("@keyFolderID", folder.ID.ToString()); command.Parameters.Add(param1); command.Parameters.Add(param2); command.Parameters.Add(param3); @@ -660,7 +660,7 @@ namespace OpenSim.Data.MSSQL getInventoryFolders(ref folders, parentID); for (int i = 0; i < folders.Count; i++) - getInventoryFolders(ref folders, folders[i].folderID); + getInventoryFolders(ref folders, folders[i].ID); return folders; } @@ -716,8 +716,8 @@ namespace OpenSim.Data.MSSQL //Delete all sub-folders foreach (InventoryFolderBase f in subFolders) { - deleteOneFolder(f.folderID); - deleteItemsInFolder(f.folderID); + deleteOneFolder(f.ID); + deleteItemsInFolder(f.ID); } //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 try { InventoryFolderBase folder = new InventoryFolderBase(); - folder.agentID = new LLUUID((string) reader["agentID"]); - folder.parentID = new LLUUID((string) reader["parentFolderID"]); - folder.folderID = new LLUUID((string) reader["folderID"]); - folder.name = (string) reader["folderName"]; - folder.type = (short) reader["type"]; - folder.version = (ushort) ((int) reader["version"]); + folder.AgentID = new LLUUID((string) reader["agentID"]); + folder.ParentID = new LLUUID((string) reader["parentFolderID"]); + folder.ID = new LLUUID((string) reader["folderID"]); + folder.Name = (string) reader["folderName"]; + folder.Type = (short) reader["type"]; + folder.Version = (ushort) ((int) reader["version"]); return folder; } catch (Exception e) @@ -507,12 +507,12 @@ namespace OpenSim.Data.MySQL sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName, ?type, ?version)"; MySqlCommand cmd = new MySqlCommand(sql, database.Connection); - cmd.Parameters.AddWithValue("?folderID", folder.folderID.ToString()); - cmd.Parameters.AddWithValue("?agentID", folder.agentID.ToString()); - cmd.Parameters.AddWithValue("?parentFolderID", folder.parentID.ToString()); - cmd.Parameters.AddWithValue("?folderName", folder.name); - cmd.Parameters.AddWithValue("?type", (short) folder.type); - cmd.Parameters.AddWithValue("?version", folder.version); + cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString()); + cmd.Parameters.AddWithValue("?agentID", folder.AgentID.ToString()); + cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString()); + cmd.Parameters.AddWithValue("?folderName", folder.Name); + cmd.Parameters.AddWithValue("?type", (short) folder.Type); + cmd.Parameters.AddWithValue("?version", folder.Version); try { @@ -545,8 +545,8 @@ namespace OpenSim.Data.MySQL "UPDATE inventoryfolders SET parentFolderID=?parentFolderID WHERE folderID=?folderID"; MySqlCommand cmd = new MySqlCommand(sql, database.Connection); - cmd.Parameters.AddWithValue("?folderID", folder.folderID.ToString()); - cmd.Parameters.AddWithValue("?parentFolderID", folder.parentID.ToString()); + cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString()); + cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString()); try { @@ -581,7 +581,7 @@ namespace OpenSim.Data.MySQL getInventoryFolders(ref folders, parentID); for (int i = 0; i < folders.Count; i++) - getInventoryFolders(ref folders, folders[i].folderID); + getInventoryFolders(ref folders, folders[i].ID); return folders; } @@ -637,8 +637,8 @@ namespace OpenSim.Data.MySQL //Delete all sub-folders foreach (InventoryFolderBase f in subFolders) { - deleteOneFolder(f.folderID); - deleteItemsInFolder(f.folderID); + deleteOneFolder(f.ID); + deleteItemsInFolder(f.ID); } //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 /// The folder to be created public void addInventoryFolder(InventoryFolderBase folder) { - if (!ExistsFolder(folder.folderID)) { + if (!ExistsFolder(folder.ID)) { using(ISession session = factory.OpenSession()) { using(ITransaction transaction = session.BeginTransaction()) { session.Save(folder); @@ -188,7 +188,7 @@ namespace OpenSim.Data.NHibernate } } } else { - m_log.ErrorFormat("Attempted to add Inventory Folder {0} that already exists, updating instead", folder.folderID); + m_log.ErrorFormat("Attempted to add Inventory Folder {0} that already exists, updating instead", folder.ID); updateInventoryFolder(folder); } } @@ -199,7 +199,7 @@ namespace OpenSim.Data.NHibernate /// The updated folder public void updateInventoryFolder(InventoryFolderBase folder) { - if (ExistsFolder(folder.folderID)) { + if (ExistsFolder(folder.ID)) { using(ISession session = factory.OpenSession()) { using(ITransaction transaction = session.BeginTransaction()) { session.Update(folder); @@ -207,7 +207,7 @@ namespace OpenSim.Data.NHibernate } } } else { - m_log.ErrorFormat("Attempted to add Inventory Folder {0} that already exists", folder.folderID); + m_log.ErrorFormat("Attempted to add Inventory Folder {0} that already exists", folder.ID); } } @@ -375,7 +375,7 @@ namespace OpenSim.Data.NHibernate getInventoryFolders(ref folders, Util.ToRawUuidString(parentID)); for (int i = 0; i < folders.Count; i++) - getInventoryFolders(ref folders, Util.ToRawUuidString(folders[i].folderID)); + getInventoryFolders(ref folders, Util.ToRawUuidString(folders[i].ID)); return folders; } 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 { DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; - DataRow inventoryRow = inventoryFolderTable.Rows.Find(Util.ToRawUuidString(folder.folderID)); + DataRow inventoryRow = inventoryFolderTable.Rows.Find(Util.ToRawUuidString(folder.ID)); if (inventoryRow == null) { if (! add) - m_log.ErrorFormat("Interface Misuse: Attempting to Update non-existant inventory folder: {0}", folder.folderID); + m_log.ErrorFormat("Interface Misuse: Attempting to Update non-existant inventory folder: {0}", folder.ID); inventoryRow = inventoryFolderTable.NewRow(); fillFolderRow(inventoryRow, folder); @@ -145,7 +145,7 @@ namespace OpenSim.Data.SQLite else { if (add) - m_log.ErrorFormat("Interface Misuse: Attempting to Add inventory folder that already exists: {0}", folder.folderID); + m_log.ErrorFormat("Interface Misuse: Attempting to Add inventory folder that already exists: {0}", folder.ID); fillFolderRow(inventoryRow, folder); } @@ -160,7 +160,7 @@ namespace OpenSim.Data.SQLite { DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; - DataRow inventoryRow = inventoryFolderTable.Rows.Find(Util.ToRawUuidString(folder.folderID)); + DataRow inventoryRow = inventoryFolderTable.Rows.Find(Util.ToRawUuidString(folder.ID)); if (inventoryRow == null) { inventoryRow = inventoryFolderTable.NewRow(); @@ -339,7 +339,7 @@ namespace OpenSim.Data.SQLite getInventoryFolders(ref folders, Util.ToRawUuidString(parentID)); for (int i = 0; i < folders.Count; i++) - getInventoryFolders(ref folders, Util.ToRawUuidString(folders[i].folderID)); + getInventoryFolders(ref folders, Util.ToRawUuidString(folders[i].ID)); return folders; } @@ -488,10 +488,10 @@ namespace OpenSim.Data.SQLite //Delete all sub-folders foreach (InventoryFolderBase f in subFolders) { - inventoryRow = inventoryFolderTable.Rows.Find(Util.ToRawUuidString(f.folderID)); + inventoryRow = inventoryFolderTable.Rows.Find(Util.ToRawUuidString(f.ID)); if (inventoryRow != null) { - deleteItemsInFolder(Util.ToRawUuidString(f.folderID)); + deleteItemsInFolder(Util.ToRawUuidString(f.ID)); inventoryRow.Delete(); } } @@ -590,29 +590,29 @@ namespace OpenSim.Data.SQLite private InventoryFolderBase buildFolder(DataRow row) { InventoryFolderBase folder = new InventoryFolderBase(); - folder.folderID = new LLUUID((string) row["UUID"]); - folder.name = (string) row["name"]; - folder.agentID = new LLUUID((string) row["agentID"]); - folder.parentID = new LLUUID((string) row["parentID"]); - folder.type = Convert.ToInt16(row["type"]); - folder.version = Convert.ToUInt16(row["version"]); + folder.ID = new LLUUID((string) row["UUID"]); + folder.Name = (string) row["name"]; + folder.AgentID = new LLUUID((string) row["agentID"]); + folder.ParentID = new LLUUID((string) row["parentID"]); + folder.Type = Convert.ToInt16(row["type"]); + folder.Version = Convert.ToUInt16(row["version"]); return folder; } private void fillFolderRow(DataRow row, InventoryFolderBase folder) { - row["UUID"] = Util.ToRawUuidString(folder.folderID); - row["name"] = folder.name; - row["agentID"] = Util.ToRawUuidString(folder.agentID); - row["parentID"] = Util.ToRawUuidString(folder.parentID); - row["type"] = folder.type; - row["version"] = folder.version; + row["UUID"] = Util.ToRawUuidString(folder.ID); + row["name"] = folder.Name; + row["agentID"] = Util.ToRawUuidString(folder.AgentID); + row["parentID"] = Util.ToRawUuidString(folder.ParentID); + row["type"] = folder.Type; + row["version"] = folder.Version; } private void moveFolderRow(DataRow row, InventoryFolderBase folder) { - row["UUID"] = Util.ToRawUuidString(folder.folderID); - row["parentID"] = Util.ToRawUuidString(folder.parentID); + row["UUID"] = Util.ToRawUuidString(folder.ID); + row["parentID"] = Util.ToRawUuidString(folder.ParentID); } /*********************************************************************** -- cgit v1.1