From 67e12b95ea7b68f4904a7484d77ecfd787d16d0c Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Tue, 30 Oct 2007 09:05:31 +0000 Subject: * Optimized usings * Shortened type references * Removed redundant 'this' qualifier --- OpenSim/Framework/Data.MySQL/MySQLAssetData.cs | 43 ++++++++++++++------------ 1 file changed, 23 insertions(+), 20 deletions(-) (limited to 'OpenSim/Framework/Data.MySQL/MySQLAssetData.cs') diff --git a/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs b/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs index bf895c0..055cd92 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs @@ -28,18 +28,17 @@ using System; using System.Collections.Generic; -using MySql.Data.MySqlClient; - +using System.Data; using libsecondlife; +using MySql.Data.MySqlClient; using OpenSim.Framework.Console; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework; namespace OpenSim.Framework.Data.MySQL { - class MySQLAssetData : IAssetProvider + internal class MySQLAssetData : IAssetProvider { - MySQLManager _dbConnection; + private MySQLManager _dbConnection; + #region IAssetProvider Members private void UpgradeAssetsTable(string oldVersion) @@ -58,14 +57,12 @@ namespace OpenSim.Framework.Data.MySQL /// private void TestTables() { - Dictionary tableList = new Dictionary(); tableList["assets"] = null; _dbConnection.GetTableVersion(tableList); UpgradeAssetsTable(tableList["assets"]); - } public AssetBase FetchAsset(LLUUID assetID) @@ -73,21 +70,24 @@ namespace OpenSim.Framework.Data.MySQL AssetBase asset = null; lock (_dbConnection) { - MySqlCommand cmd = new MySqlCommand("SELECT name, description, assetType, invType, local, temporary, data FROM assets WHERE id=?id", _dbConnection.Connection); + MySqlCommand cmd = + new MySqlCommand( + "SELECT name, description, assetType, invType, local, temporary, data FROM assets WHERE id=?id", + _dbConnection.Connection); MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16); p.Value = assetID.GetBytes(); - using (MySqlDataReader dbReader = cmd.ExecuteReader(System.Data.CommandBehavior.SingleRow)) + using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow)) { if (dbReader.Read()) { asset = new AssetBase(); - asset.Data = (byte[])dbReader["data"]; - asset.Description = (string)dbReader["description"]; + asset.Data = (byte[]) dbReader["data"]; + asset.Description = (string) dbReader["description"]; asset.FullID = assetID; - asset.InvType = (sbyte)dbReader["invType"]; - asset.Local = ((sbyte)dbReader["local"]) != 0 ? true : false; - asset.Name = (string)dbReader["name"]; - asset.Type = (sbyte)dbReader["assetType"]; + asset.InvType = (sbyte) dbReader["invType"]; + asset.Local = ((sbyte) dbReader["local"]) != 0 ? true : false; + asset.Name = (string) dbReader["name"]; + asset.Type = (sbyte) dbReader["assetType"]; } } } @@ -96,8 +96,11 @@ namespace OpenSim.Framework.Data.MySQL public void CreateAsset(AssetBase asset) { - MySqlCommand cmd = new MySqlCommand("REPLACE INTO assets(id, name, description, assetType, invType, local, temporary, data)" + - "VALUES(?id, ?name, ?description, ?assetType, ?invType, ?local, ?temporary, ?data)", _dbConnection.Connection); + MySqlCommand cmd = + new MySqlCommand( + "REPLACE INTO assets(id, name, description, assetType, invType, local, temporary, data)" + + "VALUES(?id, ?name, ?description, ?assetType, ?invType, ?local, ?temporary, ?data)", + _dbConnection.Connection); MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16); p.Value = asset.FullID.GetBytes(); cmd.Parameters.AddWithValue("?name", asset.Name); @@ -148,7 +151,7 @@ namespace OpenSim.Framework.Data.MySQL public string Version { - get { return _dbConnection.getVersion(); } + get { return _dbConnection.getVersion(); } } public string Name @@ -158,4 +161,4 @@ namespace OpenSim.Framework.Data.MySQL #endregion } -} +} \ No newline at end of file -- cgit v1.1