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/SQLiteUserAccountData.cs | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'OpenSim/Data/SQLite/SQLiteUserAccountData.cs') diff --git a/OpenSim/Data/SQLite/SQLiteUserAccountData.cs b/OpenSim/Data/SQLite/SQLiteUserAccountData.cs index 7a5de50..f98d376 100644 --- a/OpenSim/Data/SQLite/SQLiteUserAccountData.cs +++ b/OpenSim/Data/SQLite/SQLiteUserAccountData.cs @@ -66,20 +66,21 @@ namespace OpenSim.Data.SQLite if (words.Length > 2) return new UserAccountData[0]; - SqliteCommand cmd = new SqliteCommand(); - - if (words.Length == 1) - { - cmd.CommandText = String.Format("select * from {0} where (ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{2}%')", - m_Realm, scopeID.ToString(), words[0]); - } - else + using (SqliteCommand cmd = new SqliteCommand()) { - cmd.CommandText = String.Format("select * from {0} where (ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{3}%')", - m_Realm, scopeID.ToString(), words[0], words[1]); - } + if (words.Length == 1) + { + cmd.CommandText = String.Format("select * from {0} where (ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{2}%')", + m_Realm, scopeID.ToString(), words[0]); + } + else + { + cmd.CommandText = String.Format("select * from {0} where (ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{3}%')", + m_Realm, scopeID.ToString(), words[0], words[1]); + } - return DoQuery(cmd); + return DoQuery(cmd); + } } } } -- cgit v1.1