Commit Graph

58 Commits

Author SHA1 Message Date
Geert Janssens
abf29aa196 Drop the gnc-module wrapper around the test-engine library
It's not adding anything
2020-04-24 21:29:20 +02:00
Geert Janssens
301db9020d Merge branch 'maint' 2020-02-06 16:50:08 +01:00
Geert Janssens
e79e82edcf CMake - remove parameter repetition in else() and endif() statements
This follows Professional CMake's recommended practises
2020-02-05 11:38:14 +01:00
Geert Janssens
4c77f7670e engine - remove gncmod boilerplate
engine is now an ordinary shared library

This requires a few more places to run gnc_engine_init as
this is no longer done as part of module loading.
2019-12-06 20:38:21 +01:00
John Ralls
b8b33b9591 Revert "More conversions from pkg-config variables to imported targets."
This reverts commit 1a9fcfefad because
on MinGW cmake complains about the paths in pkgconfig files. This can
be addressed by using the MSYS2 cmake instead of the MINGW32 one, but
that requires some other changes... and there's also a path separator
bug in that version of FindPkgConfig.cmake.
2019-09-21 15:53:25 -07:00
John Ralls
1a9fcfefad More conversions from pkg-config variables to imported targets.
Also converts ICU detection from pkgconfig to FindICU.
2019-09-13 17:05:35 -07:00
loftx
d5297a46bf Resolve 'basic_string::_M_construct null not valid' error when no database is provided in connection string 2019-02-26 15:37:01 +01:00
Mike Alexander
2820af7166 Make test-backend-dbi-basic build and run with libdbi 8.
This may not be the correct fix, but it is plausible and it
makes the test build and run.
2019-01-28 19:23:35 -05:00
John Ralls
9bfaada356 Bug 796961 - Can't overwrite existing MYSQL database, V3.3.
Because m_exists was left true after dropping it, so the new
database wasn't created.
2018-12-28 13:22:40 -08:00
John Ralls
1116ce909b Bug 796967 - gnclock table not removed when using PostgreSQL.
Because of https://sourceforge.net/p/libdbi-drivers/bugs/24.
This issue causes trouble in save_may_clobber_data() as well, so
work around it by using a SQL query instead of dbi_conn_get_table_list.
2018-12-28 13:22:40 -08:00
Geert Janssens
d22e1db340 gnc-uri - refer to 'scheme' instead of 'protocol' as that's the more formal term used in uris
This involves renaming 3 functions:
gnc_uri_get_protocol -> gnc_uri_get_scheme
gnc_uri_is_known_protocol -> gnc_uri_is_known_scheme
gnc_uri_is_file_protocol -> gnc_uri_is_file_scheme

The *_protocol variants are marked as deprecated.
Additionally a number of local variables have been renamed from
protocol to scheme to support this change.
2018-12-27 22:33:17 +01:00
John Ralls
bf55c30aeb Fix most of the unused assignment errors from static analysis.
There are a very few left that need deeper study, but this gets
rid of most of the noise. For the most part it's just getting rid of
extra variables or removing an assignment that is always
replaced later but before any reads of the variable. A few are
discarded result variables.
2018-11-30 15:08:41 +09:00
John Ralls
6d2ef90313 Fix a magic number. 2018-09-21 13:00:34 -07:00
Geert Janssens
48b29f5e91 Fix memory leak in char* type KvpValue and fix improper uses
The core issue was that the delete visitor was never called because its parameter
type (char *) didn't match the boost::variant type (const char *).
Fixing the visitor's parameter type also require a const_cast
back to char * because that's what g_free takes as argument.

The rest of this commit is merely fixing KvpValue instantiations that
tried to create a char* KvpValue from a stack based const string instead
of a heap allocated one. That would bomb out on calling the
delete visitor.
2018-09-10 19:49:43 +02:00
John Ralls
20f6e4e690 Remove Timespec from the SQL backend. 2018-08-13 11:52:43 -07:00
John Ralls
c8b372e390 Convert GNC_TYPE_TIMESPEC to GNC_TYPE_TIME64, Kvp::Type::Timespec to Kvp::Type::Time64
They have to go together because of using gvalues to hide KVP from most of
GnuCash.
2018-08-12 16:12:19 -07:00
John Ralls
2f861bc2a4 Ensure all C++ class member raw pointers are default-initialized to nullptr. 2018-08-10 12:21:28 -07:00
John Ralls
43af50bd8a Bug 796759 - --add-price-quotes <sql file> leaves a lock on the file.
First, save isn't necessary if the book is dirty, so don't... but that
means that the book has to be marked dirty after a session swap. No more
laziness.

