Exemple #1
0
 private void UseConnections(Action <FbConnection, FirebirdConnection> action)
 {
     using (var sqlConnection = ConnectionUtils.CreateConnection())
         using (var connection = new FirebirdConnection(sqlConnection, _providers, _options))
         {
             action(sqlConnection, connection);
         }
 }
Exemple #2
0
 private void UseConnection(Action <FirebirdConnection> action)
 {
     using (var connection = new FirebirdConnection(
                ConnectionUtils.CreateConnection(),
                _providers,
                _options))
     {
         action(connection);
     }
 }
Exemple #3
0
        private void btnInsert_Click(object sender, EventArgs e)
        {
            cmds[0] = tbQuery1.Text;
            cmds[1] = tbQuery2.Text;

            if (rbMySQL.Checked == true)
            {
                MySQLConnection MySQLCon = new MySQLConnection();

                MySQLCon.MySQLServer = tbServidor.Text;
                MySQLCon.MySQLPort   = tbPort.Text;
                MySQLCon.MySQLUser   = tbUser.Text;
                MySQLCon.MySQLPass   = tbPass.Text;

                MySQLCon.TransacaoMySQL(cmds);
            }
            else if (rbMSSQL.Checked == true)
            {
                MSSQLConnection MSSQLCon = new MSSQLConnection();

                MSSQLCon.MSSQLServer = tbServidor.Text;
                MSSQLCon.MSSQLPort   = tbPort.Text;
                MSSQLCon.MSSQLUser   = tbUser.Text;
                MSSQLCon.MSSQLPass   = tbPass.Text;

                MSSQLCon.TransacaoMSSQL(cmds);
            }
            else if (rbPgSQL.Checked == true)
            {
                PgSQLConnection PgSQLCon = new PgSQLConnection();

                PgSQLCon.PgSQLServer = tbServidor.Text;
                PgSQLCon.PgSQLPort   = tbPort.Text;
                PgSQLCon.PgSQLUser   = tbUser.Text;
                PgSQLCon.PgSQLPass   = tbPass.Text;

                PgSQLCon.TransacaoPgSQL(cmds);
            }
            else if (rbFirebird.Checked == true)
            {
                FirebirdConnection FirebirdCon = new FirebirdConnection();

                FirebirdCon.FirebirdServer = tbServidor.Text;
                FirebirdCon.FirebirdPort   = tbPort.Text;
                FirebirdCon.FirebirdUser   = tbUser.Text;
                FirebirdCon.FirebirdPass   = tbPass.Text;

                FirebirdCon.TransacaoFirebird(cmds);
            }
            else
            {
                MessageBox.Show("ERRO");
            }
        }
Exemple #4
0
        public void Dispose_DisposesTheConnection_IfOwned()
        {
            using (var sqlConnection = ConnectionUtils.CreateConnection())
            {
                var connection = new FirebirdConnection(sqlConnection, _providers, _options);

                connection.Dispose();

                Assert.Equal(ConnectionState.Closed, sqlConnection.State);
            }
        }
Exemple #5
0
        public void Dispose_DoesNotDisposeTheConnection_IfNotOwned()
        {
            using (var sqlConnection = ConnectionUtils.CreateConnection())
            {
                var connection = new FirebirdConnection(sqlConnection, _providers, ownsConnection: false, options: _options);

                connection.Dispose();

                Assert.Equal(ConnectionState.Open, sqlConnection.State);
            }
        }
        public void Dispose_DisposesTheConnection_IfOwned()
        {
            using (var sqlConnection = ConnectionUtils.CreateConnection())
            {
                var connection = new FirebirdConnection(sqlConnection, _providers, _options);

                connection.Dispose();

                Assert.Equal(ConnectionState.Closed, sqlConnection.State);
            }
        }
 private void UseConnection(Action<FirebirdConnection> action)
 {
     using (var connection = new FirebirdConnection(
         ConnectionUtils.CreateConnection(),
         _providers,
         _options))
     {
         action(connection);
     }
 }
 private void UseConnections(Action<FbConnection, FirebirdConnection> action)
 {
     using (var sqlConnection = ConnectionUtils.CreateConnection())
     using (var connection = new FirebirdConnection(sqlConnection, _providers, _options))
     {
         action(sqlConnection, connection);
     }
 }
        public void Dispose_DoesNotDisposeTheConnection_IfNotOwned()
        {
            using (var sqlConnection = ConnectionUtils.CreateConnection())
            {
                var connection = new FirebirdConnection(sqlConnection, _providers, ownsConnection: false, options: _options);

                connection.Dispose();

                Assert.Equal(ConnectionState.Open, sqlConnection.State);
            }
        }