VSQLite++ - A welldesigned and portable SQLite3 Wrapper for C++ (C)

Related tags

Database vsqlite--
Overview

Build Status Coverity Scan Build Status

VSQLite++ - A welldesigned and portable SQLite3 Wrapper for C++ (C) 2006-2014 by virtuosic bytes - [email protected]

Author: Vinzenz Feenstra

License: BSD-3

Website: http://vsqlite.virtuosic-bytes.com

Join the chat at https://gitter.im/vinzenz/vsqlite--

Supported Compilers

  • g++ 4.x
  • MSVC 2005-2013
  • Clang 3.x

Operating Systems

  • Linux
  • Windows
  • Mac OS X

Dependencies

Additional notices:

  • Please let me know if you want to suggest features
  • Contributions are welcome
  • Proposals for Design Improvement are welcome
Comments
  • Incorrect row count for query

    Incorrect row count for query

    It looks like result::get_row_count() always returns zero after running a query. For example:

    sqlite::query q(conn_, "SELECT key, size FROM cache ORDER BY access_time ASC;"); auto r = q.emit_result(); cerr << "row_count: " << r->get_row_count() << endl;

    This prints 0 for a table with three records.

    The problem I have is that I want to iterate over the results to do things with each record. But I can't. The approach in the example does not work:

    do { cerr << "key: " << y->get_string(0) << endl; } while (y->next_row());

    The problem here is that the result set may be empty, in which case I don't want to do anything. But I cannot write a pre-tested loop without get_row_count(). The do loop will execute at least once, even if there are no results.

    If I do run the above loop on an empty result set, I get

    key: NULL

    That's despite the fact that the corresponding table column is defined as NOT NULL.

    What's the suggested way to process results row by row and doing nothing if there are no results?

    bug 
    opened by michihenning 10
  • a little type in sample code

    a little type in sample code

    Hi First thing first, thank you so much for sharing your efforts

    I think there is just a little typo in given sample code line sqlite::execute insert(con, "INSERT INTO TEST VALUE(?, ?);"); should be sqlite::execute ins(con, "INSERT INTO TEST VALUES(?, ?);");

    opened by abbaspalash 3
  • Transaction destructor performs a commit

    Transaction destructor performs a commit

    transaction::~transaction(){ if (m_isActive) commit(); }

    This seems really strange. Why does the destructor commit the transaction instead of rolling it back? The whole point of RAII is to make sure that, if something goes wrong, things are cleaned up. Consider something like this:

    { transaction t; // Some SQL statements here // Some other C++ code here that might throw // Some more SQL statements here } // t committed here, why?

    If something throws in this block, the transaction will still be committed, even though there was an exception. This seems really counter-intuitive. I would expect the transaction to be rolled back unless it is explicitly committed, because that is the fail-safe behavior. I believe the destructor should roll back rather than commit. Can you explain why things are the other way around?

    bug 
    opened by michihenning 3
  • Cannot insert empty blob

    Cannot insert empty blob

    It seems there is a problem in bind():

    void command::bind(int idx, std::vector const & v) { bind(idx,&v.at(0),v.size()); }

    If I call this with an empty vector, the bind throws because v.at(0) is out of range. I believe this should be something like:

    if (!v.size() == 0) { bind(idx,&v.at(0),v.size()); } else { bind(++last_arg_idx); }

    bug 
    opened by michihenning 3
  • Clarify Licence equivalence

    Clarify Licence equivalence

    Dear Authors, we would like to package your software in our build farm build.opensuse.org giving the opportunity to thousand of users to be able to get the software directly with their package manager.

    Unfortunately, we would like to have clarification about the license. All the allowed and well known licenses are located there. https://docs.google.com/spreadsheet/pub?key=0AqPp4y2wyQsbdGQ1V3pRRDg5NEpGVWpubzdRZ0tjUWc Could you have a look, and clarify the kind of BSD like you use.

    Thanks

    question 
    opened by tigerfoot 3
  • No error code in database_exception

    No error code in database_exception

    When I get a database_exception, I can get at the string for the error message, but not at the underlying error code. That's really inconvenient because I can't selectively react to different error conditions other than by parsing the error string. Doing that is really brittle. It would be nice to have an accessor on the exception classes that returns the underlying error code.

    enhancement 
    opened by michihenning 2
  • make install doesn't install headers

    make install doesn't install headers

    make install will install the library binary, but not the header files. The usual for a library package is to install both the library and header files on make install, but the Makefile.am file is set to install only libs. Headers should be added to a _HEADERS section.

    opened by akojima 2
  • Adding code to run on Powersystem

    Adding code to run on Powersystem

    Hi Here is my contribution to your code, its working good on powersystems.

    Thanks for the code, its working good.

    What do these changes do?

    Added Architecture "ppc64le"

    Are there changes in behavior for the user?

    No

    opened by genisysram 1
  • Make CMakeLists work with MSVC and fix some CMake warnings

    Make CMakeLists work with MSVC and fix some CMake warnings

    • Make it possible to build with MSVC (Visual C++) using CMake and LIBRARY_TYPE=Static
    • Fix a couple of CMake developer warnings - they are related to the usage of quoted variables in if() statements (variables can be used without quotes in conditionals, e.g. "${VAR}" can be written as VAR).
    opened by sryze 1
  • Packages for Slackware

    Packages for Slackware

    opened by gdsotirov 1
  • Typos in the website example code

    Typos in the website example code

    Hello, I very much like your library and would like to bring an issue to your attention.

    There appears to be two typos in the example code on the project's website. http://vsqlite.virtuosic-bytes.com/

    The first is execption instead of exception. The other is VALUE instead of VALUES in the prepared SQL statement.

    I hope this helps.

    opened by klampworks 1
  • Ensure crash in commit/rollback does not try twice

    Ensure crash in commit/rollback does not try twice

    It is possible that if during the rollback or commit command that there may be a disk error that will cause SQLite to return an error. When that happens we must not attempt to rollback again.

    This was seen when running multi-threaded and a bug in some code resulted in the SQLite file descripter being closed in the middle of a transaction.

    opened by mr-russ 0
  • The function `emit` shadows Qt's emit functionality

    The function `emit` shadows Qt's emit functionality

    The function emit works without Qt and Qt works without vsqlite++. When using both together, you get the following compiler error:

    In file included from src/./vsqlite++/include/sqlite/execute.hpp:35,
                     from src/./database.hpp:5,
                     from src/./todo.hpp:8,
                     from src/gui/mainwindow.cpp:9:
    src/vsqlite++/include/sqlite/command.hpp:80:19: error: expected unqualified-id before ‘)’ token
             bool emit();
    

    A simple renaming of the function emit(), which just forwards step(), in vsqlite++ solves this error.

    Is there any reason for sqlite::command::emit or will it stay equal to sqlite::command::step?

    opened by nullptrT 2
  • C++11 compatibility?

    C++11 compatibility?

    What about C++11 (or C++14) compatibilty (using a recent compiler like GCC 4.9 or future 5.0, or Clang/LLVM 3.5 or 3.6, on Linux)?

    In particular, I'm interested in

    • using std::shared_ptr, not boost::shared_ptr
    • using C++11 closures and/or for-ranged loops for iterating on the rows resulting from some SQL request.

    Regards.

    opened by bstarynk 1
