Example #1
0
		private void RunScriptsInternal(DatabaseServer server, IEnumerable<SiqualFile> files, ISiqualConnection connection)
		{
			_server = server;

			foreach (SiqualFile file in files)
			{
				RunScriptWithStatistics(file, connection);
			}
		}
Example #2
0
		private void RunScriptWithStatistics(SiqualFile file, ISiqualConnection connection)
		{
			Stopwatch timer = new Stopwatch();
			timer.Start();

			EnumRunStatus status = ExecuteScript(file, connection);

			timer.Stop();

			if (status == EnumRunStatus.Success)
				file.SaveStatusFor(_server, status, timer.Elapsed);

			FileRan(this, new FileRanEventHandlerArgs(file));
		}
        private void btnTestConnection_Click(object sender, EventArgs e)
        {
            try
            {
                DatabaseServer tempServer = new DatabaseServer
                                                {
                                                    ServerAddress = txtServerAddress.Text,
                                                    Password = txtPassword.Text,
                                                    UserName = txtUserName.Text,
                                                    DatabaseName = txtDatabaseName.Text,
                                                    UseWindowsAuth = chkWindowsAuth.Checked
                                                };

                _siqualConnection = _siqualConnectionManager.CreateConnectionFor(tempServer);
                _siqualConnection.Open();
                _siqualConnection.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
            MessageBox.Show("Connection test successful.");
        }
Example #4
0
		private EnumRunStatus ExecuteScript(SiqualFile file, ISiqualConnection connection)
		{
			string sqlScript = File.ReadAllText(file.FullFilePath);

			try
			{
				connection.Execute(sqlScript);
			}
			catch (Exception ex)
			{
				string exceptionMessage = RecursiveDrillToException(typeof(SqlException), ex);
				file.SaveStatusFor(_server, EnumRunStatus.Fail, exceptionMessage);
				if (_runAtomic)
					throw;

				return EnumRunStatus.Fail;
			}

			return EnumRunStatus.Success;
		}
 public void Setup()
 {
     _siqualConnectionManager = MockRepository.GenerateMock<ISiqualConnectionManager>();
     _siqualConnection = MockRepository.GenerateMock<ISiqualConnection>();
 }