Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/assert_efficient_sql.rb

Overview

ERGO link from efficient-sql.rubyforge.org/files/README.html to

project page

ERGO hamachi.cc

ERGO  is flunk susceptible to <?> bug?

ERGO One catch that jumps out right away is that you’re going to have to run this against a DB that looks a lot like production, since MySQL will punt to full table scans on smaller tables, and your unit test data probably qualifies as “smaller tables”.

 (and cross-cite) http://enfranchisedmind.com/blog/2008/01/14/assert_efficient_sql/
ERGO  all with no possible keys is worse than ALL with possible keys
ERGO  retire _exec

Instance Method Summary collapse

Instance Method Details

#qa_columnizedObject


31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/assert_efficient_sql.rb', line 31

def qa_columnized
  sized = {}
  self.each do |row|
    row.values.each_with_index do |value, i|
      sized[i] = [sized[i].to_i, row.keys[i].length, value.to_s.length].max
    end
  end

  table = []
  table << qa_columnized_row(self.first.keys, sized)
  table << '-' * table.first.length
  self.each { |row| table << qa_columnized_row(row.values, sized) }
  table.join("\n   ") # Spaces added to work with format_log_entry
end