Second, regardless of the outcome of inner_main_add_price_quotes the
session must be destroyed to remove the lock.

A couple of cleanups in QofSessionImpl::save as well: Rewrote the
descriptive comment to reflect how it really works when the backend has
gotten disconnected and removed the superfluous qof_book_set_backend
with the backend that we'd *just gotten from the book*.
2018-07-14 17:09:22 -07:00
John Ralls
de927d535d Fix test-backend-dbi for Postgress and MySQL.
Pass MySQL database exists errors and skip creating the database
if it exists.
2018-07-13 16:34:42 -07:00
John Ralls
756f444ac3 Update bug tracker URL
Change all instances of bugzilla.gnome.org to bugs.gnucash.org, reflecting
our migration to a self-hosted bug tracker.

Inform the Translation Project Coordinator at release that this affects
translatable strings and that all message catalogs have been updated.
2018-07-13 09:49:33 -07:00
Geert Janssens
9d5712ef09 Use same 'force' logic sequence for sqlite and other dbs 2018-07-06 22:32:01 +02:00
Geert Janssens
875781847a Bug 796724 - Can't overwrite gnucash DB on MariaDB 2018-07-06 22:30:15 +02:00
Geert Janssens
9ab06bc9b3 Bug 789594 - Unable to overwrite sqlite3 database file 2018-07-05 22:41:56 +02:00
Geert Janssens
240c4bd2cf Whitespace cosmetics 2018-07-05 22:41:56 +02:00
John Ralls
1e6627c4c5 [DBI Backend] Init and finalize the backend in setup and teardown.
Xcode 9's clang creates a separate dbi_instance for each test and so
each one needs to be initialized during its setup and finalized at
teardown.
2018-06-23 17:35:42 -07:00
John Ralls
333a14c0fd Fix ubuntu build failure.
%$^%$ C++11 initializer list behavior.
2018-06-02 17:57:42 -07:00
John Ralls
3b3074c28d Bug 796117 - Connecting 3.1 to an existing mysql db drops all data
Provide a backup recovery function that instead of dropping primaries
and restoring backups merges the primaries and backups. This should
handle a worst-case safe-save failure where the backup tables don't
have a complete set of rows for some reason.
2018-06-02 16:21:49 -07:00
John Ralls
9db60ca63c Make float database operations more consistent.
We don't use floats in GnuCash, we use doubles (and those as little as
possible), but dbd-sqlite3 is broken in that it stores only floats.
Simply casting floats to doubles introduces bogus additional digits
that can cause round-trip tests to fail. Instead convert floats to
doubles by multiplying by 10E6, rounding, then dividing by 10E6.
2018-06-02 16:16:41 -07:00
John Ralls
3e052e8dac [DBI Backend] Rework backup-table management.
Removes a public function, GncDbiSqlConnection::table_manage_backup that
should have been private in the first place.

Better encapsulates table renames and drops with private functions and
handles cases where there exist some primary tables and some backup tables.
2018-06-01 14:50:41 -07:00
John Ralls
e23769f078 [DBI Backend] If there's a set error value use that to set the backend error. 2018-06-01 14:13:11 -07:00
John Ralls
f504e39d78 Correct the type of error variables.
C++ doesn't like interchanging enums and ints.
2018-06-01 14:13:11 -07:00
John Ralls
464fdeeb26 [DBI Backend] Remove unused TableOpTypes. 2018-06-01 14:13:10 -07:00
Geert Janssens
a9f35ed7ae Lowercase cmake commands
A huge bikeshed fest but it distracted me enough to do it anyway.
2018-05-03 23:18:15 +02:00
John Ralls
cad6bb4272 Bug 792105 - Startup takes several minutes, take two.
First, remove the unnecessary locale push & pop on <CT_TIME64>load.

