Sha256: 3a600ca48103765d7549ce91d3a719ec6e61600deb8e118c5531e67ce71e759d

Contents?: true

Size: 739 Bytes

Versions: 27

Compression:

Stored size: 739 Bytes

Contents

module RailsConnector

  module BlobOracle
    def self.included(base)
      base.instance_eval do
        define_method :store_data do
          store_data_atomically {|f| fetch_into_file(f)}
        end
      end
    end

    def fetch_into_file(file)
      blob = blob_handle
      while data = blob.read(buff_size ||= 1.megabyte)
        file <<  data
        data = nil
        GC.start
      end
    ensure
      blob.close if blob
    end

    private

    def sql
      %{
        SELECT blob_data
        FROM #{self.class.table_name}
        WHERE #{self.class.primary_key} = :1
      }
    end

    def blob_handle
      con = connection.instance_variable_get '@connection'
      con.exec(sql, id).fetch.first
    end
  end

end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
infopark_fiona_connector-6.9.4 lib/rails_connector/blob_oracle.rb
infopark_fiona_connector-6.9.3.1.36404185 lib/rails_connector/blob_oracle.rb
infopark_fiona_connector-6.9.2.1.125136549 lib/rails_connector/blob_oracle.rb
infopark_fiona_connector-6.9.1.3.22208381 lib/rails_connector/blob_oracle.rb
infopark_fiona_connector-6.9.0.3.197272233 lib/rails_connector/blob_oracle.rb
infopark_fiona_connector-6.8.3.174.51542603 lib/rails_connector/blob_oracle.rb
infopark_fiona_connector-6.8.3.115.227021242 lib/rails_connector/blob_oracle.rb
infopark_fiona_connector-6.8.3.73.75172665 lib/rails_connector/blob_oracle.rb
infopark_fiona_connector-6.8.3.2.153416031 lib/rails_connector/blob_oracle.rb
infopark_fiona_connector-6.8.3.67.110847540 lib/rails_connector/blob_oracle.rb
infopark_fiona_connector-6.8.3.1.23895778 lib/rails_connector/blob_oracle.rb
infopark_fiona_connector-6.8.2.36.82613853 lib/rails_connector/blob_oracle.rb
infopark_fiona_connector-6.8.2.7.128454143 lib/rails_connector/blob_oracle.rb
infopark_fiona_connector-6.8.1.26.236500544 lib/rails_connector/blob_oracle.rb
infopark_fiona_connector-6.8.1 lib/rails_connector/blob_oracle.rb
infopark_fiona_connector-6.8.0.539.93842523 lib/rails_connector/blob_oracle.rb
infopark_fiona_connector-6.8.0.529.114081979 lib/rails_connector/blob_oracle.rb
infopark_fiona_connector-6.8.0.518.30999728 lib/rails_connector/blob_oracle.rb
infopark_fiona_connector-6.8.0.515.34928522 lib/rails_connector/blob_oracle.rb
infopark_fiona_connector-6.8.0.498.46559598 lib/rails_connector/blob_oracle.rb