aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data')
-rw-r--r--OpenSim/Data/IUserAccountData.cs5
-rw-r--r--OpenSim/Data/MSSQL/MSSQLUserAccountData.cs7
-rw-r--r--OpenSim/Data/MySQL/MySQLUserAccountData.cs38
3 files changed, 45 insertions, 5 deletions
diff --git a/OpenSim/Data/IUserAccountData.cs b/OpenSim/Data/IUserAccountData.cs
index 5ebe7d3..6ee5995 100644
--- a/OpenSim/Data/IUserAccountData.cs
+++ b/OpenSim/Data/IUserAccountData.cs
@@ -38,7 +38,7 @@ namespace OpenSim.Data
38 public UUID ScopeID; 38 public UUID ScopeID;
39 public string FirstName; 39 public string FirstName;
40 public string LastName; 40 public string LastName;
41 public Dictionary<string, object> Data; 41 public Dictionary<string, string> Data;
42 } 42 }
43 43
44 /// <summary> 44 /// <summary>
@@ -47,6 +47,7 @@ namespace OpenSim.Data
47 public interface IUserAccountData 47 public interface IUserAccountData
48 { 48 {
49 UserAccountData[] Get(string[] fields, string[] values); 49 UserAccountData[] Get(string[] fields, string[] values);
50 bool Store(UserAccountData data, UUID principalID, string token); 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 01750d8..01c64dc 100644
--- a/OpenSim/Data/MSSQL/MSSQLUserAccountData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLUserAccountData.cs
@@ -65,7 +65,7 @@ namespace OpenSim.Data.MSSQL
65 public UserAccountData Get(UUID principalID, UUID scopeID) 65 public UserAccountData Get(UUID principalID, UUID scopeID)
66 { 66 {
67 UserAccountData ret = new UserAccountData(); 67 UserAccountData ret = new UserAccountData();
68 ret.Data = new Dictionary<string, object>(); 68 ret.Data = new Dictionary<string, string>();
69 69
70 string sql = string.Format("select * from {0} where UUID = @principalID", m_Realm); 70 string sql = string.Format("select * from {0} where UUID = @principalID", m_Realm);
71 if (scopeID != UUID.Zero) 71 if (scopeID != UUID.Zero)
@@ -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 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}