Sha256: 7b32ce51bfdaccb7bbff87b0af3060998fca197de1b9c4c1452099ad6447a7a0

Contents?: true

Size: 1.2 KB

Versions: 5

Compression:

Stored size: 1.2 KB

Contents

require 'sequel_core/adapters/shared/mysql'

module Sequel
  module DataObjects
    # Database and Dataset instance methods for MySQL specific
    # support via DataObjects.
    module MySQL
      # Database instance methods for MySQL databases accessed via DataObjects.
      module DatabaseMethods
        include Sequel::MySQL::DatabaseMethods
        
        # Return instance of Sequel::DataObjects::MySQL::Dataset with the given opts.
        def dataset(opts=nil)
          Sequel::DataObjects::MySQL::Dataset.new(self, opts)
        end
        
        private
        
        # The database name for the given database.  Need to parse it out
        # of the connection string, since the DataObjects does no parsing on the
        # given connection string by default.
        def database_name
          (m = /\/(.*)/.match(URI.parse(uri).path)) && m[1]
        end
      end
      
      # Dataset class for MySQL datasets accessed via DataObjects.
      class Dataset < DataObjects::Dataset
        include Sequel::MySQL::DatasetMethods
        
        # Use execute_insert to execute the replace_sql.
        def replace(*args)
          execute_insert(replace_sql(*args))
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
colincasey-sequel-2.10.1 lib/sequel_core/adapters/do/mysql.rb
colincasey-sequel-2.10.2 lib/sequel_core/adapters/do/mysql.rb
colincasey-sequel-2.10.4 lib/sequel_core/adapters/do/mysql.rb
sequel-2.10.0 lib/sequel_core/adapters/do/mysql.rb
sequel-2.11.0 lib/sequel_core/adapters/do/mysql.rb