aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data
diff options
context:
space:
mode:
authorMelanie2009-12-31 02:26:00 +0000
committerMelanie2009-12-31 02:26:00 +0000
commit01f6aee020eddb46893cbfbcf3b1e114a85ac261 (patch)
tree6664f3d4aea41a2c8f6bab9b2645a2e10212edcc /OpenSim/Data
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')
-rw-r--r--OpenSim/Data/IUserAccountData.cs1
-rw-r--r--OpenSim/Data/MSSQL/MSSQLUserAccountData.cs5
-rw-r--r--OpenSim/Data/MySQL/MySQLUserAccountData.cs38
3 files changed, 42 insertions, 2 deletions
diff --git a/OpenSim/Data/IUserAccountData.cs b/OpenSim/Data/IUserAccountData.cs
index e350a18..6ee5995 100644
--- a/OpenSim/Data/IUserAccountData.cs
+++ b/OpenSim/Data/IUserAccountData.cs
@@ -48,5 +48,6 @@ namespace OpenSim.Data
48 { 48 {
49 UserAccountData[] Get(string[] fields, string[] values); 49 UserAccountData[] Get(string[] fields, string[] values);
50 bool Store(UserAccountData data); 50 bool Store(UserAccountData data);
51 UserAccountData[] GetUsers(UUID scopeID, string query);
51 } 52 }
52} 53}
diff --git a/OpenSim/Data/MSSQL/MSSQLUserAccountData.cs b/OpenSim/Data/MSSQL/MSSQLUserAccountData.cs
index ca09029..01c64dc 100644
--- a/OpenSim/Data/MSSQL/MSSQLUserAccountData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLUserAccountData.cs
@@ -194,5 +194,10 @@ namespace OpenSim.Data.MSSQL
194 { 194 {
195 return null; 195 return null;
196 } 196 }
197
198 public UserAccountData[] GetUsers(UUID scopeID, string query)
199 {
200 return null;
201 }
197 } 202 }
198} 203}
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}