I want a connection pool for mysql objects that I would use with the mysql C adapter and mysqlplus. But I was also looking to make it as flexible as possible so that it can be a pool of object for more than just mysql connections. I'm looking for advice on how to implement that, I currently have 2 implementations above. I read the sequel connection_pool.rb file but I don't understand everything so stripping the Sequel part is kind of a problem for me. Do you guys have any advice/opinion on how I could achieve this?
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 'sequel' | |
require 'time' | |
DB = Sequel.connect 'sqlite:/' | |
class Category < Sequel::Model | |
set_schema do | |
primary_key :id | |
text :name |
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 'sequel' | |
require "sinatra" | |
DB = Sequel.connect 'sqlite://blog.db' | |
class Post < Sequel::Model(:posts) | |
set_schema do | |
primary_key :id | |
varchar :title |
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
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.rb:493:in `const_missing': uninitialized constant ActionView::Base::Haml (NameError) | |
from /usr/lib/ruby/gems/1.8/gems/haml-2.0.9/lib/haml/helpers/action_view_mods.rb:20 | |
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' | |
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' | |
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.rb:510:in `require' | |
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.rb:355:in `new_constants_in' | |
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.rb:510:in `require' | |
from /usr/lib/ruby/gems/1.8/gems/haml-2.0.9/lib/haml/helpers.rb:1 | |
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' | |
... 15 levels... |
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
index.asdf |
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
class TrafficLight | |
def initialize | |
@colors = ["green", "yellow", "red"] | |
@index = 0 | |
end | |
def color | |
@colors[@index] | |
end | |
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
class Mysql | |
def proc(str) | |
DB.query_with_result = false | |
resultsets = [] | |
no_more_results=false | |
DB.query( %(call #{str}) ) |
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 'ramaze' | |
# Start this example with `ruby hello.rb`. | |
# After startup you will be able to access it at http://localhost:7000/ | |
# This should output "Hello, World!" in your browser. | |
class MainController < Ramaze::Controller | |
map '/' | |
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
vals = { | |
:album_id => nil, | |
:mime_type => file[:type], | |
:description => h(request[:description]), | |
:real_filename => real_filename, | |
} | |
p vals | |
new = Picture.create(vals) |
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
VirtualHost configuration: | |
wildcard NameVirtualHosts and _default_ servers: | |
*:80 is a NameVirtualHost | |
default server vroy.ca (/etc/apache2/sites-enabled/000-default:1) | |
port 80 namevhost vroy.ca (/etc/apache2/sites-enabled/000-default:1) | |
port 80 namevhost 208.88.124.71 (/etc/apache2/sites-enabled/001-test:1) | |
Syntax OK |
OlderNewer