aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/SQLite/SQLiteUserData.cs
diff options
context:
space:
mode:
authorJeff Ames2008-06-26 20:14:33 +0000
committerJeff Ames2008-06-26 20:14:33 +0000
commit9fae975a53fbb852dfbaf811dca259ddd4f74f4c (patch)
tree7273987bd5c30c4fabca6fa68b43ce25304a703a /OpenSim/Data/SQLite/SQLiteUserData.cs
parentUpdate svn properties. Minor formatting cleanup. (diff)
downloadopensim-SC-9fae975a53fbb852dfbaf811dca259ddd4f74f4c.zip
opensim-SC-9fae975a53fbb852dfbaf811dca259ddd4f74f4c.tar.gz
opensim-SC-9fae975a53fbb852dfbaf811dca259ddd4f74f4c.tar.bz2
opensim-SC-9fae975a53fbb852dfbaf811dca259ddd4f74f4c.tar.xz
Apply patch from bug #1605 -- Documentation for Data/SQLite. Thanks kerunix_Flan!
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/SQLite/SQLiteUserData.cs152
1 files changed, 144 insertions, 8 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteUserData.cs b/OpenSim/Data/SQLite/SQLiteUserData.cs
index 36ec9ea..24c7944 100644
--- a/OpenSim/Data/SQLite/SQLiteUserData.cs
+++ b/OpenSim/Data/SQLite/SQLiteUserData.cs
@@ -65,6 +65,14 @@ namespace OpenSim.Data.SQLite
65 private SqliteDataAdapter daf; 65 private SqliteDataAdapter daf;
66 SqliteConnection g_conn; 66 SqliteConnection g_conn;
67 67
68 /// <summary>
69 /// <list type="bullet">
70 /// <item>Initialises User Interface</item>
71 /// <item>Loads and initialises a new SQLite connection and maintains it.</item>
72 /// <item>use default URI if connect string string is empty.</item>
73 /// </list>
74 /// </summary>
75 /// <param name="connect">connect string</param>
68 override public void Initialise(string connect) 76 override public void Initialise(string connect)
69 { 77 {
70 // default to something sensible 78 // default to something sensible
@@ -116,7 +124,12 @@ namespace OpenSim.Data.SQLite
116 return; 124 return;
117 } 125 }
118 126
119 // see IUserData 127 /// <summary>
128 /// see IUserData,
129 /// Get user data profile by UUID
130 /// </summary>
131 /// <param name="uuid">User UUID</param>
132 /// <returns>user profile data</returns>
120 override public UserProfileData GetUserByUUID(LLUUID uuid) 133 override public UserProfileData GetUserByUUID(LLUUID uuid)
121 { 134 {
122 lock (ds) 135 lock (ds)
@@ -139,7 +152,13 @@ namespace OpenSim.Data.SQLite
139 } 152 }
140 } 153 }
141 154
142 // see IUserData 155 /// <summary>
156 /// see IUserData,
157 /// Get user data profile by name
158 /// </summary>
159 /// <param name="fname">first name</param>
160 /// <param name="lname">last name</param>
161 /// <returns>user profile data</returns>
143 override public UserProfileData GetUserByName(string fname, string lname) 162 override public UserProfileData GetUserByName(string fname, string lname)
144 { 163 {
145 string select = "surname = '" + lname + "' and username = '" + fname + "'"; 164 string select = "surname = '" + lname + "' and username = '" + fname + "'";
@@ -165,6 +184,12 @@ namespace OpenSim.Data.SQLite
165 184
166 #region User Friends List Data 185 #region User Friends List Data
167 186
187 /// <summary>
188 /// Add a new friend in the friendlist
189 /// </summary>
190 /// <param name="friendlistowner">UUID of the friendlist owner</param>
191 /// <param name="friend">UUID of the friend to add</param>
192 /// <param name="perms">permission flag</param>
168 override public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms) 193 override public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms)
169 { 194 {
170 string InsertFriends = "insert into userfriends(ownerID, friendID, friendPerms) values(:ownerID, :friendID, :perms)"; 195 string InsertFriends = "insert into userfriends(ownerID, friendID, friendPerms) values(:ownerID, :friendID, :perms)";
@@ -185,6 +210,11 @@ namespace OpenSim.Data.SQLite
185 } 210 }
186 } 211 }
187 212
213 /// <summary>
214 /// Remove a user from the friendlist
215 /// </summary>
216 /// <param name="friendlistowner">UUID of the friendlist owner</param>
217 /// <param name="friend">UUID of the friend to remove</param>
188 override public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend) 218 override public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend)
189 { 219 {
190 string DeletePerms = "delete from friendlist where (ownerID=:ownerID and friendID=:friendID) or (ownerID=:friendID and friendID=:ownerID)"; 220 string DeletePerms = "delete from friendlist where (ownerID=:ownerID and friendID=:friendID) or (ownerID=:friendID and friendID=:ownerID)";
@@ -196,6 +226,12 @@ namespace OpenSim.Data.SQLite
196 } 226 }
197 } 227 }
198 228
229 /// <summary>
230 /// Update the friendlist permission
231 /// </summary>
232 /// <param name="friendlistowner">UUID of the friendlist owner</param>
233 /// <param name="friend">UUID of the friend to modify</param>
234 /// <param name="perms">updated permission flag</param>
199 override public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms) 235 override public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms)
200 { 236 {
201 string UpdatePerms = "update friendlist set perms=:perms where ownerID=:ownerID and friendID=:friendID"; 237 string UpdatePerms = "update friendlist set perms=:perms where ownerID=:ownerID and friendID=:friendID";
@@ -208,6 +244,11 @@ namespace OpenSim.Data.SQLite
208 } 244 }
209 } 245 }
210 246
247 /// <summary>
248 /// Get (fetch?) the friendlist for a user
249 /// </summary>
250 /// <param name="friendlistowner">UUID of the friendlist owner</param>
251 /// <returns>The friendlist list</returns>
211 override public List<FriendListItem> GetUserFriendList(LLUUID friendlistowner) 252 override public List<FriendListItem> GetUserFriendList(LLUUID friendlistowner)
212 { 253 {
213 List<FriendListItem> returnlist = new List<FriendListItem>(); 254 List<FriendListItem> returnlist = new List<FriendListItem>();
@@ -246,12 +287,24 @@ namespace OpenSim.Data.SQLite
246 287
247 #endregion 288 #endregion
248 289
290 /// <summary>
291 /// STUB, Update the user's current region
292 /// </summary>
293 /// <param name="avatarid">UUID of the user</param>
294 /// <param name="regionuuid">UUID of the region</param>
295 /// <param name="regionhandle">region handle</param>
296 /// <remarks>DO NOTHING</remarks>
249 override public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid, ulong regionhandle) 297 override public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid, ulong regionhandle)
250 { 298 {
251 //m_log.Info("[USER DB]: Stub UpdateUserCUrrentRegion called"); 299 //m_log.Info("[USER DB]: Stub UpdateUserCUrrentRegion called");
252 } 300 }
253 301
254 302 /// <summary>
303 ///
304 /// </summary>
305 /// <param name="queryID"></param>
306 /// <param name="query"></param>
307 /// <returns></returns>
255 override public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) 308 override public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
256 { 309 {
257 List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>(); 310 List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>();
@@ -347,7 +400,11 @@ namespace OpenSim.Data.SQLite
347 } 400 }
348 } 401 }
349 402
350 403 /// <summary>
404 /// DEPRECATED? Store the weblogin key
405 /// </summary>
406 /// <param name="AgentID">UUID of the user</param>
407 /// <param name="WebLoginKey">UUID of the weblogin</param>
351 override public void StoreWebLoginKey(LLUUID AgentID, LLUUID WebLoginKey) 408 override public void StoreWebLoginKey(LLUUID AgentID, LLUUID WebLoginKey)
352 { 409 {
353 DataTable users = ds.Tables["users"]; 410 DataTable users = ds.Tables["users"];
@@ -487,8 +544,13 @@ namespace OpenSim.Data.SQLite
487 return true; 544 return true;
488 } 545 }
489 546
490 /// Appearance 547
548 /// <summary>
549 /// Appearance.
491 /// TODO: stubs for now to do in memory appearance. 550 /// TODO: stubs for now to do in memory appearance.
551 /// </summary>
552 /// <param name="user">The user UUID</param>
553 /// <returns>Avatar Appearence</returns>
492 override public AvatarAppearance GetUserAppearance(LLUUID user) 554 override public AvatarAppearance GetUserAppearance(LLUUID user)
493 { 555 {
494 AvatarAppearance aa = null; 556 AvatarAppearance aa = null;
@@ -501,22 +563,45 @@ namespace OpenSim.Data.SQLite
501 return aa; 563 return aa;
502 } 564 }
503 565
566 /// <summary>
567 /// Update a user appearence
568 /// </summary>
569 /// <param name="user">the user UUID</param>
570 /// <param name="appearance">appearence</param>
504 override public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance) 571 override public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance)
505 { 572 {
506 appearance.Owner = user; 573 appearance.Owner = user;
507 aplist[user] = appearance; 574 aplist[user] = appearance;
508 } 575 }
509 576
577 /// <summary>
578 /// Add an attachment item to an avatar
579 /// </summary>
580 /// <param name="user">the user UUID</param>
581 /// <param name="item">the item UUID</param>
582 /// <remarks>DO NOTHING ?</remarks>
510 override public void AddAttachment(LLUUID user, LLUUID item) 583 override public void AddAttachment(LLUUID user, LLUUID item)
511 { 584 {
512 return; 585 return;
513 } 586 }
514 587
588 /// <summary>
589 /// Remove an attachement item from an avatar
590 /// </summary>
591 /// <param name="user">the user UUID</param>
592 /// <param name="item">the item UUID</param>
593 /// <remarks>DO NOTHING ?</remarks>
515 override public void RemoveAttachment(LLUUID user, LLUUID item) 594 override public void RemoveAttachment(LLUUID user, LLUUID item)
516 { 595 {
517 return; 596 return;
518 } 597 }
519 598
599 /// <summary>
600 /// Get list of attached item
601 /// </summary>
602 /// <param name="user">the user UUID</param>
603 /// <returns>List of attached item</returns>
604 /// <remarks>DO NOTHING ?</remarks>
520 override public List<LLUUID> GetAttachments(LLUUID user) 605 override public List<LLUUID> GetAttachments(LLUUID user)
521 { 606 {
522 return new List<LLUUID>(); 607 return new List<LLUUID>();
@@ -553,6 +638,10 @@ namespace OpenSim.Data.SQLite
553 * 638 *
554 **********************************************************************/ 639 **********************************************************************/
555 640
641 /// <summary>
642 /// Create the "users" table
643 /// </summary>
644 /// <returns>DataTable</returns>
556 private static DataTable createUsersTable() 645 private static DataTable createUsersTable()
557 { 646 {
558 DataTable users = new DataTable("users"); 647 DataTable users = new DataTable("users");
@@ -588,6 +677,10 @@ namespace OpenSim.Data.SQLite
588 return users; 677 return users;
589 } 678 }
590 679
680 /// <summary>
681 /// Create the "useragents" table
682 /// </summary>
683 /// <returns>Data Table</returns>
591 private static DataTable createUserAgentsTable() 684 private static DataTable createUserAgentsTable()
592 { 685 {
593 DataTable ua = new DataTable("useragents"); 686 DataTable ua = new DataTable("useragents");
@@ -613,6 +706,10 @@ namespace OpenSim.Data.SQLite
613 return ua; 706 return ua;
614 } 707 }
615 708
709 /// <summary>
710 /// Create the "userfriends" table
711 /// </summary>
712 /// <returns>Data Table</returns>
616 private static DataTable createUserFriendsTable() 713 private static DataTable createUserFriendsTable()
617 { 714 {
618 DataTable ua = new DataTable("userfriends"); 715 DataTable ua = new DataTable("userfriends");
@@ -634,11 +731,15 @@ namespace OpenSim.Data.SQLite
634 * 731 *
635 **********************************************************************/ 732 **********************************************************************/
636 733
734 /// <summary>
735 /// TODO: this doesn't work yet because something more
736 /// interesting has to be done to actually get these values
737 /// back out. Not enough time to figure it out yet.
738 /// </summary>
739 /// <param name="row"></param>
740 /// <returns></returns>
637 private static UserProfileData buildUserProfile(DataRow row) 741 private static UserProfileData buildUserProfile(DataRow row)
638 { 742 {
639 // TODO: this doesn't work yet because something more
640 // interesting has to be done to actually get these values
641 // back out. Not enough time to figure it out yet.
642 UserProfileData user = new UserProfileData(); 743 UserProfileData user = new UserProfileData();
643 LLUUID tmp; 744 LLUUID tmp;
644 LLUUID.TryParse((String)row["UUID"], out tmp); 745 LLUUID.TryParse((String)row["UUID"], out tmp);
@@ -678,6 +779,11 @@ namespace OpenSim.Data.SQLite
678 return user; 779 return user;
679 } 780 }
680 781
782 /// <summary>
783 ///
784 /// </summary>
785 /// <param name="row"></param>
786 /// <param name="user"></param>
681 private void fillUserRow(DataRow row, UserProfileData user) 787 private void fillUserRow(DataRow row, UserProfileData user)
682 { 788 {
683 row["UUID"] = Util.ToRawUuidString(user.ID); 789 row["UUID"] = Util.ToRawUuidString(user.ID);
@@ -719,6 +825,11 @@ namespace OpenSim.Data.SQLite
719 } 825 }
720 } 826 }
721 827
828 /// <summary>
829 ///
830 /// </summary>
831 /// <param name="row"></param>
832 /// <returns></returns>
722 private static UserAgentData buildUserAgent(DataRow row) 833 private static UserAgentData buildUserAgent(DataRow row)
723 { 834 {
724 UserAgentData ua = new UserAgentData(); 835 UserAgentData ua = new UserAgentData();
@@ -742,6 +853,11 @@ namespace OpenSim.Data.SQLite
742 return ua; 853 return ua;
743 } 854 }
744 855
856 /// <summary>
857 ///
858 /// </summary>
859 /// <param name="row"></param>
860 /// <param name="ua"></param>
745 private static void fillUserAgentRow(DataRow row, UserAgentData ua) 861 private static void fillUserAgentRow(DataRow row, UserAgentData ua)
746 { 862 {
747 row["UUID"] = ua.ProfileID; 863 row["UUID"] = ua.ProfileID;
@@ -770,6 +886,11 @@ namespace OpenSim.Data.SQLite
770 * 886 *
771 **********************************************************************/ 887 **********************************************************************/
772 888
889 /// <summary>
890 ///
891 /// </summary>
892 /// <param name="da"></param>
893 /// <param name="conn"></param>
773 private void setupUserCommands(SqliteDataAdapter da, SqliteConnection conn) 894 private void setupUserCommands(SqliteDataAdapter da, SqliteConnection conn)
774 { 895 {
775 da.InsertCommand = SQLiteUtil.createInsertCommand("users", ds.Tables["users"]); 896 da.InsertCommand = SQLiteUtil.createInsertCommand("users", ds.Tables["users"]);
@@ -784,6 +905,11 @@ namespace OpenSim.Data.SQLite
784 da.DeleteCommand = delete; 905 da.DeleteCommand = delete;
785 } 906 }
786 907
908 /// <summary>
909 ///
910 /// </summary>
911 /// <param name="daf"></param>
912 /// <param name="conn"></param>
787 private void setupUserFriendsCommands(SqliteDataAdapter daf, SqliteConnection conn) 913 private void setupUserFriendsCommands(SqliteDataAdapter daf, SqliteConnection conn)
788 { 914 {
789 daf.InsertCommand = SQLiteUtil.createInsertCommand("userfriends", ds.Tables["userfriends"]); 915 daf.InsertCommand = SQLiteUtil.createInsertCommand("userfriends", ds.Tables["userfriends"]);
@@ -800,6 +926,10 @@ namespace OpenSim.Data.SQLite
800 926
801 } 927 }
802 928
929 /// <summary>
930 ///
931 /// </summary>
932 /// <param name="conn"></param>
803 private static void InitDB(SqliteConnection conn) 933 private static void InitDB(SqliteConnection conn)
804 { 934 {
805 string createUsers = SQLiteUtil.defineTable(createUsersTable()); 935 string createUsers = SQLiteUtil.defineTable(createUsersTable());
@@ -832,6 +962,12 @@ namespace OpenSim.Data.SQLite
832 conn.Close(); 962 conn.Close();
833 } 963 }
834 964
965 /// <summary>
966 ///
967 /// </summary>
968 /// <param name="conn"></param>
969 /// <param name="m"></param>
970 /// <returns></returns>
835 private static bool TestTables(SqliteConnection conn, Migration m) 971 private static bool TestTables(SqliteConnection conn, Migration m)
836 { 972 {
837 SqliteCommand cmd = new SqliteCommand(userSelect, conn); 973 SqliteCommand cmd = new SqliteCommand(userSelect, conn);