aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/Migration.cs
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-12-02 15:22:58 +0000
committerJustin Clarke Casey2008-12-02 15:22:58 +0000
commitdde32f1130f83f9471fea474b1ebc9e0520be561 (patch)
treedc8683d7b14ada4aa07497da3ed4b5d7b79c57b8 /OpenSim/Data/Migration.cs
parent* Resolve http://opensimulator.org/mantis/view.php?id=2743 and http://opensim... (diff)
downloadopensim-SC_OLD-dde32f1130f83f9471fea474b1ebc9e0520be561.zip
opensim-SC_OLD-dde32f1130f83f9471fea474b1ebc9e0520be561.tar.gz
opensim-SC_OLD-dde32f1130f83f9471fea474b1ebc9e0520be561.tar.bz2
opensim-SC_OLD-dde32f1130f83f9471fea474b1ebc9e0520be561.tar.xz
* Reapply http://opensimulator.org/mantis/view.php?id=2710
* This patch gets NHibernate working *** PLEASE NOTE: This patch now requires the libmono-oracle2.0-cil library to be installed on Ubuntu (to stop the System.Data.Oracle missing failure) *** * Not sure what the dependency is on other distros. Adding this info to http://opensimulator.org/wiki/Build_Instructions would be most welcome * Adds Castle.* libraries that were missing last time (note, dlls have been added from http://downloads.sourceforge.net/nhibernate/NHibernate-2.0.1.GA-bin.zip)
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/Migration.cs10
1 files changed, 8 insertions, 2 deletions
diff --git a/OpenSim/Data/Migration.cs b/OpenSim/Data/Migration.cs
index 8fbf789..332b8ec 100644
--- a/OpenSim/Data/Migration.cs
+++ b/OpenSim/Data/Migration.cs
@@ -82,6 +82,7 @@ namespace OpenSim.Data
82 // private static readonly string _migrations_init = "insert into migrations values('migrations', 1)"; 82 // private static readonly string _migrations_init = "insert into migrations values('migrations', 1)";
83 // private static readonly string _migrations_find = "select version from migrations where name='migrations'"; 83 // private static readonly string _migrations_find = "select version from migrations where name='migrations'";
84 84
85
85 public Migration(DbConnection conn, Assembly assem, string type) 86 public Migration(DbConnection conn, Assembly assem, string type)
86 { 87 {
87 _type = type; 88 _type = type;
@@ -112,6 +113,7 @@ namespace OpenSim.Data
112 DbCommand cmd = _conn.CreateCommand(); 113 DbCommand cmd = _conn.CreateCommand();
113 cmd.CommandText = _migrations_create; 114 cmd.CommandText = _migrations_create;
114 cmd.ExecuteNonQuery(); 115 cmd.ExecuteNonQuery();
116 cmd.Dispose();
115 117
116 InsertVersion("migrations", 1); 118 InsertVersion("migrations", 1);
117 } 119 }
@@ -135,7 +137,7 @@ namespace OpenSim.Data
135 int newversion = kvp.Key; 137 int newversion = kvp.Key;
136 cmd.CommandText = kvp.Value; 138 cmd.CommandText = kvp.Value;
137 // we need to up the command timeout to infinite as we might be doing long migrations. 139 // we need to up the command timeout to infinite as we might be doing long migrations.
138 cmd.CommandTimeout = 0; 140 //cmd.CommandTimeout = 0;
139 cmd.ExecuteNonQuery(); 141 cmd.ExecuteNonQuery();
140 142
141 if (version == 0) 143 if (version == 0)
@@ -147,6 +149,7 @@ namespace OpenSim.Data
147 UpdateVersion(_type, newversion); 149 UpdateVersion(_type, newversion);
148 } 150 }
149 version = newversion; 151 version = newversion;
152 cmd.Dispose();
150 } 153 }
151 } 154 }
152 155
@@ -189,7 +192,7 @@ namespace OpenSim.Data
189 DbCommand cmd = conn.CreateCommand(); 192 DbCommand cmd = conn.CreateCommand();
190 try 193 try
191 { 194 {
192 cmd.CommandText = "select version from migrations where name='" + type + "' limit 1"; 195 cmd.CommandText = "select version from migrations where name='" + type +"' order by version desc";
193 using (IDataReader reader = cmd.ExecuteReader()) 196 using (IDataReader reader = cmd.ExecuteReader())
194 { 197 {
195 if (reader.Read()) 198 if (reader.Read())
@@ -203,6 +206,7 @@ namespace OpenSim.Data
203 { 206 {
204 // Something went wrong, so we're version 0 207 // Something went wrong, so we're version 0
205 } 208 }
209 cmd.Dispose();
206 return version; 210 return version;
207 } 211 }
208 212
@@ -212,6 +216,7 @@ namespace OpenSim.Data
212 cmd.CommandText = "insert into migrations(name, version) values('" + type + "', " + version + ")"; 216 cmd.CommandText = "insert into migrations(name, version) values('" + type + "', " + version + ")";
213 m_log.InfoFormat("[MIGRATIONS]: Creating {0} at version {1}", type, version); 217 m_log.InfoFormat("[MIGRATIONS]: Creating {0} at version {1}", type, version);
214 cmd.ExecuteNonQuery(); 218 cmd.ExecuteNonQuery();
219 cmd.Dispose();
215 } 220 }
216 221
217 private void UpdateVersion(string type, int version) 222 private void UpdateVersion(string type, int version)
@@ -220,6 +225,7 @@ namespace OpenSim.Data
220 cmd.CommandText = "update migrations set version=" + version + " where name='" + type + "'"; 225 cmd.CommandText = "update migrations set version=" + version + " where name='" + type + "'";
221 m_log.InfoFormat("[MIGRATIONS]: Updating {0} to version {1}", type, version); 226 m_log.InfoFormat("[MIGRATIONS]: Updating {0} to version {1}", type, version);
222 cmd.ExecuteNonQuery(); 227 cmd.ExecuteNonQuery();
228 cmd.Dispose();
223 } 229 }
224 230
225 // private SortedList<int, string> GetAllMigrations() 231 // private SortedList<int, string> GetAllMigrations()