aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
diff options
context:
space:
mode:
authorTeravus Ovares2007-11-13 22:48:19 +0000
committerTeravus Ovares2007-11-13 22:48:19 +0000
commit9f6b3e2357e76b9b85b447da189b4bf4163edd3c (patch)
tree7d9c39258e45e6271db953608e6868433f9ac70d /OpenSim/Framework/Data.MySQL/MySQLUserData.cs
parentfirst pass on unlinking of objects. From Jay Clarke (IBM) (diff)
downloadopensim-SC-9f6b3e2357e76b9b85b447da189b4bf4163edd3c.zip
opensim-SC-9f6b3e2357e76b9b85b447da189b4bf4163edd3c.tar.gz
opensim-SC-9f6b3e2357e76b9b85b447da189b4bf4163edd3c.tar.bz2
opensim-SC-9f6b3e2357e76b9b85b447da189b4bf4163edd3c.tar.xz
* Added AvatarPicker in Standalone mode. Works for finding avatar to ban, manually trying to add a friend (with the add button) or useful to those who are curious which usernames have visited your standalone sim. Important for future development :D.
* Grid mode always returns 0 results until the Grid Communications portion is done.
Diffstat (limited to 'OpenSim/Framework/Data.MySQL/MySQLUserData.cs')
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLUserData.cs81
1 files changed, 80 insertions, 1 deletions
diff --git a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
index 8846650..3ae1fba 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
@@ -97,7 +97,6 @@ namespace OpenSim.Framework.Data.MySQL
97 97
98 reader.Close(); 98 reader.Close();
99 result.Dispose(); 99 result.Dispose();
100
101 return row; 100 return row;
102 } 101 }
103 } 102 }
@@ -108,7 +107,87 @@ namespace OpenSim.Framework.Data.MySQL
108 return null; 107 return null;
109 } 108 }
110 } 109 }
110 public List<OpenSim.Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
111 {
112 List<OpenSim.Framework.AvatarPickerAvatar> returnlist = new List<OpenSim.Framework.AvatarPickerAvatar>();
113 string[] querysplit;
114 querysplit = query.Split(' ');
115 if (querysplit.Length == 2)
116 {
117 try
118 {
119 lock (database)
120 {
121 Dictionary<string, string> param = new Dictionary<string, string>();
122 param["?first"] = querysplit[0];
123 param["?second"] = querysplit[1];
124
125 IDbCommand result =
126 database.Query("SELECT UUID,username,surname FROM users WHERE username = ?first AND lastname = ?second", param);
127 IDataReader reader = result.ExecuteReader();
128
129
130 while (reader.Read())
131 {
132 OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar();
133 user.AvatarID = new LLUUID((string)reader["UUID"]);
134 user.firstName = (string)reader["username"];
135 user.lastName = (string)reader["surname"];
136 returnlist.Add(user);
137
138 }
139 reader.Close();
140 result.Dispose();
141 }
142 }
143 catch (Exception e)
144 {
145 database.Reconnect();
146 MainLog.Instance.Error(e.ToString());
147 return returnlist;
148 }
111 149
150
151
152 }
153 else if (querysplit.Length == 1)
154 {
155
156 try
157 {
158 lock (database)
159 {
160 Dictionary<string, string> param = new Dictionary<string, string>();
161 param["?first"] = querysplit[0];
162 param["?second"] = querysplit[1];
163
164 IDbCommand result =
165 database.Query("SELECT UUID,username,surname FROM users WHERE username = ?first OR lastname = ?second", param);
166 IDataReader reader = result.ExecuteReader();
167
168
169 while (reader.Read())
170 {
171 OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar();
172 user.AvatarID = new LLUUID((string)reader["UUID"]);
173 user.firstName = (string)reader["username"];
174 user.lastName = (string)reader["surname"];
175 returnlist.Add(user);
176
177 }
178 reader.Close();
179 result.Dispose();
180 }
181 }
182 catch (Exception e)
183 {
184 database.Reconnect();
185 MainLog.Instance.Error(e.ToString());
186 return returnlist;
187 }
188 }
189 return returnlist;
190 }
112 /// <summary> 191 /// <summary>
113 /// Searches the database for a specified user profile by UUID 192 /// Searches the database for a specified user profile by UUID
114 /// </summary> 193 /// </summary>