aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/PGSQL/PGSQLMigration.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/PGSQL/PGSQLMigration.cs (renamed from OpenSim/Data/MSSQL/MSSQLMigration.cs)23
1 files changed, 13 insertions, 10 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLMigration.cs b/OpenSim/Data/PGSQL/PGSQLMigration.cs
index c2fecef..709fde0 100644
--- a/OpenSim/Data/MSSQL/MSSQLMigration.cs
+++ b/OpenSim/Data/PGSQL/PGSQLMigration.cs
@@ -25,22 +25,22 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using Npgsql;
28using System; 29using System;
29using System.Data; 30using System.Data;
30using System.Data.Common; 31using System.Data.Common;
31using System.Reflection; 32using System.Reflection;
32using System.Data.SqlClient;
33 33
34namespace OpenSim.Data.MSSQL 34namespace OpenSim.Data.PGSQL
35{ 35{
36 public class MSSQLMigration : Migration 36 public class PGSQLMigration : Migration
37 { 37 {
38 public MSSQLMigration(DbConnection conn, Assembly assem, string type) 38 public PGSQLMigration(NpgsqlConnection conn, Assembly assem, string type)
39 : base(conn, assem, type) 39 : base(conn, assem, type)
40 { 40 {
41 } 41 }
42 42
43 public MSSQLMigration(DbConnection conn, Assembly assem, string subtype, string type) 43 public PGSQLMigration(NpgsqlConnection conn, Assembly assem, string subtype, string type)
44 : base(conn, assem, subtype, type) 44 : base(conn, assem, subtype, type)
45 { 45 {
46 } 46 }
@@ -48,12 +48,15 @@ namespace OpenSim.Data.MSSQL
48 protected override int FindVersion(DbConnection conn, string type) 48 protected override int FindVersion(DbConnection conn, string type)
49 { 49 {
50 int version = 0; 50 int version = 0;
51 using (DbCommand cmd = conn.CreateCommand()) 51 NpgsqlConnection lcConn = (NpgsqlConnection)conn;
52
53 using (NpgsqlCommand cmd = lcConn.CreateCommand())
52 { 54 {
53 try 55 try
54 { 56 {
55 cmd.CommandText = "select top 1 version from migrations where name = '" + type + "' order by version desc"; //Must be 57 cmd.CommandText = "select version from migrations where name = '" + type + "' " +
56 using (IDataReader reader = cmd.ExecuteReader()) 58 " order by version desc limit 1"; //Must be
59 using (NpgsqlDataReader reader = cmd.ExecuteReader())
57 { 60 {
58 if (reader.Read()) 61 if (reader.Read())
59 { 62 {
@@ -73,7 +76,7 @@ namespace OpenSim.Data.MSSQL
73 76
74 protected override void ExecuteScript(DbConnection conn, string[] script) 77 protected override void ExecuteScript(DbConnection conn, string[] script)
75 { 78 {
76 if (!(conn is SqlConnection)) 79 if (!(conn is NpgsqlConnection))
77 { 80 {
78 base.ExecuteScript(conn, script); 81 base.ExecuteScript(conn, script);
79 return; 82 return;
@@ -83,7 +86,7 @@ namespace OpenSim.Data.MSSQL
83 { 86 {
84 try 87 try
85 { 88 {
86 using (SqlCommand cmd = new SqlCommand(sql, (SqlConnection)conn)) 89 using (NpgsqlCommand cmd = new NpgsqlCommand(sql, (NpgsqlConnection)conn))
87 { 90 {
88 cmd.ExecuteNonQuery(); 91 cmd.ExecuteNonQuery();
89 } 92 }