add test for when a db isn't there

This commit is contained in:
Roger Pack 2008-12-20 22:59:35 +00:00
parent dcb1e10c16
commit 9d88487022
2 changed files with 22 additions and 0 deletions

View File

@ -2,6 +2,7 @@
# run it by substiting in a 'long' [many row] query for the query variable and toggling use_all_hashes here at the top # run it by substiting in a 'long' [many row] query for the query variable and toggling use_all_hashes here at the top
# note that we load all the rows first, then run .all_hashes on the result [to see more easily the effect of all hashes] # note that we load all the rows first, then run .all_hashes on the result [to see more easily the effect of all hashes]
# on my machine and a 200_000 row table, it took 3.38s versus 3.65s # on my machine and a 200_000 row table, it took 3.38s versus 3.65s
require 'rubygems'
require 'mysqlplus' require 'mysqlplus'
use_the_all_hashes_method = true use_the_all_hashes_method = true

21
test/test_failure.rb Normal file
View File

@ -0,0 +1,21 @@
# shows the effect of using .all_hashes instead of looping on each hash
# run it by substiting in a 'long' [many row] query for the query variable and toggling use_all_hashes here at the top
# note that we load all the rows first, then run .all_hashes on the result [to see more easily the effect of all hashes]
# on my machine and a 200_000 row table, it took 3.38s versus 3.65s
require 'rubygems'
require 'mysqlplus'
begin
Mysql.real_connect('fakehost','root', '', 'local_leadgen_dev')
rescue Mysql::Error
end
begin
Mysql.real_connect('localhost','root', '', 'faketable')
rescue Mysql::Error
end
begin
Mysql.real_connect('localhost', 'root', 'pass', 'db', 3307)# bad port
rescue Mysql::Error
end
print "pass"