Owner
Vinzenz 'evilissimo' Feenstra
Love for C++, Go and Python - Developer by heart.
Vinzenz 'evilissimo' Feenstra
SQLiteC++ (SQLiteCpp) is a smart and easy to use C++ SQLite3 wrapper.

SQLiteC++ SQLiteC++ (SQLiteCpp) is a smart and easy to use C++ SQLite3 wrapper. About SQLiteC++: SQLiteC++ offers an encapsulation around the native C

Sébastien Rombauts 1.6k Dec 31, 2022
This is a demo for sqlite3.

说明 This is a demo for sqlite3. sqlite3 基础知识 sqlite3 命令分两类 系统命令 以 . 开头的命令 .q 退出sqlite3命令模式 .open 创建一个数据库 .databases 列出数据库 .schema 列出表结构 .tables 列出数据库中的

流浪小兵 1 Nov 24, 2021
Yet another SQLite wrapper for Nim

Yet another SQLite wrapper for Nim Features: Design for ARC/ORC, you don’t need to close the connection manually Use importdb macro to create helper f

Code Hz 9 Jan 4, 2023
C++11 wrapper for the LMDB embedded B+ tree database library.

lmdb++: a C++11 wrapper for LMDB This is a comprehensive C++ wrapper for the LMDB embedded database library, offering both an error-checked procedural

