aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data.MSSQL
diff options
context:
space:
mode:
authorlbsa712008-02-13 12:06:09 +0000
committerlbsa712008-02-13 12:06:09 +0000
commitbcd3a5b28bc63426e5ac1f4642afca4a391ece28 (patch)
treed38441c04425259fe450d062e7be25c90ae7cb09 /OpenSim/Framework/Data.MSSQL
parent* Removed a debug line that got called every frame. (diff)
downloadopensim-SC_OLD-bcd3a5b28bc63426e5ac1f4642afca4a391ece28.zip
opensim-SC_OLD-bcd3a5b28bc63426e5ac1f4642afca4a391ece28.tar.gz
opensim-SC_OLD-bcd3a5b28bc63426e5ac1f4642afca4a391ece28.tar.bz2
opensim-SC_OLD-bcd3a5b28bc63426e5ac1f4642afca4a391ece28.tar.xz
* Introduced customizable table names on MySQL and MSSQL UserData plug-ins.
[Provided by openlifegrid.com]
Diffstat (limited to 'OpenSim/Framework/Data.MSSQL')
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs46
1 files changed, 34 insertions, 12 deletions
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs
index ed9929c..60e6df4 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs
@@ -46,6 +46,10 @@ namespace OpenSim.Framework.Data.MSSQL
46 /// </summary> 46 /// </summary>
47 public MSSQLManager database; 47 public MSSQLManager database;
48 48
49 private string m_agentsTableName;
50 private string m_usersTableName;
51 private string m_userFriendsTableName;
52
49 /// <summary> 53 /// <summary>
50 /// Loads and initialises the MySQL storage plugin 54 /// Loads and initialises the MySQL storage plugin
51 /// </summary> 55 /// </summary>
@@ -53,12 +57,30 @@ namespace OpenSim.Framework.Data.MSSQL
53 { 57 {
54 // Load from an INI file connection details 58 // Load from an INI file connection details
55 // TODO: move this to XML? 59 // TODO: move this to XML?
56 IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini"); 60 IniFile iniFile = new IniFile("mssql_connection.ini");
57 string settingDataSource = GridDataMySqlFile.ParseFileReadValue("data_source"); 61 string settingDataSource = iniFile.ParseFileReadValue("data_source");
58 string settingInitialCatalog = GridDataMySqlFile.ParseFileReadValue("initial_catalog"); 62 string settingInitialCatalog = iniFile.ParseFileReadValue("initial_catalog");
59 string settingPersistSecurityInfo = GridDataMySqlFile.ParseFileReadValue("persist_security_info"); 63 string settingPersistSecurityInfo = iniFile.ParseFileReadValue("persist_security_info");
60 string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id"); 64 string settingUserId = iniFile.ParseFileReadValue("user_id");
61 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); 65 string settingPassword = iniFile.ParseFileReadValue("password");
66
67 m_usersTableName = iniFile.ParseFileReadValue("userstablename");
68 if (m_usersTableName == null)
69 {
70 m_usersTableName = "users";
71 }
72
73 m_userFriendsTableName = iniFile.ParseFileReadValue("userfriendstablename");
74 if (m_userFriendsTableName == null)
75 {
76 m_userFriendsTableName = "userfriends";
77 }
78
79 m_agentsTableName = iniFile.ParseFileReadValue("agentstablename");
80 if (m_agentsTableName == null)
81 {
82 m_agentsTableName = "agents";
83 }
62 84
63 database = 85 database =
64 new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, 86 new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId,
@@ -82,7 +104,7 @@ namespace OpenSim.Framework.Data.MSSQL
82 param["second"] = last; 104 param["second"] = last;
83 105
84 IDbCommand result = 106 IDbCommand result =
85 database.Query("SELECT * FROM users WHERE username = @first AND lastname = @second", param); 107 database.Query("SELECT * FROM "+m_usersTableName+" WHERE username = @first AND lastname = @second", param);
86 IDataReader reader = result.ExecuteReader(); 108 IDataReader reader = result.ExecuteReader();
87 109
88 UserProfileData row = database.readUserRow(reader); 110 UserProfileData row = database.readUserRow(reader);
@@ -150,7 +172,7 @@ namespace OpenSim.Framework.Data.MSSQL
150 172
151 IDbCommand result = 173 IDbCommand result =
152 database.Query( 174 database.Query(
153 "SELECT UUID,username,surname FROM users WHERE username = @first AND lastname = @second", 175 "SELECT UUID,username,surname FROM " + m_usersTableName + " WHERE username = @first AND lastname = @second",
154 param); 176 param);
155 IDataReader reader = result.ExecuteReader(); 177 IDataReader reader = result.ExecuteReader();
156 178
@@ -186,7 +208,7 @@ namespace OpenSim.Framework.Data.MSSQL
186 208
187 IDbCommand result = 209 IDbCommand result =
188 database.Query( 210 database.Query(
189 "SELECT UUID,username,surname FROM users WHERE username = @first OR lastname = @second", 211 "SELECT UUID,username,surname FROM " + m_usersTableName + " WHERE username = @first OR lastname = @second",
190 param); 212 param);
191 IDataReader reader = result.ExecuteReader(); 213 IDataReader reader = result.ExecuteReader();
192 214
@@ -223,7 +245,7 @@ namespace OpenSim.Framework.Data.MSSQL
223 Dictionary<string, string> param = new Dictionary<string, string>(); 245 Dictionary<string, string> param = new Dictionary<string, string>();
224 param["uuid"] = uuid.ToString(); 246 param["uuid"] = uuid.ToString();
225 247
226 IDbCommand result = database.Query("SELECT * FROM users WHERE UUID = @uuid", param); 248 IDbCommand result = database.Query("SELECT * FROM " + m_usersTableName + " WHERE UUID = @uuid", param);
227 IDataReader reader = result.ExecuteReader(); 249 IDataReader reader = result.ExecuteReader();
228 250
229 UserProfileData row = database.readUserRow(reader); 251 UserProfileData row = database.readUserRow(reader);
@@ -278,7 +300,7 @@ namespace OpenSim.Framework.Data.MSSQL
278 Dictionary<string, string> param = new Dictionary<string, string>(); 300 Dictionary<string, string> param = new Dictionary<string, string>();
279 param["uuid"] = uuid.ToString(); 301 param["uuid"] = uuid.ToString();
280 302
281 IDbCommand result = database.Query("SELECT * FROM agents WHERE UUID = @uuid", param); 303 IDbCommand result = database.Query("SELECT * FROM " + m_agentsTableName + " WHERE UUID = @uuid", param);
282 IDataReader reader = result.ExecuteReader(); 304 IDataReader reader = result.ExecuteReader();
283 305
284 UserAgentData row = database.readAgentRow(reader); 306 UserAgentData row = database.readAgentRow(reader);
@@ -342,7 +364,7 @@ namespace OpenSim.Framework.Data.MSSQL
342 364
343 public bool UpdateUserProfile(UserProfileData user) 365 public bool UpdateUserProfile(UserProfileData user)
344 { 366 {
345 SqlCommand command = new SqlCommand("UPDATE users set UUID = @uuid, " + 367 SqlCommand command = new SqlCommand("UPDATE " + m_usersTableName + " set UUID = @uuid, " +
346 "username = @username, " + 368 "username = @username, " +
347 "lastname = @lastname," + 369 "lastname = @lastname," +
348 "passwordHash = @passwordHash," + 370 "passwordHash = @passwordHash," +