aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/SQLite/SQLiteAssetData.cs
diff options
context:
space:
mode:
authorJeff Ames2008-06-26 20:14:33 +0000
committerJeff Ames2008-06-26 20:14:33 +0000
commit9fae975a53fbb852dfbaf811dca259ddd4f74f4c (patch)
tree7273987bd5c30c4fabca6fa68b43ce25304a703a /OpenSim/Data/SQLite/SQLiteAssetData.cs
parentUpdate svn properties. Minor formatting cleanup. (diff)
downloadopensim-SC-9fae975a53fbb852dfbaf811dca259ddd4f74f4c.zip
opensim-SC-9fae975a53fbb852dfbaf811dca259ddd4f74f4c.tar.gz
opensim-SC-9fae975a53fbb852dfbaf811dca259ddd4f74f4c.tar.bz2
opensim-SC-9fae975a53fbb852dfbaf811dca259ddd4f74f4c.tar.xz
Apply patch from bug #1605 -- Documentation for Data/SQLite. Thanks kerunix_Flan!
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/SQLite/SQLiteAssetData.cs68
1 files changed, 65 insertions, 3 deletions
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
56 56
57 private SqliteConnection m_conn; 57 private SqliteConnection m_conn;
58 58
59 /// <summary>
60 /// <list type="bullet">
61 /// <item>Initialises AssetData interface</item>
62 /// <item>Loads and initialises a new SQLite connection and maintains it.</item>
63 /// <item>use default URI if connect string is empty.</item>
64 /// </list>
65 /// </summary>
66 /// <param name="dbconnect">connect string</param>
59 override public void Initialise(string dbconnect) 67 override public void Initialise(string dbconnect)
60 { 68 {
61 if (dbconnect == string.Empty) 69 if (dbconnect == string.Empty)
@@ -65,9 +73,6 @@ namespace OpenSim.Data.SQLite
65 m_conn = new SqliteConnection(dbconnect); 73 m_conn = new SqliteConnection(dbconnect);
66 m_conn.Open(); 74 m_conn.Open();
67 75
68
69
70
71 Assembly assem = GetType().Assembly; 76 Assembly assem = GetType().Assembly;
72 Migration m = new Migration(m_conn, assem, "AssetStore"); 77 Migration m = new Migration(m_conn, assem, "AssetStore");
73 // TODO: remove this next line after changeset 6000, 78 // TODO: remove this next line after changeset 6000,
@@ -80,6 +85,11 @@ namespace OpenSim.Data.SQLite
80 return; 85 return;
81 } 86 }
82 87
88 /// <summary>
89 /// Fetch Asset
90 /// </summary>
91 /// <param name="uuid">UUID of ... ?</param>
92 /// <returns>Asset base</returns>
83 override public AssetBase FetchAsset(LLUUID uuid) 93 override public AssetBase FetchAsset(LLUUID uuid)
84 { 94 {
85 95
@@ -103,6 +113,10 @@ namespace OpenSim.Data.SQLite
103 } 113 }
104 } 114 }
105 115
116 /// <summary>
117 /// Create an asset
118 /// </summary>
119 /// <param name="asset">Asset Base</param>
106 override public void CreateAsset(AssetBase asset) 120 override public void CreateAsset(AssetBase asset)
107 { 121 {
108 m_log.Info("[ASSET DB]: Creating Asset " + Util.ToRawUuidString(asset.FullID)); 122 m_log.Info("[ASSET DB]: Creating Asset " + Util.ToRawUuidString(asset.FullID));
@@ -128,6 +142,10 @@ namespace OpenSim.Data.SQLite
128 } 142 }
129 } 143 }
130 144
145 /// <summary>
146 /// Update an asset
147 /// </summary>
148 /// <param name="asset"></param>
131 override public void UpdateAsset(AssetBase asset) 149 override public void UpdateAsset(AssetBase asset)
132 { 150 {
133 LogAssetLoad(asset); 151 LogAssetLoad(asset);
@@ -148,6 +166,10 @@ namespace OpenSim.Data.SQLite
148 166
149 } 167 }
150 168
169 /// <summary>
170 /// Some... logging functionnality
171 /// </summary>
172 /// <param name="asset"></param>
151 private static void LogAssetLoad(AssetBase asset) 173 private static void LogAssetLoad(AssetBase asset)
152 { 174 {
153 string temporary = asset.Temporary ? "Temporary" : "Stored"; 175 string temporary = asset.Temporary ? "Temporary" : "Stored";
@@ -161,6 +183,11 @@ namespace OpenSim.Data.SQLite
161 asset.InvType, temporary, local, assetLength)); 183 asset.InvType, temporary, local, assetLength));
162 } 184 }
163 185
186 /// <summary>
187 /// Check if an asset exist in database
188 /// </summary>
189 /// <param name="uuid">The asset UUID</param>
190 /// <returns>True if exist, or false.</returns>
164 override public bool ExistsAsset(LLUUID uuid) 191 override public bool ExistsAsset(LLUUID uuid)
165 { 192 {
166 using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn)) 193 using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn))
@@ -182,6 +209,10 @@ namespace OpenSim.Data.SQLite
182 } 209 }
183 } 210 }
184 211
212 /// <summary>
213 /// Delete an asset from database
214 /// </summary>
215 /// <param name="uuid"></param>
185 public void DeleteAsset(LLUUID uuid) 216 public void DeleteAsset(LLUUID uuid)
186 { 217 {
187 using (SqliteCommand cmd = new SqliteCommand(DeleteAssetSQL, m_conn)) 218 using (SqliteCommand cmd = new SqliteCommand(DeleteAssetSQL, m_conn))
@@ -192,6 +223,9 @@ namespace OpenSim.Data.SQLite
192 } 223 }
193 } 224 }
194 225
226 /// <summary>
227 /// commit
228 /// </summary>
195 override public void CommitAssets() // force a sync to the database 229 override public void CommitAssets() // force a sync to the database
196 { 230 {
197 m_log.Info("[ASSET DB]: Attempting commit"); 231 m_log.Info("[ASSET DB]: Attempting commit");
@@ -210,6 +244,10 @@ namespace OpenSim.Data.SQLite
210 * 244 *
211 **********************************************************************/ 245 **********************************************************************/
212 246
247 /// <summary>
248 /// Create the "assets" table
249 /// </summary>
250 /// <returns></returns>
213 private static DataTable createAssetsTable() 251 private static DataTable createAssetsTable()
214 { 252 {
215 DataTable assets = new DataTable("assets"); 253 DataTable assets = new DataTable("assets");
@@ -235,6 +273,11 @@ namespace OpenSim.Data.SQLite
235 * 273 *
236 **********************************************************************/ 274 **********************************************************************/
237 275
276 /// <summary>
277 ///
278 /// </summary>
279 /// <param name="row"></param>
280 /// <returns></returns>
238 private static AssetBase buildAsset(IDataReader row) 281 private static AssetBase buildAsset(IDataReader row)
239 { 282 {
240 // TODO: this doesn't work yet because something more 283 // TODO: this doesn't work yet because something more
@@ -263,6 +306,10 @@ namespace OpenSim.Data.SQLite
263 * 306 *
264 **********************************************************************/ 307 **********************************************************************/
265 308
309 /// <summary>
310 ///
311 /// </summary>
312 /// <param name="conn"></param>
266 private static void InitDB(SqliteConnection conn) 313 private static void InitDB(SqliteConnection conn)
267 { 314 {
268 string createAssets = SQLiteUtil.defineTable(createAssetsTable()); 315 string createAssets = SQLiteUtil.defineTable(createAssetsTable());
@@ -270,6 +317,12 @@ namespace OpenSim.Data.SQLite
270 pcmd.ExecuteNonQuery(); 317 pcmd.ExecuteNonQuery();
271 } 318 }
272 319
320 /// <summary>
321 ///
322 /// </summary>
323 /// <param name="conn"></param>
324 /// <param name="m"></param>
325 /// <returns></returns>
273 private static bool TestTables(SqliteConnection conn, Migration m) 326 private static bool TestTables(SqliteConnection conn, Migration m)
274 { 327 {
275 SqliteCommand cmd = new SqliteCommand(assetSelect, conn); 328 SqliteCommand cmd = new SqliteCommand(assetSelect, conn);
@@ -295,6 +348,9 @@ namespace OpenSim.Data.SQLite
295 348
296 #region IPlugin interface 349 #region IPlugin interface
297 350
351 /// <summary>
352 ///
353 /// </summary>
298 override public string Version 354 override public string Version
299 { 355 {
300 get 356 get
@@ -309,11 +365,17 @@ namespace OpenSim.Data.SQLite
309 } 365 }
310 } 366 }
311 367
368 /// <summary>
369 /// Initialise the AssetData interface using default URI
370 /// </summary>
312 override public void Initialise() 371 override public void Initialise()
313 { 372 {
314 Initialise("URI=file:AssetStorage.db,version=3"); 373 Initialise("URI=file:AssetStorage.db,version=3");
315 } 374 }
316 375
376 /// <summary>
377 /// Name of this DB provider
378 /// </summary>
317 override public string Name 379 override public string Name
318 { 380 {
319 get { return "SQLite Asset storage engine"; } 381 get { return "SQLite Asset storage engine"; }