Module: Litesupport::Liteconnection

Includes:
Forkable
Included in:
Litecable, Litecache, Litemetric, Litemetric::Collector, Litequeue
Defined in:
lib/litestack/litesupport.rb

Instance Method Summary collapse

Methods included from Forkable

#_fork

Instance Method Details

#closeObject



135
136
137
138
139
140
141
# File 'lib/litestack/litesupport.rb', line 135

def close
  @running = false
  @conn.acquire do |q|
    q.stmts.each_pair { |k, v| q.stmts[k].close }
    q.close
  end
end

#journal_modeObject



147
148
149
# File 'lib/litestack/litesupport.rb', line 147

def journal_mode
  run_method(:journal_mode)
end

#optionsObject

close, setup, run_stmt and run_sql assume a single connection was created



131
132
133
# File 'lib/litestack/litesupport.rb', line 131

def options
  @options
end

#pathObject



155
156
157
# File 'lib/litestack/litesupport.rb', line 155

def path
  run_method(:filename)
end

#sizeObject



143
144
145
# File 'lib/litestack/litesupport.rb', line 143

def size
  run_sql("SELECT size.page_size * count.page_count FROM pragma_page_size() AS size, pragma_page_count() AS count")[0][0].to_f / (1024 * 1024)
end

#synchronousObject



151
152
153
# File 'lib/litestack/litesupport.rb', line 151

def synchronous
  run_method(:synchronous)
end