From f8ccf00f1cd8b99a2012558ded7de01ffcff7e35 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Thu, 26 Jun 2008 20:25:57 +0000 Subject: [PATCH] Apply patch from bug #1609 -- Documentation for Data/MSSQL. Thanks kerunix_Flan! --- OpenSim/Data/MSSQL/MSSQLAssetData.cs | 50 ++++- OpenSim/Data/MSSQL/MSSQLDataStore.cs | 230 ++++++++++++++++++++++- OpenSim/Data/MSSQL/MSSQLGridData.cs | 31 ++- OpenSim/Data/MSSQL/MSSQLInventoryData.cs | 38 +++- OpenSim/Data/MSSQL/MSSQLManager.cs | 36 +++- OpenSim/Data/MSSQL/MSSQLUserData.cs | 90 ++++++++- 6 files changed, 446 insertions(+), 29 deletions(-) diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs index 12a03eb49d..50e2e3aa8d 100644 --- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs +++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs @@ -36,6 +36,9 @@ using OpenSim.Framework; namespace OpenSim.Data.MSSQL { + /// + /// A MSSQL Interface for the Asset server + /// internal class MSSQLAssetData : AssetDataBase { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -44,6 +47,13 @@ namespace OpenSim.Data.MSSQL #region IAssetProvider Members + /// + /// Migration method + /// + /// Execute "CreateAssetsTable.sql" if tableName == null + /// + /// + /// Name of table private void UpgradeAssetsTable(string tableName) { // null as the version, indicates that the table didn't exist @@ -68,6 +78,11 @@ namespace OpenSim.Data.MSSQL UpgradeAssetsTable(tableList["assets"]); } + /// + /// Fetch Asset from database + /// + /// the asset UUID + /// override public AssetBase FetchAsset(LLUUID assetID) { AssetBase asset = null; @@ -85,6 +100,10 @@ namespace OpenSim.Data.MSSQL return asset; } + /// + /// Create asset in database + /// + /// the asset override public void CreateAsset(AssetBase asset) { if (ExistsAsset((LLUUID) asset.FullID)) @@ -130,7 +149,10 @@ namespace OpenSim.Data.MSSQL } } - + /// + /// Update asset in database + /// + /// the asset override public void UpdateAsset(AssetBase asset) { SqlCommand command = new SqlCommand("UPDATE assets set id = @id, " + @@ -171,6 +193,11 @@ namespace OpenSim.Data.MSSQL } } + /// + /// Check if asset exist in database + /// + /// + /// true if exist. override public bool ExistsAsset(LLUUID uuid) { if (FetchAsset(uuid) != null) @@ -191,13 +218,23 @@ namespace OpenSim.Data.MSSQL #region IPlugin Members + /// + /// Initialises asset interface + /// + /// TODO: this would allow you to pass in connnect info as + /// a string instead of file, if someone writes the support + /// + /// + /// connect string override public void Initialise(string connect) { - // TODO: this would allow you to pass in connnect info as - // a string instead of file, if someone writes the support Initialise(); } + /// + /// Initialises asset interface + /// + /// it use mssql_connection.ini override public void Initialise() { IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini"); @@ -214,12 +251,17 @@ namespace OpenSim.Data.MSSQL TestTables(); } + /// + /// Database provider version. + /// override public string Version { -// get { return database.getVersion(); } get { return database.getVersion(); } } + /// + /// The name of this DB provider. + /// override public string Name { get { return "MSSQL Asset storage engine"; } diff --git a/OpenSim/Data/MSSQL/MSSQLDataStore.cs b/OpenSim/Data/MSSQL/MSSQLDataStore.cs index b230d23754..42eab8ed45 100644 --- a/OpenSim/Data/MSSQL/MSSQLDataStore.cs +++ b/OpenSim/Data/MSSQL/MSSQLDataStore.cs @@ -39,6 +39,9 @@ using OpenSim.Region.Environment.Scenes; namespace OpenSim.Data.MSSQL { + /// + /// A MSSQL Interface for the Region Server. + /// public class MSSQLDataStore : IRegionDataStore { // private static FileSystemDataStore Instance = new FileSystemDataStore(); @@ -67,7 +70,7 @@ namespace OpenSim.Data.MSSQL private DataTable m_landTable; private DataTable m_landAccessListTable; - // Temporary attribute while this is experimental + /// Temporary attribute while this is experimental private bool persistPrimInventories; /*********************************************************************** @@ -76,7 +79,11 @@ namespace OpenSim.Data.MSSQL * **********************************************************************/ - // see IRegionDataStore + /// + /// see IRegionDataStore + /// + /// + /// public void Initialise(string connectionString, bool persistPrimInventories) { // Instance.Initialise("", true); @@ -144,6 +151,11 @@ namespace OpenSim.Data.MSSQL } } + /// + /// + /// + /// + /// public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID) { // Instance.StoreObject(obj, regionUUID); @@ -169,6 +181,11 @@ namespace OpenSim.Data.MSSQL Commit(); } + /// + /// + /// + /// + /// public void RemoveObject(LLUUID obj, LLUUID regionUUID) { // Instance.RemoveObject(obj, regionUUID); @@ -209,6 +226,7 @@ namespace OpenSim.Data.MSSQL /// 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) { String sql = String.Format("primID = '{0}'", uuid); @@ -223,6 +241,7 @@ namespace OpenSim.Data.MSSQL /// /// Load persisted objects from region storage. /// + /// The region UUID public List LoadObjects(LLUUID regionUUID) { // return Instance.LoadObjects(regionUUID); @@ -341,6 +360,11 @@ namespace OpenSim.Data.MSSQL } } + /// + /// Store a terrain revision in region storage. + /// + /// HeightField data + /// Region UUID public void StoreTerrain(double[,] ter, LLUUID regionID) { int revision = Util.UnixTimeSinceEpoch(); @@ -361,6 +385,11 @@ namespace OpenSim.Data.MSSQL } } + /// + /// Load the latest terrain revision from region storage. + /// + /// The Region UUID + /// HeightField Data public double[,] LoadTerrain(LLUUID regionID) { double[,] terret = new double[256, 256]; @@ -407,6 +436,10 @@ namespace OpenSim.Data.MSSQL return terret; } + /// + /// + /// + /// public void RemoveLandObject(LLUUID globalID) { // Instance.RemoveLandObject(globalID); @@ -429,6 +462,10 @@ namespace OpenSim.Data.MSSQL } } + /// + /// + /// + /// public void StoreLandObject(ILandObject parcel) { lock (m_dataSet) @@ -467,6 +504,11 @@ namespace OpenSim.Data.MSSQL Commit(); } + /// + /// + /// + /// The region UUID + /// public List LoadLandObjects(LLUUID regionUUID) { List landDataForRegion = new List(); @@ -492,22 +534,38 @@ namespace OpenSim.Data.MSSQL return landDataForRegion; } + /// + /// Load (fetch?) the region banlist + /// + /// the region UUID + /// the banlist list public List LoadRegionBanList(LLUUID regionUUID) { List regionbanlist = new List(); return regionbanlist; } + /// + /// STUB, add an item into region banlist + /// + /// the item public void AddToRegionBanlist(RegionBanListItem item) { } + /// + /// STUB, remove an item from region banlist + /// + /// public void RemoveFromRegionBanlist(RegionBanListItem item) { } + /// + /// Commit + /// public void Commit() { if (m_connection.State != ConnectionState.Open) @@ -535,6 +593,9 @@ namespace OpenSim.Data.MSSQL } } + /// + /// See + /// public void Shutdown() { Commit(); @@ -548,6 +609,13 @@ namespace OpenSim.Data.MSSQL * **********************************************************************/ + /// + /// + /// + /// + /// + /// + /// private static DataColumn createCol(DataTable dt, string name, Type type) { DataColumn col = new DataColumn(name, type); @@ -555,6 +623,10 @@ namespace OpenSim.Data.MSSQL return col; } + /// + /// Create the "terrain" table + /// + /// the datatable private static DataTable createTerrainTable() { DataTable terrain = new DataTable("terrain"); @@ -566,6 +638,10 @@ namespace OpenSim.Data.MSSQL return terrain; } + /// + /// Create the "prims" table + /// + /// the datatable private static DataTable createPrimTable() { DataTable prims = new DataTable("prims"); @@ -630,6 +706,10 @@ namespace OpenSim.Data.MSSQL return prims; } + /// + /// Create the "land" table + /// + /// the datatable private static DataTable createLandTable() { DataTable land = new DataTable("land"); @@ -673,6 +753,10 @@ namespace OpenSim.Data.MSSQL return land; } + /// + /// Create "landacceslist" table + /// + /// the datatable private static DataTable createLandAccessListTable() { DataTable landaccess = new DataTable("landaccesslist"); @@ -683,6 +767,10 @@ namespace OpenSim.Data.MSSQL return landaccess; } + /// + /// Create "primsshapes" table + /// + /// the datatable private static DataTable createShapeTable() { DataTable shapes = new DataTable("primshapes"); @@ -725,6 +813,10 @@ namespace OpenSim.Data.MSSQL return shapes; } + /// + /// Create "primitems" table + /// + /// the datatable private static DataTable createItemsTable() { DataTable items = new DataTable("primitems"); @@ -766,6 +858,11 @@ namespace OpenSim.Data.MSSQL * **********************************************************************/ + /// + /// + /// + /// + /// private SceneObjectPart buildPrim(DataRow row) { SceneObjectPart prim = new SceneObjectPart(); @@ -891,6 +988,11 @@ namespace OpenSim.Data.MSSQL return taskItem; } + /// + /// + /// + /// + /// private static LandData buildLandData(DataRow row) { LandData newData = new LandData(); @@ -936,6 +1038,11 @@ namespace OpenSim.Data.MSSQL return newData; } + /// + /// + /// + /// + /// private static ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row) { ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); @@ -945,6 +1052,11 @@ namespace OpenSim.Data.MSSQL return entry; } + /// + /// Serialize terrain HeightField + /// + /// the terrain heightfield + /// private static Array serializeTerrain(double[,] val) { MemoryStream str = new MemoryStream(65536 * sizeof(double)); @@ -958,6 +1070,13 @@ namespace OpenSim.Data.MSSQL return str.ToArray(); } + /// + /// + /// + /// + /// + /// + /// private void fillPrimRow(DataRow row, SceneObjectPart prim, LLUUID sceneGroupID, LLUUID regionUUID) { row["UUID"] = prim.UUID; @@ -1034,6 +1153,11 @@ namespace OpenSim.Data.MSSQL } } + /// + /// + /// + /// + /// private static void fillItemRow(DataRow row, TaskInventoryItem taskItem) { row["itemID"] = taskItem.ItemID; @@ -1059,6 +1183,12 @@ namespace OpenSim.Data.MSSQL // row["flags"] = taskItem.Flags; } + /// + /// + /// + /// + /// + /// private static void fillLandRow(DataRow row, LandData land, LLUUID regionUUID) { row["UUID"] = land.globalID.UUID; @@ -1097,6 +1227,12 @@ namespace OpenSim.Data.MSSQL row["UserLookAtZ"] = land.userLookAt.Z; } + /// + /// + /// + /// + /// + /// private static void fillLandAccessRow(DataRow row, ParcelManager.ParcelAccessEntry entry, LLUUID parcelID) { row["LandUUID"] = parcelID.UUID; @@ -1104,6 +1240,11 @@ namespace OpenSim.Data.MSSQL row["Flags"] = entry.Flags; } + /// + /// + /// + /// + /// private static PrimitiveBaseShape buildShape(DataRow row) { PrimitiveBaseShape s = new PrimitiveBaseShape(); @@ -1143,6 +1284,11 @@ namespace OpenSim.Data.MSSQL return s; } + /// + /// + /// + /// + /// private static void fillShapeRow(DataRow row, SceneObjectPart prim) { PrimitiveBaseShape s = prim.Shape; @@ -1179,6 +1325,12 @@ namespace OpenSim.Data.MSSQL row["ExtraParams"] = s.ExtraParams; } + /// + /// + /// + /// + /// + /// private void addPrim(SceneObjectPart prim, LLUUID sceneGroupID, LLUUID regionUUID) { DataTable prims = m_dataSet.Tables["prims"]; @@ -1209,7 +1361,11 @@ namespace OpenSim.Data.MSSQL } } - // see IRegionDatastore + /// + /// See + /// + /// + /// public void StorePrimInventory(LLUUID primID, ICollection items) { if (!persistPrimInventories) @@ -1250,6 +1406,12 @@ namespace OpenSim.Data.MSSQL * **********************************************************************/ + /// + /// Create an Insert command + /// + /// + /// + /// the sql command private static SqlCommand createInsertCommand(string table, DataTable dt) { /** @@ -1285,6 +1447,13 @@ namespace OpenSim.Data.MSSQL return cmd; } + /// + /// Create an update command + /// + /// + /// + /// + /// the sql command private static SqlCommand createUpdateCommand(string table, string pk, DataTable dt) { string sql = "update " + table + " set "; @@ -1312,6 +1481,11 @@ namespace OpenSim.Data.MSSQL return cmd; } + /// + /// + /// + /// + /// private static string defineTable(DataTable dt) { string sql = "create table " + dt.TableName + "("; @@ -1345,14 +1519,18 @@ namespace OpenSim.Data.MSSQL **********************************************************************/ /// + /// /// This is a convenience function that collapses 5 repetitive /// lines for defining SqlParameters 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 Sql parameter private static SqlParameter createSqlParameter(string name, Type type) @@ -1365,6 +1543,11 @@ namespace OpenSim.Data.MSSQL return param; } + /// + /// + /// + /// + /// private void setupPrimCommands(SqlDataAdapter da, SqlConnection conn) { da.InsertCommand = createInsertCommand("prims", m_dataSet.Tables["prims"]); @@ -1379,6 +1562,11 @@ namespace OpenSim.Data.MSSQL da.DeleteCommand = delete; } + /// + /// + /// + /// + /// private void SetupItemsCommands(SqlDataAdapter da, SqlConnection conn) { da.InsertCommand = createInsertCommand("primitems", m_itemsTable); @@ -1393,12 +1581,22 @@ namespace OpenSim.Data.MSSQL da.DeleteCommand = delete; } + /// + /// + /// + /// + /// private void setupTerrainCommands(SqlDataAdapter da, SqlConnection conn) { da.InsertCommand = createInsertCommand("terrain", m_dataSet.Tables["terrain"]); da.InsertCommand.Connection = conn; } + /// + /// + /// + /// + /// private void setupLandCommands(SqlDataAdapter da, SqlConnection conn) { da.InsertCommand = createInsertCommand("land", m_dataSet.Tables["land"]); @@ -1408,12 +1606,22 @@ namespace OpenSim.Data.MSSQL da.UpdateCommand.Connection = conn; } + /// + /// + /// + /// + /// private void setupLandAccessCommands(SqlDataAdapter da, SqlConnection conn) { da.InsertCommand = createInsertCommand("landaccesslist", m_dataSet.Tables["landaccesslist"]); da.InsertCommand.Connection = conn; } + /// + /// + /// + /// + /// private void setupShapeCommands(SqlDataAdapter da, SqlConnection conn) { da.InsertCommand = createInsertCommand("primshapes", m_dataSet.Tables["primshapes"]); @@ -1428,6 +1636,10 @@ namespace OpenSim.Data.MSSQL da.DeleteCommand = delete; } + /// + /// + /// + /// private static void InitDB(SqlConnection conn) { string createPrims = defineTable(createPrimTable()); @@ -1501,6 +1713,11 @@ namespace OpenSim.Data.MSSQL conn.Close(); } + /// + /// + /// + /// + /// private bool TestTables(SqlConnection conn) { SqlCommand primSelectCmd = new SqlCommand(m_primSelect, conn); @@ -1601,6 +1818,11 @@ namespace OpenSim.Data.MSSQL * **********************************************************************/ + /// + /// Type conversion function + /// + /// a Type + /// a DbType private static DbType dbtypeFromType(Type type) { if (type == typeof(String)) diff --git a/OpenSim/Data/MSSQL/MSSQLGridData.cs b/OpenSim/Data/MSSQL/MSSQLGridData.cs index d7adb84533..d67e4639cc 100644 --- a/OpenSim/Data/MSSQL/MSSQLGridData.cs +++ b/OpenSim/Data/MSSQL/MSSQLGridData.cs @@ -37,7 +37,7 @@ using log4net; namespace OpenSim.Data.MSSQL { /// - /// A grid data interface for Microsoft SQL Server + /// A grid data interface for MSSQL Server /// public class MSSQLGridData : GridDataBase { @@ -53,6 +53,8 @@ namespace OpenSim.Data.MSSQL /// /// Initialises the Grid Interface /// + /// connect string + /// use mssql_connection.ini override public void Initialise(string connect) { // TODO: make the connect string actually do something @@ -77,6 +79,9 @@ namespace OpenSim.Data.MSSQL TestTables(); } + /// + /// + /// private void TestTables() { IDbCommand cmd = database.Query("SELECT TOP 1 * FROM "+m_regionsTableName, new Dictionary()); @@ -102,7 +107,7 @@ namespace OpenSim.Data.MSSQL } /// - /// Returns the storage system name + /// The name of this DB provider. /// /// A string containing the storage system name override public string getName() @@ -111,7 +116,7 @@ namespace OpenSim.Data.MSSQL } /// - /// Returns the storage system version + /// Database provider version. /// /// A string containing the storage system version override public string getVersion() @@ -120,13 +125,15 @@ namespace OpenSim.Data.MSSQL } /// + /// NOT IMPLEMENTED, /// Returns a list of regions within the specified ranges /// /// minimum X coordinate /// minimum Y coordinate /// maximum X coordinate /// maximum Y coordinate - /// An array of region profiles + /// null + /// always return null override public RegionProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) { return null; @@ -240,6 +247,11 @@ namespace OpenSim.Data.MSSQL } } + /// + /// Update the specified region in the database + /// + /// The profile to update + /// A dataresponse enum indicating success public override DataResponse UpdateProfile(RegionProfileData profile) { if (updateRegionRow(profile)) @@ -252,6 +264,11 @@ namespace OpenSim.Data.MSSQL } } + /// + /// Update the specified region in the database + /// + /// The profile to update + /// success ? public bool updateRegionRow(RegionProfileData profile) { //Insert new region @@ -425,6 +442,12 @@ namespace OpenSim.Data.MSSQL return false; } + /// + /// NOT IMPLEMENTED + /// + /// + /// + /// null override public ReservationData GetReservationAtPoint(uint x, uint y) { return null; diff --git a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs index b92eeab3ed..3177325080 100644 --- a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs +++ b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs @@ -37,7 +37,7 @@ using OpenSim.Framework; namespace OpenSim.Data.MSSQL { /// - /// A MySQL interface for the inventory server + /// A MSSQL interface for the inventory server /// public class MSSQLInventoryData : IInventoryData { @@ -59,6 +59,11 @@ namespace OpenSim.Data.MSSQL /// private MSSQLManager database; + /// + /// Loads and initialises the MSSQL inventory storage interface + /// + /// connect string + /// use mssql_connection.ini public void Initialise(string connect) { // TODO: actually use the provided connect string @@ -77,6 +82,10 @@ namespace OpenSim.Data.MSSQL #region Test and initialization code + /// + /// Execute "CreateFoldersTable.sql" if tableName == null + /// + /// the table name private void UpgradeFoldersTable(string tableName) { // null as the version, indicates that the table didn't exist @@ -88,6 +97,10 @@ namespace OpenSim.Data.MSSQL } } + /// + /// Execute "CreateItemsTable.sql" if tableName = null + /// + /// the table name private void UpgradeItemsTable(string tableName) { // null as the version, indicates that the table didn't exist @@ -99,6 +112,9 @@ namespace OpenSim.Data.MSSQL } } + /// + /// + /// private void TestTables() { Dictionary tableList = new Dictionary(); @@ -117,7 +133,7 @@ namespace OpenSim.Data.MSSQL /// /// The name of this DB provider /// - /// Name of DB provider + /// A string containing the name of the DB provider public string getName() { return "MSSQL Inventory Data Interface"; @@ -215,7 +231,11 @@ namespace OpenSim.Data.MSSQL } } - // see InventoryItemBase.getUserRootFolder + /// + /// see InventoryItemBase.getUserRootFolder + /// + /// the User UUID + /// public InventoryFolderBase getUserRootFolder(LLUUID user) { try @@ -549,9 +569,9 @@ namespace OpenSim.Data.MSSQL } /// - /// + /// Delete an item in inventory database /// - /// + /// the item UUID public void deleteInventoryItem(LLUUID itemID) { try @@ -690,6 +710,10 @@ namespace OpenSim.Data.MSSQL return folders; } + /// + /// Delete a folder in inventory databasae + /// + /// the folder UUID protected void deleteOneFolder(LLUUID folderID) { try @@ -708,6 +732,10 @@ namespace OpenSim.Data.MSSQL } } + /// + /// Delete an item in inventory database + /// + /// the item ID protected void deleteItemsInFolder(LLUUID folderID) { try diff --git a/OpenSim/Data/MSSQL/MSSQLManager.cs b/OpenSim/Data/MSSQL/MSSQLManager.cs index 3221b3ab5d..a170a874ee 100644 --- a/OpenSim/Data/MSSQL/MSSQLManager.cs +++ b/OpenSim/Data/MSSQL/MSSQLManager.cs @@ -108,12 +108,23 @@ namespace OpenSim.Data.MSSQL // return regions; //} + /// + /// + /// + /// + /// + /// protected static void createCol(DataTable dt, string name, Type type) { DataColumn col = new DataColumn(name, type); dt.Columns.Add(col); } + /// + /// + /// + /// + /// protected static string defineTable(DataTable dt) { string sql = "create table " + dt.TableName + "("; @@ -137,9 +148,12 @@ namespace OpenSim.Data.MSSQL return sql; } - - // this is something we'll need to implement for each db - // slightly differently. + /// + /// Type conversion function + /// + /// a type + /// a sqltype + /// this is something we'll need to implement for each db slightly differently. public static string SqlType(Type type) { if (type == typeof(String)) @@ -375,6 +389,11 @@ namespace OpenSim.Data.MSSQL return retval; } + /// + /// + /// + /// + /// public AssetBase getAssetRow(IDataReader reader) { AssetBase asset = new AssetBase(); @@ -446,7 +465,7 @@ namespace OpenSim.Data.MSSQL /// /// Execute a SQL statement stored in a resource, as a string /// - /// + /// the ressource string public void ExecuteResourceSql(string name) { SqlCommand cmd = new SqlCommand(getResourceString(name), (SqlConnection)dbcon); @@ -454,6 +473,10 @@ namespace OpenSim.Data.MSSQL cmd.Dispose(); } + /// + /// + /// + /// The actual SqlConnection public SqlConnection getConnection() { return (SqlConnection)dbcon; @@ -491,6 +514,11 @@ namespace OpenSim.Data.MSSQL } } + /// + /// + /// + /// + /// private string getResourceString(string name) { Assembly assem = GetType().Assembly; diff --git a/OpenSim/Data/MSSQL/MSSQLUserData.cs b/OpenSim/Data/MSSQL/MSSQLUserData.cs index 8714e2be3f..cb5ba241ee 100644 --- a/OpenSim/Data/MSSQL/MSSQLUserData.cs +++ b/OpenSim/Data/MSSQL/MSSQLUserData.cs @@ -53,8 +53,10 @@ namespace OpenSim.Data.MSSQL private string m_userFriendsTableName; /// - /// Loads and initialises the MySQL storage plugin + /// Loads and initialises the MSSQL storage plugin /// + /// TODO: do something with the connect string instead of ignoring it. + /// use mssql_connection.ini override public void Initialise(string connect) { // TODO: do something with the connect string instead of @@ -92,6 +94,10 @@ namespace OpenSim.Data.MSSQL TestTables(); } + /// + /// + /// + /// private bool TestTables() { IDbCommand cmd; @@ -128,6 +134,7 @@ namespace OpenSim.Data.MSSQL return true; } + /// /// Searches the database for a specified user profile by name components /// @@ -166,6 +173,12 @@ namespace OpenSim.Data.MSSQL #region User Friends List Data + /// + /// Add a new friend in the friendlist + /// + /// UUID of the friendlist owner + /// Friend's UUID + /// Permission flag override public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms) { int dtvalue = Util.UnixTimeSinceEpoch(); @@ -209,6 +222,11 @@ namespace OpenSim.Data.MSSQL } } + /// + /// Remove an friend from the friendlist + /// + /// UUID of the friendlist owner + /// UUID of the not-so-friendly user to remove from the list override public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend) { Dictionary param = new Dictionary(); @@ -242,6 +260,12 @@ namespace OpenSim.Data.MSSQL } } + /// + /// Update friendlist permission flag for a friend + /// + /// UUID of the friendlist owner + /// UUID of the friend + /// new permission flag override public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms) { Dictionary param = new Dictionary(); @@ -272,7 +296,11 @@ namespace OpenSim.Data.MSSQL } } - + /// + /// Get (fetch?) the user's friendlist + /// + /// UUID of the friendlist owner + /// Friendlist list override public List GetUserFriendList(LLUUID friendlistowner) { List Lfli = new List(); @@ -321,13 +349,23 @@ namespace OpenSim.Data.MSSQL #endregion + /// + /// STUB ! Update current region + /// + /// avatar uuid + /// region uuid + /// region handle override public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid, ulong regionhandle) { //m_log.Info("[USER]: Stub UpdateUserCUrrentRegion called"); } - - + /// + /// + /// + /// + /// + /// override public List GeneratePickerResults(LLUUID queryID, string query) { List returnlist = new List(); @@ -407,7 +445,11 @@ namespace OpenSim.Data.MSSQL return returnlist; } - // See IUserData + /// + /// See IUserData + /// + /// + /// override public UserProfileData GetUserByUUID(LLUUID uuid) { try @@ -490,6 +532,13 @@ namespace OpenSim.Data.MSSQL return null; } } + + /// + /// Store a weblogin key + /// + /// The agent UUID + /// the WebLogin Key + /// unused ? override public void StoreWebLoginKey(LLUUID AgentID, LLUUID WebLoginKey) { UserProfileData user = GetUserByUUID(AgentID); @@ -626,7 +675,11 @@ namespace OpenSim.Data.MSSQL // Do nothing. } - + /// + /// update a user profile + /// + /// the profile to update + /// override public bool UpdateUserProfile(UserProfileData user) { SqlCommand command = new SqlCommand("UPDATE " + m_usersTableName + " set UUID = @uuid, " + @@ -726,7 +779,7 @@ namespace OpenSim.Data.MSSQL /// The senders account ID /// The receivers account ID /// The amount to transfer - /// Success? + /// false override public bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount) { return false; @@ -739,7 +792,7 @@ namespace OpenSim.Data.MSSQL /// The senders account ID /// The receivers account ID /// The item to transfer - /// Success? + /// false override public bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item) { return false; @@ -832,6 +885,11 @@ namespace OpenSim.Data.MSSQL return null; } + /// + /// Update a user appearence into database + /// + /// the used UUID + /// the appearence override public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance) { string sql = String.Empty; @@ -893,16 +951,32 @@ namespace OpenSim.Data.MSSQL return; } + /// + /// add an attachement to an avatar + /// + /// the avatar UUID + /// the item UUID override public void AddAttachment(LLUUID user, LLUUID item) { return; } + /// + /// Remove an attachement from an avatar + /// + /// the avatar UUID + /// the item UUID override public void RemoveAttachment(LLUUID user, LLUUID item) { return; } + /// + /// get (fetch?) all attached item to an avatar + /// + /// the avatar UUID + /// List of attached item + /// return an empty list override public List GetAttachments(LLUUID user) { return new List();