diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLUserProfilesData.cs | 176 |
1 files changed, 88 insertions, 88 deletions
diff --git a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs index c389ae4..8af2a3e 100644 --- a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs +++ b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs | |||
@@ -40,39 +40,39 @@ namespace OpenSim.Data.MySQL | |||
40 | public class UserProfilesData: IProfilesData | 40 | public class UserProfilesData: IProfilesData |
41 | { | 41 | { |
42 | static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 42 | static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
43 | 43 | ||
44 | #region Properites | 44 | #region Properites |
45 | string ConnectionString | 45 | string ConnectionString |
46 | { | 46 | { |
47 | get; set; | 47 | get; set; |
48 | } | 48 | } |
49 | 49 | ||
50 | protected virtual Assembly Assembly | 50 | protected virtual Assembly Assembly |
51 | { | 51 | { |
52 | get { return GetType().Assembly; } | 52 | get { return GetType().Assembly; } |
53 | } | 53 | } |
54 | 54 | ||
55 | #endregion Properties | 55 | #endregion Properties |
56 | 56 | ||
57 | #region class Member Functions | 57 | #region class Member Functions |
58 | public UserProfilesData(string connectionString) | 58 | public UserProfilesData(string connectionString) |
59 | { | 59 | { |
60 | ConnectionString = connectionString; | 60 | ConnectionString = connectionString; |
61 | Init(); | 61 | Init(); |
62 | } | 62 | } |
63 | 63 | ||
64 | void Init() | 64 | void Init() |
65 | { | 65 | { |
66 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 66 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
67 | { | 67 | { |
68 | dbcon.Open(); | 68 | dbcon.Open(); |
69 | 69 | ||
70 | Migration m = new Migration(dbcon, Assembly, "UserProfiles"); | 70 | Migration m = new Migration(dbcon, Assembly, "UserProfiles"); |
71 | m.Update(); | 71 | m.Update(); |
72 | } | 72 | } |
73 | } | 73 | } |
74 | #endregion Member Functions | 74 | #endregion Member Functions |
75 | 75 | ||
76 | #region Classifieds Queries | 76 | #region Classifieds Queries |
77 | /// <summary> | 77 | /// <summary> |
78 | /// Gets the classified records. | 78 | /// Gets the classified records. |
@@ -86,7 +86,7 @@ namespace OpenSim.Data.MySQL | |||
86 | public OSDArray GetClassifiedRecords(UUID creatorId) | 86 | public OSDArray GetClassifiedRecords(UUID creatorId) |
87 | { | 87 | { |
88 | OSDArray data = new OSDArray(); | 88 | OSDArray data = new OSDArray(); |
89 | 89 | ||
90 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 90 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
91 | { | 91 | { |
92 | string query = "SELECT classifieduuid, name FROM classifieds WHERE creatoruuid = ?Id"; | 92 | string query = "SELECT classifieduuid, name FROM classifieds WHERE creatoruuid = ?Id"; |
@@ -102,7 +102,7 @@ namespace OpenSim.Data.MySQL | |||
102 | { | 102 | { |
103 | OSDMap n = new OSDMap(); | 103 | OSDMap n = new OSDMap(); |
104 | UUID Id = UUID.Zero; | 104 | UUID Id = UUID.Zero; |
105 | 105 | ||
106 | string Name = null; | 106 | string Name = null; |
107 | try | 107 | try |
108 | { | 108 | { |
@@ -124,12 +124,12 @@ namespace OpenSim.Data.MySQL | |||
124 | } | 124 | } |
125 | return data; | 125 | return data; |
126 | } | 126 | } |
127 | 127 | ||
128 | public bool UpdateClassifiedRecord(UserClassifiedAdd ad, ref string result) | 128 | public bool UpdateClassifiedRecord(UserClassifiedAdd ad, ref string result) |
129 | { | 129 | { |
130 | string query = string.Empty; | 130 | string query = string.Empty; |
131 | 131 | ||
132 | 132 | ||
133 | query += "INSERT INTO classifieds ("; | 133 | query += "INSERT INTO classifieds ("; |
134 | query += "`classifieduuid`,"; | 134 | query += "`classifieduuid`,"; |
135 | query += "`creatoruuid`,"; | 135 | query += "`creatoruuid`,"; |
@@ -173,21 +173,21 @@ namespace OpenSim.Data.MySQL | |||
173 | query += "classifiedflags=?Flags, "; | 173 | query += "classifiedflags=?Flags, "; |
174 | query += "priceforlisting=?ListingPrice, "; | 174 | query += "priceforlisting=?ListingPrice, "; |
175 | query += "snapshotuuid=?SnapshotId"; | 175 | query += "snapshotuuid=?SnapshotId"; |
176 | 176 | ||
177 | if(string.IsNullOrEmpty(ad.ParcelName)) | 177 | if(string.IsNullOrEmpty(ad.ParcelName)) |
178 | ad.ParcelName = "Unknown"; | 178 | ad.ParcelName = "Unknown"; |
179 | if(ad.ParcelId == null) | 179 | if(ad.ParcelId == null) |
180 | ad.ParcelId = UUID.Zero; | 180 | ad.ParcelId = UUID.Zero; |
181 | if(string.IsNullOrEmpty(ad.Description)) | 181 | if(string.IsNullOrEmpty(ad.Description)) |
182 | ad.Description = "No Description"; | 182 | ad.Description = "No Description"; |
183 | 183 | ||
184 | DateTime epoch = new DateTime(1970, 1, 1); | 184 | DateTime epoch = new DateTime(1970, 1, 1); |
185 | DateTime now = DateTime.Now; | 185 | DateTime now = DateTime.Now; |
186 | TimeSpan epochnow = now - epoch; | 186 | TimeSpan epochnow = now - epoch; |
187 | TimeSpan duration; | 187 | TimeSpan duration; |
188 | DateTime expiration; | 188 | DateTime expiration; |
189 | TimeSpan epochexp; | 189 | TimeSpan epochexp; |
190 | 190 | ||
191 | if(ad.Flags == 2) | 191 | if(ad.Flags == 2) |
192 | { | 192 | { |
193 | duration = new TimeSpan(7,0,0,0); | 193 | duration = new TimeSpan(7,0,0,0); |
@@ -202,7 +202,7 @@ namespace OpenSim.Data.MySQL | |||
202 | } | 202 | } |
203 | ad.CreationDate = (int)epochnow.TotalSeconds; | 203 | ad.CreationDate = (int)epochnow.TotalSeconds; |
204 | ad.ExpirationDate = (int)epochexp.TotalSeconds; | 204 | ad.ExpirationDate = (int)epochexp.TotalSeconds; |
205 | 205 | ||
206 | try | 206 | try |
207 | { | 207 | { |
208 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 208 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
@@ -225,7 +225,7 @@ namespace OpenSim.Data.MySQL | |||
225 | cmd.Parameters.AddWithValue("?ParcelName", ad.ParcelName.ToString()); | 225 | cmd.Parameters.AddWithValue("?ParcelName", ad.ParcelName.ToString()); |
226 | cmd.Parameters.AddWithValue("?Flags", ad.Flags.ToString()); | 226 | cmd.Parameters.AddWithValue("?Flags", ad.Flags.ToString()); |
227 | cmd.Parameters.AddWithValue("?ListingPrice", ad.Price.ToString ()); | 227 | cmd.Parameters.AddWithValue("?ListingPrice", ad.Price.ToString ()); |
228 | 228 | ||
229 | cmd.ExecuteNonQuery(); | 229 | cmd.ExecuteNonQuery(); |
230 | } | 230 | } |
231 | } | 231 | } |
@@ -239,20 +239,20 @@ namespace OpenSim.Data.MySQL | |||
239 | } | 239 | } |
240 | return true; | 240 | return true; |
241 | } | 241 | } |
242 | 242 | ||
243 | public bool DeleteClassifiedRecord(UUID recordId) | 243 | public bool DeleteClassifiedRecord(UUID recordId) |
244 | { | 244 | { |
245 | string query = string.Empty; | 245 | string query = string.Empty; |
246 | 246 | ||
247 | query += "DELETE FROM classifieds WHERE "; | 247 | query += "DELETE FROM classifieds WHERE "; |
248 | query += "classifieduuid = ?recordId"; | 248 | query += "classifieduuid = ?recordId"; |
249 | 249 | ||
250 | try | 250 | try |
251 | { | 251 | { |
252 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 252 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
253 | { | 253 | { |
254 | dbcon.Open(); | 254 | dbcon.Open(); |
255 | 255 | ||
256 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) | 256 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) |
257 | { | 257 | { |
258 | cmd.Parameters.AddWithValue("?recordId", recordId.ToString()); | 258 | cmd.Parameters.AddWithValue("?recordId", recordId.ToString()); |
@@ -268,14 +268,14 @@ namespace OpenSim.Data.MySQL | |||
268 | } | 268 | } |
269 | return true; | 269 | return true; |
270 | } | 270 | } |
271 | 271 | ||
272 | public bool GetClassifiedInfo(ref UserClassifiedAdd ad, ref string result) | 272 | public bool GetClassifiedInfo(ref UserClassifiedAdd ad, ref string result) |
273 | { | 273 | { |
274 | string query = string.Empty; | 274 | string query = string.Empty; |
275 | 275 | ||
276 | query += "SELECT * FROM classifieds WHERE "; | 276 | query += "SELECT * FROM classifieds WHERE "; |
277 | query += "classifieduuid = ?AdId"; | 277 | query += "classifieduuid = ?AdId"; |
278 | 278 | ||
279 | try | 279 | try |
280 | { | 280 | { |
281 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 281 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
@@ -284,7 +284,7 @@ namespace OpenSim.Data.MySQL | |||
284 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) | 284 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) |
285 | { | 285 | { |
286 | cmd.Parameters.AddWithValue("?AdId", ad.ClassifiedId.ToString()); | 286 | cmd.Parameters.AddWithValue("?AdId", ad.ClassifiedId.ToString()); |
287 | 287 | ||
288 | using (MySqlDataReader reader = cmd.ExecuteReader()) | 288 | using (MySqlDataReader reader = cmd.ExecuteReader()) |
289 | { | 289 | { |
290 | if(reader.Read ()) | 290 | if(reader.Read ()) |
@@ -303,7 +303,7 @@ namespace OpenSim.Data.MySQL | |||
303 | ad.SimName = reader.GetString("simname"); | 303 | ad.SimName = reader.GetString("simname"); |
304 | ad.GlobalPos = reader.GetString("posglobal"); | 304 | ad.GlobalPos = reader.GetString("posglobal"); |
305 | ad.ParcelName = reader.GetString("parcelname"); | 305 | ad.ParcelName = reader.GetString("parcelname"); |
306 | 306 | ||
307 | } | 307 | } |
308 | } | 308 | } |
309 | } | 309 | } |
@@ -318,16 +318,16 @@ namespace OpenSim.Data.MySQL | |||
318 | return true; | 318 | return true; |
319 | } | 319 | } |
320 | #endregion Classifieds Queries | 320 | #endregion Classifieds Queries |
321 | 321 | ||
322 | #region Picks Queries | 322 | #region Picks Queries |
323 | public OSDArray GetAvatarPicks(UUID avatarId) | 323 | public OSDArray GetAvatarPicks(UUID avatarId) |
324 | { | 324 | { |
325 | string query = string.Empty; | 325 | string query = string.Empty; |
326 | 326 | ||
327 | query += "SELECT `pickuuid`,`name` FROM userpicks WHERE "; | 327 | query += "SELECT `pickuuid`,`name` FROM userpicks WHERE "; |
328 | query += "creatoruuid = ?Id"; | 328 | query += "creatoruuid = ?Id"; |
329 | OSDArray data = new OSDArray(); | 329 | OSDArray data = new OSDArray(); |
330 | 330 | ||
331 | try | 331 | try |
332 | { | 332 | { |
333 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 333 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
@@ -336,7 +336,7 @@ namespace OpenSim.Data.MySQL | |||
336 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) | 336 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) |
337 | { | 337 | { |
338 | cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); | 338 | cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); |
339 | 339 | ||
340 | using (MySqlDataReader reader = cmd.ExecuteReader()) | 340 | using (MySqlDataReader reader = cmd.ExecuteReader()) |
341 | { | 341 | { |
342 | if(reader.HasRows) | 342 | if(reader.HasRows) |
@@ -344,7 +344,7 @@ namespace OpenSim.Data.MySQL | |||
344 | while (reader.Read()) | 344 | while (reader.Read()) |
345 | { | 345 | { |
346 | OSDMap record = new OSDMap(); | 346 | OSDMap record = new OSDMap(); |
347 | 347 | ||
348 | record.Add("pickuuid",OSD.FromString((string)reader["pickuuid"])); | 348 | record.Add("pickuuid",OSD.FromString((string)reader["pickuuid"])); |
349 | record.Add("name",OSD.FromString((string)reader["name"])); | 349 | record.Add("name",OSD.FromString((string)reader["name"])); |
350 | data.Add(record); | 350 | data.Add(record); |
@@ -361,16 +361,16 @@ namespace OpenSim.Data.MySQL | |||
361 | } | 361 | } |
362 | return data; | 362 | return data; |
363 | } | 363 | } |
364 | 364 | ||
365 | public UserProfilePick GetPickInfo(UUID avatarId, UUID pickId) | 365 | public UserProfilePick GetPickInfo(UUID avatarId, UUID pickId) |
366 | { | 366 | { |
367 | string query = string.Empty; | 367 | string query = string.Empty; |
368 | UserProfilePick pick = new UserProfilePick(); | 368 | UserProfilePick pick = new UserProfilePick(); |
369 | 369 | ||
370 | query += "SELECT * FROM userpicks WHERE "; | 370 | query += "SELECT * FROM userpicks WHERE "; |
371 | query += "creatoruuid = ?CreatorId AND "; | 371 | query += "creatoruuid = ?CreatorId AND "; |
372 | query += "pickuuid = ?PickId"; | 372 | query += "pickuuid = ?PickId"; |
373 | 373 | ||
374 | try | 374 | try |
375 | { | 375 | { |
376 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 376 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
@@ -380,18 +380,18 @@ namespace OpenSim.Data.MySQL | |||
380 | { | 380 | { |
381 | cmd.Parameters.AddWithValue("?CreatorId", avatarId.ToString()); | 381 | cmd.Parameters.AddWithValue("?CreatorId", avatarId.ToString()); |
382 | cmd.Parameters.AddWithValue("?PickId", pickId.ToString()); | 382 | cmd.Parameters.AddWithValue("?PickId", pickId.ToString()); |
383 | 383 | ||
384 | using (MySqlDataReader reader = cmd.ExecuteReader()) | 384 | using (MySqlDataReader reader = cmd.ExecuteReader()) |
385 | { | 385 | { |
386 | if(reader.HasRows) | 386 | if(reader.HasRows) |
387 | { | 387 | { |
388 | reader.Read(); | 388 | reader.Read(); |
389 | 389 | ||
390 | string description = (string)reader["description"]; | 390 | string description = (string)reader["description"]; |
391 | 391 | ||
392 | if (string.IsNullOrEmpty(description)) | 392 | if (string.IsNullOrEmpty(description)) |
393 | description = "No description given."; | 393 | description = "No description given."; |
394 | 394 | ||
395 | UUID.TryParse((string)reader["pickuuid"], out pick.PickId); | 395 | UUID.TryParse((string)reader["pickuuid"], out pick.PickId); |
396 | UUID.TryParse((string)reader["creatoruuid"], out pick.CreatorId); | 396 | UUID.TryParse((string)reader["creatoruuid"], out pick.CreatorId); |
397 | UUID.TryParse((string)reader["parceluuid"], out pick.ParcelId); | 397 | UUID.TryParse((string)reader["parceluuid"], out pick.ParcelId); |
@@ -419,11 +419,11 @@ namespace OpenSim.Data.MySQL | |||
419 | } | 419 | } |
420 | return pick; | 420 | return pick; |
421 | } | 421 | } |
422 | 422 | ||
423 | public bool UpdatePicksRecord(UserProfilePick pick) | 423 | public bool UpdatePicksRecord(UserProfilePick pick) |
424 | { | 424 | { |
425 | string query = string.Empty; | 425 | string query = string.Empty; |
426 | 426 | ||
427 | query += "INSERT INTO userpicks VALUES ("; | 427 | query += "INSERT INTO userpicks VALUES ("; |
428 | query += "?PickId,"; | 428 | query += "?PickId,"; |
429 | query += "?CreatorId,"; | 429 | query += "?CreatorId,"; |
@@ -449,7 +449,7 @@ namespace OpenSim.Data.MySQL | |||
449 | query += "pickuuid=?PickId,"; | 449 | query += "pickuuid=?PickId,"; |
450 | query += "posglobal=?GlobalPos,"; | 450 | query += "posglobal=?GlobalPos,"; |
451 | query += "gatekeeper=?Gatekeeper"; | 451 | query += "gatekeeper=?Gatekeeper"; |
452 | 452 | ||
453 | try | 453 | try |
454 | { | 454 | { |
455 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 455 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
@@ -471,7 +471,7 @@ namespace OpenSim.Data.MySQL | |||
471 | cmd.Parameters.AddWithValue("?Gatekeeper",pick.Gatekeeper); | 471 | cmd.Parameters.AddWithValue("?Gatekeeper",pick.Gatekeeper); |
472 | cmd.Parameters.AddWithValue("?SortOrder", pick.SortOrder.ToString ()); | 472 | cmd.Parameters.AddWithValue("?SortOrder", pick.SortOrder.ToString ()); |
473 | cmd.Parameters.AddWithValue("?Enabled", pick.Enabled.ToString()); | 473 | cmd.Parameters.AddWithValue("?Enabled", pick.Enabled.ToString()); |
474 | 474 | ||
475 | cmd.ExecuteNonQuery(); | 475 | cmd.ExecuteNonQuery(); |
476 | } | 476 | } |
477 | } | 477 | } |
@@ -484,24 +484,24 @@ namespace OpenSim.Data.MySQL | |||
484 | } | 484 | } |
485 | return true; | 485 | return true; |
486 | } | 486 | } |
487 | 487 | ||
488 | public bool DeletePicksRecord(UUID pickId) | 488 | public bool DeletePicksRecord(UUID pickId) |
489 | { | 489 | { |
490 | string query = string.Empty; | 490 | string query = string.Empty; |
491 | 491 | ||
492 | query += "DELETE FROM userpicks WHERE "; | 492 | query += "DELETE FROM userpicks WHERE "; |
493 | query += "pickuuid = ?PickId"; | 493 | query += "pickuuid = ?PickId"; |
494 | 494 | ||
495 | try | 495 | try |
496 | { | 496 | { |
497 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 497 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
498 | { | 498 | { |
499 | dbcon.Open(); | 499 | dbcon.Open(); |
500 | 500 | ||
501 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) | 501 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) |
502 | { | 502 | { |
503 | cmd.Parameters.AddWithValue("?PickId", pickId.ToString()); | 503 | cmd.Parameters.AddWithValue("?PickId", pickId.ToString()); |
504 | 504 | ||
505 | cmd.ExecuteNonQuery(); | 505 | cmd.ExecuteNonQuery(); |
506 | } | 506 | } |
507 | } | 507 | } |
@@ -515,12 +515,12 @@ namespace OpenSim.Data.MySQL | |||
515 | return true; | 515 | return true; |
516 | } | 516 | } |
517 | #endregion Picks Queries | 517 | #endregion Picks Queries |
518 | 518 | ||
519 | #region Avatar Notes Queries | 519 | #region Avatar Notes Queries |
520 | public bool GetAvatarNotes(ref UserProfileNotes notes) | 520 | public bool GetAvatarNotes(ref UserProfileNotes notes) |
521 | { // WIP | 521 | { // WIP |
522 | string query = string.Empty; | 522 | string query = string.Empty; |
523 | 523 | ||
524 | query += "SELECT `notes` FROM usernotes WHERE "; | 524 | query += "SELECT `notes` FROM usernotes WHERE "; |
525 | query += "useruuid = ?Id AND "; | 525 | query += "useruuid = ?Id AND "; |
526 | query += "targetuuid = ?TargetId"; | 526 | query += "targetuuid = ?TargetId"; |
@@ -534,7 +534,7 @@ namespace OpenSim.Data.MySQL | |||
534 | { | 534 | { |
535 | cmd.Parameters.AddWithValue("?Id", notes.UserId.ToString()); | 535 | cmd.Parameters.AddWithValue("?Id", notes.UserId.ToString()); |
536 | cmd.Parameters.AddWithValue("?TargetId", notes.TargetId.ToString()); | 536 | cmd.Parameters.AddWithValue("?TargetId", notes.TargetId.ToString()); |
537 | 537 | ||
538 | using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) | 538 | using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) |
539 | { | 539 | { |
540 | if(reader.HasRows) | 540 | if(reader.HasRows) |
@@ -557,12 +557,12 @@ namespace OpenSim.Data.MySQL | |||
557 | } | 557 | } |
558 | return true; | 558 | return true; |
559 | } | 559 | } |
560 | 560 | ||
561 | public bool UpdateAvatarNotes(ref UserProfileNotes note, ref string result) | 561 | public bool UpdateAvatarNotes(ref UserProfileNotes note, ref string result) |
562 | { | 562 | { |
563 | string query = string.Empty; | 563 | string query = string.Empty; |
564 | bool remove; | 564 | bool remove; |
565 | 565 | ||
566 | if(string.IsNullOrEmpty(note.Notes)) | 566 | if(string.IsNullOrEmpty(note.Notes)) |
567 | { | 567 | { |
568 | remove = true; | 568 | remove = true; |
@@ -581,7 +581,7 @@ namespace OpenSim.Data.MySQL | |||
581 | query += "UPDATE "; | 581 | query += "UPDATE "; |
582 | query += "notes=?Notes"; | 582 | query += "notes=?Notes"; |
583 | } | 583 | } |
584 | 584 | ||
585 | try | 585 | try |
586 | { | 586 | { |
587 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 587 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
@@ -593,7 +593,7 @@ namespace OpenSim.Data.MySQL | |||
593 | cmd.Parameters.AddWithValue("?Notes", note.Notes); | 593 | cmd.Parameters.AddWithValue("?Notes", note.Notes); |
594 | cmd.Parameters.AddWithValue("?TargetId", note.TargetId.ToString ()); | 594 | cmd.Parameters.AddWithValue("?TargetId", note.TargetId.ToString ()); |
595 | cmd.Parameters.AddWithValue("?UserId", note.UserId.ToString()); | 595 | cmd.Parameters.AddWithValue("?UserId", note.UserId.ToString()); |
596 | 596 | ||
597 | cmd.ExecuteNonQuery(); | 597 | cmd.ExecuteNonQuery(); |
598 | } | 598 | } |
599 | } | 599 | } |
@@ -605,18 +605,18 @@ namespace OpenSim.Data.MySQL | |||
605 | return false; | 605 | return false; |
606 | } | 606 | } |
607 | return true; | 607 | return true; |
608 | 608 | ||
609 | } | 609 | } |
610 | #endregion Avatar Notes Queries | 610 | #endregion Avatar Notes Queries |
611 | 611 | ||
612 | #region Avatar Properties | 612 | #region Avatar Properties |
613 | public bool GetAvatarProperties(ref UserProfileProperties props, ref string result) | 613 | public bool GetAvatarProperties(ref UserProfileProperties props, ref string result) |
614 | { | 614 | { |
615 | string query = string.Empty; | 615 | string query = string.Empty; |
616 | 616 | ||
617 | query += "SELECT * FROM userprofile WHERE "; | 617 | query += "SELECT * FROM userprofile WHERE "; |
618 | query += "useruuid = ?Id"; | 618 | query += "useruuid = ?Id"; |
619 | 619 | ||
620 | try | 620 | try |
621 | { | 621 | { |
622 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 622 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
@@ -625,7 +625,7 @@ namespace OpenSim.Data.MySQL | |||
625 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) | 625 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) |
626 | { | 626 | { |
627 | cmd.Parameters.AddWithValue("?Id", props.UserId.ToString()); | 627 | cmd.Parameters.AddWithValue("?Id", props.UserId.ToString()); |
628 | 628 | ||
629 | using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) | 629 | using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) |
630 | { | 630 | { |
631 | if(reader.HasRows) | 631 | if(reader.HasRows) |
@@ -649,7 +649,7 @@ namespace OpenSim.Data.MySQL | |||
649 | { | 649 | { |
650 | m_log.DebugFormat("[PROFILES_DATA]" + | 650 | m_log.DebugFormat("[PROFILES_DATA]" + |
651 | ": No data for {0}", props.UserId); | 651 | ": No data for {0}", props.UserId); |
652 | 652 | ||
653 | props.WebUrl = string.Empty; | 653 | props.WebUrl = string.Empty; |
654 | props.ImageId = UUID.Zero; | 654 | props.ImageId = UUID.Zero; |
655 | props.AboutText = string.Empty; | 655 | props.AboutText = string.Empty; |
@@ -730,11 +730,11 @@ namespace OpenSim.Data.MySQL | |||
730 | } | 730 | } |
731 | return true; | 731 | return true; |
732 | } | 732 | } |
733 | 733 | ||
734 | public bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result) | 734 | public bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result) |
735 | { | 735 | { |
736 | string query = string.Empty; | 736 | string query = string.Empty; |
737 | 737 | ||
738 | query += "UPDATE userprofile SET "; | 738 | query += "UPDATE userprofile SET "; |
739 | query += "profileURL=?profileURL, "; | 739 | query += "profileURL=?profileURL, "; |
740 | query += "profileImage=?image, "; | 740 | query += "profileImage=?image, "; |
@@ -742,7 +742,7 @@ namespace OpenSim.Data.MySQL | |||
742 | query += "profileFirstImage=?firstlifeimage,"; | 742 | query += "profileFirstImage=?firstlifeimage,"; |
743 | query += "profileFirstText=?firstlifetext "; | 743 | query += "profileFirstText=?firstlifetext "; |
744 | query += "WHERE useruuid=?uuid"; | 744 | query += "WHERE useruuid=?uuid"; |
745 | 745 | ||
746 | try | 746 | try |
747 | { | 747 | { |
748 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 748 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
@@ -756,7 +756,7 @@ namespace OpenSim.Data.MySQL | |||
756 | cmd.Parameters.AddWithValue("?firstlifeimage", props.FirstLifeImageId.ToString()); | 756 | cmd.Parameters.AddWithValue("?firstlifeimage", props.FirstLifeImageId.ToString()); |
757 | cmd.Parameters.AddWithValue("?firstlifetext", props.FirstLifeText); | 757 | cmd.Parameters.AddWithValue("?firstlifetext", props.FirstLifeText); |
758 | cmd.Parameters.AddWithValue("?uuid", props.UserId.ToString()); | 758 | cmd.Parameters.AddWithValue("?uuid", props.UserId.ToString()); |
759 | 759 | ||
760 | cmd.ExecuteNonQuery(); | 760 | cmd.ExecuteNonQuery(); |
761 | } | 761 | } |
762 | } | 762 | } |
@@ -765,18 +765,18 @@ namespace OpenSim.Data.MySQL | |||
765 | { | 765 | { |
766 | m_log.ErrorFormat("[PROFILES_DATA]" + | 766 | m_log.ErrorFormat("[PROFILES_DATA]" + |
767 | ": AgentPropertiesUpdate exception {0}", e.Message); | 767 | ": AgentPropertiesUpdate exception {0}", e.Message); |
768 | 768 | ||
769 | return false; | 769 | return false; |
770 | } | 770 | } |
771 | return true; | 771 | return true; |
772 | } | 772 | } |
773 | #endregion Avatar Properties | 773 | #endregion Avatar Properties |
774 | 774 | ||
775 | #region Avatar Interests | 775 | #region Avatar Interests |
776 | public bool UpdateAvatarInterests(UserProfileProperties up, ref string result) | 776 | public bool UpdateAvatarInterests(UserProfileProperties up, ref string result) |
777 | { | 777 | { |
778 | string query = string.Empty; | 778 | string query = string.Empty; |
779 | 779 | ||
780 | query += "UPDATE userprofile SET "; | 780 | query += "UPDATE userprofile SET "; |
781 | query += "profileWantToMask=?WantMask, "; | 781 | query += "profileWantToMask=?WantMask, "; |
782 | query += "profileWantToText=?WantText,"; | 782 | query += "profileWantToText=?WantText,"; |
@@ -784,7 +784,7 @@ namespace OpenSim.Data.MySQL | |||
784 | query += "profileSkillsText=?SkillsText, "; | 784 | query += "profileSkillsText=?SkillsText, "; |
785 | query += "profileLanguages=?Languages "; | 785 | query += "profileLanguages=?Languages "; |
786 | query += "WHERE useruuid=?uuid"; | 786 | query += "WHERE useruuid=?uuid"; |
787 | 787 | ||
788 | try | 788 | try |
789 | { | 789 | { |
790 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 790 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
@@ -798,7 +798,7 @@ namespace OpenSim.Data.MySQL | |||
798 | cmd.Parameters.AddWithValue("?SkillsText", up.SkillsText); | 798 | cmd.Parameters.AddWithValue("?SkillsText", up.SkillsText); |
799 | cmd.Parameters.AddWithValue("?Languages", up.Language); | 799 | cmd.Parameters.AddWithValue("?Languages", up.Language); |
800 | cmd.Parameters.AddWithValue("?uuid", up.UserId.ToString()); | 800 | cmd.Parameters.AddWithValue("?uuid", up.UserId.ToString()); |
801 | 801 | ||
802 | cmd.ExecuteNonQuery(); | 802 | cmd.ExecuteNonQuery(); |
803 | } | 803 | } |
804 | } | 804 | } |
@@ -820,8 +820,8 @@ namespace OpenSim.Data.MySQL | |||
820 | string query = "SELECT `snapshotuuid` FROM {0} WHERE `creatoruuid` = ?Id"; | 820 | string query = "SELECT `snapshotuuid` FROM {0} WHERE `creatoruuid` = ?Id"; |
821 | 821 | ||
822 | // Get classified image assets | 822 | // Get classified image assets |
823 | 823 | ||
824 | 824 | ||
825 | try | 825 | try |
826 | { | 826 | { |
827 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 827 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
@@ -831,7 +831,7 @@ namespace OpenSim.Data.MySQL | |||
831 | using (MySqlCommand cmd = new MySqlCommand(string.Format (query,"`classifieds`"), dbcon)) | 831 | using (MySqlCommand cmd = new MySqlCommand(string.Format (query,"`classifieds`"), dbcon)) |
832 | { | 832 | { |
833 | cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); | 833 | cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); |
834 | 834 | ||
835 | using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) | 835 | using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) |
836 | { | 836 | { |
837 | if(reader.HasRows) | 837 | if(reader.HasRows) |
@@ -850,7 +850,7 @@ namespace OpenSim.Data.MySQL | |||
850 | using (MySqlCommand cmd = new MySqlCommand(string.Format (query,"`userpicks`"), dbcon)) | 850 | using (MySqlCommand cmd = new MySqlCommand(string.Format (query,"`userpicks`"), dbcon)) |
851 | { | 851 | { |
852 | cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); | 852 | cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); |
853 | 853 | ||
854 | using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) | 854 | using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) |
855 | { | 855 | { |
856 | if(reader.HasRows) | 856 | if(reader.HasRows) |
@@ -862,7 +862,7 @@ namespace OpenSim.Data.MySQL | |||
862 | } | 862 | } |
863 | } | 863 | } |
864 | } | 864 | } |
865 | 865 | ||
866 | dbcon.Close(); | 866 | dbcon.Close(); |
867 | dbcon.Open(); | 867 | dbcon.Open(); |
868 | 868 | ||
@@ -871,7 +871,7 @@ namespace OpenSim.Data.MySQL | |||
871 | using (MySqlCommand cmd = new MySqlCommand(string.Format (query,"`userpicks`"), dbcon)) | 871 | using (MySqlCommand cmd = new MySqlCommand(string.Format (query,"`userpicks`"), dbcon)) |
872 | { | 872 | { |
873 | cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); | 873 | cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); |
874 | 874 | ||
875 | using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) | 875 | using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) |
876 | { | 876 | { |
877 | if(reader.HasRows) | 877 | if(reader.HasRows) |
@@ -893,7 +893,7 @@ namespace OpenSim.Data.MySQL | |||
893 | } | 893 | } |
894 | return data; | 894 | return data; |
895 | } | 895 | } |
896 | 896 | ||
897 | #region User Preferences | 897 | #region User Preferences |
898 | public bool GetUserPreferences(ref UserPreferences pref, ref string result) | 898 | public bool GetUserPreferences(ref UserPreferences pref, ref string result) |
899 | { | 899 | { |
@@ -987,16 +987,16 @@ namespace OpenSim.Data.MySQL | |||
987 | return true; | 987 | return true; |
988 | } | 988 | } |
989 | #endregion User Preferences | 989 | #endregion User Preferences |
990 | 990 | ||
991 | #region Integration | 991 | #region Integration |
992 | public bool GetUserAppData(ref UserAppData props, ref string result) | 992 | public bool GetUserAppData(ref UserAppData props, ref string result) |
993 | { | 993 | { |
994 | string query = string.Empty; | 994 | string query = string.Empty; |
995 | 995 | ||
996 | query += "SELECT * FROM `userdata` WHERE "; | 996 | query += "SELECT * FROM `userdata` WHERE "; |
997 | query += "UserId = ?Id AND "; | 997 | query += "UserId = ?Id AND "; |
998 | query += "TagId = ?TagId"; | 998 | query += "TagId = ?TagId"; |
999 | 999 | ||
1000 | try | 1000 | try |
1001 | { | 1001 | { |
1002 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 1002 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
@@ -1006,7 +1006,7 @@ namespace OpenSim.Data.MySQL | |||
1006 | { | 1006 | { |
1007 | cmd.Parameters.AddWithValue("?Id", props.UserId.ToString()); | 1007 | cmd.Parameters.AddWithValue("?Id", props.UserId.ToString()); |
1008 | cmd.Parameters.AddWithValue ("?TagId", props.TagId.ToString()); | 1008 | cmd.Parameters.AddWithValue ("?TagId", props.TagId.ToString()); |
1009 | 1009 | ||
1010 | using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) | 1010 | using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) |
1011 | { | 1011 | { |
1012 | if(reader.HasRows) | 1012 | if(reader.HasRows) |
@@ -1022,7 +1022,7 @@ namespace OpenSim.Data.MySQL | |||
1022 | query += "?TagId,"; | 1022 | query += "?TagId,"; |
1023 | query += "?DataKey,"; | 1023 | query += "?DataKey,"; |
1024 | query += "?DataVal) "; | 1024 | query += "?DataVal) "; |
1025 | 1025 | ||
1026 | using (MySqlCommand put = new MySqlCommand(query, dbcon)) | 1026 | using (MySqlCommand put = new MySqlCommand(query, dbcon)) |
1027 | { | 1027 | { |
1028 | put.Parameters.AddWithValue("?UserId", props.UserId.ToString()); | 1028 | put.Parameters.AddWithValue("?UserId", props.UserId.ToString()); |
@@ -1048,16 +1048,16 @@ namespace OpenSim.Data.MySQL | |||
1048 | } | 1048 | } |
1049 | 1049 | ||
1050 | public bool SetUserAppData(UserAppData props, ref string result) | 1050 | public bool SetUserAppData(UserAppData props, ref string result) |
1051 | { | 1051 | { |
1052 | string query = string.Empty; | 1052 | string query = string.Empty; |
1053 | 1053 | ||
1054 | query += "UPDATE userdata SET "; | 1054 | query += "UPDATE userdata SET "; |
1055 | query += "TagId = ?TagId, "; | 1055 | query += "TagId = ?TagId, "; |
1056 | query += "DataKey = ?DataKey, "; | 1056 | query += "DataKey = ?DataKey, "; |
1057 | query += "DataVal = ?DataVal WHERE "; | 1057 | query += "DataVal = ?DataVal WHERE "; |
1058 | query += "UserId = ?UserId AND "; | 1058 | query += "UserId = ?UserId AND "; |
1059 | query += "TagId = ?TagId"; | 1059 | query += "TagId = ?TagId"; |
1060 | 1060 | ||
1061 | try | 1061 | try |
1062 | { | 1062 | { |
1063 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 1063 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |