diff options
author | Diva Canto | 2009-12-30 21:00:52 -0800 |
---|---|---|
committer | Diva Canto | 2009-12-30 21:00:52 -0800 |
commit | c664307126e7869f6e7038173561de57be058104 (patch) | |
tree | 848f6fad19abdc65cb7c76a4eff67c8de453038a /OpenSim/Data/MySQL | |
parent | First pass at the new login service. Still incomplete, but doesn't disrupt th... (diff) | |
parent | Implement avatar picker queries (diff) | |
download | opensim-SC_OLD-c664307126e7869f6e7038173561de57be058104.zip opensim-SC_OLD-c664307126e7869f6e7038173561de57be058104.tar.gz opensim-SC_OLD-c664307126e7869f6e7038173561de57be058104.tar.bz2 opensim-SC_OLD-c664307126e7869f6e7038173561de57be058104.tar.xz |
Merge branch 'presence-refactor' of ssh://diva@opensimulator.org/var/git/opensim into presence-refactor
Diffstat (limited to 'OpenSim/Data/MySQL')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLUserAccountData.cs | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/OpenSim/Data/MySQL/MySQLUserAccountData.cs b/OpenSim/Data/MySQL/MySQLUserAccountData.cs index e2ce6d1..aa69d68 100644 --- a/OpenSim/Data/MySQL/MySQLUserAccountData.cs +++ b/OpenSim/Data/MySQL/MySQLUserAccountData.cs | |||
@@ -42,9 +42,43 @@ namespace OpenSim.Data.MySQL | |||
42 | { | 42 | { |
43 | } | 43 | } |
44 | 44 | ||
45 | public bool Store(UserAccountData data, UUID principalID, string token) | 45 | public UserAccountData[] GetUsers(UUID scopeID, string query) |
46 | { | 46 | { |
47 | return Store(data); | 47 | string[] words = query.Split(new char[] {' '}); |
48 | |||
49 | for (int i = 0 ; i < words.Length ; i++) | ||
50 | { | ||
51 | if (words[i].Length < 3) | ||
52 | { | ||
53 | if (i != words.Length - 1) | ||
54 | Array.Copy(words, i + 1, words, i, words.Length - i - 1); | ||
55 | Array.Resize(ref words, words.Length - 1); | ||
56 | } | ||
57 | } | ||
58 | |||
59 | if (words.Length == 0) | ||
60 | return new UserAccountData[0]; | ||
61 | |||
62 | if (words.Length > 2) | ||
63 | return new UserAccountData[0]; | ||
64 | |||
65 | 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 | { | ||
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 | |||
81 | return DoQuery(cmd); | ||
48 | } | 82 | } |
49 | } | 83 | } |
50 | } | 84 | } |