Exemplo n.º 1
0
        private void tsmiQueryStatistics_Click(object sender, EventArgs e)
        {
            QueryStatistics qs = queryBuilder1.QueryStatistics;

            string stats = "Used Objects (" + qs.UsedDatabaseObjects.Count + "):\r\n";

            stats = qs.UsedDatabaseObjects.Aggregate(stats, (current, t) => current + ("\r\n" + t.ObjectName.QualifiedName));

            stats += "\r\n\r\n" + "Used Columns (" + qs.UsedDatabaseObjectFields.Count + "):\r\n";
            stats  = qs.UsedDatabaseObjectFields.Aggregate(stats, (current, t) => current + ("\r\n" + t.ObjectName.QualifiedName));

            stats += "\r\n\r\n" + "Output Expressions (" + qs.OutputColumns.Count + "):\r\n";
            stats  = qs.OutputColumns.Aggregate(stats, (current, t) => current + ("\r\n" + t.Expression));

            using (QueryStatisticsForm f = new QueryStatisticsForm())
            {
                f.textBox.Text = stats;
                f.ShowDialog();
            }
        }
        public void ShowQueryStatistics()
        {
            QueryStatistics qs = SqlQuery.QueryStatistics;

            var stats = "Used Objects (" + qs.UsedDatabaseObjects.Count + "):\r\n";

            stats = qs.UsedDatabaseObjects.Aggregate(stats, (current, t) => current + ("\r\n" + t.ObjectName.QualifiedName));

            stats += "\r\n\r\n" + "Used Columns (" + qs.UsedDatabaseObjectFields.Count + "):\r\n";
            stats  = qs.UsedDatabaseObjectFields.Aggregate(stats, (current, t) => current + ("\r\n" + t.ObjectName.QualifiedName));

            stats += "\r\n\r\n" + "Output Expressions (" + qs.OutputColumns.Count + "):\r\n";
            stats  = qs.OutputColumns.Aggregate(stats, (current, t) => current + ("\r\n" + t.Expression));

            using (QueryStatisticsForm f = new QueryStatisticsForm())
            {
                f.textBox.Text = stats;
                f.ShowDialog();
            }
        }
        // HOWTO: Get query statistics
        public void QueryStatistics()
        {
            try
            {
                _query.SQL = SqlBox.Text;
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Parsing error");
                return;
            }

            QueryStatistics qs = _query.QueryStatistics;

            var stats = "Used Objects (" + qs.UsedDatabaseObjects.Count + "):\r\n";

            foreach (StatisticsDatabaseObject statisticsDatabaseObject in qs.UsedDatabaseObjects)
            {
                stats += "\r\n" + statisticsDatabaseObject.ObjectName.QualifiedName;
            }

            stats += "\r\n\r\n" + "Used Columns (" + qs.UsedDatabaseObjectFields.Count + "):\r\n";

            foreach (StatisticsField statisticsField in qs.UsedDatabaseObjectFields)
            {
                stats += "\r\n" + statisticsField.FullName.QualifiedName;
            }

            stats += "\r\n\r\n" + "Output Expressions (" + qs.OutputColumns.Count + "):\r\n";

            foreach (StatisticsOutputColumn statisticsOutputColumn in qs.OutputColumns)
            {
                stats += "\r\n" + statisticsOutputColumn.Expression;
            }

            var f = new QueryStatisticsForm {
                textBox = { Text = stats }
            };

            f.ShowDialog(this);
        }
Exemplo n.º 4
0
        private void queryStatisticsMenuItem_Click(object sender, EventArgs e)
        {
            QueryStatistics queryStatistics = queryBuilder1.QueryStatistics;
            StringBuilder   builder         = new StringBuilder();

            builder.Append("Used Objects (").Append(queryStatistics.UsedDatabaseObjects.Count).AppendLine("):");
            builder.AppendLine();

            for (int i = 0; i < queryStatistics.UsedDatabaseObjects.Count; i++)
            {
                builder.AppendLine(queryStatistics.UsedDatabaseObjects[i].ObjectName.QualifiedName);
            }

            builder.AppendLine().AppendLine();
            builder.Append("Used Columns (").Append(queryStatistics.UsedDatabaseObjectFields.Count).AppendLine("):");
            builder.AppendLine();

            for (int i = 0; i < queryStatistics.UsedDatabaseObjectFields.Count; i++)
            {
                builder.AppendLine(queryStatistics.UsedDatabaseObjectFields[i].FullName.QualifiedName);
            }

            builder.AppendLine().AppendLine();
            builder.Append("Output Expressions (").Append(queryStatistics.OutputColumns.Count).AppendLine("):");
            builder.AppendLine();

            for (int i = 0; i < queryStatistics.OutputColumns.Count; i++)
            {
                builder.AppendLine(queryStatistics.OutputColumns[i].Expression);
            }

            using (QueryStatisticsForm f = new QueryStatisticsForm())
            {
                f.textBox.Text = builder.ToString();
                f.ShowDialog();
            }
        }