diff options
Diffstat (limited to 'OpenSim/Data/Migration.cs')
-rw-r--r-- | OpenSim/Data/Migration.cs | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/OpenSim/Data/Migration.cs b/OpenSim/Data/Migration.cs index 332b8ec..8fbf789 100644 --- a/OpenSim/Data/Migration.cs +++ b/OpenSim/Data/Migration.cs | |||
@@ -82,7 +82,6 @@ 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 | |||
86 | public Migration(DbConnection conn, Assembly assem, string type) | 85 | public Migration(DbConnection conn, Assembly assem, string type) |
87 | { | 86 | { |
88 | _type = type; | 87 | _type = type; |
@@ -113,7 +112,6 @@ namespace OpenSim.Data | |||
113 | DbCommand cmd = _conn.CreateCommand(); | 112 | DbCommand cmd = _conn.CreateCommand(); |
114 | cmd.CommandText = _migrations_create; | 113 | cmd.CommandText = _migrations_create; |
115 | cmd.ExecuteNonQuery(); | 114 | cmd.ExecuteNonQuery(); |
116 | cmd.Dispose(); | ||
117 | 115 | ||
118 | InsertVersion("migrations", 1); | 116 | InsertVersion("migrations", 1); |
119 | } | 117 | } |
@@ -137,7 +135,7 @@ namespace OpenSim.Data | |||
137 | int newversion = kvp.Key; | 135 | int newversion = kvp.Key; |
138 | cmd.CommandText = kvp.Value; | 136 | cmd.CommandText = kvp.Value; |
139 | // we need to up the command timeout to infinite as we might be doing long migrations. | 137 | // we need to up the command timeout to infinite as we might be doing long migrations. |
140 | //cmd.CommandTimeout = 0; | 138 | cmd.CommandTimeout = 0; |
141 | cmd.ExecuteNonQuery(); | 139 | cmd.ExecuteNonQuery(); |
142 | 140 | ||
143 | if (version == 0) | 141 | if (version == 0) |
@@ -149,7 +147,6 @@ namespace OpenSim.Data | |||
149 | UpdateVersion(_type, newversion); | 147 | UpdateVersion(_type, newversion); |
150 | } | 148 | } |
151 | version = newversion; | 149 | version = newversion; |
152 | cmd.Dispose(); | ||
153 | } | 150 | } |
154 | } | 151 | } |
155 | 152 | ||
@@ -192,7 +189,7 @@ namespace OpenSim.Data | |||
192 | DbCommand cmd = conn.CreateCommand(); | 189 | DbCommand cmd = conn.CreateCommand(); |
193 | try | 190 | try |
194 | { | 191 | { |
195 | cmd.CommandText = "select version from migrations where name='" + type +"' order by version desc"; | 192 | cmd.CommandText = "select version from migrations where name='" + type + "' limit 1"; |
196 | using (IDataReader reader = cmd.ExecuteReader()) | 193 | using (IDataReader reader = cmd.ExecuteReader()) |
197 | { | 194 | { |
198 | if (reader.Read()) | 195 | if (reader.Read()) |
@@ -206,7 +203,6 @@ namespace OpenSim.Data | |||
206 | { | 203 | { |
207 | // Something went wrong, so we're version 0 | 204 | // Something went wrong, so we're version 0 |
208 | } | 205 | } |
209 | cmd.Dispose(); | ||
210 | return version; | 206 | return version; |
211 | } | 207 | } |
212 | 208 | ||
@@ -216,7 +212,6 @@ namespace OpenSim.Data | |||
216 | cmd.CommandText = "insert into migrations(name, version) values('" + type + "', " + version + ")"; | 212 | cmd.CommandText = "insert into migrations(name, version) values('" + type + "', " + version + ")"; |
217 | m_log.InfoFormat("[MIGRATIONS]: Creating {0} at version {1}", type, version); | 213 | m_log.InfoFormat("[MIGRATIONS]: Creating {0} at version {1}", type, version); |
218 | cmd.ExecuteNonQuery(); | 214 | cmd.ExecuteNonQuery(); |
219 | cmd.Dispose(); | ||
220 | } | 215 | } |
221 | 216 | ||
222 | private void UpdateVersion(string type, int version) | 217 | private void UpdateVersion(string type, int version) |
@@ -225,7 +220,6 @@ namespace OpenSim.Data | |||
225 | cmd.CommandText = "update migrations set version=" + version + " where name='" + type + "'"; | 220 | cmd.CommandText = "update migrations set version=" + version + " where name='" + type + "'"; |
226 | m_log.InfoFormat("[MIGRATIONS]: Updating {0} to version {1}", type, version); | 221 | m_log.InfoFormat("[MIGRATIONS]: Updating {0} to version {1}", type, version); |
227 | cmd.ExecuteNonQuery(); | 222 | cmd.ExecuteNonQuery(); |
228 | cmd.Dispose(); | ||
229 | } | 223 | } |
230 | 224 | ||
231 | // private SortedList<int, string> GetAllMigrations() | 225 | // private SortedList<int, string> GetAllMigrations() |