private void QueryButton_Click(object sender, EventArgs e) { // Validate we have at least a SELECT and a FROM. if (SelectText.Text.Trim() == String.Empty) { SelectText.Text = "*"; } if (FromText.Text.Trim() == String.Empty) { SelectFileButton.PerformClick(); if (FromText.Text.Trim() == String.Empty) { MessageBox.Show("You must have a FROM statement to continue." + Environment.NewLine + "Please select a file or enter the FROM manually.", "Query cancelled"); return; } } PerformSQLQuery(); }
private void PerformRecordCount_Click(object sender, EventArgs e) { toolStripStatusLabelDataInfo.Text = ""; if (FromText.Text.Trim() == String.Empty) { SelectFileButton.PerformClick(); if (FromText.Text.Trim() == String.Empty) { MessageBox.Show("You must have a FROM statement to continue." + Environment.NewLine + "Please select a file or enter the FROM manually.", "Query cancelled"); return; } } PerformRecordCount.Enabled = false; ICOMIISW3CInputContext input = new COMIISW3CInputContextClassClass(); toolStripStatusLabelDataInfo.Text = "There are " + GetRecordCount(FromText.Text, input).ToString() + " records to parse."; PerformRecordCount.Enabled = true; }
private void PopulateSelectListButton_Click(object sender, EventArgs e) { if (SelectedFileText.Text.Trim() == String.Empty) { SelectFileButton.PerformClick(); if (FromText.Text.Trim() == String.Empty) { MessageBox.Show("You must have a FROM statement to continue." + Environment.NewLine + "Please select a file or enter the FROM manually.", "Query cancelled"); return; } } // Use Log Parser to get a list of valid fields. Grab the top 5, as 1 might do strange things. ILogRecordset rs; if (FileFormatsComboBox.SelectedItem.ToString() == "W3C Extended Log File Format") { rs = GetRecordSet("SELECT TOP 5 * FROM " + FromText.Text, new COMIISW3CInputContextClassClass()); } else { rs = GetRecordSet("SELECT TOP 5 * FROM " + FromText.Text, null); } //MessageBox.Show(rs.getColumnCount().ToString()); SelectListBox.Items.Clear(); for (int i = 0; i < rs.getColumnCount(); i++) { SelectListBox.Items.Add(rs.getColumnName(i)); } if (FileFormatsComboBox.SelectedItem.ToString() == "W3C Extended Log File Format") { SelectListBox.Items.Add("TO_LOCALTIME(TO_TIMESTAMP(date, time)) AS LocalTime"); } }