Пример #1
0
        public void QueryConstructorTest()
        {
            DummyDatabase database = new DummyDatabase ( true, 1 );

            Query target = new Query ( );
            target.Database = database;
            // Should start as null until it has run.
            Assert.AreEqual ( null, target.Results.Success );
            Assert.AreEqual ( 0, target.Results.Time );
        }
Пример #2
0
        public void RunSQL_HasResults_Test()
        {
            DummyDatabase database = new DummyDatabase ( true, 1 );
            Query target = new Query ( );
            target.Database = database;
            target.Sql = "sql";

            target.RunSql ( );

            Assert.AreEqual ( true, target.Results.Success );
            Assert.AreEqual ( 1, target.Results.Time );
        }
Пример #3
0
 public RefactorData()
 {
     _masterQuery = new Query ( );
 }
Пример #4
0
		/// <summary>
		/// Runs the given query. Displays the result in the given text box (either the master results, or detail results)
		/// </summary>
		/// <param name="queryText"></param>
		/// <param name="results"></param>
		/// <param name="query"></param>
		private void runQuery ( Query query )
		{
			_isModified = true;
			query.Database = this._database;

			BackgroundWorker worker = new BackgroundWorker ();
			worker.DoWork += ( sender, e ) => query.RunSql ();
			worker.RunWorkerCompleted += ( sender, e ) =>
			{
				//_window.btnRun.Content = "Run";
				//this.btnRun.Enabled = true;

				if ( query != _data.MasterQuery )
					this.CurrentQueryIndex = this._data.Queries.Count - 1;

				worker.Dispose ();
			};

			//_window.btnRun.Content = "Running...";
			//this.btnRun.Enabled = false;

			worker.RunWorkerAsync ();
		}