Class: KPM::Blob

Inherits:
Object
  • Object
show all
Defined in:
lib/kpm/blob.rb

Instance Method Summary collapse

Constructor Details

#initialize(value, tmp_dir) ⇒ Blob



7
8
9
10
11
12
13
# File 'lib/kpm/blob.rb', line 7

def initialize(value, tmp_dir)
  @tmp_dir = tmp_dir
  @blob_file = @tmp_dir + File::SEPARATOR + rand.to_s
  # Make sure directory is 'rx' for others to allow LOAD_FILE to work
  FileUtils.chmod('a+rx', @tmp_dir)
  store_value(value)
end

Instance Method Details

#valueObject

On Macos systems, this will require defining a ‘secure_file_priv` config:

e.g /usr/local/etc/my.cnf :

mysqld

… secure_file_priv=“”



21
22
23
# File 'lib/kpm/blob.rb', line 21

def value
  "LOAD_FILE(\"#{@blob_file}\")"
end