Sha256: cfa939ee459fc49fe8bb314acc698db9246737d1f3692b5f337fb3f8fa243a50

Contents?: true

Size: 721 Bytes

Versions: 1

Compression:

Stored size: 721 Bytes

Contents

module MassInsert
  module Builder
    class Base

      # This function gets the correct adapter class and returns the
      # sql string ready to be executed.
      def build values, options
        adapter_class.new(values, options).execute
      end

      # Returns the class of the correct database adapter according to the
      # database engine that is used in Rails project.
      def adapter_class
        case Utilities.adapter
        when "mysql2"
          Adapters::Mysql2Adapter
        when "postgresql"
          Adapters::PostgreSQLAdapter
        when "sqlite3"
          Adapters::SQLite3Adapter
        when "sqlserver"
          Adapters::SQLServerAdapter
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mass_insert-0.1.2 lib/mass_insert/builder/base.rb