Sha256: e8238b31420b638384a1cf8e9c4ecbbcb4372549b238919bfdf9738dab4387da

Contents?: true

Size: 758 Bytes

Versions: 27

Compression:

Stored size: 758 Bytes

Contents

module Sequel

  class << self
    def fos(odbc_name,opts={})
      db = Sequel.odbc(odbc_name,opts)
      db.extend(Sequel::Pervasive::DatabaseMethods)
      db
    end

    def fos_dbr(opts={})
      db = Sequel.mysql(opts)
      db.extend(MySql::Pervasive::DatabaseMethods)
      # require the dbr libs
      Dir["#{File.dirname(__FILE__)}/../dbr_models/*.rb"].each{|f| load f}
      db
    end

    # sets the db to all sequel models
    def set_db(db)
      Sequel::Model.find_children.each { |klass| klass.to_s.constantize.db=db }
    end

    # take a fos_id like: "SEMJ.0.15.40210.1342" and convert to ["SEMJ", 0, 15, 40210, 1342]
    def fos_id_to_lookup_key(fos_id)
      fos_id.split('-').collect{|v| v.match(/\d+/) ? v.to_i : v}
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
fossil-0.5.50 lib/sequel/core_patch.rb
fossil-0.5.49 lib/sequel/core_patch.rb
fossil-0.5.48 lib/sequel/core_patch.rb
fossil-0.5.47 lib/sequel/core_patch.rb
fossil-0.5.46 lib/sequel/core_patch.rb
fossil-0.5.45 lib/sequel/core_patch.rb
fossil-0.5.44 lib/sequel/core_patch.rb
fossil-0.5.43 lib/sequel/core_patch.rb
fossil-0.5.42 lib/sequel/core_patch.rb
fossil-0.5.41 lib/sequel/core_patch.rb
fossil-0.5.40 lib/sequel/core_patch.rb
fossil-0.5.39 lib/sequel/core_patch.rb
fossil-0.5.38 lib/sequel/core_patch.rb
fossil-0.5.37 lib/sequel/core_patch.rb
fossil-0.5.36 lib/sequel/core_patch.rb
fossil-0.5.35 lib/sequel/core_patch.rb
fossil-0.5.34 lib/sequel/core_patch.rb
fossil-0.5.33 lib/sequel/core_patch.rb
fossil-0.5.32 lib/sequel/core_patch.rb
fossil-0.5.31 lib/sequel/core_patch.rb