diff options
author | UbitUmarov | 2017-05-06 20:23:55 +0100 |
---|---|---|
committer | UbitUmarov | 2017-05-06 20:23:55 +0100 |
commit | 504736eb433d4f032c1930b70d9007934caef9c5 (patch) | |
tree | 43691d3d889c2203aee77e818a60939f83bf1316 /OpenSim/Data | |
parent | GZipStream does have a CopyTo() (diff) | |
download | opensim-SC_OLD-504736eb433d4f032c1930b70d9007934caef9c5.zip opensim-SC_OLD-504736eb433d4f032c1930b70d9007934caef9c5.tar.gz opensim-SC_OLD-504736eb433d4f032c1930b70d9007934caef9c5.tar.bz2 opensim-SC_OLD-504736eb433d4f032c1930b70d9007934caef9c5.tar.xz |
build const strings a compile time...
Diffstat (limited to 'OpenSim/Data')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLUserProfilesData.cs | 347 |
1 files changed, 146 insertions, 201 deletions
diff --git a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs index dfc3711..c98e017 100644 --- a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs +++ b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs | |||
@@ -90,7 +90,7 @@ namespace OpenSim.Data.MySQL | |||
90 | 90 | ||
91 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 91 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
92 | { | 92 | { |
93 | string query = "SELECT classifieduuid, name FROM classifieds WHERE creatoruuid = ?Id"; | 93 | const string query = "SELECT classifieduuid, name FROM classifieds WHERE creatoruuid = ?Id"; |
94 | dbcon.Open(); | 94 | dbcon.Open(); |
95 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) | 95 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) |
96 | { | 96 | { |
@@ -129,52 +129,51 @@ namespace OpenSim.Data.MySQL | |||
129 | 129 | ||
130 | public bool UpdateClassifiedRecord(UserClassifiedAdd ad, ref string result) | 130 | public bool UpdateClassifiedRecord(UserClassifiedAdd ad, ref string result) |
131 | { | 131 | { |
132 | string query = string.Empty; | 132 | const string query = |
133 | 133 | "INSERT INTO classifieds (" | |
134 | 134 | + "`classifieduuid`," | |
135 | query += "INSERT INTO classifieds ("; | 135 | + "`creatoruuid`," |
136 | query += "`classifieduuid`,"; | 136 | + "`creationdate`," |
137 | query += "`creatoruuid`,"; | 137 | + "`expirationdate`," |
138 | query += "`creationdate`,"; | 138 | + "`category`," |
139 | query += "`expirationdate`,"; | 139 | + "`name`," |
140 | query += "`category`,"; | 140 | + "`description`," |
141 | query += "`name`,"; | 141 | + "`parceluuid`," |
142 | query += "`description`,"; | 142 | + "`parentestate`," |
143 | query += "`parceluuid`,"; | 143 | + "`snapshotuuid`," |
144 | query += "`parentestate`,"; | 144 | + "`simname`," |
145 | query += "`snapshotuuid`,"; | 145 | + "`posglobal`," |
146 | query += "`simname`,"; | 146 | + "`parcelname`," |
147 | query += "`posglobal`,"; | 147 | + "`classifiedflags`," |
148 | query += "`parcelname`,"; | 148 | + "`priceforlisting`) " |
149 | query += "`classifiedflags`,"; | 149 | + "VALUES (" |
150 | query += "`priceforlisting`) "; | 150 | + "?ClassifiedId," |
151 | query += "VALUES ("; | 151 | + "?CreatorId," |
152 | query += "?ClassifiedId,"; | 152 | + "?CreatedDate," |
153 | query += "?CreatorId,"; | 153 | + "?ExpirationDate," |
154 | query += "?CreatedDate,"; | 154 | + "?Category," |
155 | query += "?ExpirationDate,"; | 155 | + "?Name," |
156 | query += "?Category,"; | 156 | + "?Description," |
157 | query += "?Name,"; | 157 | + "?ParcelId," |
158 | query += "?Description,"; | 158 | + "?ParentEstate," |
159 | query += "?ParcelId,"; | 159 | + "?SnapshotId," |
160 | query += "?ParentEstate,"; | 160 | + "?SimName," |
161 | query += "?SnapshotId,"; | 161 | + "?GlobalPos," |
162 | query += "?SimName,"; | 162 | + "?ParcelName," |
163 | query += "?GlobalPos,"; | 163 | + "?Flags," |
164 | query += "?ParcelName,"; | 164 | + "?ListingPrice ) " |
165 | query += "?Flags,"; | 165 | + "ON DUPLICATE KEY UPDATE " |
166 | query += "?ListingPrice ) "; | 166 | + "category=?Category, " |
167 | query += "ON DUPLICATE KEY UPDATE "; | 167 | + "expirationdate=?ExpirationDate, " |
168 | query += "category=?Category, "; | 168 | + "name=?Name, " |
169 | query += "expirationdate=?ExpirationDate, "; | 169 | + "description=?Description, " |
170 | query += "name=?Name, "; | 170 | + "parentestate=?ParentEstate, " |
171 | query += "description=?Description, "; | 171 | + "posglobal=?GlobalPos, " |
172 | query += "parentestate=?ParentEstate, "; | 172 | + "parcelname=?ParcelName, " |
173 | query += "posglobal=?GlobalPos, "; | 173 | + "classifiedflags=?Flags, " |
174 | query += "parcelname=?ParcelName, "; | 174 | + "priceforlisting=?ListingPrice, " |
175 | query += "classifiedflags=?Flags, "; | 175 | + "snapshotuuid=?SnapshotId" |
176 | query += "priceforlisting=?ListingPrice, "; | 176 | ; |
177 | query += "snapshotuuid=?SnapshotId"; | ||
178 | 177 | ||
179 | if(string.IsNullOrEmpty(ad.ParcelName)) | 178 | if(string.IsNullOrEmpty(ad.ParcelName)) |
180 | ad.ParcelName = "Unknown"; | 179 | ad.ParcelName = "Unknown"; |
@@ -245,10 +244,7 @@ namespace OpenSim.Data.MySQL | |||
245 | 244 | ||
246 | public bool DeleteClassifiedRecord(UUID recordId) | 245 | public bool DeleteClassifiedRecord(UUID recordId) |
247 | { | 246 | { |
248 | string query = string.Empty; | 247 | const string query = "DELETE FROM classifieds WHERE classifieduuid = ?recordId"; |
249 | |||
250 | query += "DELETE FROM classifieds WHERE "; | ||
251 | query += "classifieduuid = ?recordId"; | ||
252 | 248 | ||
253 | try | 249 | try |
254 | { | 250 | { |
@@ -275,10 +271,8 @@ namespace OpenSim.Data.MySQL | |||
275 | 271 | ||
276 | public bool GetClassifiedInfo(ref UserClassifiedAdd ad, ref string result) | 272 | public bool GetClassifiedInfo(ref UserClassifiedAdd ad, ref string result) |
277 | { | 273 | { |
278 | string query = string.Empty; | ||
279 | 274 | ||
280 | query += "SELECT * FROM classifieds WHERE "; | 275 | const string query = "SELECT * FROM classifieds WHERE classifieduuid = ?AdId"; |
281 | query += "classifieduuid = ?AdId"; | ||
282 | 276 | ||
283 | try | 277 | try |
284 | { | 278 | { |
@@ -326,10 +320,8 @@ namespace OpenSim.Data.MySQL | |||
326 | #region Picks Queries | 320 | #region Picks Queries |
327 | public OSDArray GetAvatarPicks(UUID avatarId) | 321 | public OSDArray GetAvatarPicks(UUID avatarId) |
328 | { | 322 | { |
329 | string query = string.Empty; | 323 | const string query = "SELECT `pickuuid`,`name` FROM userpicks WHERE creatoruuid = ?Id"; |
330 | 324 | ||
331 | query += "SELECT `pickuuid`,`name` FROM userpicks WHERE "; | ||
332 | query += "creatoruuid = ?Id"; | ||
333 | OSDArray data = new OSDArray(); | 325 | OSDArray data = new OSDArray(); |
334 | 326 | ||
335 | try | 327 | try |
@@ -369,12 +361,8 @@ namespace OpenSim.Data.MySQL | |||
369 | 361 | ||
370 | public UserProfilePick GetPickInfo(UUID avatarId, UUID pickId) | 362 | public UserProfilePick GetPickInfo(UUID avatarId, UUID pickId) |
371 | { | 363 | { |
372 | string query = string.Empty; | ||
373 | UserProfilePick pick = new UserProfilePick(); | 364 | UserProfilePick pick = new UserProfilePick(); |
374 | 365 | const string query = "SELECT * FROM userpicks WHERE creatoruuid = ?CreatorId AND pickuuid = ?PickId"; | |
375 | query += "SELECT * FROM userpicks WHERE "; | ||
376 | query += "creatoruuid = ?CreatorId AND "; | ||
377 | query += "pickuuid = ?PickId"; | ||
378 | 366 | ||
379 | try | 367 | try |
380 | { | 368 | { |
@@ -427,33 +415,33 @@ namespace OpenSim.Data.MySQL | |||
427 | 415 | ||
428 | public bool UpdatePicksRecord(UserProfilePick pick) | 416 | public bool UpdatePicksRecord(UserProfilePick pick) |
429 | { | 417 | { |
430 | string query = string.Empty; | 418 | const string query = |
431 | 419 | "INSERT INTO userpicks VALUES (" | |
432 | query += "INSERT INTO userpicks VALUES ("; | 420 | + "?PickId," |
433 | query += "?PickId,"; | 421 | + "?CreatorId," |
434 | query += "?CreatorId,"; | 422 | + "?TopPick," |
435 | query += "?TopPick,"; | 423 | + "?ParcelId," |
436 | query += "?ParcelId,"; | 424 | + "?Name," |
437 | query += "?Name,"; | 425 | + "?Desc," |
438 | query += "?Desc,"; | 426 | + "?SnapshotId," |
439 | query += "?SnapshotId,"; | 427 | + "?User," |
440 | query += "?User,"; | 428 | + "?Original," |
441 | query += "?Original,"; | 429 | + "?SimName," |
442 | query += "?SimName,"; | 430 | + "?GlobalPos," |
443 | query += "?GlobalPos,"; | 431 | + "?SortOrder," |
444 | query += "?SortOrder,"; | 432 | + "?Enabled," |
445 | query += "?Enabled,"; | 433 | + "?Gatekeeper)" |
446 | query += "?Gatekeeper)"; | 434 | + "ON DUPLICATE KEY UPDATE " |
447 | query += "ON DUPLICATE KEY UPDATE "; | 435 | + "parceluuid=?ParcelId," |
448 | query += "parceluuid=?ParcelId,"; | 436 | + "name=?Name," |
449 | query += "name=?Name,"; | 437 | + "description=?Desc," |
450 | query += "description=?Desc,"; | 438 | + "user=?User," |
451 | query += "user=?User,"; | 439 | + "simname=?SimName," |
452 | query += "simname=?SimName,"; | 440 | + "snapshotuuid=?SnapshotId," |
453 | query += "snapshotuuid=?SnapshotId,"; | 441 | + "pickuuid=?PickId," |
454 | query += "pickuuid=?PickId,"; | 442 | + "posglobal=?GlobalPos," |
455 | query += "posglobal=?GlobalPos,"; | 443 | + "gatekeeper=?Gatekeeper" |
456 | query += "gatekeeper=?Gatekeeper"; | 444 | ; |
457 | 445 | ||
458 | try | 446 | try |
459 | { | 447 | { |
@@ -493,10 +481,7 @@ namespace OpenSim.Data.MySQL | |||
493 | 481 | ||
494 | public bool DeletePicksRecord(UUID pickId) | 482 | public bool DeletePicksRecord(UUID pickId) |
495 | { | 483 | { |
496 | string query = string.Empty; | 484 | string query = "DELETE FROM userpicks WHERE pickuuid = ?PickId"; |
497 | |||
498 | query += "DELETE FROM userpicks WHERE "; | ||
499 | query += "pickuuid = ?PickId"; | ||
500 | 485 | ||
501 | try | 486 | try |
502 | { | 487 | { |
@@ -526,11 +511,7 @@ namespace OpenSim.Data.MySQL | |||
526 | #region Avatar Notes Queries | 511 | #region Avatar Notes Queries |
527 | public bool GetAvatarNotes(ref UserProfileNotes notes) | 512 | public bool GetAvatarNotes(ref UserProfileNotes notes) |
528 | { // WIP | 513 | { // WIP |
529 | string query = string.Empty; | 514 | const string query = "SELECT `notes` FROM usernotes WHERE useruuid = ?Id AND targetuuid = ?TargetId"; |
530 | |||
531 | query += "SELECT `notes` FROM usernotes WHERE "; | ||
532 | query += "useruuid = ?Id AND "; | ||
533 | query += "targetuuid = ?TargetId"; | ||
534 | 515 | ||
535 | try | 516 | try |
536 | { | 517 | { |
@@ -568,26 +549,25 @@ namespace OpenSim.Data.MySQL | |||
568 | 549 | ||
569 | public bool UpdateAvatarNotes(ref UserProfileNotes note, ref string result) | 550 | public bool UpdateAvatarNotes(ref UserProfileNotes note, ref string result) |
570 | { | 551 | { |
571 | string query = string.Empty; | 552 | string query; |
572 | bool remove; | 553 | bool remove; |
573 | 554 | ||
574 | if(string.IsNullOrEmpty(note.Notes)) | 555 | if(string.IsNullOrEmpty(note.Notes)) |
575 | { | 556 | { |
576 | remove = true; | 557 | remove = true; |
577 | query += "DELETE FROM usernotes WHERE "; | 558 | query = "DELETE FROM usernotes WHERE useruuid=?UserId AND targetuuid=?TargetId"; |
578 | query += "useruuid=?UserId AND "; | ||
579 | query += "targetuuid=?TargetId"; | ||
580 | } | 559 | } |
581 | else | 560 | else |
582 | { | 561 | { |
583 | remove = false; | 562 | remove = false; |
584 | query += "INSERT INTO usernotes VALUES ( "; | 563 | query = "INSERT INTO usernotes VALUES (" |
585 | query += "?UserId,"; | 564 | + "?UserId," |
586 | query += "?TargetId,"; | 565 | + "?TargetId," |
587 | query += "?Notes )"; | 566 | + "?Notes )" |
588 | query += "ON DUPLICATE KEY "; | 567 | + "ON DUPLICATE KEY " |
589 | query += "UPDATE "; | 568 | + "UPDATE " |
590 | query += "notes=?Notes"; | 569 | + "notes=?Notes" |
570 | ; | ||
591 | } | 571 | } |
592 | 572 | ||
593 | try | 573 | try |
@@ -621,10 +601,7 @@ namespace OpenSim.Data.MySQL | |||
621 | #region Avatar Properties | 601 | #region Avatar Properties |
622 | public bool GetAvatarProperties(ref UserProfileProperties props, ref string result) | 602 | public bool GetAvatarProperties(ref UserProfileProperties props, ref string result) |
623 | { | 603 | { |
624 | string query = string.Empty; | 604 | string query = "SELECT * FROM userprofile WHERE useruuid = ?Id"; |
625 | |||
626 | query += "SELECT * FROM userprofile WHERE "; | ||
627 | query += "useruuid = ?Id"; | ||
628 | 605 | ||
629 | try | 606 | try |
630 | { | 607 | { |
@@ -673,35 +650,36 @@ namespace OpenSim.Data.MySQL | |||
673 | props.PublishProfile = false; | 650 | props.PublishProfile = false; |
674 | props.PublishMature = false; | 651 | props.PublishMature = false; |
675 | 652 | ||
676 | query = "INSERT INTO userprofile ("; | 653 | query = "INSERT INTO userprofile (" |
677 | query += "useruuid, "; | 654 | + "useruuid, " |
678 | query += "profilePartner, "; | 655 | + "profilePartner, " |
679 | query += "profileAllowPublish, "; | 656 | + "profileAllowPublish, " |
680 | query += "profileMaturePublish, "; | 657 | + "profileMaturePublish, " |
681 | query += "profileURL, "; | 658 | + "profileURL, " |
682 | query += "profileWantToMask, "; | 659 | + "profileWantToMask, " |
683 | query += "profileWantToText, "; | 660 | + "profileWantToText, " |
684 | query += "profileSkillsMask, "; | 661 | + "profileSkillsMask, " |
685 | query += "profileSkillsText, "; | 662 | + "profileSkillsText, " |
686 | query += "profileLanguages, "; | 663 | + "profileLanguages, " |
687 | query += "profileImage, "; | 664 | + "profileImage, " |
688 | query += "profileAboutText, "; | 665 | + "profileAboutText, " |
689 | query += "profileFirstImage, "; | 666 | + "profileFirstImage, " |
690 | query += "profileFirstText) VALUES ("; | 667 | + "profileFirstText) VALUES (" |
691 | query += "?userId, "; | 668 | + "?userId, " |
692 | query += "?profilePartner, "; | 669 | + "?profilePartner, " |
693 | query += "?profileAllowPublish, "; | 670 | + "?profileAllowPublish, " |
694 | query += "?profileMaturePublish, "; | 671 | + "?profileMaturePublish, " |
695 | query += "?profileURL, "; | 672 | + "?profileURL, " |
696 | query += "?profileWantToMask, "; | 673 | + "?profileWantToMask, " |
697 | query += "?profileWantToText, "; | 674 | + "?profileWantToText, " |
698 | query += "?profileSkillsMask, "; | 675 | + "?profileSkillsMask, " |
699 | query += "?profileSkillsText, "; | 676 | + "?profileSkillsText, " |
700 | query += "?profileLanguages, "; | 677 | + "?profileLanguages, " |
701 | query += "?profileImage, "; | 678 | + "?profileImage, " |
702 | query += "?profileAboutText, "; | 679 | + "?profileAboutText, " |
703 | query += "?profileFirstImage, "; | 680 | + "?profileFirstImage, " |
704 | query += "?profileFirstText)"; | 681 | + "?profileFirstText)" |
682 | ; | ||
705 | 683 | ||
706 | dbcon.Close(); | 684 | dbcon.Close(); |
707 | dbcon.Open(); | 685 | dbcon.Open(); |
@@ -743,15 +721,10 @@ namespace OpenSim.Data.MySQL | |||
743 | 721 | ||
744 | public bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result) | 722 | public bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result) |
745 | { | 723 | { |
746 | string query = string.Empty; | 724 | const string query = "UPDATE userprofile SET profileURL=?profileURL," |
747 | 725 | + "profileImage=?image, profileAboutText=?abouttext," | |
748 | query += "UPDATE userprofile SET "; | 726 | + "profileFirstImage=?firstlifeimage, profileFirstText=?firstlifetext " |
749 | query += "profileURL=?profileURL, "; | 727 | + "WHERE useruuid=?uuid"; |
750 | query += "profileImage=?image, "; | ||
751 | query += "profileAboutText=?abouttext,"; | ||
752 | query += "profileFirstImage=?firstlifeimage,"; | ||
753 | query += "profileFirstText=?firstlifetext "; | ||
754 | query += "WHERE useruuid=?uuid"; | ||
755 | 728 | ||
756 | try | 729 | try |
757 | { | 730 | { |
@@ -786,15 +759,13 @@ namespace OpenSim.Data.MySQL | |||
786 | #region Avatar Interests | 759 | #region Avatar Interests |
787 | public bool UpdateAvatarInterests(UserProfileProperties up, ref string result) | 760 | public bool UpdateAvatarInterests(UserProfileProperties up, ref string result) |
788 | { | 761 | { |
789 | string query = string.Empty; | 762 | const string query = "UPDATE userprofile SET " |
790 | 763 | + "profileWantToMask=?WantMask, " | |
791 | query += "UPDATE userprofile SET "; | 764 | + "profileWantToText=?WantText," |
792 | query += "profileWantToMask=?WantMask, "; | 765 | + "profileSkillsMask=?SkillsMask," |
793 | query += "profileWantToText=?WantText,"; | 766 | + "profileSkillsText=?SkillsText, " |
794 | query += "profileSkillsMask=?SkillsMask,"; | 767 | + "profileLanguages=?Languages " |
795 | query += "profileSkillsText=?SkillsText, "; | 768 | + "WHERE useruuid=?uuid"; |
796 | query += "profileLanguages=?Languages "; | ||
797 | query += "WHERE useruuid=?uuid"; | ||
798 | 769 | ||
799 | try | 770 | try |
800 | { | 771 | { |
@@ -828,18 +799,17 @@ namespace OpenSim.Data.MySQL | |||
828 | public OSDArray GetUserImageAssets(UUID avatarId) | 799 | public OSDArray GetUserImageAssets(UUID avatarId) |
829 | { | 800 | { |
830 | OSDArray data = new OSDArray(); | 801 | OSDArray data = new OSDArray(); |
831 | string query = "SELECT `snapshotuuid` FROM {0} WHERE `creatoruuid` = ?Id"; | 802 | const string queryA = "SELECT `snapshotuuid` FROM {0} WHERE `creatoruuid` = ?Id"; |
832 | 803 | ||
833 | // Get classified image assets | 804 | // Get classified image assets |
834 | 805 | ||
835 | |||
836 | try | 806 | try |
837 | { | 807 | { |
838 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 808 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
839 | { | 809 | { |
840 | dbcon.Open(); | 810 | dbcon.Open(); |
841 | 811 | ||
842 | using (MySqlCommand cmd = new MySqlCommand(string.Format (query,"`classifieds`"), dbcon)) | 812 | using (MySqlCommand cmd = new MySqlCommand(string.Format (queryA,"`classifieds`"), dbcon)) |
843 | { | 813 | { |
844 | cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); | 814 | cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); |
845 | 815 | ||
@@ -858,7 +828,7 @@ namespace OpenSim.Data.MySQL | |||
858 | dbcon.Close(); | 828 | dbcon.Close(); |
859 | dbcon.Open(); | 829 | dbcon.Open(); |
860 | 830 | ||
861 | using (MySqlCommand cmd = new MySqlCommand(string.Format (query,"`userpicks`"), dbcon)) | 831 | using (MySqlCommand cmd = new MySqlCommand(string.Format (queryA,"`userpicks`"), dbcon)) |
862 | { | 832 | { |
863 | cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); | 833 | cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); |
864 | 834 | ||
@@ -877,9 +847,9 @@ namespace OpenSim.Data.MySQL | |||
877 | dbcon.Close(); | 847 | dbcon.Close(); |
878 | dbcon.Open(); | 848 | dbcon.Open(); |
879 | 849 | ||
880 | query = "SELECT `profileImage`, `profileFirstImage` FROM `userprofile` WHERE `useruuid` = ?Id"; | 850 | const string queryB = "SELECT `profileImage`, `profileFirstImage` FROM `userprofile` WHERE `useruuid` = ?Id"; |
881 | 851 | ||
882 | using (MySqlCommand cmd = new MySqlCommand(string.Format (query,"`userpicks`"), dbcon)) | 852 | using (MySqlCommand cmd = new MySqlCommand(string.Format (queryB,"`userpicks`"), dbcon)) |
883 | { | 853 | { |
884 | cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); | 854 | cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); |
885 | 855 | ||
@@ -909,11 +879,7 @@ namespace OpenSim.Data.MySQL | |||
909 | #region User Preferences | 879 | #region User Preferences |
910 | public bool GetUserPreferences(ref UserPreferences pref, ref string result) | 880 | public bool GetUserPreferences(ref UserPreferences pref, ref string result) |
911 | { | 881 | { |
912 | string query = string.Empty; | 882 | const string query = "SELECT imviaemail,visible,email FROM usersettings WHERE useruuid = ?Id"; |
913 | |||
914 | query += "SELECT imviaemail,visible,email FROM "; | ||
915 | query += "usersettings WHERE "; | ||
916 | query += "useruuid = ?Id"; | ||
917 | 883 | ||
918 | try | 884 | try |
919 | { | 885 | { |
@@ -937,10 +903,9 @@ namespace OpenSim.Data.MySQL | |||
937 | dbcon.Close(); | 903 | dbcon.Close(); |
938 | dbcon.Open(); | 904 | dbcon.Open(); |
939 | 905 | ||
940 | query = "INSERT INTO usersettings VALUES "; | 906 | const string queryB = "INSERT INTO usersettings VALUES (?uuid,'false','false', ?Email)"; |
941 | query += "(?uuid,'false','false', ?Email)"; | ||
942 | 907 | ||
943 | using (MySqlCommand put = new MySqlCommand(query, dbcon)) | 908 | using (MySqlCommand put = new MySqlCommand(queryB, dbcon)) |
944 | { | 909 | { |
945 | 910 | ||
946 | put.Parameters.AddWithValue("?Email", pref.EMail); | 911 | put.Parameters.AddWithValue("?Email", pref.EMail); |
@@ -966,13 +931,9 @@ namespace OpenSim.Data.MySQL | |||
966 | 931 | ||
967 | public bool UpdateUserPreferences(ref UserPreferences pref, ref string result) | 932 | public bool UpdateUserPreferences(ref UserPreferences pref, ref string result) |
968 | { | 933 | { |
969 | string query = string.Empty; | 934 | const string query = "UPDATE usersettings SET imviaemail=?ImViaEmail," |
970 | 935 | + "visible=?Visible, email=?EMail " | |
971 | query += "UPDATE usersettings SET "; | 936 | + "WHERE useruuid=?uuid"; |
972 | query += "imviaemail=?ImViaEmail, "; | ||
973 | query += "visible=?Visible, "; | ||
974 | query += "email=?EMail "; | ||
975 | query += "WHERE useruuid=?uuid"; | ||
976 | 937 | ||
977 | try | 938 | try |
978 | { | 939 | { |
@@ -1005,11 +966,7 @@ namespace OpenSim.Data.MySQL | |||
1005 | #region Integration | 966 | #region Integration |
1006 | public bool GetUserAppData(ref UserAppData props, ref string result) | 967 | public bool GetUserAppData(ref UserAppData props, ref string result) |
1007 | { | 968 | { |
1008 | string query = string.Empty; | 969 | const string query = "SELECT * FROM `userdata` WHERE UserId = ?Id AND TagId = ?TagId"; |
1009 | |||
1010 | query += "SELECT * FROM `userdata` WHERE "; | ||
1011 | query += "UserId = ?Id AND "; | ||
1012 | query += "TagId = ?TagId"; | ||
1013 | 970 | ||
1014 | try | 971 | try |
1015 | { | 972 | { |
@@ -1031,13 +988,8 @@ namespace OpenSim.Data.MySQL | |||
1031 | } | 988 | } |
1032 | else | 989 | else |
1033 | { | 990 | { |
1034 | query += "INSERT INTO userdata VALUES ( "; | 991 | const string queryB = "INSERT INTO userdata VALUES (?UserId, ?TagId, ?DataKey, ?DataVal)"; |
1035 | query += "?UserId,"; | 992 | using (MySqlCommand put = new MySqlCommand(queryB, dbcon)) |
1036 | query += "?TagId,"; | ||
1037 | query += "?DataKey,"; | ||
1038 | query += "?DataVal) "; | ||
1039 | |||
1040 | using (MySqlCommand put = new MySqlCommand(query, dbcon)) | ||
1041 | { | 993 | { |
1042 | put.Parameters.AddWithValue("?UserId", props.UserId.ToString()); | 994 | put.Parameters.AddWithValue("?UserId", props.UserId.ToString()); |
1043 | put.Parameters.AddWithValue("?TagId", props.TagId.ToString()); | 995 | put.Parameters.AddWithValue("?TagId", props.TagId.ToString()); |
@@ -1064,14 +1016,7 @@ namespace OpenSim.Data.MySQL | |||
1064 | 1016 | ||
1065 | public bool SetUserAppData(UserAppData props, ref string result) | 1017 | public bool SetUserAppData(UserAppData props, ref string result) |
1066 | { | 1018 | { |
1067 | string query = string.Empty; | 1019 | const string query = "UPDATE userdata SET TagId = ?TagId, DataKey = ?DataKey, DataVal = ?DataVal WHERE UserId = ?UserId AND TagId = ?TagId"; |
1068 | |||
1069 | query += "UPDATE userdata SET "; | ||
1070 | query += "TagId = ?TagId, "; | ||
1071 | query += "DataKey = ?DataKey, "; | ||
1072 | query += "DataVal = ?DataVal WHERE "; | ||
1073 | query += "UserId = ?UserId AND "; | ||
1074 | query += "TagId = ?TagId"; | ||
1075 | 1020 | ||
1076 | try | 1021 | try |
1077 | { | 1022 | { |