workaround potencial memory leaks
parent
52a80f1742
commit
5d5bad5fc1
|
@ -316,9 +316,9 @@ namespace OpenSim.Data.MySQL
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
MySqlCommand cmd = conn.CreateCommand();
|
using(MySqlCommand cmd = conn.CreateCommand())
|
||||||
|
{
|
||||||
cmd.CommandText = String.Format("select count(*) as count from {0}", m_Table);
|
cmd.CommandText = String.Format("select count(*) as count from {0}",m_Table);
|
||||||
|
|
||||||
using (IDataReader reader = cmd.ExecuteReader())
|
using (IDataReader reader = cmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
|
@ -327,21 +327,22 @@ namespace OpenSim.Data.MySQL
|
||||||
count = Convert.ToInt32(reader["count"]);
|
count = Convert.ToInt32(reader["count"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Delete(string id)
|
public bool Delete(string id)
|
||||||
{
|
{
|
||||||
MySqlCommand cmd = new MySqlCommand();
|
using(MySqlCommand cmd = new MySqlCommand())
|
||||||
|
{
|
||||||
|
|
||||||
cmd.CommandText = String.Format("delete from {0} where id = ?id", m_Table);
|
cmd.CommandText = String.Format("delete from {0} where id = ?id",m_Table);
|
||||||
|
|
||||||
cmd.Parameters.AddWithValue("?id", id);
|
cmd.Parameters.AddWithValue("?id", id);
|
||||||
|
|
||||||
ExecuteNonQuery(cmd);
|
ExecuteNonQuery(cmd);
|
||||||
|
}
|
||||||
cmd.Dispose();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -440,8 +440,9 @@ namespace OpenSim.Data.MySQL
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
MySqlCommand cmd = new MySqlCommand("SELECT Name, Description, AccessTime, AssetType, Temporary, ID, AssetFlags, CreatorID FROM XAssetsMeta LIMIT ?start, ?count", dbcon);
|
using(MySqlCommand cmd = new MySqlCommand("SELECT Name, Description, AccessTime, AssetType, Temporary, ID, AssetFlags, CreatorID FROM XAssetsMeta LIMIT ?start, ?count",dbcon))
|
||||||
cmd.Parameters.AddWithValue("?start", start);
|
{
|
||||||
|
cmd.Parameters.AddWithValue("?start",start);
|
||||||
cmd.Parameters.AddWithValue("?count", count);
|
cmd.Parameters.AddWithValue("?count", count);
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -460,7 +461,7 @@ namespace OpenSim.Data.MySQL
|
||||||
metadata.CreatorID = dbReader["CreatorID"].ToString();
|
metadata.CreatorID = dbReader["CreatorID"].ToString();
|
||||||
|
|
||||||
// We'll ignore this for now - it appears unused!
|
// We'll ignore this for now - it appears unused!
|
||||||
// metadata.SHA1 = dbReader["hash"]);
|
// metadata.SHA1 = dbReader["hash"]);
|
||||||
|
|
||||||
UpdateAccessTime(metadata, (int)dbReader["AccessTime"]);
|
UpdateAccessTime(metadata, (int)dbReader["AccessTime"]);
|
||||||
|
|
||||||
|
@ -473,6 +474,7 @@ namespace OpenSim.Data.MySQL
|
||||||
m_log.Error("[XASSETS DB]: MySql failure fetching asset set" + Environment.NewLine + e.ToString());
|
m_log.Error("[XASSETS DB]: MySql failure fetching asset set" + Environment.NewLine + e.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return retList;
|
return retList;
|
||||||
}
|
}
|
||||||
|
|
|
@ -518,10 +518,11 @@ namespace OpenSim.Data.PGSQL
|
||||||
using (NpgsqlConnection dbcon = new NpgsqlConnection(m_connectionString))
|
using (NpgsqlConnection dbcon = new NpgsqlConnection(m_connectionString))
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
NpgsqlCommand cmd = new NpgsqlCommand( @"SELECT name, description, access_time, ""AssetType"", temporary, id, asset_flags, creatorid
|
using(NpgsqlCommand cmd = new NpgsqlCommand(@"SELECT name, description, access_time, ""AssetType"", temporary, id, asset_flags, creatorid
|
||||||
FROM XAssetsMeta
|
FROM XAssetsMeta
|
||||||
LIMIT :start, :count", dbcon);
|
LIMIT :start, :count",dbcon))
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("start", start));
|
{
|
||||||
|
cmd.Parameters.Add(m_database.CreateParameter("start",start));
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("count", count));
|
cmd.Parameters.Add(m_database.CreateParameter("count", count));
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -540,7 +541,7 @@ namespace OpenSim.Data.PGSQL
|
||||||
metadata.CreatorID = dbReader["creatorid"].ToString();
|
metadata.CreatorID = dbReader["creatorid"].ToString();
|
||||||
|
|
||||||
// We'll ignore this for now - it appears unused!
|
// We'll ignore this for now - it appears unused!
|
||||||
// metadata.SHA1 = dbReader["hash"]);
|
// metadata.SHA1 = dbReader["hash"]);
|
||||||
|
|
||||||
UpdateAccessTime(metadata, (int)dbReader["access_time"]);
|
UpdateAccessTime(metadata, (int)dbReader["access_time"]);
|
||||||
|
|
||||||
|
@ -554,6 +555,7 @@ namespace OpenSim.Data.PGSQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return retList;
|
return retList;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue