Ejemplo n.º 1
0
        private void executeCommand(OracleConnection connection, CommandGroup commandGroup, ref List <CommandExecutionOutput> CommandOutput)
        {
            foreach (Command command in commandGroup.Commands)
            {
                Trace.TraceInformation(String.Format("execute command {0}", command.Id));

                CommandExecutionOutput l_command_output = new CommandExecutionOutput();

                l_command_output.Type = commandGroup.Type;

                OracleCommand l_db_command = new OracleCommand(command.Text, connection);
                try
                {
                    int l_affected_row_count = l_db_command.ExecuteNonQuery();
                    l_command_output.Value  = String.Format("Affected Rows({0})", (l_affected_row_count < 0 ? 0 : l_affected_row_count).ToString());
                    l_command_output.Result = ExecutionResult.Success;
                }
                catch (Exception e)
                {
                    l_command_output.Value  = e.Message;
                    l_command_output.Result = ExecutionResult.Error;
                    throw;
                }
                finally
                {
                    l_command_output.End = DateTime.Now;
                    CommandOutput.Add(l_command_output);
                }
            }
        }
Ejemplo n.º 2
0
        public Output deployPackageToDB(Connection ConnectionData, Package Package)
        {
            Trace.TraceInformation(
                String.Format("Start processing of package {0} to {1}@{2}",
                              Package.Id,
                              ConnectionData.User,
                              ConnectionData.TNS
                              )
                );

            Output deployment_output = new Output();

            try
            {
                OracleConnection db_connection = initalizeConnection(ConnectionData);
                try
                {
                    executeCommandGroups(db_connection, Package.CommandGroups, ref deployment_output);
                    deployment_output.DeploymentId = Package.Id;
                    deployment_output.ConnectionId = ConnectionData.Id;
                }
                finally
                {
                    if (db_connection != null)
                    {
                        db_connection.Dispose();
                    }
                }
            }
            catch (Exception e)
            {
                Trace.TraceError(String.Format("Error while package deployment {0}", e.Message));

                deployment_output.End = DateTime.Now;

                CommandExecutionOutput error_output = new CommandExecutionOutput();

                error_output.Start  = deployment_output.Start;
                error_output.End    = deployment_output.End;
                error_output.Value  = e.Message;
                error_output.Result = ExecutionResult.Error;
                deployment_output.CommandOutput.Add(error_output);
            }

            Trace.TraceInformation(
                String.Format("Finished deploymentPackage {0}",
                              Package.Id
                              )
                );

            return(deployment_output);
        }