diff options
Diffstat (limited to 'OpenSim/Data/MSSQL/MSSQLAssetData.cs')
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLAssetData.cs | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs index f3e008d..ce70396 100644 --- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs +++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs | |||
@@ -225,17 +225,38 @@ namespace OpenSim.Data.MSSQL | |||
225 | // } | 225 | // } |
226 | 226 | ||
227 | /// <summary> | 227 | /// <summary> |
228 | /// Check if asset exist in m_database | 228 | /// Check if the assets exist in the database. |
229 | /// </summary> | 229 | /// </summary> |
230 | /// <param name="uuid"></param> | 230 | /// <param name="uuids">The assets' IDs</param> |
231 | /// <returns>true if exist.</returns> | 231 | /// <returns>For each asset: true if it exists, false otherwise</returns> |
232 | override public bool ExistsAsset(UUID uuid) | 232 | public override bool[] AssetsExist(UUID[] uuids) |
233 | { | 233 | { |
234 | if (GetAsset(uuid) != null) | 234 | if (uuids.Length == 0) |
235 | return new bool[0]; | ||
236 | |||
237 | HashSet<UUID> exist = new HashSet<UUID>(); | ||
238 | |||
239 | string ids = "'" + string.Join("','", uuids) + "'"; | ||
240 | string sql = string.Format("SELECT id FROM assets WHERE id IN ({0})", ids); | ||
241 | |||
242 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
243 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
235 | { | 244 | { |
236 | return true; | 245 | conn.Open(); |
246 | using (SqlDataReader reader = cmd.ExecuteReader()) | ||
247 | { | ||
248 | while (reader.Read()) | ||
249 | { | ||
250 | UUID id = DBGuid.FromDB(reader["id"]); | ||
251 | exist.Add(id); | ||
252 | } | ||
253 | } | ||
237 | } | 254 | } |
238 | return false; | 255 | |
256 | bool[] results = new bool[uuids.Length]; | ||
257 | for (int i = 0; i < uuids.Length; i++) | ||
258 | results[i] = exist.Contains(uuids[i]); | ||
259 | return results; | ||
239 | } | 260 | } |
240 | 261 | ||
241 | /// <summary> | 262 | /// <summary> |