aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLGridData.cs86
1 files changed, 1 insertions, 85 deletions
diff --git a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
index d62c286..3737e48 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
@@ -206,91 +206,7 @@ namespace OpenSim.Framework.Data.MySQL
206 return null; 206 return null;
207 } 207 }
208 } 208 }
209 209
210 /// <summary>
211 /// // Returns a list of avatar and UUIDs that match the query
212 /// </summary>
213 public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
214 {
215 List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>();
216
217 Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9]");
218
219 string[] querysplit;
220 querysplit = query.Split(' ');
221 if (querysplit.Length == 2)
222 {
223 Dictionary<string, string> param = new Dictionary<string, string>();
224 param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], String.Empty) + "%";
225 param["?second"] = objAlphaNumericPattern.Replace(querysplit[1], String.Empty) + "%";
226 try
227 {
228 lock (database)
229 {
230 IDbCommand result =
231 database.Query(
232 "SELECT UUID,username,surname FROM users WHERE username like ?first AND lastname like ?second LIMIT 100",
233 param);
234 IDataReader reader = result.ExecuteReader();
235
236
237 while (reader.Read())
238 {
239 AvatarPickerAvatar user = new AvatarPickerAvatar();
240 user.AvatarID = new LLUUID((string) reader["UUID"]);
241 user.firstName = (string) reader["username"];
242 user.lastName = (string) reader["surname"];
243 returnlist.Add(user);
244 }
245 reader.Close();
246 result.Dispose();
247 }
248 }
249 catch (Exception e)
250 {
251 database.Reconnect();
252 m_log.Error(e.ToString());
253 return returnlist;
254 }
255 }
256 else if (querysplit.Length == 1)
257 {
258 try
259 {
260 lock (database)
261 {
262 Dictionary<string, string> param = new Dictionary<string, string>();
263 param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], System.String.Empty) + "%";
264
265 IDbCommand result =
266 database.Query(
267 "SELECT UUID,username,surname FROM users WHERE username like ?first OR lastname like ?second",
268 param);
269 IDataReader reader = result.ExecuteReader();
270
271
272 while (reader.Read())
273 {
274 AvatarPickerAvatar user = new AvatarPickerAvatar();
275 user.AvatarID = new LLUUID((string) reader["UUID"]);
276 user.firstName = (string) reader["username"];
277 user.lastName = (string) reader["surname"];
278 returnlist.Add(user);
279 }
280 reader.Close();
281 result.Dispose();
282 }
283 }
284 catch (Exception e)
285 {
286 database.Reconnect();
287 m_log.Error(e.ToString());
288 return returnlist;
289 }
290 }
291 return returnlist;
292 }
293
294 /// <summary> 210 /// <summary>
295 /// Returns a sim profile from it's UUID 211 /// Returns a sim profile from it's UUID
296 /// </summary> 212 /// </summary>