Created
August 17, 2012 16:58
-
-
Save aaronbbrown/3380582 to your computer and use it in GitHub Desktop.
count queries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'pp' | |
h = { :select => 0, :insert => 0, :delete => 0, :update => 0} | |
ARGF.each do |line| | |
case line | |
when /SELECT.*FROM/i then | |
h[:select] += 1 | |
when /INSERT.*INTO/i then | |
h[:insert] += 1 | |
when /DELETE.*FROM/i then | |
h[:delete] += 1 | |
when /UPDATE.*SET/i then | |
h[:update] += 1 | |
end | |
end | |
pp h |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment