aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Data.MySQL/MySQLUserData.cs')
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLUserData.cs52
1 files changed, 29 insertions, 23 deletions
diff --git a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
index 27c9cf6..8846650 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
@@ -29,7 +29,6 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Data; 30using System.Data;
31using libsecondlife; 31using libsecondlife;
32using OpenSim.Framework;
33using OpenSim.Framework.Console; 32using OpenSim.Framework.Console;
34 33
35namespace OpenSim.Framework.Data.MySQL 34namespace OpenSim.Framework.Data.MySQL
@@ -37,7 +36,7 @@ namespace OpenSim.Framework.Data.MySQL
37 /// <summary> 36 /// <summary>
38 /// A database interface class to a user profile storage system 37 /// A database interface class to a user profile storage system
39 /// </summary> 38 /// </summary>
40 class MySQLUserData : IUserData 39 internal class MySQLUserData : IUserData
41 { 40 {
42 /// <summary> 41 /// <summary>
43 /// Database manager for MySQL 42 /// Database manager for MySQL
@@ -59,7 +58,9 @@ namespace OpenSim.Framework.Data.MySQL
59 string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); 58 string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
60 string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); 59 string settingPort = GridDataMySqlFile.ParseFileReadValue("port");
61 60
62 database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); 61 database =
62 new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling,
63 settingPort);
63 } 64 }
64 65
65 /// <summary> 66 /// <summary>
@@ -88,11 +89,12 @@ namespace OpenSim.Framework.Data.MySQL
88 param["?first"] = user; 89 param["?first"] = user;
89 param["?second"] = last; 90 param["?second"] = last;
90 91
91 IDbCommand result = database.Query("SELECT * FROM users WHERE username = ?first AND lastname = ?second", param); 92 IDbCommand result =
93 database.Query("SELECT * FROM users WHERE username = ?first AND lastname = ?second", param);
92 IDataReader reader = result.ExecuteReader(); 94 IDataReader reader = result.ExecuteReader();
93 95
94 UserProfileData row = database.readUserRow(reader); 96 UserProfileData row = database.readUserRow(reader);
95 97
96 reader.Close(); 98 reader.Close();
97 result.Dispose(); 99 result.Dispose();
98 100
@@ -201,21 +203,25 @@ namespace OpenSim.Framework.Data.MySQL
201 /// <param name="user">The user profile to create</param> 203 /// <param name="user">The user profile to create</param>
202 public void AddNewUserProfile(UserProfileData user) 204 public void AddNewUserProfile(UserProfileData user)
203 { 205 {
204 try 206 try
205 { 207 {
206 lock (database) 208 lock (database)
207 { 209 {
208 database.insertUserRow(user.UUID, user.username, user.surname, user.passwordHash, user.passwordSalt, user.homeRegion, user.homeLocation.X, user.homeLocation.Y, user.homeLocation.Z, 210 database.insertUserRow(user.UUID, user.username, user.surname, user.passwordHash, user.passwordSalt,
209 user.homeLookAt.X, user.homeLookAt.Y, user.homeLookAt.Z, user.created, user.lastLogin, user.userInventoryURI, user.userAssetURI, user.profileCanDoMask, user.profileWantDoMask, 211 user.homeRegion, user.homeLocation.X, user.homeLocation.Y,
210 user.profileAboutText, user.profileFirstText, user.profileImage, user.profileFirstImage); 212 user.homeLocation.Z,
211 } 213 user.homeLookAt.X, user.homeLookAt.Y, user.homeLookAt.Z, user.created,
212 } 214 user.lastLogin, user.userInventoryURI, user.userAssetURI,
213 catch (Exception e) 215 user.profileCanDoMask, user.profileWantDoMask,
214 { 216 user.profileAboutText, user.profileFirstText, user.profileImage,
215 database.Reconnect(); 217 user.profileFirstImage);
216 MainLog.Instance.Error(e.ToString()); 218 }
217 } 219 }
218 220 catch (Exception e)
221 {
222 database.Reconnect();
223 MainLog.Instance.Error(e.ToString());
224 }
219 } 225 }
220 226
221 /// <summary> 227 /// <summary>
@@ -226,8 +232,8 @@ namespace OpenSim.Framework.Data.MySQL
226 { 232 {
227 // Do nothing. 233 // Do nothing.
228 } 234 }
229 235
230 236
231 public bool UpdateUserProfile(UserProfileData user) 237 public bool UpdateUserProfile(UserProfileData user)
232 { 238 {
233 return true; 239 return true;
@@ -277,4 +283,4 @@ namespace OpenSim.Framework.Data.MySQL
277 return "0.1"; 283 return "0.1";
278 } 284 }
279 } 285 }
280} 286} \ No newline at end of file