https://github.com/systelab/cpp-sqlite-db-adapter
Implementation of C++ DB adapter based on SQLite
https://github.com/systelab/cpp-sqlite-db-adapter
cpp-library
Last synced: 3 months ago
JSON representation
Implementation of C++ DB adapter based on SQLite
- Host: GitHub
- URL: https://github.com/systelab/cpp-sqlite-db-adapter
- Owner: systelab
- Created: 2018-04-16T16:11:18.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2025-10-29T08:38:02.000Z (8 months ago)
- Last Synced: 2025-10-29T10:28:50.759Z (8 months ago)
- Topics: cpp-library
- Language: C++
- Homepage:
- Size: 85.6 MB
- Stars: 1
- Watchers: 4
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://travis-ci.org/systelab/cpp-sqlite-db-adapter)
[](https://ci.appveyor.com/project/systelab/cpp-sqlite-db-adapter)
[](https://codecov.io/gh/systelab/cpp-sqlite-db-adapter)
[](https://www.codacy.com/gh/systelab/cpp-sqlite-db-adapter/dashboard?utm_source=github.com&utm_medium=referral&utm_content=systelab/cpp-sqlite-db-adapter&utm_campaign=Badge_Grade)
# C++ Database Adapter implementation with SQLite
This repository implements the interface for the [C++ Database Adapter](https://github.com/systelab/cpp-db-adapter) using [SQLite](https://www.sqlite.org).
## Setup
### Download using Conan
This library is designed to be installed by making use of [Conan](https://conan.io/) package manager. So, you just need to add the following requirement into your Conan recipe:
```python
def requirements(self):
self.requires("DbSQLiteAdapter/1.0.0@systelab/stable")
```
> Version number of this code snipped is set just as an example. Replace it for the desired version package to retrieve.
As this package is not available on the conan-center, you will also need to configure a remote repository before installing dependencies:
```bash
conan remote add systelab-public https://csw.jfrog.io/artifactory/api/conan/cpp-conan-production-local
```
See Conan [documentation](https://docs.conan.io/en/latest/) for further details on how to integrate this package with your build system.
### Build from sources
See [BUILD.md](BUILD.md) document for details.
## Usage
Establish connection to a SQLite database by creating a configuration object that specifies the path of `.db` file to open:
```cpp
#include "DbSQLiteAdapter/Connection.h"
#include "DbSQLiteAdapter/ConnectionConfiguration.h"
systelab::db::sqlite::Connection connection;
systelab::db::sqlite::ConnectionConfiguration configuration("MyFolder/MyDatabase.db");
std::unique_ptr database = connection.loadDatabase(configuration);
```
Use the created `systelab::db::IDatabase` object to access to the database as described on [C++ Database Adapter](https://github.com/systelab/cpp-db-adapter) documentation.
### Encryption
In order work with encryption, the connection configuration object must include a key as the second attribute:
```cpp
systelab::db::sqlite::Connection connection;
systelab::db::sqlite::ConnectionConfiguration configuration("MyFolder/MyDatabase.db", "Y0urDBEncrypt1onK3y");
std::unique_ptr database = connection.loadDatabase(configuration);
```