aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/PGSQL/PGSQLXAssetData.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data/PGSQL/PGSQLXAssetData.cs')
-rw-r--r--OpenSim/Data/PGSQL/PGSQLXAssetData.cs37
1 files changed, 37 insertions, 0 deletions
diff --git a/OpenSim/Data/PGSQL/PGSQLXAssetData.cs b/OpenSim/Data/PGSQL/PGSQLXAssetData.cs
index e959619..c6cebff 100644
--- a/OpenSim/Data/PGSQL/PGSQLXAssetData.cs
+++ b/OpenSim/Data/PGSQL/PGSQLXAssetData.cs
@@ -407,6 +407,43 @@ namespace OpenSim.Data.PGSQL
407 } 407 }
408 408
409 /// <summary> 409 /// <summary>
410 /// Check if the assets exist in the database.
411 /// </summary>
412 /// <param name="uuids">The assets' IDs</param>
413 /// <returns>For each asset: true if it exists, false otherwise</returns>
414 public bool[] AssetsExist(UUID[] uuids)
415 {
416 if (uuids.Length == 0)
417 return new bool[0];
418
419 HashSet<UUID> exist = new HashSet<UUID>();
420
421 string ids = "'" + string.Join("','", uuids) + "'";
422 string sql = string.Format(@"SELECT ""ID"" FROM XAssetsMeta WHERE ""ID"" IN ({0})", ids);
423
424 using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
425 {
426 conn.Open();
427 using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
428 {
429 using (NpgsqlDataReader reader = cmd.ExecuteReader())
430 {
431 while (reader.Read())
432 {
433 UUID id = DBGuid.FromDB(reader["id"]);
434 exist.Add(id);
435 }
436 }
437 }
438 }
439
440 bool[] results = new bool[uuids.Length];
441 for (int i = 0; i < uuids.Length; i++)
442 results[i] = exist.Contains(uuids[i]);
443 return results;
444 }
445
446 /// <summary>
410 /// Check if the asset exists in the database 447 /// Check if the asset exists in the database
411 /// </summary> 448 /// </summary>
412 /// <param name="uuid">The asset UUID</param> 449 /// <param name="uuid">The asset UUID</param>