Commit Graph

150 Commits

Author SHA1 Message Date
Robert Fewell
d4e90132d9 Fix a missing mode == in 'Replace the three bool parameters
to qof_session_begin to an enum'.
2020-06-05 11:10:16 +01:00
John Ralls
b8d514e157 Don't try to unlock the GncDbiSqlConnection when it was connected read-only.
If it's locked it's not *our* lock.
2020-06-04 14:07:28 -07:00
John Ralls
6a1cb5eecd Replace the three bool parameters to qof_session_begin to an enum.
For clarity. In so doing found the backend behavior a bit inconsistent
so it's modified to do what the enum values indicate.

In the course of changing the various calls I found some implementation
errors in the back end and corrected them.
2020-06-04 14:07:28 -07:00
John Ralls
c73a1bd475 Extract function template drop_database. 2020-06-04 14:07:28 -07:00
John Ralls
a320035f42 QofSession, QofBackend: Change book_id to uri.
It's more descriptive and less likely to be confused with the book:id value
in XML files that is the book's GUID.
Also changed the QofSessionImpl::begin new_uri parameter from std::string to
const char*. There's no point in allocating a string just to call
new_uri.c_str() all over the place.
2020-06-04 14:07:28 -07:00
John Ralls
65e2639de4 Delete QOF_STDOUT.
Apparently a hack for the long-gone QSF backend.
2020-06-04 14:07:28 -07:00
John Ralls
fc637aadc7 Two more test directories needing G_LOG_DOMAIN defined.
Should fix CI failures.
2020-05-10 10:18:36 -07:00
John Ralls
5da3bf7943 [QofLog] Replace hashtable with tree of vectors.
16x speedup.
2020-05-09 14:39:08 -07:00
John Ralls
4e6c497cd1 Don't ask to save a non-existant book.
To accomplish that we separate creating a book and creating a session;
gnc_get_session no longer automatically creates a book if one isn't
connected.

We also add an initially_insensitive GtkAction array to
gnc-plugin-basic-commands with a call to make its contents insensitive
at plugin load so that the save button on the toolbar isn't lighted when
there's nothing to save.
2020-05-08 15:59:41 -07:00
John Ralls
8ff5af4c19 Decouple QofBook creation from QofSession.
So that we don't create two books when loading a session.
Step 1 to not having a dirty book when we think we should have no
book at all.
2020-05-08 15:59:41 -07:00
Geert Janssens
bbeb9a2b62 Drop all gnc-module dependencies and includes from compilation units that no longer use it
This also drops the python wrapper for gnc-module. As for the guile wrappers,
python should use other means of loading our shared libraries.

This commit required a few tweaks to the dependency chain as some units
inherited dependency information from gnc-module's public dependency
interface.
2020-04-24 22:16:24 +02:00
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
261bff1250 Drop unused module file in xml backend 2020-04-19 21:23:22 +02:00
John Ralls
f85be03bb5 Merge branch 'maint' 2020-03-29 14:46:55 -07:00
John Ralls
33902a6793 Improve test building with the Xcode generator.
Add CONFIGURATIONS keyword to unadorned tests, enables tests with
multi-config generators.
Add CONFIGURATION generator expression to libgtest.a and libgmock.a
build directory specs when building with Xcode so that it can
find them when building tests.
2020-03-23 17:52:26 -07: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
490b20d2da Merge branch 'maint' 2020-01-17 18:35:30 +01:00
Geert Janssens
073e47801d Drop useless ifdefs
The parameter it checks is always defined these days
2020-01-17 18:25:43 +01:00
Geert Janssens
d8a304c2c9 Housekeeping - reduce the number of PACKAGE and VERSION related cmake variables
This starts by setting the gnucash version number in the 'project' call.
This will result in a number of variables set by cmake. The remainder
of this commit is to reuse the auto-generated
PROJECT_NAME, PROJECT_VERSION, PROJECT_VERSION_MAJOR
PROJECT_VERSION_MINOR, PROJECT_VERSION_PATCH and PROJECT_VERSION_TWEAK
instead of all the various instances of PACKAGE, GNUCASH_MAJOR_VERSION
and so on.

One parameter is worth mentioning - GETTEXT_PACKAGE
GnuCash is not using this directly (any more) but it has to be set before
including gi18n-lib.h.
2020-01-17 18:15:27 +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
Geert Janssens
1c7f835f47 engine - move guile code to bindings/guile
This commit tries to do the minimum necessary to move the guile bits from engine
to bindings/guile. As engine is a very central piece in the software, this unfortunately
still touches many other source files:

- A few helper objects have been squashed together:
  * engine-helpers-guile.[ch] (of which the c part is extracted from engine-helpers.c)
  * gncBusGuile.[ch]
  * gnc-hooks-scm.[ch]
- The initialization function of gncmod-engine no longer initializes the scm bits.
  Any scm code that wants to interact with the engine code now has to load
  the (gnucash engine) scm module, or sometimes (gnucash business-core).
  The bulk of changes in this commit actually is updating all the scm consumers to do so.