D.R.Y. C++ 263 Dec 27, 2022
The C++14 wrapper around sqlite library

sqlite modern cpp wrapper This library is a lightweight modern wrapper around sqlite C api . #include<iostream> #include <sqlite_modern_cpp.h> using n

null 720 Dec 29, 2022
Lightweight C++ wrapper for SQLite

NLDatabase Lightweight C++ wrapper for SQLite. Requirements C++11 compiler SQLite 3 Usage Let's open a database file and read some rows: #include "NLD

Raven 0 Sep 20, 2019
A friendly and lightweight C++ database library for MySQL, PostgreSQL, SQLite and ODBC.

QTL QTL is a C ++ library for accessing SQL databases and currently supports MySQL, SQLite, PostgreSQL and ODBC. QTL is a lightweight library that con

null 173 Dec 12, 2022
Simple-MySQL-API is a free and easy API to manipulate MySQL with C99 and GCC compiler under GNU/Linux OS.

Simple-MySQL-API is a free and easy API to manipulate MySQL with C99 and GCC compiler under GNU/Linux OS.

Neptune 8 Aug 21, 2022
GridDB is a next-generation open source database that makes time series IoT and big data fast,and easy.

Overview GridDB is Database for IoT with both NoSQL interface and SQL Interface. Please refer to GridDB Features Reference for functionality. This rep

GridDB 2k Jan 8, 2023
ObjectBox C and C++: super-fast database for objects and structs

ObjectBox Embedded Database for C and C++ ObjectBox is a superfast C and C++ database for embedded devices (mobile and IoT), desktop and server apps.

ObjectBox 152 Dec 23, 2022
Reading, thinking and coding about MySQL,InnoDB and MGR

MySQL 8.0.27 Review by adzfolc Notifications In this doc, I will make the rules of my code review and period summary for later review. This chapter ma

null 6 Dec 27, 2022
dqlite is a C library that implements an embeddable and replicated SQL database engine with high-availability and automatic failover

dqlite dqlite is a C library that implements an embeddable and replicated SQL database engine with high-availability and automatic failover. The acron

Canonical 3.3k Jan 9, 2023
MySQL Server, the world's most popular open source database, and MySQL Cluster, a real-time, open source transactional database.

Copyright (c) 2000, 2021, Oracle and/or its affiliates. This is a release of MySQL, an SQL database server. License information can be found in the

MySQL 8.6k Dec 26, 2022
ESE is an embedded / ISAM-based database engine, that provides rudimentary table and indexed access.

Extensible-Storage-Engine A Non-SQL Database Engine The Extensible Storage Engine (ESE) is one of those rare codebases having proven to have a more th

Microsoft 792 Dec 22, 2022
Modern, asynchronous, and wicked fast C++11 client for Redis

redox Modern, asynchronous, and wicked fast C++11 client for Redis [] (https://travis-ci.org/hmartiro/redox) Redox is a C++ interface to the Redis key

Hayk Martiros 380 Jan 7, 2023
Nebula Graph is a distributed, fast open-source graph database featuring horizontal scalability and high availability

Nebula Graph is an open-source graph database capable of hosting super large scale graphs with dozens of billions of vertices (nodes) and trillions of edges, with milliseconds of latency.

vesoft inc. 834 Dec 24, 2022
HybridSE (Hybrid SQL Engine) is an LLVM-based, hybrid-execution and high-performance SQL engine

HybridSE (Hybrid SQL Engine) is an LLVM-based, hybrid-execution and high-performance SQL engine. It can provide fast and consistent execution on heterogeneous SQL data systems, e.g., OLAD database, HTAP system, SparkSQL, and Flink Stream SQL.

4Paradigm 45 Sep 12, 2021
OceanBase is an enterprise distributed relational database with high availability, high performance, horizontal scalability, and compatibility with SQL standards.

What is OceanBase database OceanBase Database is a native distributed relational database. It is developed entirely by Alibaba and Ant Group. OceanBas

OceanBase 5.1k Jan 4, 2023
A PostgreSQL extension providing an async networking interface accessible via SQL using a background worker and curl.

pg_net is a PostgreSQL extension exposing a SQL interface for async networking with a focus on scalability and UX.

Supabase 49 Dec 14, 2022