aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
diff options
context:
space:
mode:
authorTeravus Ovares2007-12-12 01:23:15 +0000
committerTeravus Ovares2007-12-12 01:23:15 +0000
commit83f727bb7c1da0f49ccf727bea8384ea4ebdd7d1 (patch)
tree0e725f6386e934a4d4a5dca88d0855e6109fbb18 /OpenSim/Framework/Data.MySQL/MySQLUserData.cs
parent* Temporarily sisabled neighbour cache for regions in the SceneCommunicationS... (diff)
downloadopensim-SC-83f727bb7c1da0f49ccf727bea8384ea4ebdd7d1.zip
opensim-SC-83f727bb7c1da0f49ccf727bea8384ea4ebdd7d1.tar.gz
opensim-SC-83f727bb7c1da0f49ccf727bea8384ea4ebdd7d1.tar.bz2
opensim-SC-83f727bb7c1da0f49ccf727bea8384ea4ebdd7d1.tar.xz
* Patch from justincc to fix Inconsistent automatic mysql table creation - see bug 169
Diffstat (limited to 'OpenSim/Framework/Data.MySQL/MySQLUserData.cs')
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLUserData.cs51
1 files changed, 51 insertions, 0 deletions
diff --git a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
index 9c97a6a..c21f899 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
@@ -61,8 +61,59 @@ namespace OpenSim.Framework.Data.MySQL
61 database = 61 database =
62 new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, 62 new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling,
63 settingPort); 63 settingPort);
64
65 TestTables();
64 } 66 }
65 67
68 #region Test and initialization code
69
70 /// <summary>
71 /// Ensure that the user related tables exists and are at the latest version
72 /// </summary>
73 private void TestTables()
74 {
75 Dictionary<string, string> tableList = new Dictionary<string, string>();
76
77 tableList["agents"] = null;
78 tableList["users"] = null;
79 database.GetTableVersion(tableList);
80
81 UpgradeAgentsTable(tableList["agents"]);
82 UpgradeUsersTable(tableList["users"]);
83 }
84
85 /// <summary>
86 /// Create or upgrade the table if necessary
87 /// </summary>
88 /// <param name="oldVersion">A null indicates that the table does not
89 /// currently exist</param>
90 private void UpgradeAgentsTable(string oldVersion)
91 {
92 // null as the version, indicates that the table didn't exist
93 if (oldVersion == null)
94 {
95 database.ExecuteResourceSql("CreateAgentsTable.sql");
96 return;
97 }
98 }
99
100 /// <summary>
101 /// Create or upgrade the table if necessary
102 /// </summary>
103 /// <param name="oldVersion">A null indicates that the table does not
104 /// currently exist</param>
105 private void UpgradeUsersTable(string oldVersion)
106 {
107 // null as the version, indicates that the table didn't exist
108 if (oldVersion == null)
109 {
110 database.ExecuteResourceSql("CreateUsersTable.sql");
111 return;
112 }
113 }
114
115 #endregion
116
66 /// <summary> 117 /// <summary>
67 /// Searches the database for a specified user profile 118 /// Searches the database for a specified user profile
68 /// </summary> 119 /// </summary>