aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Data.MySQL/MySQLGridData.cs')
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLGridData.cs17
1 files changed, 10 insertions, 7 deletions
diff --git a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
index 930b3f4..4d65ee9 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
@@ -176,20 +176,24 @@ namespace OpenSim.Framework.Data.MySQL
176 public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) 176 public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
177 { 177 {
178 List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>(); 178 List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>();
179
180 System.Text.RegularExpressions.Regex objAlphaNumericPattern = new System.Text.RegularExpressions.Regex("[^a-zA-Z0-9]");
181
179 string[] querysplit; 182 string[] querysplit;
180 querysplit = query.Split(' '); 183 querysplit = query.Split(' ');
181 if (querysplit.Length == 2) 184 if (querysplit.Length == 2)
182 { 185 {
186 Dictionary<string, string> param = new Dictionary<string, string>();
187 param["?first"] = objAlphaNumericPattern.Replace(querysplit[0],"") + "%";
188 param["?second"] = objAlphaNumericPattern.Replace(querysplit[1], "") + "%";
183 try 189 try
184 { 190 {
185 lock (database) 191 lock (database)
186 { 192 {
187 Dictionary<string, string> param = new Dictionary<string, string>(); 193
188 param["?first"] = querysplit[0];
189 param["?second"] = querysplit[1];
190 194
191 IDbCommand result = 195 IDbCommand result =
192 database.Query("SELECT UUID,username,surname FROM users WHERE username = ?first AND lastname = ?second", param); 196 database.Query("SELECT UUID,username,surname FROM users WHERE username like ?first AND lastname like ?second LIMIT 100", param);
193 IDataReader reader = result.ExecuteReader(); 197 IDataReader reader = result.ExecuteReader();
194 198
195 199
@@ -224,11 +228,10 @@ namespace OpenSim.Framework.Data.MySQL
224 lock (database) 228 lock (database)
225 { 229 {
226 Dictionary<string, string> param = new Dictionary<string, string>(); 230 Dictionary<string, string> param = new Dictionary<string, string>();
227 param["?first"] = querysplit[0]; 231 param["?first"] = objAlphaNumericPattern.Replace(querysplit[0],"") + "%";
228 param["?second"] = querysplit[1];
229 232
230 IDbCommand result = 233 IDbCommand result =
231 database.Query("SELECT UUID,username,surname FROM users WHERE username = ?first OR lastname = ?second", param); 234 database.Query("SELECT UUID,username,surname FROM users WHERE username like ?first OR lastname like ?second", param);
232 IDataReader reader = result.ExecuteReader(); 235 IDataReader reader = result.ExecuteReader();
233 236
234 237