aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLAssetData.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MySQL/MySQLAssetData.cs61
1 files changed, 42 insertions, 19 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs
index a29e11b..a64a256 100644
--- a/OpenSim/Data/MySQL/MySQLAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLAssetData.cs
@@ -36,6 +36,9 @@ using OpenSim.Framework;
36 36
37namespace OpenSim.Data.MySQL 37namespace OpenSim.Data.MySQL
38{ 38{
39 /// <summary>
40 /// A MySQL Interface for the Asset Server
41 /// </summary>
39 internal class MySQLAssetData : AssetDataBase, IPlugin 42 internal class MySQLAssetData : AssetDataBase, IPlugin
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);
@@ -45,12 +48,16 @@ namespace OpenSim.Data.MySQL
45 #region IPlugin Members 48 #region IPlugin Members
46 49
47 /// <summary> 50 /// <summary>
48 /// Initialises Asset interface 51 /// <para>Initialises Asset interface</para>
49 /// Loads and initialises the MySQL storage plugin 52 /// <para>
50 /// Warns and uses the obsolete mysql_connection.ini if connect string is empty. 53 /// <list type="bullet">
51 /// Check for migration 54 /// <item>Loads and initialises the MySQL storage plugin.</item>
55 /// <item>Warns and uses the obsolete mysql_connection.ini if connect string is empty.</item>
56 /// <item>Check for migration</item>
57 /// </list>
58 /// </para>
52 /// </summary> 59 /// </summary>
53 /// <param name="connect">connect string.</param> 60 /// <param name="connect">connect string</param>
54 override public void Initialise(string connect) 61 override public void Initialise(string connect)
55 { 62 {
56 // TODO: This will let you pass in the connect string in 63 // TODO: This will let you pass in the connect string in
@@ -78,10 +85,16 @@ namespace OpenSim.Data.MySQL
78 } 85 }
79 86
80 /// <summary> 87 /// <summary>
81 /// uses the obsolete mysql_connection.ini 88 /// <para>Initialises Asset interface</para>
89 /// <para>
90 /// <list type="bullet">
91 /// <item>Loads and initialises the MySQL storage plugin</item>
92 /// <item>uses the obsolete mysql_connection.ini</item>
93 /// </list>
94 /// </para>
82 /// </summary> 95 /// </summary>
83 /// <param name="connect">connect string.</param> 96 /// <param name="connect">connect string</param>
84 /// <remarks>Probably deprecated and shouldn't be used</remarks> 97 /// <remarks>Probably DEPRECATED and shouldn't be used</remarks>
85 override public void Initialise() 98 override public void Initialise()
86 { 99 {
87 IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini"); 100 IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
@@ -98,6 +111,13 @@ namespace OpenSim.Data.MySQL
98 111
99 #region IAssetProvider Members 112 #region IAssetProvider Members
100 113
114 /// <summary>
115 /// <list type="bullet">
116 /// <item>Execute CreateAssetsTable.sql if oldVersion == null</item>
117 /// <item>do nothing if oldVersion != null</item>
118 /// </list>
119 /// </summary>
120 /// <param name="oldVersion"></param>
101 private void UpgradeAssetsTable(string oldVersion) 121 private void UpgradeAssetsTable(string oldVersion)
102 { 122 {
103 // null as the version, indicates that the table didn't exist 123 // null as the version, indicates that the table didn't exist
@@ -112,6 +132,7 @@ namespace OpenSim.Data.MySQL
112 /// <summary> 132 /// <summary>
113 /// Ensure that the assets related tables exists and are at the latest version 133 /// Ensure that the assets related tables exists and are at the latest version
114 /// </summary> 134 /// </summary>
135 /// <param name="m"></param>
115 private void TestTables(Migration m) 136 private void TestTables(Migration m)
116 { 137 {
117 Dictionary<string, string> tableList = new Dictionary<string, string>(); 138 Dictionary<string, string> tableList = new Dictionary<string, string>();
@@ -129,10 +150,11 @@ namespace OpenSim.Data.MySQL
129 } 150 }
130 151
131 /// <summary> 152 /// <summary>
132 /// 153 /// Fetch Asset <paramref name="assetID"/> from database
133 /// </summary> 154 /// </summary>
134 /// <param name="assetID"></param> 155 /// <param name="assetID">Asset UUID to fetch</param>
135 /// <returns></returns> 156 /// <returns>Return the asset</returns>
157 /// <remarks>On failure : throw an exception and attempt to reconnect to database</remarks>
136 override public AssetBase FetchAsset(LLUUID assetID) 158 override public AssetBase FetchAsset(LLUUID assetID)
137 { 159 {
138 AssetBase asset = null; 160 AssetBase asset = null;
@@ -175,9 +197,10 @@ namespace OpenSim.Data.MySQL
175 } 197 }
176 198
177 /// <summary> 199 /// <summary>
178 /// 200 /// Create an asset in database, or update it if existing.
179 /// </summary> 201 /// </summary>
180 /// <param name="asset"></param> 202 /// <param name="asset">Asset UUID to create</param>
203 /// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks>
181 override public void CreateAsset(AssetBase asset) 204 override public void CreateAsset(AssetBase asset)
182 { 205 {
183 lock (_dbConnection) 206 lock (_dbConnection)
@@ -224,19 +247,19 @@ namespace OpenSim.Data.MySQL
224 } 247 }
225 248
226 /// <summary> 249 /// <summary>
227 /// 250 /// Update a asset in database, see <see cref="CreateAsset"/>
228 /// </summary> 251 /// </summary>
229 /// <param name="asset"></param> 252 /// <param name="asset">Asset UUID to update</param>
230 override public void UpdateAsset(AssetBase asset) 253 override public void UpdateAsset(AssetBase asset)
231 { 254 {
232 CreateAsset(asset); 255 CreateAsset(asset);
233 } 256 }
234 257
235 /// <summary> 258 /// <summary>
236 /// 259 /// check if the asset UUID exist in database
237 /// </summary> 260 /// </summary>
238 /// <param name="uuid"></param> 261 /// <param name="uuid">The asset UUID</param>
239 /// <returns></returns> 262 /// <returns>true if exist.</returns>
240 override public bool ExistsAsset(LLUUID uuid) 263 override public bool ExistsAsset(LLUUID uuid)
241 { 264 {
242 bool assetExists = false; 265 bool assetExists = false;
@@ -285,7 +308,7 @@ namespace OpenSim.Data.MySQL
285 #endregion 308 #endregion
286 309
287 /// <summary> 310 /// <summary>
288 /// database provider version 311 /// Database provider version
289 /// </summary> 312 /// </summary>
290 override public string Version 313 override public string Version
291 { 314 {