Ejemplo n.º 1
0
        // 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 QueryStatisticsWindow(stats)
            {
                Owner = this
            };

            f.ShowDialog();
        }
        public void ShowQueryStatistics()
        {
            var qs = QueryView.Query.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));

            var f = new QueryStatisticsWindow(stats);

            f.ShowDialog();
        }
Ejemplo n.º 3
0
        private void QueryStatistic_OnClick(object sender, RoutedEventArgs e)
        {
            QueryStatistics queryStatistics = queryBuilder.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);
            }

            var f = new QueryStatisticsWindow(builder.ToString())
            {
                Owner = this
            };

            f.ShowDialog();
        }