aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MSSQL/MSSQLMigration.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MSSQL/MSSQLMigration.cs45
1 files changed, 45 insertions, 0 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLMigration.cs b/OpenSim/Data/MSSQL/MSSQLMigration.cs
new file mode 100644
index 0000000..67fc606
--- /dev/null
+++ b/OpenSim/Data/MSSQL/MSSQLMigration.cs
@@ -0,0 +1,45 @@
1using System;
2using System.Collections.Generic;
3using System.Data;
4using System.Data.Common;
5using System.Reflection;
6using System.Text;
7
8namespace OpenSim.Data.MSSQL
9{
10 public class MSSQLMigration : Migration
11 {
12 public MSSQLMigration(DbConnection conn, Assembly assem, string type) : base(conn, assem, type)
13 {
14 }
15
16 public MSSQLMigration(DbConnection conn, Assembly assem, string subtype, string type) : base(conn, assem, subtype, type)
17 {
18 }
19
20 protected override int FindVersion(DbConnection conn, string type)
21 {
22 int version = 0;
23 using (DbCommand cmd = conn.CreateCommand())
24 {
25 try
26 {
27 cmd.CommandText = "select top 1 version from migrations where name = '" + type + "' order by version desc"; //Must be
28 using (IDataReader reader = cmd.ExecuteReader())
29 {
30 if (reader.Read())
31 {
32 version = Convert.ToInt32(reader["version"]);
33 }
34 reader.Close();
35 }
36 }
37 catch
38 {
39 // Something went wrong, so we're version 0
40 }
41 }
42 return version;
43 }
44 }
45}