Library for easy work with SQLite 3 database
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
marcelb 8f19567a59 Fix when no have params 1 month ago
.vscode Prepare statement 1 month ago
example Merge with dev 1 year ago
lib Fix when no have params 1 month ago
src Clear, add license and readme 1 month ago
test Fix when no have params 1 month ago
.gitignore Add namespace, clear 3 months ago
LICENSE Clear, add license and readme 1 month ago
README.md Clear, add license and readme 1 month ago

README.md

SQLite3 Wrapper for C++

This is a simple C++ wrapper around the SQLite3 database, designed to facilitate database operations while managing connections and queries efficiently. The wrapper utilizes modern C++ features, including mutexes for thread safety.

Features

  • Simple Interface: Easy to use API for opening databases and executing queries.
  • Thread Safety: Uses mutexes to ensure safe access in multithreaded environments.
  • Flexible Connection Management: Option to keep the database connection open or close it after use.

Installation

To use this SQLite3 wrapper in your C++ project, include the header file sqlite3.hpp in your project directory. Ensure you have the SQLite3 library installed and linked to your project.

Usage

Example

Here's a basic example demonstrating how to use the SQLite3 wrapper:

#include <iostream>
#include "../lib/sqlite3.hpp" // Adjust the path as necessary
using namespace marcelb::SQlite3;

int main() {
    try {
        SQLite3 mydb("../example/example.db", false);
        
        auto res = mydb.query("SELECT * FROM Tab1 WHERE id > ?", {"3"});
        
        for (const auto& i : res) {
            for (const auto& j : i.second) {
                std::cout << i.first << " : " << j << std::endl; 
            }
        }
        
    } catch (const std::string& err) {
        std::cout << err << std::endl;
    }

    return 0;
}

Compile

Install libsqlite3-dev, is a C library that implements an SQLite database engine

sudo apt-get -y install libsqlite3-dev

And compile your code

g++ test.cpp ../src/* -o test.o -l sqlite3

License

APACHE 2.0

Support & Feedback

For support and any feedback, contact the address: marcelb96@yahoo.com.

Contributing

Contributions are always welcome!

Feel free to fork and start working with or without a later pull request. Or contact for suggest and request an option.