Changeset 686

Show
Ignore:
Timestamp:
09/24/07 11:56:15 (1 year ago)
Author:
jam..@plainprograms.com
Message:

Add PostgreSQL support to merb_sequel, closes #192

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/merb_sequel/lib/merb/orms/sequel/connection.rb

    r613 r686  
    3737              # Use Sequel::Model.db to access this object 
    3838              ::Sequel.mysql(config[:database], :host => host, :user => user, :password => password, :logger => MERB_LOGGER) 
     39            when 'postgresql' 
     40              require "sequel/postgres" 
     41              host = config[:host] || 'localhost' 
     42              user = config[:user] || config[:username] || 'root' 
     43              password = config[:password] 
     44              encoding = config[:encoding] || config[:charset] || nil 
     45               
     46              if encoding 
     47                ::Sequel.postgres(config[:database], :host => host, :user => user, :password => password, :encoding => encoding, :logger => MERB_LOGGER) 
     48              else 
     49                ::Sequel.postgres(config[:database], :host => host, :user => user, :password => password, :logger => MERB_LOGGER) 
     50              end 
    3951            when 'sqlite' 
    4052              require "sequel/sqlite" 
    4153              if config[:database] 
    42                 ::Sequel.sqlite config[:database] 
     54                ::Sequel.sqlite(config[:database], :logger => MERB_LOGGER) 
    4355              else 
    44                 ::Sequel.sqlite 
     56                ::Sequel.sqlite(:logger => MERB_LOGGER) 
    4557              end 
    4658            else