diff options
Diffstat (limited to 'OpenSim/Data/MSSQL/MSSQLAssetData.cs')
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLAssetData.cs | 50 |
1 files changed, 46 insertions, 4 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs index 12a03eb..50e2e3a 100644 --- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs +++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs | |||
@@ -36,6 +36,9 @@ using OpenSim.Framework; | |||
36 | 36 | ||
37 | namespace OpenSim.Data.MSSQL | 37 | namespace OpenSim.Data.MSSQL |
38 | { | 38 | { |
39 | /// <summary> | ||
40 | /// A MSSQL Interface for the Asset server | ||
41 | /// </summary> | ||
39 | internal class MSSQLAssetData : AssetDataBase | 42 | internal class MSSQLAssetData : AssetDataBase |
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); |
@@ -44,6 +47,13 @@ namespace OpenSim.Data.MSSQL | |||
44 | 47 | ||
45 | #region IAssetProvider Members | 48 | #region IAssetProvider Members |
46 | 49 | ||
50 | /// <summary> | ||
51 | /// Migration method | ||
52 | /// <list type="bullet"> | ||
53 | /// <item>Execute "CreateAssetsTable.sql" if tableName == null</item> | ||
54 | /// </list> | ||
55 | /// </summary> | ||
56 | /// <param name="tableName">Name of table</param> | ||
47 | private void UpgradeAssetsTable(string tableName) | 57 | private void UpgradeAssetsTable(string tableName) |
48 | { | 58 | { |
49 | // null as the version, indicates that the table didn't exist | 59 | // null as the version, indicates that the table didn't exist |
@@ -68,6 +78,11 @@ namespace OpenSim.Data.MSSQL | |||
68 | UpgradeAssetsTable(tableList["assets"]); | 78 | UpgradeAssetsTable(tableList["assets"]); |
69 | } | 79 | } |
70 | 80 | ||
81 | /// <summary> | ||
82 | /// Fetch Asset from database | ||
83 | /// </summary> | ||
84 | /// <param name="assetID">the asset UUID</param> | ||
85 | /// <returns></returns> | ||
71 | override public AssetBase FetchAsset(LLUUID assetID) | 86 | override public AssetBase FetchAsset(LLUUID assetID) |
72 | { | 87 | { |
73 | AssetBase asset = null; | 88 | AssetBase asset = null; |
@@ -85,6 +100,10 @@ namespace OpenSim.Data.MSSQL | |||
85 | return asset; | 100 | return asset; |
86 | } | 101 | } |
87 | 102 | ||
103 | /// <summary> | ||
104 | /// Create asset in database | ||
105 | /// </summary> | ||
106 | /// <param name="asset">the asset</param> | ||
88 | override public void CreateAsset(AssetBase asset) | 107 | override public void CreateAsset(AssetBase asset) |
89 | { | 108 | { |
90 | if (ExistsAsset((LLUUID) asset.FullID)) | 109 | if (ExistsAsset((LLUUID) asset.FullID)) |
@@ -130,7 +149,10 @@ namespace OpenSim.Data.MSSQL | |||
130 | } | 149 | } |
131 | } | 150 | } |
132 | 151 | ||
133 | 152 | /// <summary> | |
153 | /// Update asset in database | ||
154 | /// </summary> | ||
155 | /// <param name="asset">the asset</param> | ||
134 | override public void UpdateAsset(AssetBase asset) | 156 | override public void UpdateAsset(AssetBase asset) |
135 | { | 157 | { |
136 | SqlCommand command = new SqlCommand("UPDATE assets set id = @id, " + | 158 | SqlCommand command = new SqlCommand("UPDATE assets set id = @id, " + |
@@ -171,6 +193,11 @@ namespace OpenSim.Data.MSSQL | |||
171 | } | 193 | } |
172 | } | 194 | } |
173 | 195 | ||
196 | /// <summary> | ||
197 | /// Check if asset exist in database | ||
198 | /// </summary> | ||
199 | /// <param name="uuid"></param> | ||
200 | /// <returns>true if exist.</returns> | ||
174 | override public bool ExistsAsset(LLUUID uuid) | 201 | override public bool ExistsAsset(LLUUID uuid) |
175 | { | 202 | { |
176 | if (FetchAsset(uuid) != null) | 203 | if (FetchAsset(uuid) != null) |
@@ -191,13 +218,23 @@ namespace OpenSim.Data.MSSQL | |||
191 | 218 | ||
192 | #region IPlugin Members | 219 | #region IPlugin Members |
193 | 220 | ||
221 | /// <summary> | ||
222 | /// <para>Initialises asset interface</para> | ||
223 | /// <para> | ||
224 | /// TODO: this would allow you to pass in connnect info as | ||
225 | /// a string instead of file, if someone writes the support | ||
226 | /// </para> | ||
227 | /// </summary> | ||
228 | /// <param name="connect">connect string</param> | ||
194 | override public void Initialise(string connect) | 229 | override public void Initialise(string connect) |
195 | { | 230 | { |
196 | // TODO: this would allow you to pass in connnect info as | ||
197 | // a string instead of file, if someone writes the support | ||
198 | Initialise(); | 231 | Initialise(); |
199 | } | 232 | } |
200 | 233 | ||
234 | /// <summary> | ||
235 | /// Initialises asset interface | ||
236 | /// </summary> | ||
237 | /// <remarks>it use mssql_connection.ini</remarks> | ||
201 | override public void Initialise() | 238 | override public void Initialise() |
202 | { | 239 | { |
203 | IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini"); | 240 | IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini"); |
@@ -214,12 +251,17 @@ namespace OpenSim.Data.MSSQL | |||
214 | TestTables(); | 251 | TestTables(); |
215 | } | 252 | } |
216 | 253 | ||
254 | /// <summary> | ||
255 | /// Database provider version. | ||
256 | /// </summary> | ||
217 | override public string Version | 257 | override public string Version |
218 | { | 258 | { |
219 | // get { return database.getVersion(); } | ||
220 | get { return database.getVersion(); } | 259 | get { return database.getVersion(); } |
221 | } | 260 | } |
222 | 261 | ||
262 | /// <summary> | ||
263 | /// The name of this DB provider. | ||
264 | /// </summary> | ||
223 | override public string Name | 265 | override public string Name |
224 | { | 266 | { |
225 | get { return "MSSQL Asset storage engine"; } | 267 | get { return "MSSQL Asset storage engine"; } |