<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -21,31 +21,23 @@ module QueryStats
     # Gets or sets the current label to be applied to queries for custom tracking.
     # Including QueryStats in ApplicationController will label queries :controller or :view
     attr_accessor :label
-    # Gets the current query type
-    attr_reader   :query_type
   
     # Creates a new instance of QueryStats::Holder with an empty array of stats.
     def initialize
-      @ignore_types = [
-        :begin_db_transaction,
-        :columns,
-        :commit_db_transaction,
-        :rollback_db_transaction
-      ]
       @stats = []
     end
 
     # Add data to the array of stats - should only be called by the active record connection adapter.
-    def add(seconds, query, name = nil, *args) #:nodoc:
+    def add(sql, seconds, name = nil, *args) #:nodoc:
       @stats.shift if @stats.size &gt;= LIMIT
-      return if @ignore_types.include?(@query_type)
+      query_type = query_type_from_sql(sql)
       @stats &lt;&lt; {
-        :sql     =&gt; query,
+        :sql     =&gt; sql,
         :name    =&gt; name,
         :label   =&gt; @label,
         :seconds =&gt; seconds,
-        :type    =&gt; @query_type
-      }
+        :type    =&gt; query_type
+      } if query_type
     end
 
     # Remove the current label and clear the array of stats.
@@ -69,12 +61,6 @@ module QueryStats
       with_type(type).length
     end
   
-    # Set the query type - this should only be called automatically from the connection adapter.
-    def query_type=(sym) #:nodoc:
-      @query_type = sym
-      @query_type = :select if @query_type.to_s =~ /select/
-    end
-  
     # Return an array of query statistics collected.
     def stats
       @stats
@@ -86,17 +72,31 @@ module QueryStats
     end
     alias :total_time :runtime
   
-    # Returns an array of statistics for queries with a given label.
-    # Set ignore to false to include transaction and column queries.
-    def with_label(label, ignore = true)
+    def with_label(label)
       stats = @stats.select { |q| q[:label] == label }
-      ignore ? stats.reject { |q| @ignore_types.include?(q[:type]) } : stats
     end
   
     # Returns an array of statistics for queries with a given type.
     def with_type(type)
       @stats.select { |q| q[:type] == type }
     end
+    
+    protected
+    
+    def query_type_from_sql(sql)
+      case sql.upcase
+      when /^SELECT/
+        :select
+      when /^INSERT/
+        :insert
+      when /^DELETE/
+        :delete
+      when /^UPDATE/
+        :update
+      else
+        nil
+      end
+    end
 
   end
 end
\ No newline at end of file</diff>
      <filename>lib/query_stats/holder.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,28 +3,8 @@
 module QueryStats
   # Captures query data from ActiveRecord::Base.
   module Recorder
-    QUERY_METHODS = [
-      :begin_db_transaction,
-      :columns,
-      :commit_db_transaction,
-      :delete,
-      :insert,
-      :rollback_db_transaction,
-      :select_all,
-      :select_one,
-      :select_value,
-      :select_values,
-      :update
-    ]
     def self.included(base) #:nodoc:
       base.class_eval do
-        QUERY_METHODS.each do |method|
-          define_method(&quot;#{method}_with_query_stats&quot;) do |*args|
-            queries.query_type = method
-            send &quot;#{method}_without_query_stats&quot;, *args
-          end
-          alias_method_chain method, :query_stats
-        end
         alias_method_chain :execute, :query_stats
       end
     end
@@ -41,8 +21,8 @@ module QueryStats
       seconds = Benchmark.realtime do
         result = execute_without_query_stats(*args)
       end
-      queries.add(seconds, *args)
+      queries.add(args.first, seconds, *args[1..-1])
       result
     end
   end
-end
\ No newline at end of file
+end</diff>
      <filename>lib/query_stats/recorder.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + &quot;/test_helper&quot;)
+require File.dirname(__FILE__) + &quot;/test_helper&quot;
 
 class QueryStatsTest &lt; Test::Unit::TestCase
   include QueryStats::Helper</diff>
      <filename>test/query_stats_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>529020d07e78b9a931c1c3b315c9a801467f7e0a</id>
    </parent>
  </parents>
  <author>
    <name>Dan Manges</name>
    <email>daniel.manges@gmail.com</email>
  </author>
  <url>http://github.com/dan-manges/query_stats/commit/f3003ad13e0d2be5a00965cbd14b57edab3d9c41</url>
  <id>f3003ad13e0d2be5a00965cbd14b57edab3d9c41</id>
  <committed-date>2008-08-24T16:04:59-07:00</committed-date>
  <authored-date>2008-08-24T16:04:59-07:00</authored-date>
  <message>get rid of query_type state, determine type from sql rather than from method</message>
  <tree>653834d6d24c99c4c3444c6668677c3d2c62507b</tree>
  <committer>
    <name>Dan Manges</name>
    <email>daniel.manges@gmail.com</email>
  </committer>
</commit>
