znmud-0.0.1/benchmark/
znmud-0.0.1/cmd/
znmud-0.0.1/cmd/emotes/
znmud-0.0.1/cmd/objects/
znmud-0.0.1/cmd/tiny/
znmud-0.0.1/doc/
znmud-0.0.1/farts/
znmud-0.0.1/lib/
znmud-0.0.1/lib/combat/
znmud-0.0.1/lib/core/bodytypes/
znmud-0.0.1/lib/engine/
znmud-0.0.1/lib/farts/
znmud-0.0.1/logs/
#
# file::    sqlite3hash.rb
# author::  Jon A. Lambert
# version:: 2.9.0
# date::    03/16/2006
#
# This source code copyright (C) 2005, 2006 by Jon A. Lambert
# All rights reserved.
#
# Released under the terms of the TeensyMUD Public License
# See LICENSE file for additional information.
#

# Override class with our hash methods
module SQLite3
  class Database
    def [](idx)
      result = execute("select data from tmud where id = ?;", idx.to_i)
      result.first.first ? result.first.first : nil
    end
    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
    def has_key?(idx)
      result = execute("select data from tmud where id = ?;", idx.to_i)
      result.first.first ? true : false
    end
    def delete(idx)
      result = execute("delete from tmud where id = ?;", idx.to_i)
    rescue Exception
    end
  end
end