diff options
Diffstat (limited to 'OpenSim/Framework/Data.MySQL/MySQLGridData.cs')
-rw-r--r-- | OpenSim/Framework/Data.MySQL/MySQLGridData.cs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs index bb0e8b3..ac3d849 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs | |||
@@ -62,8 +62,42 @@ namespace OpenSim.Framework.Data.MySQL | |||
62 | database = | 62 | database = |
63 | new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, | 63 | new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, |
64 | settingPort); | 64 | settingPort); |
65 | |||
66 | TestTables(); | ||
65 | } | 67 | } |
66 | 68 | ||
69 | #region Test and initialization code | ||
70 | |||
71 | /// <summary> | ||
72 | /// Ensure that the user related tables exists and are at the latest version | ||
73 | /// </summary> | ||
74 | private void TestTables() | ||
75 | { | ||
76 | Dictionary<string, string> tableList = new Dictionary<string, string>(); | ||
77 | |||
78 | tableList["regions"] = null; | ||
79 | database.GetTableVersion(tableList); | ||
80 | |||
81 | UpgradeRegionsTable(tableList["regions"]); | ||
82 | } | ||
83 | |||
84 | /// <summary> | ||
85 | /// Create or upgrade the table if necessary | ||
86 | /// </summary> | ||
87 | /// <param name="oldVersion">A null indicates that the table does not | ||
88 | /// currently exist</param> | ||
89 | private void UpgradeRegionsTable(string oldVersion) | ||
90 | { | ||
91 | // null as the version, indicates that the table didn't exist | ||
92 | if (oldVersion == null) | ||
93 | { | ||
94 | database.ExecuteResourceSql("CreateRegionsTable.sql"); | ||
95 | return; | ||
96 | } | ||
97 | } | ||
98 | |||
99 | #endregion | ||
100 | |||
67 | /// <summary> | 101 | /// <summary> |
68 | /// Shuts down the grid interface | 102 | /// Shuts down the grid interface |
69 | /// </summary> | 103 | /// </summary> |