aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs
diff options
context:
space:
mode:
authoronefang2019-05-19 21:24:15 +1000
committeronefang2019-05-19 21:24:15 +1000
commit5e4d6cab00cb29cd088ab7b62ab13aff103b64cb (patch)
treea9fbc62df9eb2d1d9ba2698d8552eae71eca20d8 /OpenSim/Data/SQLite/SQLiteUserProfilesData.cs
parentAdd a build script. (diff)
downloadopensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.zip
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.gz
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.bz2
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.xz
Dump OpenSim 0.9.0.1 into it's own branch.
Diffstat (limited to 'OpenSim/Data/SQLite/SQLiteUserProfilesData.cs')
-rw-r--r--OpenSim/Data/SQLite/SQLiteUserProfilesData.cs165
1 files changed, 83 insertions, 82 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs b/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs
index cd3e8b6..13aac79 100644
--- a/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs
+++ b/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs
@@ -46,43 +46,43 @@ namespace OpenSim.Data.SQLite
46 { 46 {
47 private static readonly ILog m_log = 47 private static readonly ILog m_log =
48 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 48 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 49
50 private SqliteConnection m_connection; 50 private SqliteConnection m_connection;
51 private string m_connectionString; 51 private string m_connectionString;
52 52
53 private Dictionary<string, FieldInfo> m_FieldMap = 53 private Dictionary<string, FieldInfo> m_FieldMap =
54 new Dictionary<string, FieldInfo>(); 54 new Dictionary<string, FieldInfo>();
55 55
56 protected virtual Assembly Assembly 56 protected virtual Assembly Assembly
57 { 57 {
58 get { return GetType().Assembly; } 58 get { return GetType().Assembly; }
59 } 59 }
60 60
61 public SQLiteUserProfilesData() 61 public SQLiteUserProfilesData()
62 { 62 {
63 } 63 }
64 64
65 public SQLiteUserProfilesData(string connectionString) 65 public SQLiteUserProfilesData(string connectionString)
66 { 66 {
67 Initialise(connectionString); 67 Initialise(connectionString);
68 } 68 }
69 69
70 public void Initialise(string connectionString) 70 public void Initialise(string connectionString)
71 { 71 {
72 if (Util.IsWindows()) 72 if (Util.IsWindows())
73 Util.LoadArchSpecificWindowsDll("sqlite3.dll"); 73 Util.LoadArchSpecificWindowsDll("sqlite3.dll");
74 74
75 m_connectionString = connectionString; 75 m_connectionString = connectionString;
76 76
77 m_log.Info("[PROFILES_DATA]: Sqlite - connecting: "+m_connectionString); 77 m_log.Info("[PROFILES_DATA]: Sqlite - connecting: "+m_connectionString);
78 78
79 m_connection = new SqliteConnection(m_connectionString); 79 m_connection = new SqliteConnection(m_connectionString);
80 m_connection.Open(); 80 m_connection.Open();
81 81
82 Migration m = new Migration(m_connection, Assembly, "UserProfiles"); 82 Migration m = new Migration(m_connection, Assembly, "UserProfiles");
83 m.Update(); 83 m.Update();
84 } 84 }
85 85
86 private string[] FieldList 86 private string[] FieldList
87 { 87 {
88 get { return new List<string>(m_FieldMap.Keys).ToArray(); } 88 get { return new List<string>(m_FieldMap.Keys).ToArray(); }
@@ -123,7 +123,7 @@ namespace OpenSim.Data.SQLite
123 } 123 }
124 124
125 reader.Close(); 125 reader.Close();
126 126
127 return data; 127 return data;
128 } 128 }
129 public bool UpdateClassifiedRecord(UserClassifiedAdd ad, ref string result) 129 public bool UpdateClassifiedRecord(UserClassifiedAdd ad, ref string result)
@@ -162,21 +162,21 @@ namespace OpenSim.Data.SQLite
162 query += ":ParcelName,"; 162 query += ":ParcelName,";
163 query += ":Flags,"; 163 query += ":Flags,";
164 query += ":ListingPrice ) "; 164 query += ":ListingPrice ) ";
165 165
166 if(string.IsNullOrEmpty(ad.ParcelName)) 166 if(string.IsNullOrEmpty(ad.ParcelName))
167 ad.ParcelName = "Unknown"; 167 ad.ParcelName = "Unknown";
168 if(ad.ParcelId == null) 168 if(ad.ParcelId == null)
169 ad.ParcelId = UUID.Zero; 169 ad.ParcelId = UUID.Zero;
170 if(string.IsNullOrEmpty(ad.Description)) 170 if(string.IsNullOrEmpty(ad.Description))
171 ad.Description = "No Description"; 171 ad.Description = "No Description";
172 172
173 DateTime epoch = new DateTime(1970, 1, 1); 173 DateTime epoch = new DateTime(1970, 1, 1);
174 DateTime now = DateTime.Now; 174 DateTime now = DateTime.Now;
175 TimeSpan epochnow = now - epoch; 175 TimeSpan epochnow = now - epoch;
176 TimeSpan duration; 176 TimeSpan duration;
177 DateTime expiration; 177 DateTime expiration;
178 TimeSpan epochexp; 178 TimeSpan epochexp;
179 179
180 if(ad.Flags == 2) 180 if(ad.Flags == 2)
181 { 181 {
182 duration = new TimeSpan(7,0,0,0); 182 duration = new TimeSpan(7,0,0,0);
@@ -211,7 +211,7 @@ namespace OpenSim.Data.SQLite
211 cmd.Parameters.AddWithValue(":ParcelName", ad.ParcelName.ToString()); 211 cmd.Parameters.AddWithValue(":ParcelName", ad.ParcelName.ToString());
212 cmd.Parameters.AddWithValue(":Flags", ad.Flags.ToString()); 212 cmd.Parameters.AddWithValue(":Flags", ad.Flags.ToString());
213 cmd.Parameters.AddWithValue(":ListingPrice", ad.Price.ToString ()); 213 cmd.Parameters.AddWithValue(":ListingPrice", ad.Price.ToString ());
214 214
215 cmd.ExecuteNonQuery(); 215 cmd.ExecuteNonQuery();
216 } 216 }
217 } 217 }
@@ -227,17 +227,17 @@ namespace OpenSim.Data.SQLite
227 public bool DeleteClassifiedRecord(UUID recordId) 227 public bool DeleteClassifiedRecord(UUID recordId)
228 { 228 {
229 string query = string.Empty; 229 string query = string.Empty;
230 230
231 query += "DELETE FROM classifieds WHERE "; 231 query += "DELETE FROM classifieds WHERE ";
232 query += "classifieduuid = :ClasifiedId"; 232 query += "classifieduuid = :ClasifiedId";
233 233
234 try 234 try
235 { 235 {
236 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) 236 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
237 { 237 {
238 cmd.CommandText = query; 238 cmd.CommandText = query;
239 cmd.Parameters.AddWithValue(":ClassifiedId", recordId.ToString()); 239 cmd.Parameters.AddWithValue(":ClassifiedId", recordId.ToString());
240 240
241 cmd.ExecuteNonQuery(); 241 cmd.ExecuteNonQuery();
242 } 242 }
243 } 243 }
@@ -254,17 +254,17 @@ namespace OpenSim.Data.SQLite
254 { 254 {
255 IDataReader reader = null; 255 IDataReader reader = null;
256 string query = string.Empty; 256 string query = string.Empty;
257 257
258 query += "SELECT * FROM classifieds WHERE "; 258 query += "SELECT * FROM classifieds WHERE ";
259 query += "classifieduuid = :AdId"; 259 query += "classifieduuid = :AdId";
260 260
261 try 261 try
262 { 262 {
263 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) 263 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
264 { 264 {
265 cmd.CommandText = query; 265 cmd.CommandText = query;
266 cmd.Parameters.AddWithValue(":AdId", ad.ClassifiedId.ToString()); 266 cmd.Parameters.AddWithValue(":AdId", ad.ClassifiedId.ToString());
267 267
268 using (reader = cmd.ExecuteReader()) 268 using (reader = cmd.ExecuteReader())
269 { 269 {
270 if(reader.Read ()) 270 if(reader.Read ())
@@ -299,24 +299,24 @@ namespace OpenSim.Data.SQLite
299 { 299 {
300 IDataReader reader = null; 300 IDataReader reader = null;
301 string query = string.Empty; 301 string query = string.Empty;
302 302
303 query += "SELECT `pickuuid`,`name` FROM userpicks WHERE "; 303 query += "SELECT `pickuuid`,`name` FROM userpicks WHERE ";
304 query += "creatoruuid = :Id"; 304 query += "creatoruuid = :Id";
305 OSDArray data = new OSDArray(); 305 OSDArray data = new OSDArray();
306 306
307 try 307 try
308 { 308 {
309 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) 309 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
310 { 310 {
311 cmd.CommandText = query; 311 cmd.CommandText = query;
312 cmd.Parameters.AddWithValue(":Id", avatarId.ToString()); 312 cmd.Parameters.AddWithValue(":Id", avatarId.ToString());
313 313
314 using (reader = cmd.ExecuteReader()) 314 using (reader = cmd.ExecuteReader())
315 { 315 {
316 while (reader.Read()) 316 while (reader.Read())
317 { 317 {
318 OSDMap record = new OSDMap(); 318 OSDMap record = new OSDMap();
319 319
320 record.Add("pickuuid",OSD.FromString((string)reader["pickuuid"])); 320 record.Add("pickuuid",OSD.FromString((string)reader["pickuuid"]));
321 record.Add("name",OSD.FromString((string)reader["name"])); 321 record.Add("name",OSD.FromString((string)reader["name"]));
322 data.Add(record); 322 data.Add(record);
@@ -336,11 +336,11 @@ namespace OpenSim.Data.SQLite
336 IDataReader reader = null; 336 IDataReader reader = null;
337 string query = string.Empty; 337 string query = string.Empty;
338 UserProfilePick pick = new UserProfilePick(); 338 UserProfilePick pick = new UserProfilePick();
339 339
340 query += "SELECT * FROM userpicks WHERE "; 340 query += "SELECT * FROM userpicks WHERE ";
341 query += "creatoruuid = :CreatorId AND "; 341 query += "creatoruuid = :CreatorId AND ";
342 query += "pickuuid = :PickId"; 342 query += "pickuuid = :PickId";
343 343
344 try 344 try
345 { 345 {
346 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) 346 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
@@ -348,17 +348,17 @@ namespace OpenSim.Data.SQLite
348 cmd.CommandText = query; 348 cmd.CommandText = query;
349 cmd.Parameters.AddWithValue(":CreatorId", avatarId.ToString()); 349 cmd.Parameters.AddWithValue(":CreatorId", avatarId.ToString());
350 cmd.Parameters.AddWithValue(":PickId", pickId.ToString()); 350 cmd.Parameters.AddWithValue(":PickId", pickId.ToString());
351 351
352 using (reader = cmd.ExecuteReader()) 352 using (reader = cmd.ExecuteReader())
353 { 353 {
354 354
355 while (reader.Read()) 355 while (reader.Read())
356 { 356 {
357 string description = (string)reader["description"]; 357 string description = (string)reader["description"];
358 358
359 if (string.IsNullOrEmpty(description)) 359 if (string.IsNullOrEmpty(description))
360 description = "No description given."; 360 description = "No description given.";
361 361
362 UUID.TryParse((string)reader["pickuuid"], out pick.PickId); 362 UUID.TryParse((string)reader["pickuuid"], out pick.PickId);
363 UUID.TryParse((string)reader["creatoruuid"], out pick.CreatorId); 363 UUID.TryParse((string)reader["creatoruuid"], out pick.CreatorId);
364 UUID.TryParse((string)reader["parceluuid"], out pick.ParcelId); 364 UUID.TryParse((string)reader["parceluuid"], out pick.ParcelId);
@@ -385,7 +385,7 @@ namespace OpenSim.Data.SQLite
385 } 385 }
386 386
387 public bool UpdatePicksRecord(UserProfilePick pick) 387 public bool UpdatePicksRecord(UserProfilePick pick)
388 { 388 {
389 string query = string.Empty; 389 string query = string.Empty;
390 390
391 query += "INSERT OR REPLACE INTO userpicks ("; 391 query += "INSERT OR REPLACE INTO userpicks (";
@@ -416,7 +416,7 @@ namespace OpenSim.Data.SQLite
416 query += ":GlobalPos,"; 416 query += ":GlobalPos,";
417 query += ":SortOrder,"; 417 query += ":SortOrder,";
418 query += ":Enabled) "; 418 query += ":Enabled) ";
419 419
420 try 420 try
421 { 421 {
422 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) 422 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
@@ -456,10 +456,10 @@ namespace OpenSim.Data.SQLite
456 public bool DeletePicksRecord(UUID pickId) 456 public bool DeletePicksRecord(UUID pickId)
457 { 457 {
458 string query = string.Empty; 458 string query = string.Empty;
459 459
460 query += "DELETE FROM userpicks WHERE "; 460 query += "DELETE FROM userpicks WHERE ";
461 query += "pickuuid = :PickId"; 461 query += "pickuuid = :PickId";
462 462
463 try 463 try
464 { 464 {
465 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) 465 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
@@ -479,15 +479,15 @@ namespace OpenSim.Data.SQLite
479 } 479 }
480 480
481 public bool GetAvatarNotes(ref UserProfileNotes notes) 481 public bool GetAvatarNotes(ref UserProfileNotes notes)
482 { 482 {
483 IDataReader reader = null; 483 IDataReader reader = null;
484 string query = string.Empty; 484 string query = string.Empty;
485 485
486 query += "SELECT `notes` FROM usernotes WHERE "; 486 query += "SELECT `notes` FROM usernotes WHERE ";
487 query += "useruuid = :Id AND "; 487 query += "useruuid = :Id AND ";
488 query += "targetuuid = :TargetId"; 488 query += "targetuuid = :TargetId";
489 OSDArray data = new OSDArray(); 489 OSDArray data = new OSDArray();
490 490
491 try 491 try
492 { 492 {
493 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) 493 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
@@ -495,7 +495,7 @@ namespace OpenSim.Data.SQLite
495 cmd.CommandText = query; 495 cmd.CommandText = query;
496 cmd.Parameters.AddWithValue(":Id", notes.UserId.ToString()); 496 cmd.Parameters.AddWithValue(":Id", notes.UserId.ToString());
497 cmd.Parameters.AddWithValue(":TargetId", notes.TargetId.ToString()); 497 cmd.Parameters.AddWithValue(":TargetId", notes.TargetId.ToString());
498 498
499 using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) 499 using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
500 { 500 {
501 while (reader.Read()) 501 while (reader.Read())
@@ -514,10 +514,10 @@ namespace OpenSim.Data.SQLite
514 } 514 }
515 515
516 public bool UpdateAvatarNotes(ref UserProfileNotes note, ref string result) 516 public bool UpdateAvatarNotes(ref UserProfileNotes note, ref string result)
517 { 517 {
518 string query = string.Empty; 518 string query = string.Empty;
519 bool remove; 519 bool remove;
520 520
521 if(string.IsNullOrEmpty(note.Notes)) 521 if(string.IsNullOrEmpty(note.Notes))
522 { 522 {
523 remove = true; 523 remove = true;
@@ -533,7 +533,7 @@ namespace OpenSim.Data.SQLite
533 query += ":TargetId,"; 533 query += ":TargetId,";
534 query += ":Notes )"; 534 query += ":Notes )";
535 } 535 }
536 536
537 try 537 try
538 { 538 {
539 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) 539 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
@@ -544,7 +544,7 @@ namespace OpenSim.Data.SQLite
544 cmd.Parameters.AddWithValue(":Notes", note.Notes); 544 cmd.Parameters.AddWithValue(":Notes", note.Notes);
545 cmd.Parameters.AddWithValue(":TargetId", note.TargetId.ToString ()); 545 cmd.Parameters.AddWithValue(":TargetId", note.TargetId.ToString ());
546 cmd.Parameters.AddWithValue(":UserId", note.UserId.ToString()); 546 cmd.Parameters.AddWithValue(":UserId", note.UserId.ToString());
547 547
548 cmd.ExecuteNonQuery(); 548 cmd.ExecuteNonQuery();
549 } 549 }
550 } 550 }
@@ -561,7 +561,7 @@ namespace OpenSim.Data.SQLite
561 { 561 {
562 IDataReader reader = null; 562 IDataReader reader = null;
563 string query = string.Empty; 563 string query = string.Empty;
564 564
565 query += "SELECT * FROM userprofile WHERE "; 565 query += "SELECT * FROM userprofile WHERE ";
566 query += "useruuid = :Id"; 566 query += "useruuid = :Id";
567 567
@@ -569,7 +569,7 @@ namespace OpenSim.Data.SQLite
569 { 569 {
570 cmd.CommandText = query; 570 cmd.CommandText = query;
571 cmd.Parameters.AddWithValue(":Id", props.UserId.ToString()); 571 cmd.Parameters.AddWithValue(":Id", props.UserId.ToString());
572 572
573 573
574 try 574 try
575 { 575 {
@@ -611,7 +611,7 @@ namespace OpenSim.Data.SQLite
611 props.Language = string.Empty; 611 props.Language = string.Empty;
612 props.PublishProfile = false; 612 props.PublishProfile = false;
613 props.PublishMature = false; 613 props.PublishMature = false;
614 614
615 query = "INSERT INTO userprofile ("; 615 query = "INSERT INTO userprofile (";
616 query += "useruuid, "; 616 query += "useruuid, ";
617 query += "profilePartner, "; 617 query += "profilePartner, ";
@@ -659,7 +659,7 @@ namespace OpenSim.Data.SQLite
659 put.Parameters.AddWithValue(":profileAboutText", props.AboutText); 659 put.Parameters.AddWithValue(":profileAboutText", props.AboutText);
660 put.Parameters.AddWithValue(":profileFirstImage", props.FirstLifeImageId.ToString()); 660 put.Parameters.AddWithValue(":profileFirstImage", props.FirstLifeImageId.ToString());
661 put.Parameters.AddWithValue(":profileFirstText", props.FirstLifeText); 661 put.Parameters.AddWithValue(":profileFirstText", props.FirstLifeText);
662 662
663 put.ExecuteNonQuery(); 663 put.ExecuteNonQuery();
664 } 664 }
665 } 665 }
@@ -668,9 +668,9 @@ namespace OpenSim.Data.SQLite
668 } 668 }
669 669
670 public bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result) 670 public bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result)
671 { 671 {
672 string query = string.Empty; 672 string query = string.Empty;
673 673
674 query += "UPDATE userprofile SET "; 674 query += "UPDATE userprofile SET ";
675 query += "profileURL=:profileURL, "; 675 query += "profileURL=:profileURL, ";
676 query += "profileImage=:image, "; 676 query += "profileImage=:image, ";
@@ -678,7 +678,7 @@ namespace OpenSim.Data.SQLite
678 query += "profileFirstImage=:firstlifeimage,"; 678 query += "profileFirstImage=:firstlifeimage,";
679 query += "profileFirstText=:firstlifetext "; 679 query += "profileFirstText=:firstlifetext ";
680 query += "WHERE useruuid=:uuid"; 680 query += "WHERE useruuid=:uuid";
681 681
682 try 682 try
683 { 683 {
684 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) 684 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
@@ -690,7 +690,7 @@ namespace OpenSim.Data.SQLite
690 cmd.Parameters.AddWithValue(":firstlifeimage", props.FirstLifeImageId.ToString()); 690 cmd.Parameters.AddWithValue(":firstlifeimage", props.FirstLifeImageId.ToString());
691 cmd.Parameters.AddWithValue(":firstlifetext", props.FirstLifeText); 691 cmd.Parameters.AddWithValue(":firstlifetext", props.FirstLifeText);
692 cmd.Parameters.AddWithValue(":uuid", props.UserId.ToString()); 692 cmd.Parameters.AddWithValue(":uuid", props.UserId.ToString());
693 693
694 cmd.ExecuteNonQuery(); 694 cmd.ExecuteNonQuery();
695 } 695 }
696 } 696 }
@@ -698,16 +698,16 @@ namespace OpenSim.Data.SQLite
698 { 698 {
699 m_log.ErrorFormat("[PROFILES_DATA]" + 699 m_log.ErrorFormat("[PROFILES_DATA]" +
700 ": AgentPropertiesUpdate exception {0}", e.Message); 700 ": AgentPropertiesUpdate exception {0}", e.Message);
701 701
702 return false; 702 return false;
703 } 703 }
704 return true; 704 return true;
705 } 705 }
706 706
707 public bool UpdateAvatarInterests(UserProfileProperties up, ref string result) 707 public bool UpdateAvatarInterests(UserProfileProperties up, ref string result)
708 { 708 {
709 string query = string.Empty; 709 string query = string.Empty;
710 710
711 query += "UPDATE userprofile SET "; 711 query += "UPDATE userprofile SET ";
712 query += "profileWantToMask=:WantMask, "; 712 query += "profileWantToMask=:WantMask, ";
713 query += "profileWantToText=:WantText,"; 713 query += "profileWantToText=:WantText,";
@@ -715,7 +715,7 @@ namespace OpenSim.Data.SQLite
715 query += "profileSkillsText=:SkillsText, "; 715 query += "profileSkillsText=:SkillsText, ";
716 query += "profileLanguages=:Languages "; 716 query += "profileLanguages=:Languages ";
717 query += "WHERE useruuid=:uuid"; 717 query += "WHERE useruuid=:uuid";
718 718
719 try 719 try
720 { 720 {
721 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) 721 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
@@ -727,7 +727,7 @@ namespace OpenSim.Data.SQLite
727 cmd.Parameters.AddWithValue(":SkillsText", up.SkillsText); 727 cmd.Parameters.AddWithValue(":SkillsText", up.SkillsText);
728 cmd.Parameters.AddWithValue(":Languages", up.Language); 728 cmd.Parameters.AddWithValue(":Languages", up.Language);
729 cmd.Parameters.AddWithValue(":uuid", up.UserId.ToString()); 729 cmd.Parameters.AddWithValue(":uuid", up.UserId.ToString());
730 730
731 cmd.ExecuteNonQuery(); 731 cmd.ExecuteNonQuery();
732 } 732 }
733 } 733 }
@@ -741,16 +741,17 @@ namespace OpenSim.Data.SQLite
741 return true; 741 return true;
742 } 742 }
743 743
744
744 public bool UpdateUserPreferences(ref UserPreferences pref, ref string result) 745 public bool UpdateUserPreferences(ref UserPreferences pref, ref string result)
745 { 746 {
746 string query = string.Empty; 747 string query = string.Empty;
747 748
748 query += "UPDATE usersettings SET "; 749 query += "UPDATE usersettings SET ";
749 query += "imviaemail=:ImViaEmail, "; 750 query += "imviaemail=:ImViaEmail, ";
750 query += "visible=:Visible, "; 751 query += "visible=:Visible, ";
751 query += "email=:EMail "; 752 query += "email=:EMail ";
752 query += "WHERE useruuid=:uuid"; 753 query += "WHERE useruuid=:uuid";
753 754
754 try 755 try
755 { 756 {
756 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) 757 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
@@ -760,7 +761,7 @@ namespace OpenSim.Data.SQLite
760 cmd.Parameters.AddWithValue(":Visible", pref.Visible); 761 cmd.Parameters.AddWithValue(":Visible", pref.Visible);
761 cmd.Parameters.AddWithValue(":EMail", pref.EMail); 762 cmd.Parameters.AddWithValue(":EMail", pref.EMail);
762 cmd.Parameters.AddWithValue(":uuid", pref.UserId.ToString()); 763 cmd.Parameters.AddWithValue(":uuid", pref.UserId.ToString());
763 764
764 cmd.ExecuteNonQuery(); 765 cmd.ExecuteNonQuery();
765 } 766 }
766 } 767 }
@@ -778,20 +779,20 @@ namespace OpenSim.Data.SQLite
778 { 779 {
779 IDataReader reader = null; 780 IDataReader reader = null;
780 string query = string.Empty; 781 string query = string.Empty;
781 782
782 query += "SELECT imviaemail,visible,email FROM "; 783 query += "SELECT imviaemail,visible,email FROM ";
783 query += "usersettings WHERE "; 784 query += "usersettings WHERE ";
784 query += "useruuid = :Id"; 785 query += "useruuid = :Id";
785 786
786 OSDArray data = new OSDArray(); 787 OSDArray data = new OSDArray();
787 788
788 try 789 try
789 { 790 {
790 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) 791 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
791 { 792 {
792 cmd.CommandText = query; 793 cmd.CommandText = query;
793 cmd.Parameters.AddWithValue("?Id", pref.UserId.ToString()); 794 cmd.Parameters.AddWithValue("?Id", pref.UserId.ToString());
794 795
795 using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) 796 using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
796 { 797 {
797 if(reader.Read()) 798 if(reader.Read())
@@ -804,13 +805,13 @@ namespace OpenSim.Data.SQLite
804 { 805 {
805 query = "INSERT INTO usersettings VALUES "; 806 query = "INSERT INTO usersettings VALUES ";
806 query += "(:Id,'false','false', :Email)"; 807 query += "(:Id,'false','false', :Email)";
807 808
808 using (SqliteCommand put = (SqliteCommand)m_connection.CreateCommand()) 809 using (SqliteCommand put = (SqliteCommand)m_connection.CreateCommand())
809 { 810 {
810 put.Parameters.AddWithValue(":Id", pref.UserId.ToString()); 811 put.Parameters.AddWithValue(":Id", pref.UserId.ToString());
811 put.Parameters.AddWithValue(":Email", pref.EMail); 812 put.Parameters.AddWithValue(":Email", pref.EMail);
812 put.ExecuteNonQuery(); 813 put.ExecuteNonQuery();
813 814
814 } 815 }
815 } 816 }
816 } 817 }
@@ -830,11 +831,11 @@ namespace OpenSim.Data.SQLite
830 { 831 {
831 IDataReader reader = null; 832 IDataReader reader = null;
832 string query = string.Empty; 833 string query = string.Empty;
833 834
834 query += "SELECT * FROM `userdata` WHERE "; 835 query += "SELECT * FROM `userdata` WHERE ";
835 query += "UserId = :Id AND "; 836 query += "UserId = :Id AND ";
836 query += "TagId = :TagId"; 837 query += "TagId = :TagId";
837 838
838 try 839 try
839 { 840 {
840 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) 841 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
@@ -842,7 +843,7 @@ namespace OpenSim.Data.SQLite
842 cmd.CommandText = query; 843 cmd.CommandText = query;
843 cmd.Parameters.AddWithValue(":Id", props.UserId.ToString()); 844 cmd.Parameters.AddWithValue(":Id", props.UserId.ToString());
844 cmd.Parameters.AddWithValue (":TagId", props.TagId.ToString()); 845 cmd.Parameters.AddWithValue (":TagId", props.TagId.ToString());
845 846
846 using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) 847 using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
847 { 848 {
848 if(reader.Read()) 849 if(reader.Read())
@@ -857,7 +858,7 @@ namespace OpenSim.Data.SQLite
857 query += ":TagId,"; 858 query += ":TagId,";
858 query += ":DataKey,"; 859 query += ":DataKey,";
859 query += ":DataVal) "; 860 query += ":DataVal) ";
860 861
861 using (SqliteCommand put = (SqliteCommand)m_connection.CreateCommand()) 862 using (SqliteCommand put = (SqliteCommand)m_connection.CreateCommand())
862 { 863 {
863 put.Parameters.AddWithValue(":Id", props.UserId.ToString()); 864 put.Parameters.AddWithValue(":Id", props.UserId.ToString());
@@ -881,16 +882,16 @@ namespace OpenSim.Data.SQLite
881 return true; 882 return true;
882 } 883 }
883 public bool SetUserAppData(UserAppData props, ref string result) 884 public bool SetUserAppData(UserAppData props, ref string result)
884 { 885 {
885 string query = string.Empty; 886 string query = string.Empty;
886 887
887 query += "UPDATE userdata SET "; 888 query += "UPDATE userdata SET ";
888 query += "TagId = :TagId, "; 889 query += "TagId = :TagId, ";
889 query += "DataKey = :DataKey, "; 890 query += "DataKey = :DataKey, ";
890 query += "DataVal = :DataVal WHERE "; 891 query += "DataVal = :DataVal WHERE ";
891 query += "UserId = :UserId AND "; 892 query += "UserId = :UserId AND ";
892 query += "TagId = :TagId"; 893 query += "TagId = :TagId";
893 894
894 try 895 try
895 { 896 {
896 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) 897 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
@@ -917,17 +918,17 @@ namespace OpenSim.Data.SQLite
917 IDataReader reader = null; 918 IDataReader reader = null;
918 OSDArray data = new OSDArray(); 919 OSDArray data = new OSDArray();
919 string query = "SELECT `snapshotuuid` FROM {0} WHERE `creatoruuid` = :Id"; 920 string query = "SELECT `snapshotuuid` FROM {0} WHERE `creatoruuid` = :Id";
920 921
921 // Get classified image assets 922 // Get classified image assets
922 923
923 924
924 try 925 try
925 { 926 {
926 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) 927 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
927 { 928 {
928 cmd.CommandText = query; 929 cmd.CommandText = query;
929 cmd.Parameters.AddWithValue(":Id", avatarId.ToString()); 930 cmd.Parameters.AddWithValue(":Id", avatarId.ToString());
930 931
931 using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) 932 using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
932 { 933 {
933 while(reader.Read()) 934 while(reader.Read())
@@ -941,7 +942,7 @@ namespace OpenSim.Data.SQLite
941 { 942 {
942 cmd.CommandText = query; 943 cmd.CommandText = query;
943 cmd.Parameters.AddWithValue(":Id", avatarId.ToString()); 944 cmd.Parameters.AddWithValue(":Id", avatarId.ToString());
944 945
945 using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) 946 using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
946 { 947 {
947 if(reader.Read()) 948 if(reader.Read())
@@ -950,14 +951,14 @@ namespace OpenSim.Data.SQLite
950 } 951 }
951 } 952 }
952 } 953 }
953 954
954 query = "SELECT `profileImage`, `profileFirstImage` FROM `userprofile` WHERE `useruuid` = :Id"; 955 query = "SELECT `profileImage`, `profileFirstImage` FROM `userprofile` WHERE `useruuid` = :Id";
955 956
956 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) 957 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
957 { 958 {
958 cmd.CommandText = query; 959 cmd.CommandText = query;
959 cmd.Parameters.AddWithValue(":Id", avatarId.ToString()); 960 cmd.Parameters.AddWithValue(":Id", avatarId.ToString());
960 961
961 using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) 962 using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
962 { 963 {
963 if(reader.Read()) 964 if(reader.Read())