diff options
Diffstat (limited to 'mRemoteNG/Config/DataProviders/SqlDataProvider.cs')
-rw-r--r-- | mRemoteNG/Config/DataProviders/SqlDataProvider.cs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/mRemoteNG/Config/DataProviders/SqlDataProvider.cs b/mRemoteNG/Config/DataProviders/SqlDataProvider.cs index 96f0b43b..820e5f31 100644 --- a/mRemoteNG/Config/DataProviders/SqlDataProvider.cs +++ b/mRemoteNG/Config/DataProviders/SqlDataProvider.cs @@ -5,6 +5,7 @@ using mRemoteNG.App; using mRemoteNG.Properties; using MySql.Data.MySqlClient; using System.Data.SqlClient; +using Npgsql; namespace mRemoteNG.Config.DataProviders { @@ -95,6 +96,28 @@ namespace mRemoteNG.Config.DataProviders } } } + else if (DatabaseConnector.GetType() == typeof(PostgreSQLDatabaseConnector)) + { + var dbConnection = (NpgsqlConnection)DatabaseConnector.DbConnection(); + using (NpgsqlTransaction transaction = dbConnection.BeginTransaction(System.Data.IsolationLevel.Serializable)) + { + using (NpgsqlCommand sqlCommand = new NpgsqlCommand()) + { + sqlCommand.Connection = dbConnection; + sqlCommand.Transaction = transaction; + sqlCommand.CommandText = "SELECT * FROM tblCons"; + using (NpgsqlDataAdapter dataAdapter = new NpgsqlDataAdapter(sqlCommand)) + { + //dataAdapter.UpdateBatchSize = 1000; + using (NpgsqlCommandBuilder cb = new NpgsqlCommandBuilder(dataAdapter)) + { + dataAdapter.Update(dataTable); + transaction.Commit(); + } + } + } + } + } } public void OpenConnection() |