aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MySQL/MySQLXAssetData.cs52
1 files changed, 31 insertions, 21 deletions
diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs
index e519a94..9f9c9cf 100644
--- a/OpenSim/Data/MySQL/MySQLXAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs
@@ -131,6 +131,7 @@ namespace OpenSim.Data.MySQL
131// m_log.DebugFormat("[MYSQL XASSET DATA]: Looking for asset {0}", assetID); 131// m_log.DebugFormat("[MYSQL XASSET DATA]: Looking for asset {0}", assetID);
132 132
133 AssetBase asset = null; 133 AssetBase asset = null;
134 int accessTime = 0;
134 135
135 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 136 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
136 { 137 {
@@ -141,7 +142,6 @@ namespace OpenSim.Data.MySQL
141 dbcon)) 142 dbcon))
142 { 143 {
143 cmd.Parameters.AddWithValue("?ID", assetID.ToString()); 144 cmd.Parameters.AddWithValue("?ID", assetID.ToString());
144
145 try 145 try
146 { 146 {
147 using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow)) 147 using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
@@ -160,25 +160,7 @@ namespace OpenSim.Data.MySQL
160 160
161 asset.Temporary = Convert.ToBoolean(dbReader["Temporary"]); 161 asset.Temporary = Convert.ToBoolean(dbReader["Temporary"]);
162 asset.Flags = (AssetFlags)Convert.ToInt32(dbReader["AssetFlags"]); 162 asset.Flags = (AssetFlags)Convert.ToInt32(dbReader["AssetFlags"]);
163 163 accessTime = (int)dbReader["AccessTime"];
164 if (m_enableCompression)
165 {
166 using(MemoryStream ms = new MemoryStream(asset.Data))
167 using(GZipStream decompressionStream = new GZipStream(ms, CompressionMode.Decompress))
168 {
169 using(MemoryStream outputStream = new MemoryStream())
170 {
171 decompressionStream.CopyTo(outputStream, int.MaxValue);
172// int compressedLength = asset.Data.Length;
173 asset.Data = outputStream.ToArray();
174 }
175// m_log.DebugFormat(
176// "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}",
177// asset.ID, asset.Name, asset.Data.Length, compressedLength);
178 }
179 }
180
181 UpdateAccessTime(asset.Metadata, (int)dbReader["AccessTime"]);
182 } 164 }
183 } 165 }
184 } 166 }
@@ -190,7 +172,35 @@ namespace OpenSim.Data.MySQL
190 dbcon.Close(); 172 dbcon.Close();
191 } 173 }
192 174
193 return asset; 175 if(asset == null)
176 return asset;
177
178 if(accessTime > 0)
179 {
180 try
181 {
182 UpdateAccessTime(asset.Metadata, accessTime);
183 }
184 catch { }
185 }
186
187 if (m_enableCompression && asset.Data != null)
188 {
189 using(MemoryStream ms = new MemoryStream(asset.Data))
190 using(GZipStream decompressionStream = new GZipStream(ms, CompressionMode.Decompress))
191 {
192 using(MemoryStream outputStream = new MemoryStream())
193 {
194 decompressionStream.CopyTo(outputStream, int.MaxValue);
195// int compressedLength = asset.Data.Length;
196 asset.Data = outputStream.ToArray();
197 }
198// m_log.DebugFormat(
199// "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}",
200// asset.ID, asset.Name, asset.Data.Length, compressedLength);
201 }
202 }
203 return asset;
194 } 204 }
195 205
196 /// <summary> 206 /// <summary>