<commit_before>﻿using System;
using System.Collections.Generic;
using System.Data.Common;


namespace MvcMiniProfiler
{
    /// <summary>
    /// Categories of sql statements.
    /// </summary>
    public enum ExecuteType : byte
    {
        /// <summary>
        /// Unknown
        /// </summary>
        None = 0,

        /// <summary>
        /// DML statements that alter database state, e.g. INSERT, UPDATE
        /// </summary>
        NonQuery = 1,

        /// <summary>
        /// Statements that return a single record
        /// </summary>
        Scalar = 2,

        /// <summary>
        /// Statements that iterate over a result set
        /// </summary>
        Reader = 3
    }

    // TODO: refactor this out into MiniProfiler
    internal class SqlProfiler
    {
        Dictionary<Tuple<object, ExecuteType>, SqlTiming> _inProgress = new Dictionary<Tuple<object, ExecuteType>, SqlTiming>();
        Dictionary<DbDataReader, SqlTiming> _inProgressReaders = new Dictionary<DbDataReader, SqlTiming>();

        internal MiniProfiler _profiler;

        public SqlProfiler(MiniProfiler profiler)
        {
            _profiler = profiler;
        }

        public void ExecuteStartImpl(DbCommand command, ExecuteType type)
        {
            var id = Tuple.Create((object)command, type);
            var sqlTiming = new SqlTiming(command, type, _profiler);

            _inProgress[id] = sqlTiming;<commit_msg>expose SqlProfiler for http://code.google.com/p/mvc-mini-profiler/issues/detail?id=30 (really need to refactor this out as a partial to MiniProfiler)<commit_after>﻿using System;
using System.Collections.Generic;
using System.Data.Common;


namespace MvcMiniProfiler
{
    /// <summary>
    /// Categories of sql statements.
    /// </summary>
    public enum ExecuteType : byte
    {
        /// <summary>
        /// Unknown
        /// </summary>
        None = 0,

        /// <summary>
        /// DML statements that alter database state, e.g. INSERT, UPDATE
        /// </summary>
        NonQuery = 1,

        /// <summary>
        /// Statements that return a single record
        /// </summary>
        Scalar = 2,

        /// <summary>
        /// Statements that iterate over a result set
        /// </summary>
        Reader = 3
    }

    // TODO: refactor this out into MiniProfiler
    public class SqlProfiler
    {
        Dictionary<Tuple<object, ExecuteType>, SqlTiming> _inProgress = new Dictionary<Tuple<object, ExecuteType>, SqlTiming>();
        Dictionary<DbDataReader, SqlTiming> _inProgressReaders = new Dictionary<DbDataReader, SqlTiming>();

        internal MiniProfiler _profiler;

        public SqlProfiler(MiniProfiler profiler)
        {
            _profiler = profiler;
        }

        public void ExecuteStartImpl(DbCommand command, ExecuteType type)
        {
            var id = Tuple.Create((object)command, type);
            var sqlTiming = new SqlTiming(command, type, _profiler);

            _inProgress[id] = sqlTiming;
{'fraction_non_alphanumeric': 0.10856573705179283, 'fraction_numerical': 0.0033200531208499337, 'mean_word_length': 2.028140703517588, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3077548', 'n_tokens_mistral': 864, 'n_tokens_neox': 837, 'n_words': 225}