aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs31
1 files changed, 18 insertions, 13 deletions
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs
index 95a0c08..56ad3fa 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs
@@ -37,7 +37,7 @@ namespace OpenSim.Framework.Data.MSSQL
37 /// <summary> 37 /// <summary>
38 /// A database interface class to a user profile storage system 38 /// A database interface class to a user profile storage system
39 /// </summary> 39 /// </summary>
40 internal class MSSQLUserData : IUserData 40 public class MSSQLUserData : IUserData
41 { 41 {
42 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 42 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
43 43
@@ -86,37 +86,41 @@ namespace OpenSim.Framework.Data.MSSQL
86 new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, 86 new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId,
87 settingPassword); 87 settingPassword);
88 88
89 if (!TestTables()) 89 TestTables();
90 {
91 database.ExecuteResourceSql("Mssql-agents.sql");
92 database.ExecuteResourceSql("Mssql-users.sql");
93 database.ExecuteResourceSql("Mssql-userfriends.sql");
94 }
95 } 90 }
96 91
97 private bool TestTables() 92 private bool TestTables()
98 { 93 {
99 IDbCommand cmd = database.Query("select top 1 webLoginKey from "+m_usersTableName, new Dictionary<string, string>()); 94 IDbCommand cmd;
95
96 cmd = database.Query("select top 1 * from " + m_usersTableName, new Dictionary<string, string>());
100 try 97 try
101 { 98 {
102 cmd.ExecuteNonQuery(); 99 cmd.ExecuteNonQuery();
103 cmd.Dispose();
104 } 100 }
105 catch 101 catch
106 { 102 {
107 database.Query("alter table "+m_usersTableName+" add column [webLoginKey] varchar(36) default NULL", new Dictionary<string, string>()); 103 database.ExecuteResourceSql("Mssql-users.sql");
104 }
105
106 cmd = database.Query("select top 1 * from " + m_agentsTableName, new Dictionary<string, string>());
107 try
108 {
108 cmd.ExecuteNonQuery(); 109 cmd.ExecuteNonQuery();
109 cmd.Dispose(); 110 }
111 catch
112 {
113 database.ExecuteResourceSql("Mssql-agents.sql");
110 } 114 }
111 115
112 cmd = database.Query("select top 1 * from "+m_usersTableName, new Dictionary<string, string>()); 116 cmd = database.Query("select top 1 * from " + m_userFriendsTableName, new Dictionary<string, string>());
113 try 117 try
114 { 118 {
115 cmd.ExecuteNonQuery(); 119 cmd.ExecuteNonQuery();
116 } 120 }
117 catch 121 catch
118 { 122 {
119 return false; 123 database.ExecuteResourceSql("CreateUserFriendsTable.sql");
120 } 124 }
121 125
122 return true; 126 return true;
@@ -180,6 +184,7 @@ namespace OpenSim.Framework.Data.MSSQL
180 "VALUES " + 184 "VALUES " +
181 "(@ownerID,@friendID,@friendPerms,@datetimestamp)", 185 "(@ownerID,@friendID,@friendPerms,@datetimestamp)",
182 param); 186 param);
187
183 adder.ExecuteNonQuery(); 188 adder.ExecuteNonQuery();
184 189
185 adder = 190 adder =