From 9fae975a53fbb852dfbaf811dca259ddd4f74f4c Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Thu, 26 Jun 2008 20:14:33 +0000 Subject: Apply patch from bug #1605 -- Documentation for Data/SQLite. Thanks kerunix_Flan! --- OpenSim/Data/SQLite/SQLiteInventoryStore.cs | 104 +++++++++++++++++++++++++--- 1 file changed, 93 insertions(+), 11 deletions(-) (limited to 'OpenSim/Data/SQLite/SQLiteInventoryStore.cs') diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs index 5b77f82..f7a1fdc 100644 --- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs +++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs @@ -36,6 +36,9 @@ using OpenSim.Framework; namespace OpenSim.Data.SQLite { + /// + /// An Inventory Interface to the SQLite database + /// public class SQLiteInventoryStore : SQLiteUtil, IInventoryData { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -48,8 +51,13 @@ namespace OpenSim.Data.SQLite private SqliteDataAdapter invFoldersDa; /// - /// Initialises the interface + /// + /// Initialises Inventory interface + /// Loads and initialises a new SQLite connection and maintains it. + /// use default URI if connect string string is empty. + /// /// + /// connect string public void Initialise(string dbconnect) { if (dbconnect == string.Empty) @@ -90,6 +98,11 @@ namespace OpenSim.Data.SQLite ds.AcceptChanges(); } + /// + /// + /// + /// + /// public InventoryItemBase buildItem(DataRow row) { InventoryItemBase item = new InventoryItemBase(); @@ -130,6 +143,11 @@ namespace OpenSim.Data.SQLite return item; } + /// + /// + /// + /// + /// private static void fillItemRow(DataRow row, InventoryItemBase item) { row["UUID"] = Util.ToRawUuidString(item.ID); @@ -156,6 +174,12 @@ namespace OpenSim.Data.SQLite row["flags"] = item.Flags; } + /// + /// Add inventory folder + /// + /// Folder base + /// true=create folder. false=update existing folder + /// nasty private void addFolder(InventoryFolderBase folder, bool add) { lock (ds) @@ -184,6 +208,10 @@ namespace OpenSim.Data.SQLite } } + /// + /// Move an inventory folder + /// + /// folder base private void moveFolder(InventoryFolderBase folder) { lock (ds) @@ -206,6 +234,11 @@ namespace OpenSim.Data.SQLite } } + /// + /// add an item in inventory + /// + /// the item + /// true=add item ; false=update existing item private void addItem(InventoryItemBase item, bool add) { lock (ds) @@ -233,31 +266,34 @@ namespace OpenSim.Data.SQLite } } + /// + /// TODO : DataSet commit + /// public void Shutdown() { // TODO: DataSet commit } /// - /// Closes the interface + /// Closes the inventory interface /// public void Close() { } /// - /// The plugin being loaded + /// The name of this DB provider /// - /// A string containing the plugin name + /// Name of DB provider public string getName() { return "SQLite Inventory Data Interface"; } /// - /// The plugins version + /// Returns the version of this DB provider /// - /// A string containing the plugin version + /// A string containing the DB provider version public string getVersion() { Module module = GetType().Module; @@ -362,7 +398,11 @@ namespace OpenSim.Data.SQLite return folders; } - // See IInventoryData + /// + /// See IInventoryData + /// + /// + /// public List getFolderHierarchy(LLUUID parentID) { List folders = new List(); @@ -440,9 +480,9 @@ namespace OpenSim.Data.SQLite } /// - /// + /// Delete an inventory item /// - /// + /// The item UUID public void deleteInventoryItem(LLUUID itemID) { lock (ds) @@ -463,7 +503,7 @@ namespace OpenSim.Data.SQLite /// Delete all items in the specified folder /// /// id of the folder, whose item content should be deleted - //!TODO, this is horribly inefficient, but I don't want to ruin the overall structure of this implementation + /// this is horribly inefficient, but I don't want to ruin the overall structure of this implementation private void deleteItemsInFolder(LLUUID folderId) { List items = getInventoryInFolder(Util.ToRawUuidString(folderId)); @@ -505,7 +545,7 @@ namespace OpenSim.Data.SQLite /// /// This will clean-up any child folders and child items as well /// - /// + /// the folder UUID public void deleteInventoryFolder(LLUUID folderID) { lock (ds) @@ -544,6 +584,9 @@ namespace OpenSim.Data.SQLite * **********************************************************************/ + /// + /// Create the "inventoryitems" table + /// private static DataTable createInventoryItemsTable() { DataTable inv = new DataTable("inventoryitems"); @@ -582,6 +625,10 @@ namespace OpenSim.Data.SQLite return inv; } + /// + /// Creates the "inventoryfolders" table + /// + /// private static DataTable createInventoryFoldersTable() { DataTable fol = new DataTable("inventoryfolders"); @@ -597,6 +644,11 @@ namespace OpenSim.Data.SQLite return fol; } + /// + /// + /// + /// + /// private void setupItemsCommands(SqliteDataAdapter da, SqliteConnection conn) { lock (ds) @@ -614,6 +666,11 @@ namespace OpenSim.Data.SQLite } } + /// + /// + /// + /// + /// private void setupFoldersCommands(SqliteDataAdapter da, SqliteConnection conn) { lock (ds) @@ -631,6 +688,11 @@ namespace OpenSim.Data.SQLite } } + /// + /// + /// + /// + /// private static InventoryFolderBase buildFolder(DataRow row) { InventoryFolderBase folder = new InventoryFolderBase(); @@ -643,6 +705,11 @@ namespace OpenSim.Data.SQLite return folder; } + /// + /// + /// + /// + /// private static void fillFolderRow(DataRow row, InventoryFolderBase folder) { row["UUID"] = Util.ToRawUuidString(folder.ID); @@ -653,6 +720,11 @@ namespace OpenSim.Data.SQLite row["version"] = folder.Version; } + /// + /// + /// + /// + /// private static void moveFolderRow(DataRow row, InventoryFolderBase folder) { row["UUID"] = Util.ToRawUuidString(folder.ID); @@ -665,6 +737,10 @@ namespace OpenSim.Data.SQLite * **********************************************************************/ + /// + /// + /// + /// private static void InitDB(SqliteConnection conn) { string createInventoryItems = defineTable(createInventoryItemsTable()); @@ -677,6 +753,12 @@ namespace OpenSim.Data.SQLite scmd.ExecuteNonQuery(); } + /// + /// + /// + /// + /// + /// private static bool TestTables(SqliteConnection conn, Migration m) { SqliteCommand invItemsSelectCmd = new SqliteCommand(invItemsSelect, conn); -- cgit v1.1