|
myTinySQL v0.2.0-2-g5000098
A tiny SQL interpreter over fixed-width text files
|
How to install, build and run myTinySQL. It takes a few minutes on a Linux machine with a recent C++ compiler.
| What | Needed | Notes |
|---|---|---|
| Operating system | Linux | Tested on Ubuntu 26.04 LTS (x86-64). Other distributions with a recent compiler should work. |
| C++ compiler | g++ 13 or newer (C++20) | The code uses std::format, which GCC provides from version 13. Tested with g++ 15.2. |
| Build tool | GNU make | Tested with GNU Make 4.4. |
| Libraries | none to install | Only the C++ standard library and the Linux system headers (sys/socket.h, unistd.h, ...), which come with the compiler. |
| Git | to download the code | Or download the zip from GitHub instead. |
| Doxygen | optional | Only for make doxygen (the HTML code documentation). Tested with 1.15. |
| Web browser | optional | For the --http mode, e.g. Chromium or Firefox. |
Not supported: macOS (the server uses MSG_NOSIGNAL, which exists only on Linux) and native Windows (no POSIX sockets). On Windows, WSL with Ubuntu should work, but it has not been tested.
Ubuntu 24.04 or newer, Debian 13 or newer:
Fedora 39 or newer:
Optional, for the HTML code documentation:
Check the compiler version: the first line must say 13 or higher.
On older systems whose default compiler is older (for example Ubuntu 22.04 with g++ 11, or Debian 12 with g++ 12), install g++ 13 or newer from your distribution, then build with make CXX=g++-13 (use the version you installed).
Without git: on the GitHub page click Code → Download ZIP, unzip it, and open a terminal in that folder.
This creates the program ./myTinySql. Object files go to build/.
Eight test scripts run on a copy of the sample tables. Each line must say PASS.
For the complete check (build, tests, server, memory safety, documentation, a fresh copy from GitHub), run make check (about 2 minutes). It needs curl, git and doxygen; a fresh Ubuntu has no curl, so install them first:
Then make check ends with ALL DONE - IT WORKS; see TESTING.md.
Always run the program from the project folder: it reads its tables from data/ in the current folder (or use --data=DIR).
Run a SQL script:
Type statements at a prompt (Ctrl+D to quit):
Use it from a browser:
Then open http://localhost:8080. The page lists the tables on the left; you can search, add, edit and delete rows, create new tables, and run any SQL in the console at the bottom. Stop the server with Ctrl+C.
All options:
Then open build/doxygen/html/index.html in a browser. The same pages are online at https://ricard1406.github.io/myTinySql/.
| Problem | Cause and fix |
|---|---|
fatal error: format: No such file or directory while building | The compiler is too old. Install g++ 13 or newer and build with make CXX=g++-13. |
data directory 'data' not found | The program was started outside the project folder. cd into it, or pass --data=/path/to/myTinySql/data. |
web page 'web/index.html' not found | The program was started outside the project folder, so the page's files in web/ were not found. cd into it, or pass --web=/path/to/myTinySql/web. |
bind to port 8080: Address already in use | Another program (or another myTinySql) already uses port 8080. Stop it, or choose another port: ./myTinySql --http --port=8081. |
| The browser page does not load from another computer | The server listens on all network interfaces, but a firewall may block port 8080. Use --allow=192.168. to accept only your home network. |
Nothing is installed outside the project folder: to remove myTinySQL, delete the folder.