Second, the registry accesses were caused by using g_win32_get_locale
to convert the Microsoft locale strings to POSIX ones. We don't care
what kind of string we get as long as we can pass it back to setlocale,
so remove that.

Third, gnc_push/pop_locale were used only in backend/dbi in a
very limited way and did much more than was necessary, so
convert them to C++ inlines in gnc-backend-dbi.hpp that does
only what we need them to.
2018-04-17 16:32:45 -07:00
John Ralls
4ba77f7b09 Remove another gnc_pop_locale(). 2018-04-14 13:11:23 -07:00
John Ralls
a04fd573ef Bug 792105 - Startup takes several minutes
set/get_locale are apparently very expensive on Mingw64, and setting
the C locale for extracting a string is unnecessary.

Unfortunately the released version of libdbi still uses strtod so
setting the C locale *is* still necessary for retrieving floats
and doubles and for passing queries.

Thanks to Mkubat for the diagnosis.
2018-04-14 12:38:04 -07:00
Geert Janssens
7271ce3dee Add feature kvp frame to the dbi test file 2018-03-30 19:02:57 +02:00
John Ralls
e5561bd7ab Fix lost Bayesian matches in SQL backend.
The import-map-bayes uses a three-part key that uses the same delimiter
as a path and the SQL backend was throwing away everything except the
account guid.

Added more slot types including import-map-bayes ones to the test xml
file to help debug this and to catch it in the future.

Also don't pass std::string.c_str() to a std::vector<std::string>
constructor, just pass the string.
2018-03-16 13:59:04 -07:00
Geert Janssens
0f4a72b49f Remove unused file 2018-01-26 18:26:06 +01:00
Rob Gowin
54ac7f23e0 Remove Autotools 2018-01-13 12:52:57 -06:00
John Ralls
c0fd3b3165 Remove all references to the now-defunct Yahoo! quote retrieval
And make Alphavantage the default.
2018-01-02 10:43:49 -08:00
John Ralls
bbd2df6a3b Bug 791848 - GC 2.6.x does not handle ISO dates introduced with GC 2.7.
Set a feature to prevent versions older that 2.6.20 from loading a
database from which they cannot read the dates. Ideally we would do this
only if the database is written to, but the current persistence design
includes committing back to the database during the load so the net
effect is that the flag would be set anyway.
2017-12-26 15:18:43 -08:00
lmat
5636afc4a2 Kvp no longer parses entries looking for delimiters 2017-12-21 07:39:32 -05:00
John Ralls
0026b10851 Merge branch 'maint' into unstable 2017-12-17 13:00:00 -08:00
John Ralls
5204100d53 Use GNUInstallDirs in CMake Builds
Provides correct file layout when building distribution tarballs.
Fixes Bugs 790840 and 790841.
2017-11-28 14:25:35 -08:00
John Ralls
13657ee1bb Merge branch 'maint' into unstable 2017-11-25 15:35:24 -08:00
John Ralls
d8c2f52447 Correct quoting for SQL backends.
Only string values should be quoted in queries; in particular NULL
isn't a string value and must not be quoted.
Note that this is a less than perfect solution because it doesn't use
the Database's quoting function and so doesn't escape quotes, linefeeds,
or carriage returns inside the string. That's because the SQL generating
logic is independent of the connection class and can't easily get to it.
2017-11-25 14:46:31 -08:00
John Ralls
9c4635e393 Bug 784623 - GNUCash does not work with sql backend.
Wherin the problem is that MySQL's TIMESTAMP has a date range of
1970-01-01 00:00:01 to 2038-01-19 03:14:07 and is unable to handle
time_t of 0. MySQL's TIMESTAMP also assumes that input is in the server's
timezone and adjusts it to UTC. GnuCash has already done that conversion.
2017-11-23 11:41:09 -08:00
John Ralls
9444c1e300 Fix bad string construction in adjust_sql_options. 2017-11-19 17:32:12 -08:00
John Ralls
61316648b8 Bug 789608 - Compilation problems when linking libraries.
Fix using a preproc macro in a different file from where it was declared
and more-strict template resolution of error_handler<> by gcc-7.x.
2017-11-09 13:47:08 -08:00