aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Data/RegionProfileData.cs19
-rw-r--r--OpenSim/Data/SQLite/SQLiteAssetData.cs68
-rw-r--r--OpenSim/Data/SQLite/SQLiteGridData.cs21
-rw-r--r--OpenSim/Data/SQLite/SQLiteInventoryStore.cs104
-rw-r--r--OpenSim/Data/SQLite/SQLiteManager.cs14
-rw-r--r--OpenSim/Data/SQLite/SQLiteRegionData.cs263
-rw-r--r--OpenSim/Data/SQLite/SQLiteUserData.cs152
-rw-r--r--OpenSim/Data/SQLite/SQLiteUtils.cs64
8 files changed, 634 insertions, 71 deletions
diff --git a/OpenSim/Data/RegionProfileData.cs b/OpenSim/Data/RegionProfileData.cs
index 897dcbf..12f3927 100644
--- a/OpenSim/Data/RegionProfileData.cs
+++ b/OpenSim/Data/RegionProfileData.cs
@@ -130,13 +130,16 @@ namespace OpenSim.Data
130 /// </summary> 130 /// </summary>
131 public LLUUID originUUID; 131 public LLUUID originUUID;
132 132
133
133 /// <summary> 134 /// <summary>
134 /// Get Sim profile data from grid server when in grid mode 135 /// Request sim profile information from a grid server, by Region UUID
135 /// </summary> 136 /// </summary>
136 /// <param name="region_uuid"></param> 137 /// <param name="region_uuid">The region UUID to look for</param>
137 /// <param name="gridserver_url"></param> 138 /// <param name="gridserver_url"></param>
138 /// <param name="?"></param> 139 /// <param name="gridserver_sendkey"></param>
139 /// <returns></returns> 140 /// <param name="gridserver_recvkey"></param>
141 /// <returns>The sim profile. Null if there was a request failure</returns>
142 /// <remarks>This method should be statics</remarks>
140 public RegionProfileData RequestSimProfileData(LLUUID region_uuid, string gridserver_url, 143 public RegionProfileData RequestSimProfileData(LLUUID region_uuid, string gridserver_url,
141 string gridserver_sendkey, string gridserver_recvkey) 144 string gridserver_sendkey, string gridserver_recvkey)
142 { 145 {
@@ -172,9 +175,9 @@ namespace OpenSim.Data
172 } 175 }
173 176
174 /// <summary> 177 /// <summary>
175 /// Request sim profile information from a grid server 178 /// Request sim profile information from a grid server, by Region Handle
176 /// </summary> 179 /// </summary>
177 /// <param name="region_handle"></param> 180 /// <param name="region_handle">the region handle to look for</param>
178 /// <param name="gridserver_url"></param> 181 /// <param name="gridserver_url"></param>
179 /// <param name="gridserver_sendkey"></param> 182 /// <param name="gridserver_sendkey"></param>
180 /// <param name="gridserver_recvkey"></param> 183 /// <param name="gridserver_recvkey"></param>
@@ -214,9 +217,9 @@ namespace OpenSim.Data
214 } 217 }
215 218
216 /// <summary> 219 /// <summary>
217 /// Request sim profile information from a grid server 220 /// Request sim profile information from a grid server, by Region Name
218 /// </summary> 221 /// </summary>
219 /// <param name="region_handle"></param> 222 /// <param name="region_handle">the region name to look for</param>
220 /// <param name="gridserver_url"></param> 223 /// <param name="gridserver_url"></param>
221 /// <param name="gridserver_sendkey"></param> 224 /// <param name="gridserver_sendkey"></param>
222 /// <param name="gridserver_recvkey"></param> 225 /// <param name="gridserver_recvkey"></param>
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"; }
diff --git a/OpenSim/Data/SQLite/SQLiteGridData.cs b/OpenSim/Data/SQLite/SQLiteGridData.cs
index 7c5bb0c..0d24a40 100644
--- a/OpenSim/Data/SQLite/SQLiteGridData.cs
+++ b/OpenSim/Data/SQLite/SQLiteGridData.cs
@@ -41,13 +41,18 @@ namespace OpenSim.Data.SQLite
41 public class SQLiteGridData : GridDataBase 41 public class SQLiteGridData : GridDataBase
42 { 42 {
43 /// <summary> 43 /// <summary>
44 /// A database manager 44 /// SQLite database manager
45 /// </summary> 45 /// </summary>
46 private SQLiteManager database; 46 private SQLiteManager database;
47 47
48 /// <summary> 48 /// <summary>
49 /// Initialises the Grid Interface 49 /// <list type="bullet">
50 /// <item>Initialises Inventory interface</item>
51 /// <item>Loads and initialises a new SQLite connection and maintains it.</item>
52 /// <item>use default URI if connect string is empty.</item>
53 /// </list>
50 /// </summary> 54 /// </summary>
55 /// <param name="dbconnect">connect string</param>
51 override public void Initialise(string connect) 56 override public void Initialise(string connect)
52 { 57 {
53 database = new SQLiteManager(connect); 58 database = new SQLiteManager(connect);
@@ -87,13 +92,14 @@ namespace OpenSim.Data.SQLite
87 /// <param name="c">maximum X coordinate</param> 92 /// <param name="c">maximum X coordinate</param>
88 /// <param name="d">maximum Y coordinate</param> 93 /// <param name="d">maximum Y coordinate</param>
89 /// <returns>An array of region profiles</returns> 94 /// <returns>An array of region profiles</returns>
95 /// <remarks>NOT IMPLEMENTED ? always return null</remarks>
90 override public RegionProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) 96 override public RegionProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d)
91 { 97 {
92 return null; 98 return null;
93 } 99 }
94 100
95 /// <summary> 101 /// <summary>
96 /// Returns a sim profile from it's location 102 /// Returns a sim profile from it's handle
97 /// </summary> 103 /// </summary>
98 /// <param name="handle">Region location handle</param> 104 /// <param name="handle">Region location handle</param>
99 /// <returns>Sim profile</returns> 105 /// <returns>Sim profile</returns>
@@ -162,8 +168,9 @@ namespace OpenSim.Data.SQLite
162 } 168 }
163 169
164 /// <summary> 170 /// <summary>
165 /// // Returns a list of avatar and UUIDs that match the query 171 /// Returns a list of avatar and UUIDs that match the query
166 /// </summary> 172 /// </summary>
173 /// <remarks>do nothing yet</remarks>
167 public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) 174 public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
168 { 175 {
169 //Do nothing yet 176 //Do nothing yet
@@ -232,6 +239,12 @@ namespace OpenSim.Data.SQLite
232 return false; 239 return false;
233 } 240 }
234 241
242 /// <summary>
243 /// NOT IMPLEMENTED
244 /// </summary>
245 /// <param name="x">x coordinate</param>
246 /// <param name="y">y coordinate</param>
247 /// <returns>always return null</returns>
235 override public ReservationData GetReservationAtPoint(uint x, uint y) 248 override public ReservationData GetReservationAtPoint(uint x, uint y)
236 { 249 {
237 return null; 250 return null;
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;
36 36
37namespace OpenSim.Data.SQLite 37namespace OpenSim.Data.SQLite
38{ 38{
39 /// <summary>
40 /// An Inventory Interface to the SQLite database
41 /// </summary>
39 public class SQLiteInventoryStore : SQLiteUtil, IInventoryData 42 public class SQLiteInventoryStore : SQLiteUtil, IInventoryData
40 { 43 {
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -48,8 +51,13 @@ namespace OpenSim.Data.SQLite
48 private SqliteDataAdapter invFoldersDa; 51 private SqliteDataAdapter invFoldersDa;
49 52
50 /// <summary> 53 /// <summary>
51 /// Initialises the interface 54 /// <list type="bullet">
55 /// <item>Initialises Inventory interface</item>
56 /// <item>Loads and initialises a new SQLite connection and maintains it.</item>
57 /// <item>use default URI if connect string string is empty.</item>
58 /// </list>
52 /// </summary> 59 /// </summary>
60 /// <param name="dbconnect">connect string</param>
53 public void Initialise(string dbconnect) 61 public void Initialise(string dbconnect)
54 { 62 {
55 if (dbconnect == string.Empty) 63 if (dbconnect == string.Empty)
@@ -90,6 +98,11 @@ namespace OpenSim.Data.SQLite
90 ds.AcceptChanges(); 98 ds.AcceptChanges();
91 } 99 }
92 100
101 /// <summary>
102 ///
103 /// </summary>
104 /// <param name="row"></param>
105 /// <returns></returns>
93 public InventoryItemBase buildItem(DataRow row) 106 public InventoryItemBase buildItem(DataRow row)
94 { 107 {
95 InventoryItemBase item = new InventoryItemBase(); 108 InventoryItemBase item = new InventoryItemBase();
@@ -130,6 +143,11 @@ namespace OpenSim.Data.SQLite
130 return item; 143 return item;
131 } 144 }
132 145
146 /// <summary>
147 ///
148 /// </summary>
149 /// <param name="row"></param>
150 /// <param name="item"></param>
133 private static void fillItemRow(DataRow row, InventoryItemBase item) 151 private static void fillItemRow(DataRow row, InventoryItemBase item)
134 { 152 {
135 row["UUID"] = Util.ToRawUuidString(item.ID); 153 row["UUID"] = Util.ToRawUuidString(item.ID);
@@ -156,6 +174,12 @@ namespace OpenSim.Data.SQLite
156 row["flags"] = item.Flags; 174 row["flags"] = item.Flags;
157 } 175 }
158 176
177 /// <summary>
178 /// Add inventory folder
179 /// </summary>
180 /// <param name="folder">Folder base</param>
181 /// <param name="add">true=create folder. false=update existing folder</param>
182 /// <remarks>nasty</remarks>
159 private void addFolder(InventoryFolderBase folder, bool add) 183 private void addFolder(InventoryFolderBase folder, bool add)
160 { 184 {
161 lock (ds) 185 lock (ds)
@@ -184,6 +208,10 @@ namespace OpenSim.Data.SQLite
184 } 208 }
185 } 209 }
186 210
211 /// <summary>
212 /// Move an inventory folder
213 /// </summary>
214 /// <param name="folder">folder base</param>
187 private void moveFolder(InventoryFolderBase folder) 215 private void moveFolder(InventoryFolderBase folder)
188 { 216 {
189 lock (ds) 217 lock (ds)
@@ -206,6 +234,11 @@ namespace OpenSim.Data.SQLite
206 } 234 }
207 } 235 }
208 236
237 /// <summary>
238 /// add an item in inventory
239 /// </summary>
240 /// <param name="item">the item</param>
241 /// <param name="add">true=add item ; false=update existing item</param>
209 private void addItem(InventoryItemBase item, bool add) 242 private void addItem(InventoryItemBase item, bool add)
210 { 243 {
211 lock (ds) 244 lock (ds)
@@ -233,31 +266,34 @@ namespace OpenSim.Data.SQLite
233 } 266 }
234 } 267 }
235 268
269 /// <summary>
270 /// TODO : DataSet commit
271 /// </summary>
236 public void Shutdown() 272 public void Shutdown()
237 { 273 {
238 // TODO: DataSet commit 274 // TODO: DataSet commit
239 } 275 }
240 276
241 /// <summary> 277 /// <summary>
242 /// Closes the interface 278 /// Closes the inventory interface
243 /// </summary> 279 /// </summary>
244 public void Close() 280 public void Close()
245 { 281 {
246 } 282 }
247 283
248 /// <summary> 284 /// <summary>
249 /// The plugin being loaded 285 /// The name of this DB provider
250 /// </summary> 286 /// </summary>
251 /// <returns>A string containing the plugin name</returns> 287 /// <returns>Name of DB provider</returns>
252 public string getName() 288 public string getName()
253 { 289 {
254 return "SQLite Inventory Data Interface"; 290 return "SQLite Inventory Data Interface";
255 } 291 }
256 292
257 /// <summary> 293 /// <summary>
258 /// The plugins version 294 /// Returns the version of this DB provider
259 /// </summary> 295 /// </summary>
260 /// <returns>A string containing the plugin version</returns> 296 /// <returns>A string containing the DB provider version</returns>
261 public string getVersion() 297 public string getVersion()
262 { 298 {
263 Module module = GetType().Module; 299 Module module = GetType().Module;
@@ -362,7 +398,11 @@ namespace OpenSim.Data.SQLite
362 return folders; 398 return folders;
363 } 399 }
364 400
365 // See IInventoryData 401 /// <summary>
402 /// See IInventoryData
403 /// </summary>
404 /// <param name="parentID"></param>
405 /// <returns></returns>
366 public List<InventoryFolderBase> getFolderHierarchy(LLUUID parentID) 406 public List<InventoryFolderBase> getFolderHierarchy(LLUUID parentID)
367 { 407 {
368 List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); 408 List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
@@ -440,9 +480,9 @@ namespace OpenSim.Data.SQLite
440 } 480 }
441 481
442 /// <summary> 482 /// <summary>
443 /// 483 /// Delete an inventory item
444 /// </summary> 484 /// </summary>
445 /// <param name="item"></param> 485 /// <param name="item">The item UUID</param>
446 public void deleteInventoryItem(LLUUID itemID) 486 public void deleteInventoryItem(LLUUID itemID)
447 { 487 {
448 lock (ds) 488 lock (ds)
@@ -463,7 +503,7 @@ namespace OpenSim.Data.SQLite
463 /// Delete all items in the specified folder 503 /// Delete all items in the specified folder
464 /// </summary> 504 /// </summary>
465 /// <param name="folderId">id of the folder, whose item content should be deleted</param> 505 /// <param name="folderId">id of the folder, whose item content should be deleted</param>
466 //!TODO, this is horribly inefficient, but I don't want to ruin the overall structure of this implementation 506 /// <todo>this is horribly inefficient, but I don't want to ruin the overall structure of this implementation</todo>
467 private void deleteItemsInFolder(LLUUID folderId) 507 private void deleteItemsInFolder(LLUUID folderId)
468 { 508 {
469 List<InventoryItemBase> items = getInventoryInFolder(Util.ToRawUuidString(folderId)); 509 List<InventoryItemBase> items = getInventoryInFolder(Util.ToRawUuidString(folderId));
@@ -505,7 +545,7 @@ namespace OpenSim.Data.SQLite
505 /// <remarks> 545 /// <remarks>
506 /// This will clean-up any child folders and child items as well 546 /// This will clean-up any child folders and child items as well
507 /// </remarks> 547 /// </remarks>
508 /// <param name="item"></param> 548 /// <param name="folderID">the folder UUID</param>
509 public void deleteInventoryFolder(LLUUID folderID) 549 public void deleteInventoryFolder(LLUUID folderID)
510 { 550 {
511 lock (ds) 551 lock (ds)
@@ -544,6 +584,9 @@ namespace OpenSim.Data.SQLite
544 * 584 *
545 **********************************************************************/ 585 **********************************************************************/
546 586
587 /// <summary>
588 /// Create the "inventoryitems" table
589 /// </summary>
547 private static DataTable createInventoryItemsTable() 590 private static DataTable createInventoryItemsTable()
548 { 591 {
549 DataTable inv = new DataTable("inventoryitems"); 592 DataTable inv = new DataTable("inventoryitems");
@@ -582,6 +625,10 @@ namespace OpenSim.Data.SQLite
582 return inv; 625 return inv;
583 } 626 }
584 627
628 /// <summary>
629 /// Creates the "inventoryfolders" table
630 /// </summary>
631 /// <returns></returns>
585 private static DataTable createInventoryFoldersTable() 632 private static DataTable createInventoryFoldersTable()
586 { 633 {
587 DataTable fol = new DataTable("inventoryfolders"); 634 DataTable fol = new DataTable("inventoryfolders");
@@ -597,6 +644,11 @@ namespace OpenSim.Data.SQLite
597 return fol; 644 return fol;
598 } 645 }
599 646
647 /// <summary>
648 ///
649 /// </summary>
650 /// <param name="da"></param>
651 /// <param name="conn"></param>
600 private void setupItemsCommands(SqliteDataAdapter da, SqliteConnection conn) 652 private void setupItemsCommands(SqliteDataAdapter da, SqliteConnection conn)
601 { 653 {
602 lock (ds) 654 lock (ds)
@@ -614,6 +666,11 @@ namespace OpenSim.Data.SQLite
614 } 666 }
615 } 667 }
616 668
669 /// <summary>
670 ///
671 /// </summary>
672 /// <param name="da"></param>
673 /// <param name="conn"></param>
617 private void setupFoldersCommands(SqliteDataAdapter da, SqliteConnection conn) 674 private void setupFoldersCommands(SqliteDataAdapter da, SqliteConnection conn)
618 { 675 {
619 lock (ds) 676 lock (ds)
@@ -631,6 +688,11 @@ namespace OpenSim.Data.SQLite
631 } 688 }
632 } 689 }
633 690
691 /// <summary>
692 ///
693 /// </summary>
694 /// <param name="row"></param>
695 /// <returns></returns>
634 private static InventoryFolderBase buildFolder(DataRow row) 696 private static InventoryFolderBase buildFolder(DataRow row)
635 { 697 {
636 InventoryFolderBase folder = new InventoryFolderBase(); 698 InventoryFolderBase folder = new InventoryFolderBase();
@@ -643,6 +705,11 @@ namespace OpenSim.Data.SQLite
643 return folder; 705 return folder;
644 } 706 }
645 707
708 /// <summary>
709 ///
710 /// </summary>
711 /// <param name="row"></param>
712 /// <param name="folder"></param>
646 private static void fillFolderRow(DataRow row, InventoryFolderBase folder) 713 private static void fillFolderRow(DataRow row, InventoryFolderBase folder)
647 { 714 {
648 row["UUID"] = Util.ToRawUuidString(folder.ID); 715 row["UUID"] = Util.ToRawUuidString(folder.ID);
@@ -653,6 +720,11 @@ namespace OpenSim.Data.SQLite
653 row["version"] = folder.Version; 720 row["version"] = folder.Version;
654 } 721 }
655 722
723 /// <summary>
724 ///
725 /// </summary>
726 /// <param name="row"></param>
727 /// <param name="folder"></param>
656 private static void moveFolderRow(DataRow row, InventoryFolderBase folder) 728 private static void moveFolderRow(DataRow row, InventoryFolderBase folder)
657 { 729 {
658 row["UUID"] = Util.ToRawUuidString(folder.ID); 730 row["UUID"] = Util.ToRawUuidString(folder.ID);
@@ -665,6 +737,10 @@ namespace OpenSim.Data.SQLite
665 * 737 *
666 **********************************************************************/ 738 **********************************************************************/
667 739
740 /// <summary>
741 ///
742 /// </summary>
743 /// <param name="conn"></param>
668 private static void InitDB(SqliteConnection conn) 744 private static void InitDB(SqliteConnection conn)
669 { 745 {
670 string createInventoryItems = defineTable(createInventoryItemsTable()); 746 string createInventoryItems = defineTable(createInventoryItemsTable());
@@ -677,6 +753,12 @@ namespace OpenSim.Data.SQLite
677 scmd.ExecuteNonQuery(); 753 scmd.ExecuteNonQuery();
678 } 754 }
679 755
756 /// <summary>
757 ///
758 /// </summary>
759 /// <param name="conn"></param>
760 /// <param name="m"></param>
761 /// <returns></returns>
680 private static bool TestTables(SqliteConnection conn, Migration m) 762 private static bool TestTables(SqliteConnection conn, Migration m)
681 { 763 {
682 SqliteCommand invItemsSelectCmd = new SqliteCommand(invItemsSelect, conn); 764 SqliteCommand invItemsSelectCmd = new SqliteCommand(invItemsSelect, conn);
diff --git a/OpenSim/Data/SQLite/SQLiteManager.cs b/OpenSim/Data/SQLite/SQLiteManager.cs
index 4d39527..46c40e5 100644
--- a/OpenSim/Data/SQLite/SQLiteManager.cs
+++ b/OpenSim/Data/SQLite/SQLiteManager.cs
@@ -35,6 +35,9 @@ using log4net;
35 35
36namespace OpenSim.Data.SQLite 36namespace OpenSim.Data.SQLite
37{ 37{
38 /// <summary>
39 /// SQLite Manager
40 /// </summary>
38 internal class SQLiteManager : SQLiteUtil 41 internal class SQLiteManager : SQLiteUtil
39 { 42 {
40 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -42,13 +45,12 @@ namespace OpenSim.Data.SQLite
42 private IDbConnection dbcon; 45 private IDbConnection dbcon;
43 46
44 /// <summary> 47 /// <summary>
45 /// Initialises and creates a new SQLite connection and maintains it. 48 /// <list type="bullet">
49 /// <item>Initialises and creates a new SQLite connection and maintains it.</item>
50 /// <item>use default URI if connect string is empty.</item>
51 /// </list>
46 /// </summary> 52 /// </summary>
47 /// <param name="hostname">The SQLite server being connected to</param> 53 /// <param name="connect">connect string</param>
48 /// <param name="database">The name of the SQLite database being used</param>
49 /// <param name="username">The username logging into the database</param>
50 /// <param name="password">The password for the user logging in</param>
51 /// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param>
52 public SQLiteManager(string connect) 54 public SQLiteManager(string connect)
53 { 55 {
54 try 56 try
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs
index eb6f253..86f4370 100644
--- a/OpenSim/Data/SQLite/SQLiteRegionData.cs
+++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs
@@ -40,6 +40,9 @@ using OpenSim.Region.Environment.Scenes;
40 40
41namespace OpenSim.Data.SQLite 41namespace OpenSim.Data.SQLite
42{ 42{
43 /// <summary>
44 /// A RegionData Interface to the SQLite database
45 /// </summary>
43 public class SQLiteRegionData : IRegionDataStore 46 public class SQLiteRegionData : IRegionDataStore
44 { 47 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -74,7 +77,15 @@ namespace OpenSim.Data.SQLite
74 * 77 *
75 **********************************************************************/ 78 **********************************************************************/
76 79
77 // see IRegionDataStore 80 /// <summary>
81 /// See IRegionDataStore
82 /// <list type="bullet">
83 /// <item>Initialises RegionData Interface</item>
84 /// <item>Loads and initialises a new SQLite connection and maintains it.</item>
85 /// </list>
86 /// </summary>
87 /// <param name="connectionString">the connection string</param>
88 /// <param name="persistPrimInventories">?</param>
78 public void Initialise(string connectionString, bool persistPrimInventories) 89 public void Initialise(string connectionString, bool persistPrimInventories)
79 { 90 {
80 m_connectionString = connectionString; 91 m_connectionString = connectionString;
@@ -203,6 +214,11 @@ namespace OpenSim.Data.SQLite
203 } 214 }
204 } 215 }
205 216
217 /// <summary>
218 /// Adds an object into region storage
219 /// </summary>
220 /// <param name="obj">the object</param>
221 /// <param name="regionUUID">the region UUID</param>
206 public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID) 222 public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID)
207 { 223 {
208 lock (ds) 224 lock (ds)
@@ -233,6 +249,11 @@ namespace OpenSim.Data.SQLite
233 // m_log.Info("[Dump of prims]: " + ds.GetXml()); 249 // m_log.Info("[Dump of prims]: " + ds.GetXml());
234 } 250 }
235 251
252 /// <summary>
253 /// Removes an object from region storage
254 /// </summary>
255 /// <param name="obj">the object</param>
256 /// <param name="regionUUID">the region UUID</param>
236 public void RemoveObject(LLUUID obj, LLUUID regionUUID) 257 public void RemoveObject(LLUUID obj, LLUUID regionUUID)
237 { 258 {
238 m_log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", obj.UUID, regionUUID); 259 m_log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", obj.UUID, regionUUID);
@@ -271,6 +292,7 @@ namespace OpenSim.Data.SQLite
271 /// Remove all persisted items of the given prim. 292 /// Remove all persisted items of the given prim.
272 /// The caller must acquire the necessrary synchronization locks and commit or rollback changes. 293 /// The caller must acquire the necessrary synchronization locks and commit or rollback changes.
273 /// </summary> 294 /// </summary>
295 /// <param name="uuid">The item UUID</param>
274 private void RemoveItems(LLUUID uuid) 296 private void RemoveItems(LLUUID uuid)
275 { 297 {
276 DataTable items = ds.Tables["primitems"]; 298 DataTable items = ds.Tables["primitems"];
@@ -287,7 +309,7 @@ namespace OpenSim.Data.SQLite
287 /// <summary> 309 /// <summary>
288 /// Load persisted objects from region storage. 310 /// Load persisted objects from region storage.
289 /// </summary> 311 /// </summary>
290 /// <param name="regionUUID"></param> 312 /// <param name="regionUUID">The region UUID</param>
291 /// <returns>List of loaded groups</returns> 313 /// <returns>List of loaded groups</returns>
292 public List<SceneObjectGroup> LoadObjects(LLUUID regionUUID) 314 public List<SceneObjectGroup> LoadObjects(LLUUID regionUUID)
293 { 315 {
@@ -375,7 +397,7 @@ namespace OpenSim.Data.SQLite
375 /// <summary> 397 /// <summary>
376 /// Load in a prim's persisted inventory. 398 /// Load in a prim's persisted inventory.
377 /// </summary> 399 /// </summary>
378 /// <param name="prim"></param> 400 /// <param name="prim">the prim</param>
379 private void LoadItems(SceneObjectPart prim) 401 private void LoadItems(SceneObjectPart prim)
380 { 402 {
381 //m_log.DebugFormat("[DATASTORE]: Loading inventory for {0}, {1}", prim.Name, prim.UUID); 403 //m_log.DebugFormat("[DATASTORE]: Loading inventory for {0}, {1}", prim.Name, prim.UUID);
@@ -405,6 +427,11 @@ namespace OpenSim.Data.SQLite
405 } 427 }
406 } 428 }
407 429
430 /// <summary>
431 /// Store a terrain revision in region storage
432 /// </summary>
433 /// <param name="ter">terrain heightfield</param>
434 /// <param name="regionID">region UUID</param>
408 public void StoreTerrain(double[,] ter, LLUUID regionID) 435 public void StoreTerrain(double[,] ter, LLUUID regionID)
409 { 436 {
410 lock (ds) 437 lock (ds)
@@ -444,6 +471,11 @@ namespace OpenSim.Data.SQLite
444 } 471 }
445 } 472 }
446 473
474 /// <summary>
475 /// Load the latest terrain revision from region storage
476 /// </summary>
477 /// <param name="regionID">the region UUID</param>
478 /// <returns>Heightfield data</returns>
447 public double[,] LoadTerrain(LLUUID regionID) 479 public double[,] LoadTerrain(LLUUID regionID)
448 { 480 {
449 lock (ds) 481 lock (ds)
@@ -488,6 +520,10 @@ namespace OpenSim.Data.SQLite
488 } 520 }
489 } 521 }
490 522
523 /// <summary>
524 ///
525 /// </summary>
526 /// <param name="globalID"></param>
491 public void RemoveLandObject(LLUUID globalID) 527 public void RemoveLandObject(LLUUID globalID)
492 { 528 {
493 lock (ds) 529 lock (ds)
@@ -506,6 +542,10 @@ namespace OpenSim.Data.SQLite
506 } 542 }
507 } 543 }
508 544
545 /// <summary>
546 ///
547 /// </summary>
548 /// <param name="parcel"></param>
509 public void StoreLandObject(ILandObject parcel) 549 public void StoreLandObject(ILandObject parcel)
510 { 550 {
511 lock (ds) 551 lock (ds)
@@ -543,6 +583,11 @@ namespace OpenSim.Data.SQLite
543 Commit(); 583 Commit();
544 } 584 }
545 585
586 /// <summary>
587 ///
588 /// </summary>
589 /// <param name="regionUUID"></param>
590 /// <returns></returns>
546 public List<LandData> LoadLandObjects(LLUUID regionUUID) 591 public List<LandData> LoadLandObjects(LLUUID regionUUID)
547 { 592 {
548 List<LandData> landDataForRegion = new List<LandData>(); 593 List<LandData> landDataForRegion = new List<LandData>();
@@ -568,6 +613,9 @@ namespace OpenSim.Data.SQLite
568 return landDataForRegion; 613 return landDataForRegion;
569 } 614 }
570 615
616 /// <summary>
617 ///
618 /// </summary>
571 public void Commit() 619 public void Commit()
572 { 620 {
573 lock (ds) 621 lock (ds)
@@ -587,6 +635,9 @@ namespace OpenSim.Data.SQLite
587 } 635 }
588 } 636 }
589 637
638 /// <summary>
639 /// See <see cref="Commit"/>
640 /// </summary>
590 public void Shutdown() 641 public void Shutdown()
591 { 642 {
592 Commit(); 643 Commit();
@@ -600,12 +651,22 @@ namespace OpenSim.Data.SQLite
600 * 651 *
601 **********************************************************************/ 652 **********************************************************************/
602 653
654 /// <summary>
655 ///
656 /// </summary>
657 /// <param name="dt"></param>
658 /// <param name="name"></param>
659 /// <param name="type"></param>
603 private static void createCol(DataTable dt, string name, Type type) 660 private static void createCol(DataTable dt, string name, Type type)
604 { 661 {
605 DataColumn col = new DataColumn(name, type); 662 DataColumn col = new DataColumn(name, type);
606 dt.Columns.Add(col); 663 dt.Columns.Add(col);
607 } 664 }
608 665
666 /// <summary>
667 /// Creates the "terrain" table
668 /// </summary>
669 /// <returns>terrain table DataTable</returns>
609 private static DataTable createTerrainTable() 670 private static DataTable createTerrainTable()
610 { 671 {
611 DataTable terrain = new DataTable("terrain"); 672 DataTable terrain = new DataTable("terrain");
@@ -617,6 +678,10 @@ namespace OpenSim.Data.SQLite
617 return terrain; 678 return terrain;
618 } 679 }
619 680
681 /// <summary>
682 /// Creates the "prims" table
683 /// </summary>
684 /// <returns>prim table DataTable</returns>
620 private static DataTable createPrimTable() 685 private static DataTable createPrimTable()
621 { 686 {
622 DataTable prims = new DataTable("prims"); 687 DataTable prims = new DataTable("prims");
@@ -681,6 +746,10 @@ namespace OpenSim.Data.SQLite
681 return prims; 746 return prims;
682 } 747 }
683 748
749 /// <summary>
750 /// Creates "primshapes" table
751 /// </summary>
752 /// <returns>shape table DataTable</returns>
684 private static DataTable createShapeTable() 753 private static DataTable createShapeTable()
685 { 754 {
686 DataTable shapes = new DataTable("primshapes"); 755 DataTable shapes = new DataTable("primshapes");
@@ -723,6 +792,10 @@ namespace OpenSim.Data.SQLite
723 return shapes; 792 return shapes;
724 } 793 }
725 794
795 /// <summary>
796 /// creates "primitems" table
797 /// </summary>
798 /// <returns>item table DataTable</returns>
726 private static DataTable createItemsTable() 799 private static DataTable createItemsTable()
727 { 800 {
728 DataTable items = new DataTable("primitems"); 801 DataTable items = new DataTable("primitems");
@@ -756,6 +829,10 @@ namespace OpenSim.Data.SQLite
756 return items; 829 return items;
757 } 830 }
758 831
832 /// <summary>
833 /// Creates "land" table
834 /// </summary>
835 /// <returns>land table DataTable</returns>
759 private static DataTable createLandTable() 836 private static DataTable createLandTable()
760 { 837 {
761 DataTable land = new DataTable("land"); 838 DataTable land = new DataTable("land");
@@ -800,6 +877,10 @@ namespace OpenSim.Data.SQLite
800 return land; 877 return land;
801 } 878 }
802 879
880 /// <summary>
881 /// create "landaccesslist" table
882 /// </summary>
883 /// <returns>Landacceslist DataTable</returns>
803 private static DataTable createLandAccessListTable() 884 private static DataTable createLandAccessListTable()
804 { 885 {
805 DataTable landaccess = new DataTable("landaccesslist"); 886 DataTable landaccess = new DataTable("landaccesslist");
@@ -810,6 +891,10 @@ namespace OpenSim.Data.SQLite
810 return landaccess; 891 return landaccess;
811 } 892 }
812 893
894 /// <summary>
895 /// create "regionban" table
896 /// </summary>
897 /// <returns>regionban datatable</returns>
813 private static DataTable createRegionBanListTable() 898 private static DataTable createRegionBanListTable()
814 { 899 {
815 DataTable regionbanlist = new DataTable("regionban"); 900 DataTable regionbanlist = new DataTable("regionban");
@@ -829,6 +914,11 @@ namespace OpenSim.Data.SQLite
829 * 914 *
830 **********************************************************************/ 915 **********************************************************************/
831 916
917 /// <summary>
918 ///
919 /// </summary>
920 /// <param name="row"></param>
921 /// <returns></returns>
832 private SceneObjectPart buildPrim(DataRow row) 922 private SceneObjectPart buildPrim(DataRow row)
833 { 923 {
834 // TODO: this doesn't work yet because something more 924 // TODO: this doesn't work yet because something more
@@ -971,6 +1061,11 @@ namespace OpenSim.Data.SQLite
971 return taskItem; 1061 return taskItem;
972 } 1062 }
973 1063
1064 /// <summary>
1065 /// Build a Land Data from the persisted data.
1066 /// </summary>
1067 /// <param name="row"></param>
1068 /// <returns></returns>
974 private LandData buildLandData(DataRow row) 1069 private LandData buildLandData(DataRow row)
975 { 1070 {
976 LandData newData = new LandData(); 1071 LandData newData = new LandData();
@@ -1059,6 +1154,11 @@ namespace OpenSim.Data.SQLite
1059 return newData; 1154 return newData;
1060 } 1155 }
1061 1156
1157 /// <summary>
1158 /// Build a land access entry from the persisted data.
1159 /// </summary>
1160 /// <param name="row"></param>
1161 /// <returns></returns>
1062 private static ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row) 1162 private static ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row)
1063 { 1163 {
1064 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 1164 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
@@ -1069,7 +1169,11 @@ namespace OpenSim.Data.SQLite
1069 } 1169 }
1070 1170
1071 1171
1072 1172 /// <summary>
1173 /// Load a region banlist
1174 /// </summary>
1175 /// <param name="regionUUID">the region UUID</param>
1176 /// <returns>The banlist</returns>
1073 public List<RegionBanListItem> LoadRegionBanList(LLUUID regionUUID) 1177 public List<RegionBanListItem> LoadRegionBanList(LLUUID regionUUID)
1074 { 1178 {
1075 List<RegionBanListItem> regionbanlist = new List<RegionBanListItem>(); 1179 List<RegionBanListItem> regionbanlist = new List<RegionBanListItem>();
@@ -1096,6 +1200,10 @@ namespace OpenSim.Data.SQLite
1096 return regionbanlist; 1200 return regionbanlist;
1097 } 1201 }
1098 1202
1203 /// <summary>
1204 /// Add en entry into region banlist
1205 /// </summary>
1206 /// <param name="item"></param>
1099 public void AddToRegionBanlist(RegionBanListItem item) 1207 public void AddToRegionBanlist(RegionBanListItem item)
1100 { 1208 {
1101 lock (ds) 1209 lock (ds)
@@ -1111,6 +1219,10 @@ namespace OpenSim.Data.SQLite
1111 } 1219 }
1112 } 1220 }
1113 1221
1222 /// <summary>
1223 /// remove an entry from the region banlist
1224 /// </summary>
1225 /// <param name="item"></param>
1114 public void RemoveFromRegionBanlist(RegionBanListItem item) 1226 public void RemoveFromRegionBanlist(RegionBanListItem item)
1115 { 1227 {
1116 lock (ds) 1228 lock (ds)
@@ -1124,6 +1236,11 @@ namespace OpenSim.Data.SQLite
1124 } 1236 }
1125 } 1237 }
1126 1238
1239 /// <summary>
1240 ///
1241 /// </summary>
1242 /// <param name="val"></param>
1243 /// <returns></returns>
1127 private static Array serializeTerrain(double[,] val) 1244 private static Array serializeTerrain(double[,] val)
1128 { 1245 {
1129 MemoryStream str = new MemoryStream(65536*sizeof (double)); 1246 MemoryStream str = new MemoryStream(65536*sizeof (double));
@@ -1153,6 +1270,13 @@ namespace OpenSim.Data.SQLite
1153// row["Heightfield"] = str.ToArray(); 1270// row["Heightfield"] = str.ToArray();
1154// } 1271// }
1155 1272
1273 /// <summary>
1274 ///
1275 /// </summary>
1276 /// <param name="row"></param>
1277 /// <param name="prim"></param>
1278 /// <param name="sceneGroupID"></param>
1279 /// <param name="regionUUID"></param>
1156 private static void fillPrimRow(DataRow row, SceneObjectPart prim, LLUUID sceneGroupID, LLUUID regionUUID) 1280 private static void fillPrimRow(DataRow row, SceneObjectPart prim, LLUUID sceneGroupID, LLUUID regionUUID)
1157 { 1281 {
1158 row["UUID"] = Util.ToRawUuidString(prim.UUID); 1282 row["UUID"] = Util.ToRawUuidString(prim.UUID);
@@ -1213,6 +1337,11 @@ namespace OpenSim.Data.SQLite
1213 row["SitTargetOrientZ"] = sitTargetOrient.Z; 1337 row["SitTargetOrientZ"] = sitTargetOrient.Z;
1214 } 1338 }
1215 1339
1340 /// <summary>
1341 ///
1342 /// </summary>
1343 /// <param name="row"></param>
1344 /// <param name="taskItem"></param>
1216 private static void fillItemRow(DataRow row, TaskInventoryItem taskItem) 1345 private static void fillItemRow(DataRow row, TaskInventoryItem taskItem)
1217 { 1346 {
1218 row["itemID"] = taskItem.ItemID; 1347 row["itemID"] = taskItem.ItemID;
@@ -1238,6 +1367,12 @@ namespace OpenSim.Data.SQLite
1238 row["flags"] = taskItem.Flags; 1367 row["flags"] = taskItem.Flags;
1239 } 1368 }
1240 1369
1370 /// <summary>
1371 ///
1372 /// </summary>
1373 /// <param name="row"></param>
1374 /// <param name="land"></param>
1375 /// <param name="regionUUID"></param>
1241 private static void fillLandRow(DataRow row, LandData land, LLUUID regionUUID) 1376 private static void fillLandRow(DataRow row, LandData land, LLUUID regionUUID)
1242 { 1377 {
1243 row["UUID"] = Util.ToRawUuidString(land.globalID); 1378 row["UUID"] = Util.ToRawUuidString(land.globalID);
@@ -1277,6 +1412,12 @@ namespace OpenSim.Data.SQLite
1277 row["AuthbuyerID"] = Util.ToRawUuidString(land.authBuyerID); 1412 row["AuthbuyerID"] = Util.ToRawUuidString(land.authBuyerID);
1278 } 1413 }
1279 1414
1415 /// <summary>
1416 ///
1417 /// </summary>
1418 /// <param name="row"></param>
1419 /// <param name="entry"></param>
1420 /// <param name="parcelID"></param>
1280 private static void fillLandAccessRow(DataRow row, ParcelManager.ParcelAccessEntry entry, LLUUID parcelID) 1421 private static void fillLandAccessRow(DataRow row, ParcelManager.ParcelAccessEntry entry, LLUUID parcelID)
1281 { 1422 {
1282 row["LandUUID"] = Util.ToRawUuidString(parcelID); 1423 row["LandUUID"] = Util.ToRawUuidString(parcelID);
@@ -1284,6 +1425,11 @@ namespace OpenSim.Data.SQLite
1284 row["Flags"] = entry.Flags; 1425 row["Flags"] = entry.Flags;
1285 } 1426 }
1286 1427
1428 /// <summary>
1429 ///
1430 /// </summary>
1431 /// <param name="row"></param>
1432 /// <returns></returns>
1287 private PrimitiveBaseShape buildShape(DataRow row) 1433 private PrimitiveBaseShape buildShape(DataRow row)
1288 { 1434 {
1289 PrimitiveBaseShape s = new PrimitiveBaseShape(); 1435 PrimitiveBaseShape s = new PrimitiveBaseShape();
@@ -1334,6 +1480,11 @@ namespace OpenSim.Data.SQLite
1334 return s; 1480 return s;
1335 } 1481 }
1336 1482
1483 /// <summary>
1484 ///
1485 /// </summary>
1486 /// <param name="row"></param>
1487 /// <param name="prim"></param>
1337 private static void fillShapeRow(DataRow row, SceneObjectPart prim) 1488 private static void fillShapeRow(DataRow row, SceneObjectPart prim)
1338 { 1489 {
1339 PrimitiveBaseShape s = prim.Shape; 1490 PrimitiveBaseShape s = prim.Shape;
@@ -1371,6 +1522,12 @@ namespace OpenSim.Data.SQLite
1371 row["ExtraParams"] = s.ExtraParams; 1522 row["ExtraParams"] = s.ExtraParams;
1372 } 1523 }
1373 1524
1525 /// <summary>
1526 ///
1527 /// </summary>
1528 /// <param name="prim"></param>
1529 /// <param name="sceneGroupID"></param>
1530 /// <param name="regionUUID"></param>
1374 private void addPrim(SceneObjectPart prim, LLUUID sceneGroupID, LLUUID regionUUID) 1531 private void addPrim(SceneObjectPart prim, LLUUID sceneGroupID, LLUUID regionUUID)
1375 { 1532 {
1376 DataTable prims = ds.Tables["prims"]; 1533 DataTable prims = ds.Tables["prims"];
@@ -1401,7 +1558,11 @@ namespace OpenSim.Data.SQLite
1401 } 1558 }
1402 } 1559 }
1403 1560
1404 // see IRegionDatastore 1561 /// <summary>
1562 /// see IRegionDatastore
1563 /// </summary>
1564 /// <param name="primID"></param>
1565 /// <param name="items"></param>
1405 public void StorePrimInventory(LLUUID primID, ICollection<TaskInventoryItem> items) 1566 public void StorePrimInventory(LLUUID primID, ICollection<TaskInventoryItem> items)
1406 { 1567 {
1407 if (!persistPrimInventories) 1568 if (!persistPrimInventories)
@@ -1444,17 +1605,23 @@ namespace OpenSim.Data.SQLite
1444 * 1605 *
1445 **********************************************************************/ 1606 **********************************************************************/
1446 1607
1608 /// <summary>
1609 /// Create an insert command
1610 /// </summary>
1611 /// <param name="table">table name</param>
1612 /// <param name="dt">data table</param>
1613 /// <returns>the created command</returns>
1614 /// <remarks>
1615 /// This is subtle enough to deserve some commentary.
1616 /// Instead of doing *lots* and *lots of hardcoded strings
1617 /// for database definitions we'll use the fact that
1618 /// realistically all insert statements look like "insert
1619 /// into A(b, c) values(:b, :c) on the parameterized query
1620 /// front. If we just have a list of b, c, etc... we can
1621 /// generate these strings instead of typing them out.
1622 /// </remarks>
1447 private static SqliteCommand createInsertCommand(string table, DataTable dt) 1623 private static SqliteCommand createInsertCommand(string table, DataTable dt)
1448 { 1624 {
1449 /**
1450 * This is subtle enough to deserve some commentary.
1451 * Instead of doing *lots* and *lots of hardcoded strings
1452 * for database definitions we'll use the fact that
1453 * realistically all insert statements look like "insert
1454 * into A(b, c) values(:b, :c) on the parameterized query
1455 * front. If we just have a list of b, c, etc... we can
1456 * generate these strings instead of typing them out.
1457 */
1458 string[] cols = new string[dt.Columns.Count]; 1625 string[] cols = new string[dt.Columns.Count];
1459 for (int i = 0; i < dt.Columns.Count; i++) 1626 for (int i = 0; i < dt.Columns.Count; i++)
1460 { 1627 {
@@ -1479,6 +1646,14 @@ namespace OpenSim.Data.SQLite
1479 return cmd; 1646 return cmd;
1480 } 1647 }
1481 1648
1649
1650 /// <summary>
1651 /// create an update command
1652 /// </summary>
1653 /// <param name="table">table name</param>
1654 /// <param name="pk"></param>
1655 /// <param name="dt"></param>
1656 /// <returns>the created command</returns>
1482 private static SqliteCommand createUpdateCommand(string table, string pk, DataTable dt) 1657 private static SqliteCommand createUpdateCommand(string table, string pk, DataTable dt)
1483 { 1658 {
1484 string sql = "update " + table + " set "; 1659 string sql = "update " + table + " set ";
@@ -1506,7 +1681,11 @@ namespace OpenSim.Data.SQLite
1506 return cmd; 1681 return cmd;
1507 } 1682 }
1508 1683
1509 1684 /// <summary>
1685 ///
1686 /// </summary>
1687 /// <param name="dt">Data Table</param>
1688 /// <returns></returns>
1510 private static string defineTable(DataTable dt) 1689 private static string defineTable(DataTable dt)
1511 { 1690 {
1512 string sql = "create table " + dt.TableName + "("; 1691 string sql = "create table " + dt.TableName + "(";
@@ -1559,6 +1738,11 @@ namespace OpenSim.Data.SQLite
1559 return param; 1738 return param;
1560 } 1739 }
1561 1740
1741 /// <summary>
1742 ///
1743 /// </summary>
1744 /// <param name="da"></param>
1745 /// <param name="conn"></param>
1562 private void setupPrimCommands(SqliteDataAdapter da, SqliteConnection conn) 1746 private void setupPrimCommands(SqliteDataAdapter da, SqliteConnection conn)
1563 { 1747 {
1564 da.InsertCommand = createInsertCommand("prims", ds.Tables["prims"]); 1748 da.InsertCommand = createInsertCommand("prims", ds.Tables["prims"]);
@@ -1573,6 +1757,11 @@ namespace OpenSim.Data.SQLite
1573 da.DeleteCommand = delete; 1757 da.DeleteCommand = delete;
1574 } 1758 }
1575 1759
1760 /// <summary>
1761 ///
1762 /// </summary>
1763 /// <param name="da"></param>
1764 /// <param name="conn"></param>
1576 private void setupItemsCommands(SqliteDataAdapter da, SqliteConnection conn) 1765 private void setupItemsCommands(SqliteDataAdapter da, SqliteConnection conn)
1577 { 1766 {
1578 da.InsertCommand = createInsertCommand("primitems", ds.Tables["primitems"]); 1767 da.InsertCommand = createInsertCommand("primitems", ds.Tables["primitems"]);
@@ -1587,12 +1776,22 @@ namespace OpenSim.Data.SQLite
1587 da.DeleteCommand = delete; 1776 da.DeleteCommand = delete;
1588 } 1777 }
1589 1778
1779 /// <summary>
1780 ///
1781 /// </summary>
1782 /// <param name="da"></param>
1783 /// <param name="conn"></param>
1590 private void setupTerrainCommands(SqliteDataAdapter da, SqliteConnection conn) 1784 private void setupTerrainCommands(SqliteDataAdapter da, SqliteConnection conn)
1591 { 1785 {
1592 da.InsertCommand = createInsertCommand("terrain", ds.Tables["terrain"]); 1786 da.InsertCommand = createInsertCommand("terrain", ds.Tables["terrain"]);
1593 da.InsertCommand.Connection = conn; 1787 da.InsertCommand.Connection = conn;
1594 } 1788 }
1595 1789
1790 /// <summary>
1791 ///
1792 /// </summary>
1793 /// <param name="da"></param>
1794 /// <param name="conn"></param>
1596 private void setupLandCommands(SqliteDataAdapter da, SqliteConnection conn) 1795 private void setupLandCommands(SqliteDataAdapter da, SqliteConnection conn)
1597 { 1796 {
1598 da.InsertCommand = createInsertCommand("land", ds.Tables["land"]); 1797 da.InsertCommand = createInsertCommand("land", ds.Tables["land"]);
@@ -1602,12 +1801,22 @@ namespace OpenSim.Data.SQLite
1602 da.UpdateCommand.Connection = conn; 1801 da.UpdateCommand.Connection = conn;
1603 } 1802 }
1604 1803
1804 /// <summary>
1805 ///
1806 /// </summary>
1807 /// <param name="da"></param>
1808 /// <param name="conn"></param>
1605 private void setupLandAccessCommands(SqliteDataAdapter da, SqliteConnection conn) 1809 private void setupLandAccessCommands(SqliteDataAdapter da, SqliteConnection conn)
1606 { 1810 {
1607 da.InsertCommand = createInsertCommand("landaccesslist", ds.Tables["landaccesslist"]); 1811 da.InsertCommand = createInsertCommand("landaccesslist", ds.Tables["landaccesslist"]);
1608 da.InsertCommand.Connection = conn; 1812 da.InsertCommand.Connection = conn;
1609 } 1813 }
1610 1814
1815 /// <summary>
1816 ///
1817 /// </summary>
1818 /// <param name="da"></param>
1819 /// <param name="conn"></param>
1611 private void setupRegionBanCommands(SqliteDataAdapter da, SqliteConnection conn) 1820 private void setupRegionBanCommands(SqliteDataAdapter da, SqliteConnection conn)
1612 { 1821 {
1613 da.InsertCommand = createInsertCommand("regionban", ds.Tables["regionban"]); 1822 da.InsertCommand = createInsertCommand("regionban", ds.Tables["regionban"]);
@@ -1617,7 +1826,11 @@ namespace OpenSim.Data.SQLite
1617 da.UpdateCommand.Connection = conn; 1826 da.UpdateCommand.Connection = conn;
1618 } 1827 }
1619 1828
1620 1829 /// <summary>
1830 ///
1831 /// </summary>
1832 /// <param name="da"></param>
1833 /// <param name="conn"></param>
1621 private void setupShapeCommands(SqliteDataAdapter da, SqliteConnection conn) 1834 private void setupShapeCommands(SqliteDataAdapter da, SqliteConnection conn)
1622 { 1835 {
1623 da.InsertCommand = createInsertCommand("primshapes", ds.Tables["primshapes"]); 1836 da.InsertCommand = createInsertCommand("primshapes", ds.Tables["primshapes"]);
@@ -1710,6 +1923,12 @@ namespace OpenSim.Data.SQLite
1710 // } 1923 // }
1711 // } 1924 // }
1712 1925
1926 /// <summary>
1927 ///
1928 /// </summary>
1929 /// <param name="conn"></param>
1930 /// <param name="m"></param>
1931 /// <returns></returns>
1713 private bool TestTables(SqliteConnection conn, Migration m) 1932 private bool TestTables(SqliteConnection conn, Migration m)
1714 { 1933 {
1715 SqliteCommand primSelectCmd = new SqliteCommand(primSelect, conn); 1934 SqliteCommand primSelectCmd = new SqliteCommand(primSelect, conn);
@@ -1822,6 +2041,11 @@ namespace OpenSim.Data.SQLite
1822 * 2041 *
1823 **********************************************************************/ 2042 **********************************************************************/
1824 2043
2044 /// <summary>
2045 /// Type conversion function
2046 /// </summary>
2047 /// <param name="type"></param>
2048 /// <returns></returns>
1825 private static DbType dbtypeFromType(Type type) 2049 private static DbType dbtypeFromType(Type type)
1826 { 2050 {
1827 if (type == typeof (String)) 2051 if (type == typeof (String))
@@ -1854,8 +2078,11 @@ namespace OpenSim.Data.SQLite
1854 } 2078 }
1855 } 2079 }
1856 2080
1857 // this is something we'll need to implement for each db 2081 /// <summary>
1858 // slightly differently. 2082 /// </summary>
2083 /// <param name="type">a Type</param>
2084 /// <returns>an sqliteType</returns>
2085 /// <remarks>this is something we'll need to implement for each db slightly differently.</remarks>
1859 private static string sqliteType(Type type) 2086 private static string sqliteType(Type type)
1860 { 2087 {
1861 if (type == typeof (String)) 2088 if (type == typeof (String))
diff --git a/OpenSim/Data/SQLite/SQLiteUserData.cs b/OpenSim/Data/SQLite/SQLiteUserData.cs
index 36ec9ea..24c7944 100644
--- a/OpenSim/Data/SQLite/SQLiteUserData.cs
+++ b/OpenSim/Data/SQLite/SQLiteUserData.cs
@@ -65,6 +65,14 @@ namespace OpenSim.Data.SQLite
65 private SqliteDataAdapter daf; 65 private SqliteDataAdapter daf;
66 SqliteConnection g_conn; 66 SqliteConnection g_conn;
67 67
68 /// <summary>
69 /// <list type="bullet">
70 /// <item>Initialises User Interface</item>
71 /// <item>Loads and initialises a new SQLite connection and maintains it.</item>
72 /// <item>use default URI if connect string string is empty.</item>
73 /// </list>
74 /// </summary>
75 /// <param name="connect">connect string</param>
68 override public void Initialise(string connect) 76 override public void Initialise(string connect)
69 { 77 {
70 // default to something sensible 78 // default to something sensible
@@ -116,7 +124,12 @@ namespace OpenSim.Data.SQLite
116 return; 124 return;
117 } 125 }
118 126
119 // see IUserData 127 /// <summary>
128 /// see IUserData,
129 /// Get user data profile by UUID
130 /// </summary>
131 /// <param name="uuid">User UUID</param>
132 /// <returns>user profile data</returns>
120 override public UserProfileData GetUserByUUID(LLUUID uuid) 133 override public UserProfileData GetUserByUUID(LLUUID uuid)
121 { 134 {
122 lock (ds) 135 lock (ds)
@@ -139,7 +152,13 @@ namespace OpenSim.Data.SQLite
139 } 152 }
140 } 153 }
141 154
142 // see IUserData 155 /// <summary>
156 /// see IUserData,
157 /// Get user data profile by name
158 /// </summary>
159 /// <param name="fname">first name</param>
160 /// <param name="lname">last name</param>
161 /// <returns>user profile data</returns>
143 override public UserProfileData GetUserByName(string fname, string lname) 162 override public UserProfileData GetUserByName(string fname, string lname)
144 { 163 {
145 string select = "surname = '" + lname + "' and username = '" + fname + "'"; 164 string select = "surname = '" + lname + "' and username = '" + fname + "'";
@@ -165,6 +184,12 @@ namespace OpenSim.Data.SQLite
165 184
166 #region User Friends List Data 185 #region User Friends List Data
167 186
187 /// <summary>
188 /// Add a new friend in the friendlist
189 /// </summary>
190 /// <param name="friendlistowner">UUID of the friendlist owner</param>
191 /// <param name="friend">UUID of the friend to add</param>
192 /// <param name="perms">permission flag</param>
168 override public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms) 193 override public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms)
169 { 194 {
170 string InsertFriends = "insert into userfriends(ownerID, friendID, friendPerms) values(:ownerID, :friendID, :perms)"; 195 string InsertFriends = "insert into userfriends(ownerID, friendID, friendPerms) values(:ownerID, :friendID, :perms)";
@@ -185,6 +210,11 @@ namespace OpenSim.Data.SQLite
185 } 210 }
186 } 211 }
187 212
213 /// <summary>
214 /// Remove a user from the friendlist
215 /// </summary>
216 /// <param name="friendlistowner">UUID of the friendlist owner</param>
217 /// <param name="friend">UUID of the friend to remove</param>
188 override public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend) 218 override public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend)
189 { 219 {
190 string DeletePerms = "delete from friendlist where (ownerID=:ownerID and friendID=:friendID) or (ownerID=:friendID and friendID=:ownerID)"; 220 string DeletePerms = "delete from friendlist where (ownerID=:ownerID and friendID=:friendID) or (ownerID=:friendID and friendID=:ownerID)";
@@ -196,6 +226,12 @@ namespace OpenSim.Data.SQLite
196 } 226 }
197 } 227 }
198 228
229 /// <summary>
230 /// Update the friendlist permission
231 /// </summary>
232 /// <param name="friendlistowner">UUID of the friendlist owner</param>
233 /// <param name="friend">UUID of the friend to modify</param>
234 /// <param name="perms">updated permission flag</param>
199 override public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms) 235 override public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms)
200 { 236 {
201 string UpdatePerms = "update friendlist set perms=:perms where ownerID=:ownerID and friendID=:friendID"; 237 string UpdatePerms = "update friendlist set perms=:perms where ownerID=:ownerID and friendID=:friendID";
@@ -208,6 +244,11 @@ namespace OpenSim.Data.SQLite
208 } 244 }
209 } 245 }
210 246
247 /// <summary>
248 /// Get (fetch?) the friendlist for a user
249 /// </summary>
250 /// <param name="friendlistowner">UUID of the friendlist owner</param>
251 /// <returns>The friendlist list</returns>
211 override public List<FriendListItem> GetUserFriendList(LLUUID friendlistowner) 252 override public List<FriendListItem> GetUserFriendList(LLUUID friendlistowner)
212 { 253 {
213 List<FriendListItem> returnlist = new List<FriendListItem>(); 254 List<FriendListItem> returnlist = new List<FriendListItem>();
@@ -246,12 +287,24 @@ namespace OpenSim.Data.SQLite
246 287
247 #endregion 288 #endregion
248 289
290 /// <summary>
291 /// STUB, Update the user's current region
292 /// </summary>
293 /// <param name="avatarid">UUID of the user</param>
294 /// <param name="regionuuid">UUID of the region</param>
295 /// <param name="regionhandle">region handle</param>
296 /// <remarks>DO NOTHING</remarks>
249 override public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid, ulong regionhandle) 297 override public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid, ulong regionhandle)
250 { 298 {
251 //m_log.Info("[USER DB]: Stub UpdateUserCUrrentRegion called"); 299 //m_log.Info("[USER DB]: Stub UpdateUserCUrrentRegion called");
252 } 300 }
253 301
254 302 /// <summary>
303 ///
304 /// </summary>
305 /// <param name="queryID"></param>
306 /// <param name="query"></param>
307 /// <returns></returns>
255 override public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) 308 override public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
256 { 309 {
257 List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>(); 310 List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>();
@@ -347,7 +400,11 @@ namespace OpenSim.Data.SQLite
347 } 400 }
348 } 401 }
349 402
350 403 /// <summary>
404 /// DEPRECATED? Store the weblogin key
405 /// </summary>
406 /// <param name="AgentID">UUID of the user</param>
407 /// <param name="WebLoginKey">UUID of the weblogin</param>
351 override public void StoreWebLoginKey(LLUUID AgentID, LLUUID WebLoginKey) 408 override public void StoreWebLoginKey(LLUUID AgentID, LLUUID WebLoginKey)
352 { 409 {
353 DataTable users = ds.Tables["users"]; 410 DataTable users = ds.Tables["users"];
@@ -487,8 +544,13 @@ namespace OpenSim.Data.SQLite
487 return true; 544 return true;
488 } 545 }
489 546
490 /// Appearance 547
548 /// <summary>
549 /// Appearance.
491 /// TODO: stubs for now to do in memory appearance. 550 /// TODO: stubs for now to do in memory appearance.
551 /// </summary>
552 /// <param name="user">The user UUID</param>
553 /// <returns>Avatar Appearence</returns>
492 override public AvatarAppearance GetUserAppearance(LLUUID user) 554 override public AvatarAppearance GetUserAppearance(LLUUID user)
493 { 555 {
494 AvatarAppearance aa = null; 556 AvatarAppearance aa = null;
@@ -501,22 +563,45 @@ namespace OpenSim.Data.SQLite
501 return aa; 563 return aa;
502 } 564 }
503 565
566 /// <summary>
567 /// Update a user appearence
568 /// </summary>
569 /// <param name="user">the user UUID</param>
570 /// <param name="appearance">appearence</param>
504 override public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance) 571 override public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance)
505 { 572 {
506 appearance.Owner = user; 573 appearance.Owner = user;
507 aplist[user] = appearance; 574 aplist[user] = appearance;
508 } 575 }
509 576
577 /// <summary>
578 /// Add an attachment item to an avatar
579 /// </summary>
580 /// <param name="user">the user UUID</param>
581 /// <param name="item">the item UUID</param>
582 /// <remarks>DO NOTHING ?</remarks>
510 override public void AddAttachment(LLUUID user, LLUUID item) 583 override public void AddAttachment(LLUUID user, LLUUID item)
511 { 584 {
512 return; 585 return;
513 } 586 }
514 587
588 /// <summary>
589 /// Remove an attachement item from an avatar
590 /// </summary>
591 /// <param name="user">the user UUID</param>
592 /// <param name="item">the item UUID</param>
593 /// <remarks>DO NOTHING ?</remarks>
515 override public void RemoveAttachment(LLUUID user, LLUUID item) 594 override public void RemoveAttachment(LLUUID user, LLUUID item)
516 { 595 {
517 return; 596 return;
518 } 597 }
519 598
599 /// <summary>
600 /// Get list of attached item
601 /// </summary>
602 /// <param name="user">the user UUID</param>
603 /// <returns>List of attached item</returns>
604 /// <remarks>DO NOTHING ?</remarks>
520 override public List<LLUUID> GetAttachments(LLUUID user) 605 override public List<LLUUID> GetAttachments(LLUUID user)
521 { 606 {
522 return new List<LLUUID>(); 607 return new List<LLUUID>();
@@ -553,6 +638,10 @@ namespace OpenSim.Data.SQLite
553 * 638 *
554 **********************************************************************/ 639 **********************************************************************/
555 640
641 /// <summary>
642 /// Create the "users" table
643 /// </summary>
644 /// <returns>DataTable</returns>
556 private static DataTable createUsersTable() 645 private static DataTable createUsersTable()
557 { 646 {
558 DataTable users = new DataTable("users"); 647 DataTable users = new DataTable("users");
@@ -588,6 +677,10 @@ namespace OpenSim.Data.SQLite
588 return users; 677 return users;
589 } 678 }
590 679
680 /// <summary>
681 /// Create the "useragents" table
682 /// </summary>
683 /// <returns>Data Table</returns>
591 private static DataTable createUserAgentsTable() 684 private static DataTable createUserAgentsTable()
592 { 685 {
593 DataTable ua = new DataTable("useragents"); 686 DataTable ua = new DataTable("useragents");
@@ -613,6 +706,10 @@ namespace OpenSim.Data.SQLite
613 return ua; 706 return ua;
614 } 707 }
615 708
709 /// <summary>
710 /// Create the "userfriends" table
711 /// </summary>
712 /// <returns>Data Table</returns>
616 private static DataTable createUserFriendsTable() 713 private static DataTable createUserFriendsTable()
617 { 714 {
618 DataTable ua = new DataTable("userfriends"); 715 DataTable ua = new DataTable("userfriends");
@@ -634,11 +731,15 @@ namespace OpenSim.Data.SQLite
634 * 731 *
635 **********************************************************************/ 732 **********************************************************************/
636 733
734 /// <summary>
735 /// TODO: this doesn't work yet because something more
736 /// interesting has to be done to actually get these values
737 /// back out. Not enough time to figure it out yet.
738 /// </summary>
739 /// <param name="row"></param>
740 /// <returns></returns>
637 private static UserProfileData buildUserProfile(DataRow row) 741 private static UserProfileData buildUserProfile(DataRow row)
638 { 742 {
639 // TODO: this doesn't work yet because something more
640 // interesting has to be done to actually get these values
641 // back out. Not enough time to figure it out yet.
642 UserProfileData user = new UserProfileData(); 743 UserProfileData user = new UserProfileData();
643 LLUUID tmp; 744 LLUUID tmp;
644 LLUUID.TryParse((String)row["UUID"], out tmp); 745 LLUUID.TryParse((String)row["UUID"], out tmp);
@@ -678,6 +779,11 @@ namespace OpenSim.Data.SQLite
678 return user; 779 return user;
679 } 780 }
680 781
782 /// <summary>
783 ///
784 /// </summary>
785 /// <param name="row"></param>
786 /// <param name="user"></param>
681 private void fillUserRow(DataRow row, UserProfileData user) 787 private void fillUserRow(DataRow row, UserProfileData user)
682 { 788 {
683 row["UUID"] = Util.ToRawUuidString(user.ID); 789 row["UUID"] = Util.ToRawUuidString(user.ID);
@@ -719,6 +825,11 @@ namespace OpenSim.Data.SQLite
719 } 825 }
720 } 826 }
721 827
828 /// <summary>
829 ///
830 /// </summary>
831 /// <param name="row"></param>
832 /// <returns></returns>
722 private static UserAgentData buildUserAgent(DataRow row) 833 private static UserAgentData buildUserAgent(DataRow row)
723 { 834 {
724 UserAgentData ua = new UserAgentData(); 835 UserAgentData ua = new UserAgentData();
@@ -742,6 +853,11 @@ namespace OpenSim.Data.SQLite
742 return ua; 853 return ua;
743 } 854 }
744 855
856 /// <summary>
857 ///
858 /// </summary>
859 /// <param name="row"></param>
860 /// <param name="ua"></param>
745 private static void fillUserAgentRow(DataRow row, UserAgentData ua) 861 private static void fillUserAgentRow(DataRow row, UserAgentData ua)
746 { 862 {
747 row["UUID"] = ua.ProfileID; 863 row["UUID"] = ua.ProfileID;
@@ -770,6 +886,11 @@ namespace OpenSim.Data.SQLite
770 * 886 *
771 **********************************************************************/ 887 **********************************************************************/
772 888
889 /// <summary>
890 ///
891 /// </summary>
892 /// <param name="da"></param>
893 /// <param name="conn"></param>
773 private void setupUserCommands(SqliteDataAdapter da, SqliteConnection conn) 894 private void setupUserCommands(SqliteDataAdapter da, SqliteConnection conn)
774 { 895 {
775 da.InsertCommand = SQLiteUtil.createInsertCommand("users", ds.Tables["users"]); 896 da.InsertCommand = SQLiteUtil.createInsertCommand("users", ds.Tables["users"]);
@@ -784,6 +905,11 @@ namespace OpenSim.Data.SQLite
784 da.DeleteCommand = delete; 905 da.DeleteCommand = delete;
785 } 906 }
786 907
908 /// <summary>
909 ///
910 /// </summary>
911 /// <param name="daf"></param>
912 /// <param name="conn"></param>
787 private void setupUserFriendsCommands(SqliteDataAdapter daf, SqliteConnection conn) 913 private void setupUserFriendsCommands(SqliteDataAdapter daf, SqliteConnection conn)
788 { 914 {
789 daf.InsertCommand = SQLiteUtil.createInsertCommand("userfriends", ds.Tables["userfriends"]); 915 daf.InsertCommand = SQLiteUtil.createInsertCommand("userfriends", ds.Tables["userfriends"]);
@@ -800,6 +926,10 @@ namespace OpenSim.Data.SQLite
800 926
801 } 927 }
802 928
929 /// <summary>
930 ///
931 /// </summary>
932 /// <param name="conn"></param>
803 private static void InitDB(SqliteConnection conn) 933 private static void InitDB(SqliteConnection conn)
804 { 934 {
805 string createUsers = SQLiteUtil.defineTable(createUsersTable()); 935 string createUsers = SQLiteUtil.defineTable(createUsersTable());
@@ -832,6 +962,12 @@ namespace OpenSim.Data.SQLite
832 conn.Close(); 962 conn.Close();
833 } 963 }
834 964
965 /// <summary>
966 ///
967 /// </summary>
968 /// <param name="conn"></param>
969 /// <param name="m"></param>
970 /// <returns></returns>
835 private static bool TestTables(SqliteConnection conn, Migration m) 971 private static bool TestTables(SqliteConnection conn, Migration m)
836 { 972 {
837 SqliteCommand cmd = new SqliteCommand(userSelect, conn); 973 SqliteCommand cmd = new SqliteCommand(userSelect, conn);
diff --git a/OpenSim/Data/SQLite/SQLiteUtils.cs b/OpenSim/Data/SQLite/SQLiteUtils.cs
index 0862de0..18bb137 100644
--- a/OpenSim/Data/SQLite/SQLiteUtils.cs
+++ b/OpenSim/Data/SQLite/SQLiteUtils.cs
@@ -44,6 +44,12 @@ namespace OpenSim.Data.SQLite
44 * 44 *
45 **********************************************************************/ 45 **********************************************************************/
46 46
47 /// <summary>
48 ///
49 /// </summary>
50 /// <param name="dt"></param>
51 /// <param name="name"></param>
52 /// <param name="type"></param>
47 public static void createCol(DataTable dt, string name, Type type) 53 public static void createCol(DataTable dt, string name, Type type)
48 { 54 {
49 DataColumn col = new DataColumn(name, type); 55 DataColumn col = new DataColumn(name, type);
@@ -60,17 +66,24 @@ namespace OpenSim.Data.SQLite
60 * 66 *
61 **********************************************************************/ 67 **********************************************************************/
62 68
69 /// <summary>
70 /// Create an insert command
71 /// </summary>
72 /// <param name="table">table name</param>
73 /// <param name="dt">data table</param>
74 /// <returns>the created command</returns>
75 /// <remarks>
76 /// This is subtle enough to deserve some commentary.
77 /// Instead of doing *lots* and *lots of hardcoded strings
78 /// for database definitions we'll use the fact that
79 /// realistically all insert statements look like "insert
80 /// into A(b, c) values(:b, :c) on the parameterized query
81 /// front. If we just have a list of b, c, etc... we can
82 /// generate these strings instead of typing them out.
83 /// </remarks>
63 public static SqliteCommand createInsertCommand(string table, DataTable dt) 84 public static SqliteCommand createInsertCommand(string table, DataTable dt)
64 { 85 {
65 /** 86
66 * This is subtle enough to deserve some commentary.
67 * Instead of doing *lots* and *lots of hardcoded strings
68 * for database definitions we'll use the fact that
69 * realistically all insert statements look like "insert
70 * into A(b, c) values(:b, :c) on the parameterized query
71 * front. If we just have a list of b, c, etc... we can
72 * generate these strings instead of typing them out.
73 */
74 string[] cols = new string[dt.Columns.Count]; 87 string[] cols = new string[dt.Columns.Count];
75 for (int i = 0; i < dt.Columns.Count; i++) 88 for (int i = 0; i < dt.Columns.Count; i++)
76 { 89 {
@@ -95,6 +108,13 @@ namespace OpenSim.Data.SQLite
95 return cmd; 108 return cmd;
96 } 109 }
97 110
111 /// <summary>
112 /// create an update command
113 /// </summary>
114 /// <param name="table">table name</param>
115 /// <param name="pk"></param>
116 /// <param name="dt"></param>
117 /// <returns>the created command</returns>
98 public static SqliteCommand createUpdateCommand(string table, string pk, DataTable dt) 118 public static SqliteCommand createUpdateCommand(string table, string pk, DataTable dt)
99 { 119 {
100 string sql = "update " + table + " set "; 120 string sql = "update " + table + " set ";
@@ -122,7 +142,11 @@ namespace OpenSim.Data.SQLite
122 return cmd; 142 return cmd;
123 } 143 }
124 144
125 145 /// <summary>
146 ///
147 /// </summary>
148 /// <param name="dt">Data Table</param>
149 /// <returns></returns>
126 public static string defineTable(DataTable dt) 150 public static string defineTable(DataTable dt)
127 { 151 {
128 string sql = "create table " + dt.TableName + "("; 152 string sql = "create table " + dt.TableName + "(";
@@ -158,15 +182,21 @@ namespace OpenSim.Data.SQLite
158 **********************************************************************/ 182 **********************************************************************/
159 183
160 ///<summary> 184 ///<summary>
185 /// <para>
161 /// This is a convenience function that collapses 5 repetitive 186 /// This is a convenience function that collapses 5 repetitive
162 /// lines for defining SqliteParameters to 2 parameters: 187 /// lines for defining SqliteParameters to 2 parameters:
163 /// column name and database type. 188 /// column name and database type.
164 /// 189 /// </para>
190 ///
191 /// <para>
165 /// It assumes certain conventions like :param as the param 192 /// It assumes certain conventions like :param as the param
166 /// name to replace in parametrized queries, and that source 193 /// name to replace in parametrized queries, and that source
167 /// version is always current version, both of which are fine 194 /// version is always current version, both of which are fine
168 /// for us. 195 /// for us.
196 /// </para>
169 ///</summary> 197 ///</summary>
198 /// <param name="name"></param>
199 /// <param name="type"></param>
170 ///<returns>a built sqlite parameter</returns> 200 ///<returns>a built sqlite parameter</returns>
171 public static SqliteParameter createSqliteParameter(string name, Type type) 201 public static SqliteParameter createSqliteParameter(string name, Type type)
172 { 202 {
@@ -184,6 +214,11 @@ namespace OpenSim.Data.SQLite
184 * 214 *
185 **********************************************************************/ 215 **********************************************************************/
186 216
217 /// <summary>
218 /// Type conversion function
219 /// </summary>
220 /// <param name="type">a type</param>
221 /// <returns>a DbType</returns>
187 public static DbType dbtypeFromType(Type type) 222 public static DbType dbtypeFromType(Type type)
188 { 223 {
189 if (type == typeof (String)) 224 if (type == typeof (String))
@@ -224,8 +259,11 @@ namespace OpenSim.Data.SQLite
224 } 259 }
225 } 260 }
226 261
227 // this is something we'll need to implement for each db 262 /// <summary>
228 // slightly differently. 263 /// </summary>
264 /// <param name="type">a Type</param>
265 /// <returns>a string</returns>
266 /// <remarks>this is something we'll need to implement for each db slightly differently.</remarks>
229 public static string sqliteType(Type type) 267 public static string sqliteType(Type type)
230 { 268 {
231 if (type == typeof (String)) 269 if (type == typeof (String))