Skip to content

Instantly share code, notes, and snippets.

@hobodave hobodave/to.rb
Created Mar 5, 2011

Embed
What would you like to do?
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
You can’t perform that action at this time.