diff options
author | Teravus Ovares | 2007-11-13 22:48:19 +0000 |
---|---|---|
committer | Teravus Ovares | 2007-11-13 22:48:19 +0000 |
commit | 9f6b3e2357e76b9b85b447da189b4bf4163edd3c (patch) | |
tree | 7d9c39258e45e6271db953608e6868433f9ac70d /OpenSim/Framework/Data.MySQL | |
parent | first pass on unlinking of objects. From Jay Clarke (IBM) (diff) | |
download | opensim-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')
-rw-r--r-- | OpenSim/Framework/Data.MySQL/MySQLGridData.cs | 85 | ||||
-rw-r--r-- | OpenSim/Framework/Data.MySQL/MySQLUserData.cs | 81 |
2 files changed, 165 insertions, 1 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 |
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> |