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



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

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

#journal_modeObject



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

def journal_mode
  run_method(:journal_mode)
end

#optionsObject

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



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

def options
  @options
end

#pathObject



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

def path
  run_method(:filename)
end

#sizeObject



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

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



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

def synchronous
  run_method(:synchronous)
end