示例#1
0
 public QueryStressSettings()
 {
     MainDbConnectionInfo    = new DatabaseSelect.ConnectionInfo(this);
     ShareDbSettings         = true;
     ParamDbConnectionInfo   = new DatabaseSelect.ConnectionInfo();
     MainQuery               = "";
     ParamQuery              = "";
     NumThreads              = 1;
     NumIterations           = 1;
     ParamMappings           = new Dictionary <string, string>();
     ConnectionTimeout       = 15;
     CommandTimeout          = 0;
     EnableConnectionPooling = true;
     CollectIoStats          = true;
     CollectTimeStats        = true;
     ForceDataRetrieval      = false;
 }
示例#2
0
 public QueryStressSettings()
 {
     mainDBConnectionInfo    = new DatabaseSelect.ConnectionInfo(this);
     shareDBSettings         = true;
     paramDBConnectionInfo   = new DatabaseSelect.ConnectionInfo();
     mainQuery               = "";
     paramQuery              = "";
     numThreads              = 1;
     numIterations           = 1;
     paramMappings           = new Dictionary <string, string>();
     connectionTimeout       = 15;
     commandTimeout          = 0;
     enableConnectionPooling = true;
     collectIOStats          = true;
     collectTimeStats        = true;
     forceDataRetrieval      = false;
 }
示例#3
0
 public QueryStressSettings()
 {
     MainDbConnectionInfo = new DatabaseSelect.ConnectionInfo(this);
     ShareDbSettings = true;
     ParamDbConnectionInfo = new DatabaseSelect.ConnectionInfo();
     MainQuery = "";
     ParamQuery = "";
     NumThreads = 1;
     NumIterations = 1;
     ParamMappings = new Dictionary<string, string>();
     ConnectionTimeout = 15;
     CommandTimeout = 0;
     EnableConnectionPooling = true;
     CollectIoStats = true;
     CollectTimeStats = true;
     ForceDataRetrieval = false;
 }
示例#4
0
 public QueryStressSettings()
 {
     mainDBConnectionInfo = new DatabaseSelect.ConnectionInfo(this);
     shareDBSettings = true;
     paramDBConnectionInfo = new DatabaseSelect.ConnectionInfo();
     mainQuery = "";
     paramQuery = "";
     numThreads = 1;
     numIterations = 1;
     paramMappings = new Dictionary<string, string>();
     connectionTimeout = 15;
     commandTimeout = 0;
     enableConnectionPooling = true;
     collectIOStats = true;
     collectTimeStats = true;
     forceDataRetrieval = false;
 }
示例#5
0
        private void getColumnsButton_Click(object sender, EventArgs e)
        {
            this.queryVariables = this.getParams();

            SqlDataReader reader = null;

            DatabaseSelect.ConnectionInfo DBInfo = settings.shareDBSettings ? settings.mainDBConnectionInfo : settings.paramDBConnectionInfo;

            if (!DBInfo.TestConnection())
            {
                MessageBox.Show("You must set valid database connection information. Click the Database button to configure the settings.");
                return;
            }

            using (SqlConnection conn = new SqlConnection(DBInfo.ConnectionString))
            {
                try
                {
                    SqlCommand comm = new SqlCommand(paramQueryTextBox.Text, conn);
                    conn.Open();
                    reader = comm.ExecuteReader(CommandBehavior.SchemaOnly);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }

                if (reader != null)
                {
                    columnMapGrid.Rows.Clear();
                    paramValues.Clear();

                    for (int i = 0; i < reader.FieldCount; i++)
                    {
                        paramValues.Add(reader.GetName(i), reader.GetDataTypeName(i));
                    }

                    reader.Dispose();

                    foreach (string variable in queryVariables)
                    {
                        int             colOrdinal = columnMapGrid.Rows.Add();
                        DataGridViewRow row        = columnMapGrid.Rows[colOrdinal];
                        row.Cells[0].Value    = variable;
                        row.Cells[0].ReadOnly = true;

                        //placeholder for columntype
                        row.Cells[1].Value    = "";
                        row.Cells[1].ReadOnly = true;

                        DataGridViewComboBoxCell combo = new DataGridViewComboBoxCell();

                        combo.Items.Add("");

                        bool checkParam = false;
                        if ((sender.GetType() == typeof(System.String)) &&
                            ((string)sender == "constructor") &&
                            settings.paramMappings.ContainsKey(variable))
                        {
                            checkParam = true;
                        }

                        foreach (string paramName in paramValues.Keys)
                        {
                            combo.Items.Add(paramName);

                            if (checkParam)
                            {
                                if (settings.paramMappings[variable] == paramName)
                                {
                                    combo.Value        = paramName;
                                    row.Cells[1].Value = paramValues[paramName];
                                }
                            }
                        }

                        row.Cells[2] = combo;
                    }
                }
            }
        }
示例#6
0
        private void go_button_Click(object sender, EventArgs e)
        {
            if (!this.settings.mainDBConnectionInfo.TestConnection())
            {
                MessageBox.Show("You must set valid database connection information. Click the Database button to configure the settings.");
                return;
            }

            this.cancelled      = false;
            this.exitOnComplete = false;

            this.exceptions = new Dictionary <string, int>();

            this.totalIterations   = 0;
            this.totalTime         = 0;
            this.totalCPUTime      = 0;
            this.totalElapsedTime  = 0;
            this.totalTimeMessages = 0;
            this.totalLogicalReads = 0;
            this.totalReadMessages = 0;
            this.totalExceptions   = 0;

            this.iterationsSecond_textBox.Text    = "0";
            this.avgSeconds_textBox.Text          = "0.0";
            this.actualSeconds_textBox.Text       = "---";
            this.cpuTime_textBox.Text             = "---";
            this.logicalReads_textBox.Text        = "---";
            this.go_button.Enabled                = false;
            this.cancel_button.Enabled            = true;
            this.iterations_numericUpDown.Enabled = false;
            this.threads_numericUpDown.Enabled    = false;

            this.progressBar1.Value = 0;

            SaveSettingsFromForm1();

            this.totalExpectedIterations = this.settings.numThreads * this.settings.numIterations;

            DatabaseSelect.ConnectionInfo paramConnectionInfo = settings.shareDBSettings ? settings.mainDBConnectionInfo : settings.paramDBConnectionInfo;
            db_label.Text = "" +
                            "Server: " + paramConnectionInfo.Server +
                            ((paramConnectionInfo.Database.Length > 0) ? ("  //  Database: " + paramConnectionInfo.Database) : (""));

            LoadEngine engine = new LoadEngine(
                this.settings.mainDBConnectionInfo.ConnectionString,
                this.settings.mainQuery,
                this.settings.numThreads,
                this.settings.numIterations,
                this.settings.paramQuery,
                this.settings.paramMappings,
                paramConnectionInfo.ConnectionString,
                this.settings.commandTimeout,
                this.settings.collectIOStats,
                this.settings.collectTimeStats,
                this.settings.forceDataRetrieval);

            backgroundWorker1.RunWorkerAsync(engine);

            this.start = new TimeSpan(DateTime.Now.Ticks);

            mainUITimer.Start();
        }