aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLUserAccountData.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-04-30 15:54:35 +0100
committerJustin Clark-Casey (justincc)2012-04-30 15:54:35 +0100
commit522eff61383e9a8acfdf34289cd64a8fdc27bb19 (patch)
tree3e9d6428bf6832caafd69d45c3a377a9f643dcae /OpenSim/Data/MySQL/MySQLUserAccountData.cs
parentComment out debug [ASYNC DELETER] messages for now. (diff)
downloadopensim-SC-522eff61383e9a8acfdf34289cd64a8fdc27bb19.zip
opensim-SC-522eff61383e9a8acfdf34289cd64a8fdc27bb19.tar.gz
opensim-SC-522eff61383e9a8acfdf34289cd64a8fdc27bb19.tar.bz2
opensim-SC-522eff61383e9a8acfdf34289cd64a8fdc27bb19.tar.xz
Consistently use using() to make sure we dispose of used MySqlCommands where this is not already being done.
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MySQL/MySQLUserAccountData.cs33
1 files changed, 17 insertions, 16 deletions
diff --git a/OpenSim/Data/MySQL/MySQLUserAccountData.cs b/OpenSim/Data/MySQL/MySQLUserAccountData.cs
index aa69d68..e964295 100644
--- a/OpenSim/Data/MySQL/MySQLUserAccountData.cs
+++ b/OpenSim/Data/MySQL/MySQLUserAccountData.cs
@@ -62,23 +62,24 @@ namespace OpenSim.Data.MySQL
62 if (words.Length > 2) 62 if (words.Length > 2)
63 return new UserAccountData[0]; 63 return new UserAccountData[0];
64 64
65 MySqlCommand cmd = new MySqlCommand(); 65 using (MySqlCommand cmd = new MySqlCommand())
66
67 if (words.Length == 1)
68 {
69 cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?search or LastName like ?search)", m_Realm);
70 cmd.Parameters.AddWithValue("?search", "%" + words[0] + "%");
71 cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
72 }
73 else
74 { 66 {
75 cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst or LastName like ?searchLast)", m_Realm); 67 if (words.Length == 1)
76 cmd.Parameters.AddWithValue("?searchFirst", "%" + words[0] + "%"); 68 {
77 cmd.Parameters.AddWithValue("?searchLast", "%" + words[1] + "%"); 69 cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?search or LastName like ?search)", m_Realm);
78 cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); 70 cmd.Parameters.AddWithValue("?search", "%" + words[0] + "%");
79 } 71 cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
72 }
73 else
74 {
75 cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst or LastName like ?searchLast)", m_Realm);
76 cmd.Parameters.AddWithValue("?searchFirst", "%" + words[0] + "%");
77 cmd.Parameters.AddWithValue("?searchLast", "%" + words[1] + "%");
78 cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
79 }
80 80
81 return DoQuery(cmd); 81 return DoQuery(cmd);
82 }
82 } 83 }
83 } 84 }
84} 85} \ No newline at end of file