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.cs85
1 files changed, 85 insertions, 0 deletions
diff --git a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
index fdfc61c..930b3f4 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
@@ -169,6 +169,91 @@ namespace OpenSim.Framework.Data.MySQL
169 return null; 169 return null;
170 } 170 }
171 } 171 }
172 /// <summary>
173 /// // Returns a list of avatar and UUIDs that match the query
174 /// </summary>
175
176 public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
177 {
178 List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>();
179 string[] querysplit;
180 querysplit = query.Split(' ');
181 if (querysplit.Length == 2)
182 {
183 try
184 {
185 lock (database)
186 {
187 Dictionary<string, string> param = new Dictionary<string, string>();
188 param["?first"] = querysplit[0];
189 param["?second"] = querysplit[1];
190
191 IDbCommand result =
192 database.Query("SELECT UUID,username,surname FROM users WHERE username = ?first AND lastname = ?second", param);
193 IDataReader reader = result.ExecuteReader();
194
195
196 while (reader.Read())
197 {
198 AvatarPickerAvatar user = new AvatarPickerAvatar();
199 user.AvatarID = new LLUUID((string)reader["UUID"]);
200 user.firstName = (string)reader["username"];
201 user.lastName = (string)reader["surname"];
202 returnlist.Add(user);
203
204 }
205 reader.Close();
206 result.Dispose();
207 }
208 }
209 catch (Exception e)
210 {
211 database.Reconnect();
212 MainLog.Instance.Error(e.ToString());
213 return returnlist;
214 }
215
216
217
218 }
219 else if (querysplit.Length == 1)
220 {
221
222 try
223 {
224 lock (database)
225 {
226 Dictionary<string, string> param = new Dictionary<string, string>();
227 param["?first"] = querysplit[0];
228 param["?second"] = querysplit[1];
229
230 IDbCommand result =
231 database.Query("SELECT UUID,username,surname FROM users WHERE username = ?first OR lastname = ?second", param);
232 IDataReader reader = result.ExecuteReader();
233
234
235 while (reader.Read())
236 {
237 AvatarPickerAvatar user = new AvatarPickerAvatar();
238 user.AvatarID = new LLUUID((string)reader["UUID"]);
239 user.firstName = (string)reader["username"];
240 user.lastName = (string)reader["surname"];
241 returnlist.Add(user);
242
243 }
244 reader.Close();
245 result.Dispose();
246 }
247 }
248 catch (Exception e)
249 {
250 database.Reconnect();
251 MainLog.Instance.Error(e.ToString());
252 return returnlist;
253 }
254 }
255 return returnlist;
256 }
172 257
173 /// <summary> 258 /// <summary>
174 /// Returns a sim profile from it's UUID 259 /// Returns a sim profile from it's UUID