Sha256: 590cfea413ee891c36a72f0a43d409a1722a74289f967734f981429dd1b9ee7b

Contents?: true

Size: 486 Bytes

Versions: 11

Compression:

Stored size: 486 Bytes

Contents

module RailsDb
  class SqlImport
    include Connection

    attr_reader :time, :result

    def initialize(file)
      @file = file
    end

    def valid?
      if @file.nil?
        raise RailsDbError.new('Please select valid SQL file and continue')
      end
    end

    def import
      valid?
      @time = Database.adapter.execute(@file.read)
      @result = Result.ok
    rescue RailsDbError, ActiveRecord::StatementInvalid => e
      @result = Result.new(e)
    end

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rails_db-0.8 lib/rails_db/sql_import.rb
rails_db-0.7.2 lib/rails_db/sql_import.rb
rails_db-0.7.1 lib/rails_db/sql_import.rb
rails_db-0.7 lib/rails_db/sql_import.rb
rails_db-0.6 lib/rails_db/sql_import.rb
rails_db-0.5.1 lib/rails_db/sql_import.rb
rails_db-0.5 lib/rails_db/sql_import.rb
rails_db-0.4 lib/rails_db/sql_import.rb
rails_db-0.3 lib/rails_db/sql_import.rb
rails_db-0.2.1 lib/rails_db/sql_import.rb
rails_db-0.2 lib/rails_db/sql_import.rb