155 Commits

Author SHA1 Message Date
Daniel Schmidt
0c9d4a3f36 Improved name of new function, documentation and tests. 2020-03-26 09:19:27 +01:00
Daniel Schmidt
98aff92081 Implemented getDeclaredType with documentation. 2020-03-16 15:26:30 +01:00
Sébastien Rombauts
ffc1a3ef65 Fix the SQLITECPP_PURE_FUNC macro to actually use the correct "pure" attribute 2020-01-14 10:31:27 +01:00
KOLANICH
51bd6d66ea Added a pure method. Should improve efficiency 2020-01-13 12:56:14 +03:00
Sébastien Rombauts
cb421a8518
Merge pull request #242 from KOLANICH/efficiency_1
- Added a `getIndex` method and used it.
- Improved code reuse.
- Moved some functions from sources into headers.
2020-01-09 14:09:39 +01:00
Sébastien Rombauts
3757998c16 Improve test coverage of Database: improve tests & remove a variant of createFunction() 2020-01-04 22:28:55 +01:00
Sébastien Rombauts
dcc623d745 Remove some redundant inline keywords 2020-01-04 20:46:11 +01:00
Sébastien Rombauts
4f4d833868 Add a new non static variant for getHeaderInfo() (TODO: need unit tests) 2020-01-04 19:11:24 +01:00
Sébastien Rombauts
9ea0cffc15 Replace Database::backup() "C" implementation by calling the Backup class 2020-01-03 22:58:42 +01:00
Sébastien Rombauts
92ff87be60 Conversion of sqlite3* Database::mpSQLite to a std::unique_ptr with a custom Deleter
I might switch to a std::shared_ptr to share it with Statement objects if more appropriate
2020-01-03 22:56:13 +01:00
Sébastien Rombauts
da4d692c13 Start a new 3.x branch requiring C++11 and CMake 3.1
- Remove support for Visual Studio < 2015
- Remove Statement::isOk() deprecated in 2.2.0 and renamed to Statement::hasRow()
2020-01-02 00:04:06 +01:00
Sébastien Rombauts
e6288ee920 Update copyright notice 2020-01-01 08:08:59 +01:00
Sébastien Rombauts
fd7958b809 Release 2.5.0 2019-12-31 21:33:49 +01:00
Patrick Servello
b5c0a08d3d Added SQLite header parsing functionality and associated tests (#249)
* Added SQLite header parsing functionality and associated tests

* Removed unused header file.

* Removed an accidental copy pasted remove() statement

* Replaced stdint with plain old C types for now. Will apply fixed with datatypes to cpp11 branch

* Added test scenarios to simulate blank file name, non existant file and a corrupt header

* Refactored exception flow to match latest tidying, brought casts out of function calls and cleared up invalid header exception message
2019-12-30 13:45:51 +01:00
Sébastien Rombauts
dc3f1ac271 Add unit test for Database::createFunction()
using an example from
https://stackoverflow.com/a/8283265/1163698 How can I create a user-defined function in SQLite?
2019-12-29 22:22:10 +01:00
KOLANICH
b98eabbe9f Moved some functions from sources into headers. 2019-12-26 11:54:23 +03:00
KOLANICH
5ff189a69c Added a getIndex method and used it. 2019-12-26 11:53:51 +03:00
Sébastien Rombauts
8015952b93 Fix #216 Set PROJECT_VERSION to fix CMP0048 Policy warnings 2019-08-25 21:38:39 +02:00
Sébastien Rombauts
c1ab7075f4 Fix compilation of new enum Database::BackupType for C++98 2019-07-09 09:37:05 +02:00
Oleg Smolsky
514d7d6846 Implement Database::backup() (#211)
Easily backup/restore a live DB via the sqlite3_backup_init() API
 - https://www.sqlite.org/backup.html
 - https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupinit

Use the reference implementation from the documentation
2019-07-09 09:35:31 +02:00
maxbachmann
3ba20a3519 Improve execute many and fix GCC 9 Build by explicitly scoping SQLiteCpp::bind()
Fix #206 #207
2019-06-27 21:44:03 +02:00
Sébastien Rombauts
49c1f6c08d Rename Statement::getExpandedSQL() from #201 and fix #203 #205 memory leak 2019-06-24 22:01:54 +02:00
Sébastien Rombauts
9b00034b06
Merge pull request #201 from os12/master
Add Statement::getExtendedSQL()
2019-06-18 20:24:33 +02:00
Sébastien Rombauts
1eda5c751c Minor cleanup of the codebase, mostly putting braces on their own line in unit tests 2019-06-16 15:48:57 +02:00
maxbachmann
b38e88decb add tuple_bind and execute_many (#197)
added the option to use a tuple with values to bind.

use this to implement executeMany as described in #24, so it will be possible to pass multiple tuples
2019-06-16 10:46:21 +02:00
Oleg Smolsky
ce45099695 Add Statement::getExtendedSQL()
- it returns a UTF-8 string containing the SQL text of prepared statement with
   bound parameters expanded
2019-06-15 10:27:30 -07:00
maxbachmann
81913790f2 Update VariadicBind.h for C++11 instead of C++14 (#196)
* Update VariadicBind.h

* replace c++14 by c++11

* activate tests for c++11

* replace string_literals for c++11 support
2019-05-16 08:41:29 +02:00
Linus Klöckner
65ecffba01 Fix problem with MSVC 19
"error C2039: '_snprintf': is not a member of 'std'"
2019-03-30 11:14:39 +01:00
Sébastien Rombauts
f2b1017710 Add a Statement::Ptr move constructor to fix leak because of ref counter incremented on copy 2019-03-05 00:20:06 +01:00
Sébastien Rombauts
f1301a4a11
Merge pull request #192 from jrave/bind_parameter_count
Add wrapper for bind parameter count
2019-03-04 20:18:49 +01:00
Sébastien Rombauts
78915c8f43 Fix #190 Add Statement move constructor 2019-03-04 18:43:59 +01:00
Johannes Rave
1dab172264 Add wrapper for bind parameter count 2019-03-04 18:43:32 +02:00
Sébastien Rombauts
678562e727 Implement Database move constructors for MSVC #190
Added checks to proper _MSC_VER 1600 (VS2010)
2019-03-03 22:02:58 +01:00
Sébastien Rombauts
09dd10886c Release 2.3.0 2019-03-03 20:53:02 +01:00
Sébastien Rombauts
35aaf73191 Add implicit cast operators to char & short and their unsigned variants
Fix #179 error: conversion from 'SQLite::Column' to 'unsigned char' is ambiguous
2019-03-03 09:54:40 +01:00
Sébastien Rombauts
2e69a81ccf Fix #189 unit test "Column.basis" failing on Visual Studio 2013
The implicit cast to std::string() would fallback to const char* with MSVC 2010-2013 (witch does not work with the NULL char in the middle)

Without it, trying to access a binary blob with implicit cast to string
ends up converting it to a C-style char*, damaging the data by truncating it to the first null character!
2019-03-03 08:55:18 +01:00
Sébastien Rombauts
df7d113a3b Add test case to try to repro the reported ambiguous bind() int64_t on LP64 Android 2019-03-02 23:43:03 +01:00
Sébastien Rombauts
2cb3cb2fef Update copyright notice 2019-03-02 15:46:53 +01:00
Sébastien Rombauts
9667c523a0
Merge pull request #157 from hubslave/patch-1
Add a move constructor to Database
2019-02-13 09:10:03 +01:00
Jakub Fornadel
b280587204
Update VariadicBind.h
Remove warning: expression result unused [-Wunused-value]
https://stackoverflow.com/questions/14370043/can-operators-be-overloaded-for-initializer-list-literals
2018-12-18 11:44:35 +01:00
hubslave
65f719d82b
Add a move constructor to Database
This makes it possible to e.g. return Databases from functions. Gated behind a __cplusplus >= 201103L check for compatibility with older C++ versions.
2018-03-29 16:48:16 +03:00
Sébastien Rombauts
a41629f9ed Fix #155 Statement::bind truncates long integer to 32 bits on x86_64 Linux
Reproduced the problem with a dedicated unit test, then fixed the bug.

Thanks @tszypenbejl for the clear analysis and the fix.
2018-02-23 17:10:53 +01:00
Sébastien Rombauts
d020c5f694 Update copyright notices to 2018 2018-01-24 11:26:38 +01:00
Sébastien Rombauts
86985dfd1f Fix nullptr detection with AppleClang 2017-12-17 21:42:23 +01:00
Sébastien Rombauts
5ed4a1ab79 nullptr compatibility: special detection for clang 2017-12-13 17:18:48 +01:00
Sébastien Rombauts
4f32da182c Add my Utils.h file to define nullptr on C++98 and C++03 compilers 2017-12-13 10:34:55 +01:00
Alexander Guettler
cebea884c3
Add the fix from a3160dcfc2f80f692f3477a67c202ff87f75fa5a also to the bind by name functions 2017-11-09 11:05:01 -08:00
Sébastien Rombauts
a3160dcfc2 Add Statement binding for long int values to Fix #147 2017-11-06 13:02:23 +01:00
Sébastien Rombauts
eb065bf741 Update version to 2.2.0 2017-09-19 15:17:26 +02:00
Sébastien Rombauts
4f7899c959 Rename Statement::mbIsOk to mbHasRow 2017-08-28 17:17:18 +02:00