aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLUserAccountData.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLUserAccountData.cs')
-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