Sha256: abc1a0c51a010eb382bd89c37e4ab5a3a9684b936753cb6f58fbd54ab3614804

Contents?: true

Size: 832 Bytes

Versions: 3

Compression:

Stored size: 832 Bytes

Contents

module MassInsert
  module Adapters
    class SQLServerAdapter < Adapter

      MAX_VALUES_PER_INSERTION = 1000

      # This functions calls the necessary functions to create a complete
      # sqlserver query to multiple insertion. The methods are in the Abstract
      # Query module. If some method is too specific to this database adapter
      # you can overwrite it. The values that the user gave will be treated
      # in batches of 500 items because sqlite database allows by default
      # batches of 500.and each batch will generate a query. This method will
      # generate an array with batch queries.
      def execute
        @values.each_slice(MAX_VALUES_PER_INSERTION).map do |slice|
          @values = slice
          "#{begin_string}#{string_columns}#{string_values}"
        end
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mass_insert-0.0.3 lib/mass_insert/adapters/sqlserver_adapter.rb
mass_insert-0.0.2 lib/mass_insert/adapters/sqlserver_adapter.rb
mass_insert-0.0.1 lib/mass_insert/adapters/sqlserver_adapter.rb