John Ralls
4b62deee42
Rework gnc_sql_append_guid_list_to_sql to eliminate GString and GList.
...
Which in turn forced rework of its users since the GString and GList were
passed-in parameters.
2016-10-28 10:33:52 -07:00
John Ralls
cb464da599
Replace GHashTable in GncSqlConnection with a std::vector.
2016-10-28 10:33:52 -07:00
John Ralls
885470b3e7
Replace std::vector<std::string> with StrVec.
2016-10-28 10:33:52 -07:00
John Ralls
d1fd223f9f
Make conn_table_operation and add_columns_ddl members of GncDbiSqlConnection.
...
So they don't need to be friends.
2016-10-28 10:33:51 -07:00
John Ralls
6f67e2dd1a
Convert GncSqlBackend and GncDbiBackend into a class hierarchy.
...
This is a rather complex change, because it also begins to separate the
responsibilities of the backends and GncSqlConnection.
2016-10-28 10:33:51 -07:00
John Ralls
d106346316
Minimally document GncDbiResult.
2016-10-28 10:33:51 -07:00
John Ralls
97b6e3a6c6
Pass ownership of the dbi_conn to GncDbiSqlConnection.
2016-10-28 10:33:51 -07:00
John Ralls
e0d5cc5b0b
New function GncSqlConnection::dberror().
...
GncDbiSqlResult::dberror() just calls it instead of retrieving the dbi_conn
to call dbi_conn_error() itself.
2016-10-28 10:33:51 -07:00
John Ralls
583c951adc
Use the right include delineators, it's not in the current source dir.
2016-10-28 10:33:51 -07:00
John Ralls
5823bf0d9a
Move GncDbiSqlConnection into a separate file.
...
The declaration stays in gnc-backend-dbi.h because the dependencies are
still a little too tangled to be able to separate it.
2016-10-28 10:33:51 -07:00
John Ralls
ccbfb69cf1
Delete unused or duplicated member variables from GncSqlBackend & GncDbiBackend.
2016-10-28 10:33:51 -07:00
John Ralls
c0a193c593
Remove unused/never implemented QofBackend functions.
...
Note that the QofQuery functions that sort-of used them are ifdefed out
instead of deleted to serve as place-holders since we'll be bringing
back backend querying later.
2016-10-28 10:33:51 -07:00
John Ralls
eed4a012c3
Remove no-longer-needed gnc_table_slist_free.
2016-10-28 10:33:51 -07:00
John Ralls
1f52839271
Templatize QofDbiBackendProvider.
2016-10-28 10:33:50 -07:00
John Ralls
3894a2e8b7
Convert struct provider_functions_t into virtual class GncDbiProvider.
...
Implementation templated as template <DbType> GncDbiProviderImpl.
Converted GSLists to std::vectors and GStrings to std::strings.
2016-10-28 10:33:50 -07:00
John Ralls
faf59964e4
Rename gnc-backend-dbi-priv.h to gnc-backend-dbi.hpp.
...
Also remove "#ifdef __cplusplus" from both gnc-backend-dbi.hpp and
gnc-backend-dbi.h, these files are always C++.
2016-10-28 10:33:50 -07:00
John Ralls
7fe404808a
Delete some no-longer (or in some cases never) used functions.
2016-10-28 10:33:50 -07:00
John Ralls
cfa3ab24f6
Convert GncSqlConnection to a C++ class.
2016-10-28 10:33:50 -07:00
John Ralls
12e763884e
Use a std::unique_ptr for GncSqlStatement for better memory management.
2016-10-28 10:33:50 -07:00
John Ralls
64c1fda6ec
gnc-backend-dbi.cpp: NULL -> nullptr.
2016-10-28 10:33:50 -07:00
John Ralls
92f2f2765e
Replace the ptr-to-func GncSqlObjectBackend struct with a class hierarchy.
...
Can't template them because we need to iterate on the collection when loading.
2016-10-28 10:33:50 -07:00
John Ralls
6e84ccac75
Move GncSqlColumnTypeHandler functions into GncSqlColumnTableEntry.
...
Unfortunately a rather massive change. Gets rid of GncSqlColumnTypeHandler
and its hideous run-time registry by making the handler functions members
of GncSqlColumnTableEntry. GncSqlColumnTableEntry becomes an abstract super-
class with a templatized subclass GncSqlColumnTableEntryImpl whose template
parameter is the GncSqlObjectType that's also the GncSqlColumnTableEntryImpl's
m_col_type member. That member is a candidate for future removal as it's not
necessary. An explicit specialization is provided for each GncSqlObjectType and
that's a candidate for future code-shrinkage as there's still a fair amount
of duplication in spite of adding several helper template functions to absorb
most of the meat. The abstract GncSqlColumnTableEntry class is motivated by
the need to have an iterable container which in turn requires runtime
polymorphism. This can probably be replaced with a variadic-template
pseudo-container.
The two major benefits of this change are that it gets rid of one more set
of macro functions and provides vtable dispatch that has only one level
of indirection instead of the cumbersome string-hash-table-lookup to
find the handler followed by invoking the handler's function.
The two header files are removed because they exposed only the initialization
function which in turn only registered the respective GncSqlColumnTypeHandler.
2016-10-28 10:33:50 -07:00
John Ralls
e20c17b642
Change the object type string defines to an enum.
...
Because doing unnecessary string compares is dumb.
2016-10-28 10:33:49 -07:00
John Ralls
a716636e00
Convert GncSqlStatement to a virtual class.
...
Implemented by GncDbiSqlStatement. Use class function semantics.
2016-10-28 10:33:49 -07:00
John Ralls
0d548da223
Create a new set_parameter template function to reduce repetition.
2016-10-28 10:33:49 -07:00
John Ralls
a0ae59a96a
Reimplement row retrieval as an iterator on GncSqlResults.
...
Replaces a much-copied and longish while loop with a simple range-for loop
that's guaranteed not to iterate if the result-set is empty.
2016-10-28 10:33:49 -07:00
John Ralls
576bc8ae7d
Don't override an already-set QofBackend error.
2016-10-28 10:33:49 -07:00
John Ralls
8078c41a35
Make GncSqlRow a class and replace GValues with typed transfer functions.
2016-10-28 10:33:49 -07:00
John Ralls
2f0b5ec8fe
Remove tabs from gnc-backend-sql*.
2016-10-28 10:33:49 -07:00
John Ralls
7e3ba421d7
Fix potential dereference error.
...
Thanks Geert Janssens.
2016-10-28 10:33:49 -07:00
John Ralls
7d4ca43fd0
Combine add_colname_to_list and add_gvalue_to_slist into single function add_value_to_vec.
...
The two lists were always used together so replace them with a single
vector of std::pair<std::string, std::string>; this also gets rid of the
intermediate GValue which was used to convert the returned value to a string.
operator<<() can do that for us more transparently.
Also template most of the add_value_to_vec functions.
2016-10-28 10:33:49 -07:00
John Ralls
96a8a7b99f
Make GncSqlColumnTableEntry arrays into std::vectors.
...
Allows use of range for.
2016-10-28 10:33:48 -07:00
John Ralls
be1a5f56d6
Replace heap-allocate GncSqlColumnInfo GList with on-stack std::vector.
...
Faster, more concise, can't leak.
2016-10-28 10:33:48 -07:00
John Ralls
72ac25d755
Change GncSqlColumnInfo::m_null_allowed to m_not_null and invert logic.
...
The COL_NNUL flag is "not null", the SQL table column qualifier is NOT NULL,
and bitwise AND is clearer code than bitwise XOR.
2016-10-28 10:33:48 -07:00
John Ralls
611f210a07
Provide constructors for GncSqlColumnInfo, change variable names to m_ prefix.
2016-10-28 10:33:48 -07:00
John Ralls
049b905d86
Replace qof_object_foo_backend with c++ native containers.
...
Since C++ provides find and for_each on native containers there's no need
for a hand-rolled version in libqof.
2016-10-28 10:33:48 -07:00
John Ralls
a808525d05
Fix free of non-malloced memory crash in SQL save slots.
2016-10-27 16:25:56 -07:00
John Ralls
1e5f245900
Merge convert GUID from inheriting boost::guid to composition.
2016-10-25 11:49:48 -07:00
lmat
85770afb8e
Replaced inheritance from boost uuid with composition
...
Rather than extending boost::uuids::uuid, we add a boost::uuids::uuid
member to handle the implementation of equality checking, uuid
generation, etc.
2016-10-25 12:36:53 -04:00
lmat
0a5a0ab7ab
Separate C guid from C++ guid
2016-10-21 17:19:58 -04:00
lmat
e1e85cee16
Added forward declaration for struct GncGUID
...
I also removed the guid.hpp include where I could.
2016-10-19 17:05:48 -04:00
Geert Janssens
3877c03ee7
Merge branch 'maint'
2016-10-10 13:55:35 +02:00
Geert Janssens
38e6d7f7ce
Bug 771617 - Build fails because test test-report-utilities is sensitive to time of day/timezone
...
Previous commit was working with years and monts potentially outside the supported range.
2016-10-10 12:28:49 +02:00
Geert Janssens
c5414e336a
Merge branch 'maint'
2016-10-10 11:57:03 +02:00
Geert Janssens
6bdac283fa
Bug 771617 - Build fails because test test-report-utilities is sensitive to time of day/timezone
...
Use the date-time functions in gnc-date instead of the guile ones for more consistent behaviour.
Do the same for test test-cash-flow, which was also time-of-day sensitive
2016-10-10 11:49:10 +02:00
John Ralls
20c0271e98
Fix CSV importer to handle GMT + 13 Timezone (New Zealand Daylight Time).
...
Also remove special time calculations and use gnc_dmy2timespec_neutral()
for consistency with rest of GnuCash.
2016-10-09 10:52:55 +02:00
John Ralls
b00694fde4
Bug 772382 - Date off-by-one after DST change
...
The time needs to be 10:59, not 11:00: 13 hours after 11:00 is 24:00,
which is really 00:00 the next day.
2016-10-09 10:52:55 +02:00
Christian Stimming
6e132d83fd
Get cutecash to compile/link again.
...
To my surprise the C++/Qt executable still compiles, links, and run.
2016-10-05 22:19:29 +02:00
John Ralls
901c89dffa
Fix CSV importer to handle GMT + 13 Timezone (New Zealand Daylight Time).
...
Also remove special time calculations and use gnc_dmy2timespec_neutral()
for consistency with rest of GnuCash.
2016-10-04 20:01:10 +02:00
John Ralls
5a7c791c96
Bug 772382 - Date off-by-one after DST change
...
The time needs to be 10:59, not 11:00: 13 hours after 11:00 is 24:00,
which is really 00:00 the next day.
2016-10-04 20:01:10 +02:00