Created
March 5, 2011 04:09
-
-
Save hobodave/856100 to your computer and use it in GitHub Desktop.
This file contains 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
require 'rubygems' | |
require 'timeout' | |
require 'mysql' | |
Timeout::timeout(5) { | |
conn = Mysql.new('localhost', 'hobodave', 'hobopass', 'test') | |
conn.query("SELECT SLEEP(300)") | |
} |
This file contains 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
require 'rubygems' | |
require 'timeout' | |
require 'active_record' | |
=begin | |
CREATE TABLE products ( | |
id int(11) NOT NULL auto_increment, | |
name varchar(255), | |
PRIMARY KEY (id) | |
); | |
=end | |
class Product < ActiveRecord::Base; end | |
Timeout::timeout(5) { | |
ActiveRecord::Base.establish_connection( | |
:adapter => "mysql", | |
:host => "localhost", | |
:username => "hobodave", | |
:password => "hobopass", | |
:database => "test" | |
) | |
Product.find_by_sql 'select sleep(300)' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment