diff --git a/T2/README.md b/T2/README.md index 654b1d78af215c2960ec37f910c0b70930a41415..032faf84e7733f1b360b6ecdbc086a42ff5c6d49 100644 --- a/T2/README.md +++ b/T2/README.md @@ -1,22 +1,22 @@ -# STEAMDB V0.0.1 -### dependencies: latest version of ruby (2.5.0), active\_record gem, sqlite3 gem +# STEAMDB V0.0.1 +### dependencies: latest version of ruby (2.5.0), active\_record gem, sqlite3 gem -## Introduction -Hi! This is a project made for the second evaluation of the Tópicos em Programação de Computadores (CI320) course at Universidade Federal do Paraná in Brazil. +## Introduction +Hi! This is a project made for the second evaluation of the Tópicos em Programação de Computadores (CI320) course at Universidade Federal do Paraná in Brazil. -This project simulates a simplified working database management system similar to sqlite3. It was implemented in the Ruby language and it uses the Active Record gem to establish a connection with sqlite3. +This project simulates a simplified working database management system similar to sqlite3. It was implemented in the Ruby language and it uses the Active Record gem to establish a connection with sqlite3. -## How to use -### Creating the database +## How to use +### Creating the database To create the tables defined in the schema.rb file, run: -$ ruby schema.rb +$ ruby schema.rb -The steamdb.sqlite3 file on this repository already contains a few example rows to simplify the testing of the different functionalities. To reset the entire database, simply delete the steamdb.sqlite3 file and run the schema.rb file again. +The steamdb.sqlite3 file on this repository already contains a few example rows to simplify the testing of the different functionalities. To reset the entire database, simply delete the steamdb.sqlite3 file and run the schema.rb file again. -The models for each object type are defined in the models.rb file. This database system implements 1 to 1, 1 to n and n to n relationships. +The models for each object type are defined in the models.rb file. This database system implements 1 to 1, 1 to n and n to n relationships. ### Running SteamDB -To run SteamDB, just enter the following command on your terminal: +To run SteamDB, just enter the following command on your terminal: $ ruby steamdb.rb ### Instructions @@ -26,4 +26,29 @@ This program contains four basic functionalities: - altera (update one or more elements) - lista (list all the elements of a table) -### Command syntax +### Command syntax +< op > < table > < { attribute=value } > + +possible < op > values are insere, exclui, altera and lista +< table > indicates the name of the table you will be using for the operation +{ ... } indicates the possibility of more than one argument +attribute=value has different meanings, acting both as a WHERE select and as an attribution + +To clarify, here are some examples: + +Creating the developer named Jose that lives in Brasil: ++ insere developers name="jose" country="brasil" + +Listing all the developers ++ lista developers + +Changing the name and country values of the row(s) with a "Jose" value on the name column ++ altera developers name="jose" name="joão" country="usa" + +Observation: in the "altera" operation, the first (and only the first) attribute=value pair is used to select one or more rows with the defined value + +Deleting a row ++ exclui developers name="joão" country="usa" + +Deleting all rows of a table ++ exclui developers \ No newline at end of file