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/SQLiteAssetData.cs | 68 ++++++++++++++++++++++++++++++++-- 1 file changed, 65 insertions(+), 3 deletions(-) (limited to 'OpenSim/Data/SQLite/SQLiteAssetData.cs') diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs index 4370cf7..f560b9e 100644 --- a/OpenSim/Data/SQLite/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs @@ -56,6 +56,14 @@ namespace OpenSim.Data.SQLite private SqliteConnection m_conn; + /// + /// + /// Initialises AssetData interface + /// Loads and initialises a new SQLite connection and maintains it. + /// use default URI if connect string is empty. + /// + /// + /// connect string override public void Initialise(string dbconnect) { if (dbconnect == string.Empty) @@ -65,9 +73,6 @@ namespace OpenSim.Data.SQLite m_conn = new SqliteConnection(dbconnect); m_conn.Open(); - - - Assembly assem = GetType().Assembly; Migration m = new Migration(m_conn, assem, "AssetStore"); // TODO: remove this next line after changeset 6000, @@ -80,6 +85,11 @@ namespace OpenSim.Data.SQLite return; } + /// + /// Fetch Asset + /// + /// UUID of ... ? + /// Asset base override public AssetBase FetchAsset(LLUUID uuid) { @@ -103,6 +113,10 @@ namespace OpenSim.Data.SQLite } } + /// + /// Create an asset + /// + /// Asset Base override public void CreateAsset(AssetBase asset) { m_log.Info("[ASSET DB]: Creating Asset " + Util.ToRawUuidString(asset.FullID)); @@ -128,6 +142,10 @@ namespace OpenSim.Data.SQLite } } + /// + /// Update an asset + /// + /// override public void UpdateAsset(AssetBase asset) { LogAssetLoad(asset); @@ -148,6 +166,10 @@ namespace OpenSim.Data.SQLite } + /// + /// Some... logging functionnality + /// + /// private static void LogAssetLoad(AssetBase asset) { string temporary = asset.Temporary ? "Temporary" : "Stored"; @@ -161,6 +183,11 @@ namespace OpenSim.Data.SQLite asset.InvType, temporary, local, assetLength)); } + /// + /// Check if an asset exist in database + /// + /// The asset UUID + /// True if exist, or false. override public bool ExistsAsset(LLUUID uuid) { using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn)) @@ -182,6 +209,10 @@ namespace OpenSim.Data.SQLite } } + /// + /// Delete an asset from database + /// + /// public void DeleteAsset(LLUUID uuid) { using (SqliteCommand cmd = new SqliteCommand(DeleteAssetSQL, m_conn)) @@ -192,6 +223,9 @@ namespace OpenSim.Data.SQLite } } + /// + /// commit + /// override public void CommitAssets() // force a sync to the database { m_log.Info("[ASSET DB]: Attempting commit"); @@ -210,6 +244,10 @@ namespace OpenSim.Data.SQLite * **********************************************************************/ + /// + /// Create the "assets" table + /// + /// private static DataTable createAssetsTable() { DataTable assets = new DataTable("assets"); @@ -235,6 +273,11 @@ namespace OpenSim.Data.SQLite * **********************************************************************/ + /// + /// + /// + /// + /// private static AssetBase buildAsset(IDataReader row) { // TODO: this doesn't work yet because something more @@ -263,6 +306,10 @@ namespace OpenSim.Data.SQLite * **********************************************************************/ + /// + /// + /// + /// private static void InitDB(SqliteConnection conn) { string createAssets = SQLiteUtil.defineTable(createAssetsTable()); @@ -270,6 +317,12 @@ namespace OpenSim.Data.SQLite pcmd.ExecuteNonQuery(); } + /// + /// + /// + /// + /// + /// private static bool TestTables(SqliteConnection conn, Migration m) { SqliteCommand cmd = new SqliteCommand(assetSelect, conn); @@ -295,6 +348,9 @@ namespace OpenSim.Data.SQLite #region IPlugin interface + /// + /// + /// override public string Version { get @@ -309,11 +365,17 @@ namespace OpenSim.Data.SQLite } } + /// + /// Initialise the AssetData interface using default URI + /// override public void Initialise() { Initialise("URI=file:AssetStorage.db,version=3"); } + /// + /// Name of this DB provider + /// override public string Name { get { return "SQLite Asset storage engine"; } -- cgit v1.1