# File lib/storage/sqlitehash.rb, line 17 def [](idx) result = execute("select data from tmud where id = ?;", idx.to_i) result.first.first ? result.first.first : nil end
# File lib/storage/sqlitehash.rb, line 21 def []=(idx, data) result = execute("insert into tmud values (?, ?);", idx.to_i, data) rescue Exception result = execute("update tmud set data = ? where id = ?;", data, idx.to_i) ensure data end
# File lib/storage/sqlitehash.rb, line 32 def delete(idx) result = execute("delete from tmud where id = ?;", idx.to_i) rescue Exception end
# File lib/storage/sqlitehash.rb, line 28 def has_key?(idx) result = execute("select data from tmud where id = ?;", idx.to_i) result.first.first ? true : false end