diff --git a/OpenSim/Data/RegionProfileData.cs b/OpenSim/Data/RegionProfileData.cs index 897dcbf3a4..12f3927ff6 100644 --- a/OpenSim/Data/RegionProfileData.cs +++ b/OpenSim/Data/RegionProfileData.cs @@ -130,13 +130,16 @@ namespace OpenSim.Data /// public LLUUID originUUID; + /// - /// Get Sim profile data from grid server when in grid mode + /// Request sim profile information from a grid server, by Region UUID /// - /// + /// The region UUID to look for /// - /// - /// + /// + /// + /// The sim profile. Null if there was a request failure + /// This method should be statics public RegionProfileData RequestSimProfileData(LLUUID region_uuid, string gridserver_url, string gridserver_sendkey, string gridserver_recvkey) { @@ -172,9 +175,9 @@ namespace OpenSim.Data } /// - /// Request sim profile information from a grid server + /// Request sim profile information from a grid server, by Region Handle /// - /// + /// the region handle to look for /// /// /// @@ -214,9 +217,9 @@ namespace OpenSim.Data } /// - /// Request sim profile information from a grid server + /// Request sim profile information from a grid server, by Region Name /// - /// + /// the region name to look for /// /// /// diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs index 4370cf7d93..f560b9e3d8 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"; } diff --git a/OpenSim/Data/SQLite/SQLiteGridData.cs b/OpenSim/Data/SQLite/SQLiteGridData.cs index 7c5bb0c520..0d24a40076 100644 --- a/OpenSim/Data/SQLite/SQLiteGridData.cs +++ b/OpenSim/Data/SQLite/SQLiteGridData.cs @@ -41,13 +41,18 @@ namespace OpenSim.Data.SQLite public class SQLiteGridData : GridDataBase { /// - /// A database manager + /// SQLite database manager /// private SQLiteManager database; /// - /// Initialises the Grid Interface + /// + /// Initialises Inventory 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 connect) { database = new SQLiteManager(connect); @@ -87,13 +92,14 @@ namespace OpenSim.Data.SQLite /// maximum X coordinate /// maximum Y coordinate /// An array of region profiles + /// NOT IMPLEMENTED ? always return null override public RegionProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) { return null; } /// - /// Returns a sim profile from it's location + /// Returns a sim profile from it's handle /// /// Region location handle /// Sim profile @@ -162,8 +168,9 @@ namespace OpenSim.Data.SQLite } /// - /// // Returns a list of avatar and UUIDs that match the query + /// Returns a list of avatar and UUIDs that match the query /// + /// do nothing yet public List GeneratePickerResults(LLUUID queryID, string query) { //Do nothing yet @@ -232,6 +239,12 @@ namespace OpenSim.Data.SQLite return false; } + /// + /// NOT IMPLEMENTED + /// + /// x coordinate + /// y coordinate + /// always return null override public ReservationData GetReservationAtPoint(uint x, uint y) { return null; diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs index 5b77f826ab..f7a1fdc73f 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); diff --git a/OpenSim/Data/SQLite/SQLiteManager.cs b/OpenSim/Data/SQLite/SQLiteManager.cs index 4d395274e3..46c40e5db6 100644 --- a/OpenSim/Data/SQLite/SQLiteManager.cs +++ b/OpenSim/Data/SQLite/SQLiteManager.cs @@ -35,6 +35,9 @@ using log4net; namespace OpenSim.Data.SQLite { + /// + /// SQLite Manager + /// internal class SQLiteManager : SQLiteUtil { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -42,13 +45,12 @@ namespace OpenSim.Data.SQLite private IDbConnection dbcon; /// - /// Initialises and creates a new SQLite connection and maintains it. + /// + /// Initialises and creates a new SQLite connection and maintains it. + /// use default URI if connect string is empty. + /// /// - /// The SQLite server being connected to - /// The name of the SQLite database being used - /// The username logging into the database - /// The password for the user logging in - /// Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'. + /// connect string public SQLiteManager(string connect) { try diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs index eb6f2538dd..86f43708e7 100644 --- a/OpenSim/Data/SQLite/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs @@ -40,6 +40,9 @@ using OpenSim.Region.Environment.Scenes; namespace OpenSim.Data.SQLite { + /// + /// A RegionData Interface to the SQLite database + /// public class SQLiteRegionData : IRegionDataStore { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -74,7 +77,15 @@ namespace OpenSim.Data.SQLite * **********************************************************************/ - // see IRegionDataStore + /// + /// See IRegionDataStore + /// + /// Initialises RegionData Interface + /// Loads and initialises a new SQLite connection and maintains it. + /// + /// + /// the connection string + /// ? public void Initialise(string connectionString, bool persistPrimInventories) { m_connectionString = connectionString; @@ -203,6 +214,11 @@ namespace OpenSim.Data.SQLite } } + /// + /// Adds an object into region storage + /// + /// the object + /// the region UUID public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID) { lock (ds) @@ -233,6 +249,11 @@ namespace OpenSim.Data.SQLite // m_log.Info("[Dump of prims]: " + ds.GetXml()); } + /// + /// Removes an object from region storage + /// + /// the object + /// the region UUID public void RemoveObject(LLUUID obj, LLUUID regionUUID) { m_log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", obj.UUID, regionUUID); @@ -271,6 +292,7 @@ namespace OpenSim.Data.SQLite /// Remove all persisted items of the given prim. /// The caller must acquire the necessrary synchronization locks and commit or rollback changes. /// + /// The item UUID private void RemoveItems(LLUUID uuid) { DataTable items = ds.Tables["primitems"]; @@ -287,7 +309,7 @@ namespace OpenSim.Data.SQLite /// /// Load persisted objects from region storage. /// - /// + /// The region UUID /// List of loaded groups public List LoadObjects(LLUUID regionUUID) { @@ -375,7 +397,7 @@ namespace OpenSim.Data.SQLite /// /// Load in a prim's persisted inventory. /// - /// + /// the prim private void LoadItems(SceneObjectPart prim) { //m_log.DebugFormat("[DATASTORE]: Loading inventory for {0}, {1}", prim.Name, prim.UUID); @@ -405,6 +427,11 @@ namespace OpenSim.Data.SQLite } } + /// + /// Store a terrain revision in region storage + /// + /// terrain heightfield + /// region UUID public void StoreTerrain(double[,] ter, LLUUID regionID) { lock (ds) @@ -444,6 +471,11 @@ namespace OpenSim.Data.SQLite } } + /// + /// Load the latest terrain revision from region storage + /// + /// the region UUID + /// Heightfield data public double[,] LoadTerrain(LLUUID regionID) { lock (ds) @@ -488,6 +520,10 @@ namespace OpenSim.Data.SQLite } } + /// + /// + /// + /// public void RemoveLandObject(LLUUID globalID) { lock (ds) @@ -506,6 +542,10 @@ namespace OpenSim.Data.SQLite } } + /// + /// + /// + /// public void StoreLandObject(ILandObject parcel) { lock (ds) @@ -543,6 +583,11 @@ namespace OpenSim.Data.SQLite Commit(); } + /// + /// + /// + /// + /// public List LoadLandObjects(LLUUID regionUUID) { List landDataForRegion = new List(); @@ -568,6 +613,9 @@ namespace OpenSim.Data.SQLite return landDataForRegion; } + /// + /// + /// public void Commit() { lock (ds) @@ -587,6 +635,9 @@ namespace OpenSim.Data.SQLite } } + /// + /// See + /// public void Shutdown() { Commit(); @@ -600,12 +651,22 @@ namespace OpenSim.Data.SQLite * **********************************************************************/ + /// + /// + /// + /// + /// + /// private static void createCol(DataTable dt, string name, Type type) { DataColumn col = new DataColumn(name, type); dt.Columns.Add(col); } + /// + /// Creates the "terrain" table + /// + /// terrain table DataTable private static DataTable createTerrainTable() { DataTable terrain = new DataTable("terrain"); @@ -617,6 +678,10 @@ namespace OpenSim.Data.SQLite return terrain; } + /// + /// Creates the "prims" table + /// + /// prim table DataTable private static DataTable createPrimTable() { DataTable prims = new DataTable("prims"); @@ -681,6 +746,10 @@ namespace OpenSim.Data.SQLite return prims; } + /// + /// Creates "primshapes" table + /// + /// shape table DataTable private static DataTable createShapeTable() { DataTable shapes = new DataTable("primshapes"); @@ -723,6 +792,10 @@ namespace OpenSim.Data.SQLite return shapes; } + /// + /// creates "primitems" table + /// + /// item table DataTable private static DataTable createItemsTable() { DataTable items = new DataTable("primitems"); @@ -756,6 +829,10 @@ namespace OpenSim.Data.SQLite return items; } + /// + /// Creates "land" table + /// + /// land table DataTable private static DataTable createLandTable() { DataTable land = new DataTable("land"); @@ -800,6 +877,10 @@ namespace OpenSim.Data.SQLite return land; } + /// + /// create "landaccesslist" table + /// + /// Landacceslist DataTable private static DataTable createLandAccessListTable() { DataTable landaccess = new DataTable("landaccesslist"); @@ -810,6 +891,10 @@ namespace OpenSim.Data.SQLite return landaccess; } + /// + /// create "regionban" table + /// + /// regionban datatable private static DataTable createRegionBanListTable() { DataTable regionbanlist = new DataTable("regionban"); @@ -829,6 +914,11 @@ namespace OpenSim.Data.SQLite * **********************************************************************/ + /// + /// + /// + /// + /// private SceneObjectPart buildPrim(DataRow row) { // TODO: this doesn't work yet because something more @@ -971,6 +1061,11 @@ namespace OpenSim.Data.SQLite return taskItem; } + /// + /// Build a Land Data from the persisted data. + /// + /// + /// private LandData buildLandData(DataRow row) { LandData newData = new LandData(); @@ -1059,6 +1154,11 @@ namespace OpenSim.Data.SQLite return newData; } + /// + /// Build a land access entry from the persisted data. + /// + /// + /// private static ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row) { ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); @@ -1069,7 +1169,11 @@ namespace OpenSim.Data.SQLite } - + /// + /// Load a region banlist + /// + /// the region UUID + /// The banlist public List LoadRegionBanList(LLUUID regionUUID) { List regionbanlist = new List(); @@ -1096,6 +1200,10 @@ namespace OpenSim.Data.SQLite return regionbanlist; } + /// + /// Add en entry into region banlist + /// + /// public void AddToRegionBanlist(RegionBanListItem item) { lock (ds) @@ -1111,6 +1219,10 @@ namespace OpenSim.Data.SQLite } } + /// + /// remove an entry from the region banlist + /// + /// public void RemoveFromRegionBanlist(RegionBanListItem item) { lock (ds) @@ -1124,6 +1236,11 @@ namespace OpenSim.Data.SQLite } } + /// + /// + /// + /// + /// private static Array serializeTerrain(double[,] val) { MemoryStream str = new MemoryStream(65536*sizeof (double)); @@ -1153,6 +1270,13 @@ namespace OpenSim.Data.SQLite // row["Heightfield"] = str.ToArray(); // } + /// + /// + /// + /// + /// + /// + /// private static void fillPrimRow(DataRow row, SceneObjectPart prim, LLUUID sceneGroupID, LLUUID regionUUID) { row["UUID"] = Util.ToRawUuidString(prim.UUID); @@ -1213,6 +1337,11 @@ namespace OpenSim.Data.SQLite row["SitTargetOrientZ"] = sitTargetOrient.Z; } + /// + /// + /// + /// + /// private static void fillItemRow(DataRow row, TaskInventoryItem taskItem) { row["itemID"] = taskItem.ItemID; @@ -1238,6 +1367,12 @@ namespace OpenSim.Data.SQLite row["flags"] = taskItem.Flags; } + /// + /// + /// + /// + /// + /// private static void fillLandRow(DataRow row, LandData land, LLUUID regionUUID) { row["UUID"] = Util.ToRawUuidString(land.globalID); @@ -1277,6 +1412,12 @@ namespace OpenSim.Data.SQLite row["AuthbuyerID"] = Util.ToRawUuidString(land.authBuyerID); } + /// + /// + /// + /// + /// + /// private static void fillLandAccessRow(DataRow row, ParcelManager.ParcelAccessEntry entry, LLUUID parcelID) { row["LandUUID"] = Util.ToRawUuidString(parcelID); @@ -1284,6 +1425,11 @@ namespace OpenSim.Data.SQLite row["Flags"] = entry.Flags; } + /// + /// + /// + /// + /// private PrimitiveBaseShape buildShape(DataRow row) { PrimitiveBaseShape s = new PrimitiveBaseShape(); @@ -1334,6 +1480,11 @@ namespace OpenSim.Data.SQLite return s; } + /// + /// + /// + /// + /// private static void fillShapeRow(DataRow row, SceneObjectPart prim) { PrimitiveBaseShape s = prim.Shape; @@ -1371,6 +1522,12 @@ namespace OpenSim.Data.SQLite row["ExtraParams"] = s.ExtraParams; } + /// + /// + /// + /// + /// + /// private void addPrim(SceneObjectPart prim, LLUUID sceneGroupID, LLUUID regionUUID) { DataTable prims = ds.Tables["prims"]; @@ -1401,7 +1558,11 @@ namespace OpenSim.Data.SQLite } } - // see IRegionDatastore + /// + /// see IRegionDatastore + /// + /// + /// public void StorePrimInventory(LLUUID primID, ICollection items) { if (!persistPrimInventories) @@ -1444,17 +1605,23 @@ namespace OpenSim.Data.SQLite * **********************************************************************/ + /// + /// Create an insert command + /// + /// table name + /// data table + /// the created command + /// + /// This is subtle enough to deserve some commentary. + /// Instead of doing *lots* and *lots of hardcoded strings + /// for database definitions we'll use the fact that + /// realistically all insert statements look like "insert + /// into A(b, c) values(:b, :c) on the parameterized query + /// front. If we just have a list of b, c, etc... we can + /// generate these strings instead of typing them out. + /// private static SqliteCommand createInsertCommand(string table, DataTable dt) { - /** - * This is subtle enough to deserve some commentary. - * Instead of doing *lots* and *lots of hardcoded strings - * for database definitions we'll use the fact that - * realistically all insert statements look like "insert - * into A(b, c) values(:b, :c) on the parameterized query - * front. If we just have a list of b, c, etc... we can - * generate these strings instead of typing them out. - */ string[] cols = new string[dt.Columns.Count]; for (int i = 0; i < dt.Columns.Count; i++) { @@ -1479,6 +1646,14 @@ namespace OpenSim.Data.SQLite return cmd; } + + /// + /// create an update command + /// + /// table name + /// + /// + /// the created command private static SqliteCommand createUpdateCommand(string table, string pk, DataTable dt) { string sql = "update " + table + " set "; @@ -1506,7 +1681,11 @@ namespace OpenSim.Data.SQLite return cmd; } - + /// + /// + /// + /// Data Table + /// private static string defineTable(DataTable dt) { string sql = "create table " + dt.TableName + "("; @@ -1559,6 +1738,11 @@ namespace OpenSim.Data.SQLite return param; } + /// + /// + /// + /// + /// private void setupPrimCommands(SqliteDataAdapter da, SqliteConnection conn) { da.InsertCommand = createInsertCommand("prims", ds.Tables["prims"]); @@ -1573,6 +1757,11 @@ namespace OpenSim.Data.SQLite da.DeleteCommand = delete; } + /// + /// + /// + /// + /// private void setupItemsCommands(SqliteDataAdapter da, SqliteConnection conn) { da.InsertCommand = createInsertCommand("primitems", ds.Tables["primitems"]); @@ -1587,12 +1776,22 @@ namespace OpenSim.Data.SQLite da.DeleteCommand = delete; } + /// + /// + /// + /// + /// private void setupTerrainCommands(SqliteDataAdapter da, SqliteConnection conn) { da.InsertCommand = createInsertCommand("terrain", ds.Tables["terrain"]); da.InsertCommand.Connection = conn; } + /// + /// + /// + /// + /// private void setupLandCommands(SqliteDataAdapter da, SqliteConnection conn) { da.InsertCommand = createInsertCommand("land", ds.Tables["land"]); @@ -1602,12 +1801,22 @@ namespace OpenSim.Data.SQLite da.UpdateCommand.Connection = conn; } + /// + /// + /// + /// + /// private void setupLandAccessCommands(SqliteDataAdapter da, SqliteConnection conn) { da.InsertCommand = createInsertCommand("landaccesslist", ds.Tables["landaccesslist"]); da.InsertCommand.Connection = conn; } + /// + /// + /// + /// + /// private void setupRegionBanCommands(SqliteDataAdapter da, SqliteConnection conn) { da.InsertCommand = createInsertCommand("regionban", ds.Tables["regionban"]); @@ -1617,7 +1826,11 @@ namespace OpenSim.Data.SQLite da.UpdateCommand.Connection = conn; } - + /// + /// + /// + /// + /// private void setupShapeCommands(SqliteDataAdapter da, SqliteConnection conn) { da.InsertCommand = createInsertCommand("primshapes", ds.Tables["primshapes"]); @@ -1710,6 +1923,12 @@ namespace OpenSim.Data.SQLite // } // } + /// + /// + /// + /// + /// + /// private bool TestTables(SqliteConnection conn, Migration m) { SqliteCommand primSelectCmd = new SqliteCommand(primSelect, conn); @@ -1822,6 +2041,11 @@ namespace OpenSim.Data.SQLite * **********************************************************************/ + /// + /// Type conversion function + /// + /// + /// private static DbType dbtypeFromType(Type type) { if (type == typeof (String)) @@ -1854,8 +2078,11 @@ namespace OpenSim.Data.SQLite } } - // this is something we'll need to implement for each db - // slightly differently. + /// + /// + /// a Type + /// an sqliteType + /// this is something we'll need to implement for each db slightly differently. private static string sqliteType(Type type) { if (type == typeof (String)) diff --git a/OpenSim/Data/SQLite/SQLiteUserData.cs b/OpenSim/Data/SQLite/SQLiteUserData.cs index 36ec9ea551..24c7944733 100644 --- a/OpenSim/Data/SQLite/SQLiteUserData.cs +++ b/OpenSim/Data/SQLite/SQLiteUserData.cs @@ -65,6 +65,14 @@ namespace OpenSim.Data.SQLite private SqliteDataAdapter daf; SqliteConnection g_conn; + /// + /// + /// Initialises User Interface + /// Loads and initialises a new SQLite connection and maintains it. + /// use default URI if connect string string is empty. + /// + /// + /// connect string override public void Initialise(string connect) { // default to something sensible @@ -116,7 +124,12 @@ namespace OpenSim.Data.SQLite return; } - // see IUserData + /// + /// see IUserData, + /// Get user data profile by UUID + /// + /// User UUID + /// user profile data override public UserProfileData GetUserByUUID(LLUUID uuid) { lock (ds) @@ -139,7 +152,13 @@ namespace OpenSim.Data.SQLite } } - // see IUserData + /// + /// see IUserData, + /// Get user data profile by name + /// + /// first name + /// last name + /// user profile data override public UserProfileData GetUserByName(string fname, string lname) { string select = "surname = '" + lname + "' and username = '" + fname + "'"; @@ -165,6 +184,12 @@ namespace OpenSim.Data.SQLite #region User Friends List Data + /// + /// Add a new friend in the friendlist + /// + /// UUID of the friendlist owner + /// UUID of the friend to add + /// permission flag override public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms) { string InsertFriends = "insert into userfriends(ownerID, friendID, friendPerms) values(:ownerID, :friendID, :perms)"; @@ -185,6 +210,11 @@ namespace OpenSim.Data.SQLite } } + /// + /// Remove a user from the friendlist + /// + /// UUID of the friendlist owner + /// UUID of the friend to remove override public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend) { 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 } } + /// + /// Update the friendlist permission + /// + /// UUID of the friendlist owner + /// UUID of the friend to modify + /// updated permission flag override public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms) { string UpdatePerms = "update friendlist set perms=:perms where ownerID=:ownerID and friendID=:friendID"; @@ -208,6 +244,11 @@ namespace OpenSim.Data.SQLite } } + /// + /// Get (fetch?) the friendlist for a user + /// + /// UUID of the friendlist owner + /// The friendlist list override public List GetUserFriendList(LLUUID friendlistowner) { List returnlist = new List(); @@ -246,12 +287,24 @@ namespace OpenSim.Data.SQLite #endregion + /// + /// STUB, Update the user's current region + /// + /// UUID of the user + /// UUID of the region + /// region handle + /// DO NOTHING override public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid, ulong regionhandle) { //m_log.Info("[USER DB]: Stub UpdateUserCUrrentRegion called"); } - + /// + /// + /// + /// + /// + /// override public List GeneratePickerResults(LLUUID queryID, string query) { List returnlist = new List(); @@ -347,7 +400,11 @@ namespace OpenSim.Data.SQLite } } - + /// + /// DEPRECATED? Store the weblogin key + /// + /// UUID of the user + /// UUID of the weblogin override public void StoreWebLoginKey(LLUUID AgentID, LLUUID WebLoginKey) { DataTable users = ds.Tables["users"]; @@ -487,8 +544,13 @@ namespace OpenSim.Data.SQLite return true; } - /// Appearance + + /// + /// Appearance. /// TODO: stubs for now to do in memory appearance. + /// + /// The user UUID + /// Avatar Appearence override public AvatarAppearance GetUserAppearance(LLUUID user) { AvatarAppearance aa = null; @@ -501,22 +563,45 @@ namespace OpenSim.Data.SQLite return aa; } + /// + /// Update a user appearence + /// + /// the user UUID + /// appearence override public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance) { appearance.Owner = user; aplist[user] = appearance; } + /// + /// Add an attachment item to an avatar + /// + /// the user UUID + /// the item UUID + /// DO NOTHING ? override public void AddAttachment(LLUUID user, LLUUID item) { return; } + /// + /// Remove an attachement item from an avatar + /// + /// the user UUID + /// the item UUID + /// DO NOTHING ? override public void RemoveAttachment(LLUUID user, LLUUID item) { return; } + /// + /// Get list of attached item + /// + /// the user UUID + /// List of attached item + /// DO NOTHING ? override public List GetAttachments(LLUUID user) { return new List(); @@ -553,6 +638,10 @@ namespace OpenSim.Data.SQLite * **********************************************************************/ + /// + /// Create the "users" table + /// + /// DataTable private static DataTable createUsersTable() { DataTable users = new DataTable("users"); @@ -588,6 +677,10 @@ namespace OpenSim.Data.SQLite return users; } + /// + /// Create the "useragents" table + /// + /// Data Table private static DataTable createUserAgentsTable() { DataTable ua = new DataTable("useragents"); @@ -613,6 +706,10 @@ namespace OpenSim.Data.SQLite return ua; } + /// + /// Create the "userfriends" table + /// + /// Data Table private static DataTable createUserFriendsTable() { DataTable ua = new DataTable("userfriends"); @@ -634,11 +731,15 @@ namespace OpenSim.Data.SQLite * **********************************************************************/ + /// + /// TODO: this doesn't work yet because something more + /// interesting has to be done to actually get these values + /// back out. Not enough time to figure it out yet. + /// + /// + /// private static UserProfileData buildUserProfile(DataRow row) { - // TODO: this doesn't work yet because something more - // interesting has to be done to actually get these values - // back out. Not enough time to figure it out yet. UserProfileData user = new UserProfileData(); LLUUID tmp; LLUUID.TryParse((String)row["UUID"], out tmp); @@ -678,6 +779,11 @@ namespace OpenSim.Data.SQLite return user; } + /// + /// + /// + /// + /// private void fillUserRow(DataRow row, UserProfileData user) { row["UUID"] = Util.ToRawUuidString(user.ID); @@ -719,6 +825,11 @@ namespace OpenSim.Data.SQLite } } + /// + /// + /// + /// + /// private static UserAgentData buildUserAgent(DataRow row) { UserAgentData ua = new UserAgentData(); @@ -742,6 +853,11 @@ namespace OpenSim.Data.SQLite return ua; } + /// + /// + /// + /// + /// private static void fillUserAgentRow(DataRow row, UserAgentData ua) { row["UUID"] = ua.ProfileID; @@ -770,6 +886,11 @@ namespace OpenSim.Data.SQLite * **********************************************************************/ + /// + /// + /// + /// + /// private void setupUserCommands(SqliteDataAdapter da, SqliteConnection conn) { da.InsertCommand = SQLiteUtil.createInsertCommand("users", ds.Tables["users"]); @@ -784,6 +905,11 @@ namespace OpenSim.Data.SQLite da.DeleteCommand = delete; } + /// + /// + /// + /// + /// private void setupUserFriendsCommands(SqliteDataAdapter daf, SqliteConnection conn) { daf.InsertCommand = SQLiteUtil.createInsertCommand("userfriends", ds.Tables["userfriends"]); @@ -800,6 +926,10 @@ namespace OpenSim.Data.SQLite } + /// + /// + /// + /// private static void InitDB(SqliteConnection conn) { string createUsers = SQLiteUtil.defineTable(createUsersTable()); @@ -832,6 +962,12 @@ namespace OpenSim.Data.SQLite conn.Close(); } + /// + /// + /// + /// + /// + /// private static bool TestTables(SqliteConnection conn, Migration m) { SqliteCommand cmd = new SqliteCommand(userSelect, conn); diff --git a/OpenSim/Data/SQLite/SQLiteUtils.cs b/OpenSim/Data/SQLite/SQLiteUtils.cs index 0862de016b..18bb137e2f 100644 --- a/OpenSim/Data/SQLite/SQLiteUtils.cs +++ b/OpenSim/Data/SQLite/SQLiteUtils.cs @@ -44,6 +44,12 @@ namespace OpenSim.Data.SQLite * **********************************************************************/ + /// + /// + /// + /// + /// + /// public static void createCol(DataTable dt, string name, Type type) { DataColumn col = new DataColumn(name, type); @@ -60,17 +66,24 @@ namespace OpenSim.Data.SQLite * **********************************************************************/ + /// + /// Create an insert command + /// + /// table name + /// data table + /// the created command + /// + /// This is subtle enough to deserve some commentary. + /// Instead of doing *lots* and *lots of hardcoded strings + /// for database definitions we'll use the fact that + /// realistically all insert statements look like "insert + /// into A(b, c) values(:b, :c) on the parameterized query + /// front. If we just have a list of b, c, etc... we can + /// generate these strings instead of typing them out. + /// public static SqliteCommand createInsertCommand(string table, DataTable dt) { - /** - * This is subtle enough to deserve some commentary. - * Instead of doing *lots* and *lots of hardcoded strings - * for database definitions we'll use the fact that - * realistically all insert statements look like "insert - * into A(b, c) values(:b, :c) on the parameterized query - * front. If we just have a list of b, c, etc... we can - * generate these strings instead of typing them out. - */ + string[] cols = new string[dt.Columns.Count]; for (int i = 0; i < dt.Columns.Count; i++) { @@ -95,6 +108,13 @@ namespace OpenSim.Data.SQLite return cmd; } + /// + /// create an update command + /// + /// table name + /// + /// + /// the created command public static SqliteCommand createUpdateCommand(string table, string pk, DataTable dt) { string sql = "update " + table + " set "; @@ -122,7 +142,11 @@ namespace OpenSim.Data.SQLite return cmd; } - + /// + /// + /// + /// Data Table + /// public static string defineTable(DataTable dt) { string sql = "create table " + dt.TableName + "("; @@ -158,15 +182,21 @@ namespace OpenSim.Data.SQLite **********************************************************************/ /// + /// /// This is a convenience function that collapses 5 repetitive /// lines for defining SqliteParameters to 2 parameters: /// column name and database type. - /// + /// + /// + /// /// It assumes certain conventions like :param as the param /// name to replace in parametrized queries, and that source /// version is always current version, both of which are fine /// for us. + /// /// + /// + /// ///a built sqlite parameter public static SqliteParameter createSqliteParameter(string name, Type type) { @@ -184,6 +214,11 @@ namespace OpenSim.Data.SQLite * **********************************************************************/ + /// + /// Type conversion function + /// + /// a type + /// a DbType public static DbType dbtypeFromType(Type type) { if (type == typeof (String)) @@ -224,8 +259,11 @@ namespace OpenSim.Data.SQLite } } - // this is something we'll need to implement for each db - // slightly differently. + /// + /// + /// a Type + /// a string + /// this is something we'll need to implement for each db slightly differently. public static string sqliteType(Type type) { if (type == typeof (String))