136 Commits

Author SHA1 Message Date
Sébastien Rombauts
a865d1c61a Update copyright notice to 2025 2025-05-19 21:20:36 +02:00
Sergei Trofimovich
a534d50580 tests/Database_test.cpp: fix a warning around #endif
Without the change `gcc` detects unexpected tokens as:

    /build/source/tests/Database_test.cpp:566:9: warning: extra tokens at end of #endif directive [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wendif-labels-Wendif-labels8;;]
      566 | #endif  && !defined(__APPLE__)
          |         ^~
2024-09-07 14:35:10 +01:00
Sébastien Rombauts
0f8d9125d9 NOTE on macOS FindSQLite3 find an unrelated sqlite3.h from Mono.framework that doesn't match the actual package version! 2024-08-18 22:31:50 +02:00
Sébastien Rombauts
26d5e47fe6 Replace all double-quoted string literals by single quotes
Fix #481 23 test fails under FreeBSD 14.1 builtin SQLite library

The SQLITE_DQS compile-time option activates or deactivates the legacy double-quoted string literal misfeature.
Legacy behavior is that double-quoted string literals are allowed anywhere.
2024-08-17 23:16:14 +02:00
Sébastien Rombauts
1909a777d5 Update copyright notice to 2024 2024-08-16 20:46:14 +02:00
Sébastien Rombauts
e933212f69 Fix inequality assertions for real numbers failing on Valgrind (2/2)
EXPECT_FLOAT_EQ
2023-08-29 19:23:35 +02:00
Sébastien Rombauts
d4d57b7f5b Fix inequality assertions for real numbers failing on Valgrind (1/2)
EXPECT_DOUBLE_EQ
2023-08-29 19:11:42 +02:00
Sébastien Rombauts
7dbcf482f2 Update copyright notice to 2023 2023-05-24 18:49:55 +02:00
Sébastien Rombauts
cc0044a603 Add a Transaction::rollback() method 2022-12-15 19:00:04 +01:00
Sébastien Rombauts
81a28af858 Fix Savepoint_test comments and file formatting 2022-12-15 18:57:21 +01:00
Sébastien Rombauts
343299a31d
Merge pull request #390 fix incorrect work of savepoint from spoyler/save_point
Fix #381
2022-12-15 13:12:10 +01:00
Jorrit Wronski
a1510849f8 Do not compare the version number for external SQLite3 libraries 2022-12-13 11:01:56 +01:00
Сидоров Андрей Алексеевич
1a63044624 Add release for savepoint after rollabck in destructor for deleting it form sqlite transaction stack. 2022-12-12 12:35:34 +03:00
Doug Nazar
77fc1f30b2 Ensure that TEXT column is UTF-8 encoded before using sqlite3_column_blob()
If the database is in a different format (ie. UTF-16) the memory that
sqlite3_column_blob() will point to by default will be the native (UTF-16)
encoding. Calling sqlite3_column_bytes() will basically be a noop for
a BLOB or a TEXT already in UTF-8. Otherwise it'll convert to TEXT w/UTF-8.

Run the 'basis' tests against both a UTF-8 and a UTF-16 database.
Reset & rerun query between tests blocks to reset column types.
Reorder a few getText()/getString() operations to ensure we test both ordering.
Don't try to convert random blob to TEXT. Will fail encoding conversion.
2022-12-02 14:03:03 -05:00
Sébastien Rombauts
7747c23059 Add comments in the unit tests on how to bind a NULL value 2022-09-30 19:56:30 +02:00
Sébastien Rombauts
3d149cc62f Removal of removing long APIs 2022-07-24 22:03:55 +02:00
Sébastien Rombauts
bc80914ddf
Merge branch 'master' into windows-migration 2022-07-24 18:41:45 +02:00
Sébastien Rombauts
091726aa65 Fix Statement unit tests still using long
long & long long api have been replaced by int32_t and int64_t types

TODO: we need to continue cleanup APIs to remove all long from the codebase before we can release a new version
2022-07-24 16:19:37 +02:00
Jonathan Guzmán
179ef091c6
define preprocesor definition
define NON_AMBIGOUS_OVERLOAD to prevent ambiguous overload
and use int instead of long to prevent ambiguous overload errors
2022-04-19 21:58:04 -06:00
Jonathan Guzmán
6b6078ab3f
use int64_t instead of long long(unit tests)
using long long may be ambigous for the compiler in the call of bind()
using a fixed type(int64_t) solves this issue
this issue was replicated on both Arch Linux&Windows
with clang 13.0.1/14.0.1
2022-04-19 21:12:46 -06:00
Kacperos155
27a32521b7 Add test for Column std::shared_ptr; remove noexcept from throwing Column constructor 2022-01-26 04:19:10 +01:00
Kacperos155
10d779a349 Fixed #349; Column throw when constructed with nullptr 2022-01-26 03:22:17 +01:00
John Jenkins
abd139c597 Allow specifying transaction behaviors DEFERRED, IMMEDIATE, and EXCLUSIVE 2021-10-04 16:27:08 -05:00
Jason Rhinelander
bfe0221b8c Disable std::filesystem on macOS targetting <10.15
macOS flat out refuses to compile if you touch std::filesystem when
targetting macOS < 10.15 (to be able to deploy a binary to older macOS
versions).

This disables the std::filesystem support when in C++17 mode with such a
target.
2021-08-19 22:01:23 -03:00
Sébastien Rombauts
64c34bc7bd Added unit tests for new getChanges() and fix comment being too long 2021-07-25 10:46:56 +02:00
Sébastien Rombauts
cac0000ada Merge #299 Added Savepoint support from catalogm 2021-01-06 11:07:44 +01:00
Patrick Servello
81e5a1f910
Add Database constructor for filesystem::path #296 (#314)
* Add Database constructor for filesystem::path #296

* Fixed incorrect MSVC version value for C++17

* Updated another incorrect version string

* Updated MSVC compiler check again. The <filesystem> header wasn't transitioned from std::experimental until MSVC 15.7

* Changed version check to look at c++ version no MSVC version
2021-01-06 08:41:32 +01:00
Benjamin Stauffer
1d0d8fe446 Add Database::tryExec()
Similar to Statement::tryExecuteStep(), allows calls to sqlite3_exec()
with the caller assuming responsibility for checking and handling the
returned status.
2020-11-12 02:05:05 -06:00
Kelvin Hammond
61bdad3aae Added test for Savepoint, calling rollback after release or commit 2020-09-10 19:03:00 -04:00
Kelvin Hammond
ee6762c0d9 Added: Savepoint support 2020-09-10 18:59:08 -04:00
Daniel Schmidt
0c9d4a3f36 Improved name of new function, documentation and tests. 2020-03-26 09:19:27 +01:00
Daniel Schmidt
9dee407ff0 Added unit tests for new function on statements. 2020-03-25 16:20:10 +01:00
Sébastien Rombauts
f70374262d Improve Statement unit tests coverage (bind by name with a std::string) 2020-01-09 14:00:58 +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
ddb4929ddb Fix and improve read-header unit tests, as well as backup tests 2020-01-04 19:10:32 +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
e6288ee920 Update copyright notice 2020-01-01 08:08:59 +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
54c7a189af Add a basic unit test to Database::loadExtension() (without a proper extension to test) 2019-12-29 23:49:32 +01:00
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