97 Commits

Author SHA1 Message Date
Sébastien Rombauts
f9cd39b278 Improve and complete unit tests of Exception 2019-12-29 23:33:37 +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
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
Oleg Smolsky
7dba62bcf1 Added a minimal test for Statement::getExtendedSQL()
- there is nothing conditional here in the wrapper
2019-06-18 09:42:35 -07: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
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
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
af8e2cea9e Unit test using a Builder function to showcase the Database move contructor 2019-03-04 08:36:19 +01: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
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
804879d27d Revert OLD cmake policy & tested commented out 2019-03-02 23:46:59 +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
Jorrit Wronski
890155363c CMake compatibility (#170)
* Added compatibility with older and newer CMake versions, fixed an issue with the SQLite SEE tests
* Fixed include directory handling
* Add comments
2019-02-13 08:32:53 +01: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
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
2286e66d53 Fix a signed/unsigned warning 2017-11-06 13:02:46 +01:00
Sébastien Rombauts
a3160dcfc2 Add Statement binding for long int values to Fix #147 2017-11-06 13:02:23 +01:00
Skabunkel
fcf6db7f5d updated sqlite3 to version 3.20.1
* Updated sqlite3/sqlite3.h and sqlite3/sqlite3.c
* Updated test Statment.invalid since error message has changed.
2017-08-30 20:32:28 +02:00
Sébastien Rombauts
4f7899c959 Rename Statement::mbIsOk to mbHasRow 2017-08-28 17:17:18 +02:00
Henrik Jakobsson Majava
f4947e7a03 Added tests for tryExecuteStep and tryReset 2017-08-28 15:10:56 +02:00
Sébastien Rombauts
9c15cf7c98 Merge pull request #136 from fekir/fix_stream
Ensure that operator<< correctly prints strings with embedded '\0'
2017-08-21 11:10:57 +02:00
fekir
a826dcacc1 Improve test for constructor consistency 2017-08-19 09:19:55 +02:00
fekir
b2f059e188 Add test for constructor consistency 2017-08-19 09:18:28 +02:00
fekir
94ebe5ced6 Add default copy constructor to exception class
The throw statement may copy the exception, since exception are thrown by value
Having const members disables the assignment operator
2017-08-19 08:53:01 +02:00
fekir
d3a10465b5 Remove unused variable 2017-08-18 20:24:36 +02:00
fekir
21ead7c5a4 Ensure that operator<< correctly prints strings with embedded '\0' 2017-08-18 18:24:10 +02:00
dend
f01a644dc0 Added convenience functions for constructing objects from a row 2017-02-12 22:10:29 -05:00
Jorrit Wronski
dbd31fb56b Fixed some compiler warnings 2016-12-23 14:57:09 +01:00
Jorrit Wronski
d26bd2cb8a Added tests for the encrypted database 2016-12-23 14:54:02 +01:00
Sébastien Rombauts
e893575a76 Add unit tests for getLibVersion() and getLibVersionNumber() 2016-07-25 22:20:19 +02:00
Sébastien Rombauts
f77b707206 Revert recent switch from uint32_t/int64_t to use int/unsigned/long/long long and fix #93 2016-07-19 10:56:08 +02:00
Bruno Coelho
f022c6af60 Add option to check if column is null by name 2016-07-15 16:15:34 +01:00
Sébastien Rombauts
401b7361ed Renamed errmsg() and getErrStr() methods to getErrorMsg() and getErrorStr() 2016-07-13 18:37:22 +02:00
Sébastien Rombauts
fd8f50bdd9 Remove last #include <sqlite3.h> from a header : add a few public constants
- Move #include <sqlite3.h> from Exception.h to a new corresponding .cpp
 - Add SQLite::OPEN_READONLY...
2016-07-13 17:16:41 +02:00
Sébastien Rombauts
57d991b85e Complete unit tests for Database::errmsg() 2016-07-08 17:41:35 +02:00
Sébastien Rombauts
67a88298df Add last missing unit test for Statement: bindNoCopy() by name 2016-07-08 09:05:28 +02:00
Sébastien Rombauts
fe5a615a0d Add unit tests for Statement bindByName uint32_t and error getters 2016-07-07 23:12:20 +02:00
Sébastien Rombauts
ed052a36bd Add unit test for bindNoCopy() 2016-07-07 21:53:45 +02:00
Sébastien Rombauts
5056c29f9e Add unit test for bind() of an uint32_t value 2016-07-07 08:50:49 +02:00
Sébastien Rombauts
d9bc842b66 Add unit test of getString() for blob with null character 2016-07-06 22:18:06 +02:00