This project acts like a real MySQL database system that can process SQL commands. You can create/drop databases and the program will encode the data and store it in the local machine. When you need to view the data, simply use the exact same commands in SQL by typing in "SELECT * FROM Database1" and the program will display the data in the terminal in a form.
Used for tokenize the command input into tokens. There are mainly three kinds of commands that need to be tokenized;
- Meta-commands that control the system, such as the
Quitcommand which terminates the app. - Database-level commands (like "Create database xxx", or "Show databases")
- Data-oriented commands (like "Create table...", "Show tables", "insert (...) into tablename", ...)
- Statement is the basic abstract class of SQLStatement and DBStatement.
- The tokenizer parse the commands into SQLStatement or DBStatement based on the keywards.
- The statement will be routed to specific command processor for processing the command.
Used for processing different command.
- Used the chain-of-responsibility pattern, handle the control to the next processor.
- CommandProcessor processes the commands like "quit", "version", "help".
- DBManager processes the database-related commands like "create/delete database db".
- SQL processes the data-related commands like "select/update/delete records".
Storage class for storing data.
- Row class is the storage class for each row in the table. It can be encoded to a block.
- Storage class is the class for storing the whole table. Different kinds of data will be encoded into appropriate data type for storing in a local file.
Used for display the data in the terminal to users.
- BlockVisitor is a helper class, used for visiting all the blocks in the storage memory. It will retrieve the blocks if it satisfies a specific condition.
- EntityDescriptionView and RecordsView use the BlockVisitor to get the data from the memory and display it in the terminal.

