diff options
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLUserAccountData.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLUserAccountData.cs | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/OpenSim/Data/MySQL/MySQLUserAccountData.cs b/OpenSim/Data/MySQL/MySQLUserAccountData.cs index 92afa75..a621d84 100644 --- a/OpenSim/Data/MySQL/MySQLUserAccountData.cs +++ b/OpenSim/Data/MySQL/MySQLUserAccountData.cs | |||
@@ -46,17 +46,21 @@ namespace OpenSim.Data.MySQL | |||
46 | { | 46 | { |
47 | string[] words = query.Split(new char[] {' '}); | 47 | string[] words = query.Split(new char[] {' '}); |
48 | 48 | ||
49 | bool valid = false; | ||
50 | |||
49 | for (int i = 0 ; i < words.Length ; i++) | 51 | for (int i = 0 ; i < words.Length ; i++) |
50 | { | 52 | { |
51 | if (words[i].Length < 3) | 53 | if (words[i].Length > 2) |
52 | { | 54 | valid = true; |
53 | if (i != words.Length - 1) | 55 | // if (words[i].Length < 3) |
54 | Array.Copy(words, i + 1, words, i, words.Length - i - 1); | 56 | // { |
55 | Array.Resize(ref words, words.Length - 1); | 57 | // if (i != words.Length - 1) |
56 | } | 58 | // Array.Copy(words, i + 1, words, i, words.Length - i - 1); |
59 | // Array.Resize(ref words, words.Length - 1); | ||
60 | // } | ||
57 | } | 61 | } |
58 | 62 | ||
59 | if (words.Length == 0) | 63 | if ((!valid) || words.Length == 0) |
60 | return new UserAccountData[0]; | 64 | return new UserAccountData[0]; |
61 | 65 | ||
62 | if (words.Length > 2) | 66 | if (words.Length > 2) |
@@ -67,14 +71,14 @@ namespace OpenSim.Data.MySQL | |||
67 | if (words.Length == 1) | 71 | if (words.Length == 1) |
68 | { | 72 | { |
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); | 73 | 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] + "%"); | 74 | cmd.Parameters.AddWithValue("?search", words[0] + "%"); |
71 | cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); | 75 | cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); |
72 | } | 76 | } |
73 | else | 77 | else |
74 | { | 78 | { |
75 | cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst and LastName like ?searchLast)", m_Realm); | 79 | cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst and LastName like ?searchLast)", m_Realm); |
76 | cmd.Parameters.AddWithValue("?searchFirst", "%" + words[0] + "%"); | 80 | cmd.Parameters.AddWithValue("?searchFirst", words[0] + "%"); |
77 | cmd.Parameters.AddWithValue("?searchLast", "%" + words[1] + "%"); | 81 | cmd.Parameters.AddWithValue("?searchLast", words[1] + "%"); |
78 | cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); | 82 | cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); |
79 | } | 83 | } |
80 | 84 | ||