- scm-scm target has been removed. Instead (gnucash utilities) is part
  of scm-engine. A few dependency graphs have been updated for this.

More refinements will be in followup commits.
2019-12-06 19:59:11 +01:00
Frank H. Ellenberger
91183a2af5 drop emacs_trailer from xml files.
Modern versions of emacs know, how to behave on xml files.
2019-11-25 00:42:40 +01:00
Christopher Lam
de09259f13 Bug 797500 - valgrind errors - new/delete vs malloc/free
Mismatched new/g_free()
Change to new/guid_free() which calls delete
2019-11-17 09:55:51 +08:00
John Ralls
badda88224 Clear, not empty.
Found by gcc when setting C++17 on master.
2019-10-05 11:44:09 -07:00
Robert Fewell
2bcb9bb1a5 Test for Invoices XML dates not being INT64_MAX
To prevent errors being logged to the trace file when invoices are
saved test for the date values not being INT64_MAX which is an unset
date.
2019-08-29 11:28:18 +01:00
John Ralls
887f7fac32 Bug 746937 - Template transaction splits are loaded in reverse order...
and then not sorted before saving.

Actually not sorted after loading because the template accounts weren't
being committed.
2019-07-27 15:15:55 -07:00
John Ralls
456ab2241f Remove unused ifdefs for IMPLEMENT_BOOK_DOM_TREES_LATER.
Apparently stub code for a different way of generating the DOM tree, never implemented.
2019-07-26 16:17:09 -07:00
John Ralls
e88f31e05c Bug 784623 - GNUCash does not work with sql backend, I can open...
in read only mode

Upgrade the splits table as well, an oversight from the original fix.
2019-07-19 21:20:43 -07:00
John Ralls
a3871d9ca1 Warn if can't lock for any reason other than that the file is locked already.
And include the error string in the message.
2019-06-28 11:48:01 -07:00
John Ralls
957df9a32b Add a +0000 offset to ISO8601 timestamps in the XML backend.
Apparently GnuCash for Android hard-coded the offset spec into their
parser, so it can't import XML files without it.
2019-05-27 14:51:06 -07:00
Geert Janssens
b7479e8fb0 Bump minimum cmake version to 3.5
This version is available for all supported platforms and distros
(CentOS can have a version via EPEL, which is required anyway)

Advantages:
- one cmake version for all platforms
- we can drop all conditions based on cmake version
2019-05-25 12:04:51 +02: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
9fa7b7f940 Implement a faster date-time serialization function.
Has the side effect of recording all date-times in XML files in UTC
instead of local time with a timezone.
2019-01-04 16:34:33 -08: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
Christopher D. Carson
aaeb639d07 Performance fix in dom_chars_handler: use g_strndup instead of g_strdup
Because the origin string can be extraordinarly long, you get more
benefit from this than you would imagine
2018-12-24 13:46:48 +01:00
John Ralls
e81bcf6e33 Fix the remaining static analysis warnings.
Except two incorrect leak warnings and one about mktemp
 being insecure in the XML backend. See the respective
comments about those.
2018-11-30 15:08:41 +09: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
876bfd19ad Protect against nullptr dereference, remove unused GError.
Found by clang static analyzer.
2018-11-30 15:08:41 +09:00
John Ralls
faba7975ac Fix a bunch of memory allocation errors found by clang static analysis. 2018-11-30 15:08:41 +09:00
Di Mang
893383ce9b removing double semicolons at the end of lines 2018-09-30 19:10:50 +02:00
Geert Janssens
406953c2ae Bug 796820 - References to 'Gnome Bugzilla' should be changed to 'GnuCash Bugzilla'
Additionally use https everywhere to refer to bugs.gnucash.org or bugzilla.gnome.org
2018-09-28 15:00:43 +02:00
John Ralls
26a179872d Don't create 2 new books for every new session.
And don't ask to save a not-dirty or empty book, fixing
Bug 794870 - If no book is opened, gnucash still asks if the user wants
to save changes when opening a file
2018-09-23 16:42:11 -07:00
John Ralls
6d2ef90313 Fix a magic number. 2018-09-21 13:00:34 -07:00
Geert Janssens
5057703d30 Sql backend - show progress similar to how it's done for xml backend
That is let the percentage increase gradually. The current granularity is still
very rough, but at least it gives an indication of getting closer to fully
loading the data. The previous configuration on the other hand only suggested
something was happening but with no indication where in the load process
gnucash was.
2018-09-15 17:48:37 +02:00
Geert Janssens
5775662b52 Raise edit level of all accounts before loading transactions and splits
This prevents calling xaccAccountRecomputeBalanceInCurrency on each split that gets added,
which was exponentially increasing load times. On a huge test book the
load time dropped from 53 minutes to 1m20s.
2018-09-15 17:05:16 +02:00
Geert Janssens
221c46585c Sql backend - load transactions before business objects to reduce individual slot queries 2018-09-15 16:38:55 +02:00