aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL
diff options
context:
space:
mode:
authorMelanie2009-12-31 02:26:00 +0000
committerMelanie2009-12-31 02:26:00 +0000
commit01f6aee020eddb46893cbfbcf3b1e114a85ac261 (patch)
tree6664f3d4aea41a2c8f6bab9b2645a2e10212edcc /OpenSim/Data/MySQL
parentImplement saving user account data (diff)
downloadopensim-SC-01f6aee020eddb46893cbfbcf3b1e114a85ac261.zip
opensim-SC-01f6aee020eddb46893cbfbcf3b1e114a85ac261.tar.gz
opensim-SC-01f6aee020eddb46893cbfbcf3b1e114a85ac261.tar.bz2
opensim-SC-01f6aee020eddb46893cbfbcf3b1e114a85ac261.tar.xz
Implement avatar picker queries
Diffstat (limited to 'OpenSim/Data/MySQL')
-rw-r--r--OpenSim/Data/MySQL/MySQLUserAccountData.cs38
1 files changed, 36 insertions, 2 deletions
diff --git a/OpenSim/Data/MySQL/MySQLUserAccountData.cs b/OpenSim/Data/MySQL/MySQLUserAccountData.cs
index ae7d5ca..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) 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}