From 94da908813e42c328572bc5da2ddc41b6664b59c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 14 Nov 2012 04:45:59 +0000 Subject: More consistently dispose of SqliteCommand in OpenSim.Data.SQLite where possible. Not doing SQLiteInventoryStore since this is no longer used and should disappear in the future. --- OpenSim/Data/SQLite/SQLiteAvatarData.cs | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'OpenSim/Data/SQLite/SQLiteAvatarData.cs') diff --git a/OpenSim/Data/SQLite/SQLiteAvatarData.cs b/OpenSim/Data/SQLite/SQLiteAvatarData.cs index faf34da..c6d615b 100644 --- a/OpenSim/Data/SQLite/SQLiteAvatarData.cs +++ b/OpenSim/Data/SQLite/SQLiteAvatarData.cs @@ -56,23 +56,17 @@ namespace OpenSim.Data.SQLite public bool Delete(UUID principalID, string name) { - SqliteCommand cmd = new SqliteCommand(); - - cmd.CommandText = String.Format("delete from {0} where `PrincipalID` = :PrincipalID and `Name` = :Name", m_Realm); - cmd.Parameters.AddWithValue(":PrincipalID", principalID.ToString()); - cmd.Parameters.AddWithValue(":Name", name); - - try + using (SqliteCommand cmd = new SqliteCommand()) { + cmd.CommandText = String.Format("delete from {0} where `PrincipalID` = :PrincipalID and `Name` = :Name", m_Realm); + cmd.Parameters.AddWithValue(":PrincipalID", principalID.ToString()); + cmd.Parameters.AddWithValue(":Name", name); + if (ExecuteNonQuery(cmd, m_Connection) > 0) return true; - - return false; - } - finally - { - //CloseCommand(cmd); } + + return false; } } -} +} \ No newline at end of file -- cgit v1.1