From 5e7dba726896fcb84882b53952651742926e6efb Mon Sep 17 00:00:00 2001 From: Tleiades Hax Date: Fri, 26 Oct 2007 11:46:27 +0000 Subject: Very early first implementation of grid based assets. Run this on a major grid, and weep --- OpenSim/Framework/Data.MySQL/MySQLAssetData.cs | 30 ++++++++++++++------------ 1 file changed, 16 insertions(+), 14 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 a8f0fdb..0112474 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs @@ -71,22 +71,24 @@ namespace OpenSim.Framework.Data.MySQL public AssetBase FetchAsset(LLUUID assetID) { AssetBase asset = null; - - 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)) + lock (_dbConnection) { - if (dbReader.Read()) + 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)) { - asset = new AssetBase(); - 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"]; + if (dbReader.Read()) + { + asset = new AssetBase(); + 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"]; + } } } return asset; -- cgit v1.1