SimpleDB is a minimalistic database implementation following a tutorial in Rust. This project is designed as an educational tool to demonstrate basic database concepts and Rust programming practices.
These instructions will guide you through setting up the Rust environment and getting a copy of the project up and running on your local machine.
To run this project, you need to install Rust and its package manager, Cargo. Here's how you can set it up:
-
Install Rust: Follow the instructions on the official Rust website to install Rustup, which will set up Rust and Cargo on your machine.
-
Verify the installation by running:
rustc --version cargo --version
You should see the installed versions of Rust and Cargo.
-
Clone the repository:
git clone [email protected]:Schuyweiz/simple-db.git
-
Navigate to the project directory:
cd simpledb
-
To run the database, provide the name of the database file as a command-line argument:
cargo run -- database_name.db
Replace
database_name.db
with your preferred database file name. The program will create the database file if it doesn't exist.
After running the project, you can interact with the database through the command line. The program accepts SQL-like commands and a special metadata command:
-
Metadata Command:
.exit
: Exits the database program.
-
SQL Commands:
select
: Retrieves and displays data from the database.insert id username email
: Inserts a new row into the database with the specifiedid
,username
, andemail
.
Example commands:
insert 1 user1 user1@example.com
select
.exit