Skip to content

Instantly share code, notes, and snippets.

@hobodave
Created March 5, 2011 04:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hobodave/856100 to your computer and use it in GitHub Desktop.
Save hobodave/856100 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'timeout'
require 'mysql'
Timeout::timeout(5) {
conn = Mysql.new('localhost', 'hobodave', 'hobopass', 'test')
conn.query("SELECT SLEEP(300)")
}
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