Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/davidchocholaty/libbitcoin-sqlite-task
This repository contains a small SQLite program in C++ for the stretch goal (libbitcoin organization, Summer of Bitcoin programme).
https://github.com/davidchocholaty/libbitcoin-sqlite-task
Last synced: 1 day ago
JSON representation
This repository contains a small SQLite program in C++ for the stretch goal (libbitcoin organization, Summer of Bitcoin programme).
- Host: GitHub
- URL: https://github.com/davidchocholaty/libbitcoin-sqlite-task
- Owner: davidchocholaty
- License: mit
- Created: 2024-04-19T19:54:39.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-04-24T13:13:59.000Z (7 months ago)
- Last Synced: 2024-04-24T17:34:28.809Z (7 months ago)
- Language: C++
- Size: 168 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# libbitcoin-sqlite-task
This repository contains a small SQLite program in C++ for the stretch goal (libbitcoin organization, Summer of Bitcoin programme) created in 2024.## Build and run
For the successful compilation, the ```Boost``` and ```SQLite3``` libraries are required. Then run the following commands:Create the build directory:
```
mkdir build; cd build
```Run cmake for configuration:
```
cmake ..
```Compile with make by using:
```
make
```Run the application with:
```
./app
```## Table scheme
For the small database table scheme, the example from the official website of the [Visual Paradigm](https://www.visual-paradigm.com/features/database-design-with-erd-tools/) program was chosen. The *Staff* table structure is as follows:![table_scheme.png](doc/table_scheme.png)
The examples of the table records are taken from the same source.
## Program description
The program (created in the [main.cpp](main.cpp) source file) creates a new database in the ```dbschema.db``` file. After that, the *Staff* table is created and the example persons are inserted from the [file](people.csv) (as in the [table scheme](#table-scheme)). Then the following queries are proceed (in the same order):
- Select and print people with a salary greater or equal to 3500.
- Insert a new person. This person has the same last name as at least one person who already is stored in the table.
- Print all persons from the table which has the last name mentioned in the previous point (LastName = Sloan).
- Update the phone number for the person with a specific identifier (ID = 1).Lastly, the table is dropped from the database and the whole database (the ```dbschema.db``` file) is deleted because of the only example purposes.
## Program output
In order to simply view the example the program output is saved in [text file](program_output.txt) created by:```
./app > program_output.txt
```## Code style
Because the used SQLite library functions is a C library and the original [libbitcoin database](https://github.com/libbitcoin/libbitcoin-database) is written in more a C style code too, I have decided to used this approach instead of using the [C++ style guide](https://google.github.io/styleguide/cppguide.html).Since this is only an example application, some values are "hard-coded" in the program.