diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLMigration.cs | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLMigration.cs b/OpenSim/Data/MSSQL/MSSQLMigration.cs index cd395b8..1aa96c7 100644 --- a/OpenSim/Data/MSSQL/MSSQLMigration.cs +++ b/OpenSim/Data/MSSQL/MSSQLMigration.cs | |||
@@ -29,16 +29,19 @@ using System; | |||
29 | using System.Data; | 29 | using System.Data; |
30 | using System.Data.Common; | 30 | using System.Data.Common; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Data.SqlClient; | ||
32 | 33 | ||
33 | namespace OpenSim.Data.MSSQL | 34 | namespace OpenSim.Data.MSSQL |
34 | { | 35 | { |
35 | public class MSSQLMigration : Migration | 36 | public class MSSQLMigration : Migration |
36 | { | 37 | { |
37 | public MSSQLMigration(DbConnection conn, Assembly assem, string type) : base(conn, assem, type) | 38 | public MSSQLMigration(DbConnection conn, Assembly assem, string type) |
39 | : base(conn, assem, type) | ||
38 | { | 40 | { |
39 | } | 41 | } |
40 | 42 | ||
41 | public MSSQLMigration(DbConnection conn, Assembly assem, string subtype, string type) : base(conn, assem, subtype, type) | 43 | public MSSQLMigration(DbConnection conn, Assembly assem, string subtype, string type) |
44 | : base(conn, assem, subtype, type) | ||
42 | { | 45 | { |
43 | } | 46 | } |
44 | 47 | ||
@@ -67,5 +70,30 @@ namespace OpenSim.Data.MSSQL | |||
67 | } | 70 | } |
68 | return version; | 71 | return version; |
69 | } | 72 | } |
73 | |||
74 | protected override void ExecuteScript(DbConnection conn, string[] script) | ||
75 | { | ||
76 | if (!(conn is SqlConnection)) | ||
77 | { | ||
78 | base.ExecuteScript(conn, script); | ||
79 | return; | ||
80 | } | ||
81 | |||
82 | foreach (string sql in script) | ||
83 | { | ||
84 | try | ||
85 | { | ||
86 | using (SqlCommand cmd = new SqlCommand(sql, (SqlConnection)conn)) | ||
87 | { | ||
88 | cmd.ExecuteNonQuery(); | ||
89 | } | ||
90 | } | ||
91 | catch (Exception ex) | ||
92 | { | ||
93 | throw new Exception(sql); | ||
94 | |||
95 | } | ||
96 | } | ||
97 | } | ||
70 | } | 98 | } |
71 | } | 99 | } |