Skip to content

Latest commit

 

History

History
35 lines (24 loc) · 1.7 KB

README.md

File metadata and controls

35 lines (24 loc) · 1.7 KB

Running Tests

From inside the directory, run ruby test_database.rb

Using the Database

Two options:

  1. Straight from command line (does not work)

    1. Navigate to directory
    2. Run sh setup.sh
    3. type database commands like:
      • SET Hello World
      • GET Hello
      • DELETE Hello
    4. WARNING: I was attempting, with this maneuver, to replicate exactly the input and output mechanism delineated in the prompt. However, the database does not hold state by this method. I messed with it for about 20 minutes, then decided that you're probably more interested in my database implementation than the exact input mechanism, and I moved on.
  2. Via irb

    1. Navigate to directory
    2. Type irb
    3. Type load 'database.rb'
    4. Instantiate database via, for example db = Database.instance
    5. Call methods on the db instance
    6. All method names are the lower case version of what is described in the prompt. For example, db.begin, db.commit, db.end
    7. I attempted to name these methods exactly as described in the prompt (removing the database object and having a file full of methods named things like BEGIN, DELETE, COMMIT), but it turns out a few of these are keywords in ruby. I'm not in the business of bogarting ruby keywords to make my databases, so I left it as an object.

Here is a screenshot of my irb console demonstrating the database at work:

database at work

Here is a screenshot of deletion inside a transaction:

deletion within transaction