From 83f727bb7c1da0f49ccf727bea8384ea4ebdd7d1 Mon Sep 17 00:00:00 2001
From: Teravus Ovares
Date: Wed, 12 Dec 2007 01:23:15 +0000
Subject: * Patch from justincc to fix Inconsistent automatic mysql table
creation - see bug 169
---
OpenSim/Framework/Data.MySQL/MySQLGridData.cs | 34 +++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
(limited to 'OpenSim/Framework/Data.MySQL/MySQLGridData.cs')
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
database =
new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling,
settingPort);
+
+ TestTables();
}
+ #region Test and initialization code
+
+ ///
+ /// Ensure that the user related tables exists and are at the latest version
+ ///
+ private void TestTables()
+ {
+ Dictionary tableList = new Dictionary();
+
+ tableList["regions"] = null;
+ database.GetTableVersion(tableList);
+
+ UpgradeRegionsTable(tableList["regions"]);
+ }
+
+ ///
+ /// Create or upgrade the table if necessary
+ ///
+ /// A null indicates that the table does not
+ /// currently exist
+ private void UpgradeRegionsTable(string oldVersion)
+ {
+ // null as the version, indicates that the table didn't exist
+ if (oldVersion == null)
+ {
+ database.ExecuteResourceSql("CreateRegionsTable.sql");
+ return;
+ }
+ }
+
+ #endregion
+
///
/// Shuts down the grid interface
///
--
cgit v1.1