Commit Graph
109 Commits
Author SHA1 Message Date
louiz’ e267512ad4 Restore the is_one_of variable template 2018-01-25 02:22:19 +01:00
louiz’ 33a5f1355d Remove a variable template usage
Because it’s only supported in gcc>=5.0
2018-01-25 01:22:35 +01:00
louiz’ 7e64a2e361 Add a DEBUG_SQL_QUERIES to log info about the executed SQL queries
fix #3324
2018-01-14 21:46:49 +01:00
louiz’ 3cd6490236 Remove all the ugly database debug 2018-01-14 21:44:22 +01:00
louiz’ 286aa58c7b Remove a warning (unused argument) 2017-12-17 15:21:40 +01:00
louiz’ a557718bf2 db_name also accepts postgres:// scheme for PostgreSQL connections 2017-12-16 15:34:54 +01:00
louiz’ c3313d0d41 Always free the PGresult pointer returned by PQexec
Fix a somewhat big memory leak
2017-12-05 01:05:45 +01:00
louiz’ 6dc49f3284 Fix a few warnings 2017-12-02 20:08:50 +01:00
louiz’ 414bbca0bc Handle postgresql and sqlite3 libs properly
Do not fail to compile when one of them is missing but the other one is not.

Raise an error when trying to open a database with the missing library.

see #3237
2017-12-02 20:08:50 +01:00
Jonas Wielicki e1c7a6518a Actually free the database on Database::close()
.release() returns the pointer and releases ownership *without*
destruction.
2017-12-02 20:08:50 +01:00
Jonas Wielicki 58f78f31e6 Make destructor of DatabaseEngine virtual 2017-12-02 20:08:50 +01:00
Jonas Wielicki 14dcc57a19 Make destructor of Statement virtual
I got an ASAN error otherwise (type mismatch)
2017-12-02 20:08:50 +01:00
Jonas Wielicki 4f7ad3f985 Support for full postgresql URIs
(cf. https://www.postgresql.org/docs/9.4/static/libpq-connect.html#LIBPQ-CONNSTRING)
2017-12-02 20:08:50 +01:00
louiz’ 0168b96b79 Add postgresql support 2017-12-02 20:08:47 +01:00
Romain DEP. 103e508f3b compat: revert to using sqlite's close() function for compat with older distros.
close_v2(), in use before this commit, was introduced as part of sqlite 3.7.14
 (2012-09-03), and is as such incompatible with debian wheezy (3.7.13) and
 centos6 (3.6.20).
 FTR, Wheezy will be supported until May 2018, and centos6, until November 2020.
2017-09-21 08:38:04 +02:00
louiz’ bfcf294517 Add the persistent_by_default configuration option
fix #3293
2017-09-09 17:09:17 +02:00
louiz’ 2c717d347d Add an index for the muc_log_line table
This immensely speeds up the archive select queries.

fix #3292
2017-08-26 17:42:59 +02:00
louiz’ 655151d88a Cache the encoding_in database value, to avoid doing a query for each message 2017-08-26 13:51:15 +02:00
louiz’ 2a62b8b082 Fix a sqlite3 leak when the database fails to open 2017-08-19 13:02:34 +02:00
louiz’ 9648fd286c Display the correct error message when we fail to open the sqlite3 db
fix #3290
2017-08-19 13:02:13 +02:00
louiz’ 84034ed3dc Use a db roster to manage biboumi’s presence with the contacts 2017-07-16 00:16:43 +02:00
louiz’ 3974371e7b Replace a function argument from ... to the template Args&&... thing 2017-07-08 19:07:53 +02:00
louiz’ fd7ee48a86 Remove many log_debug from the database module 2017-07-08 18:11:25 +02:00
louiz’ faed8952cb Remove a bunch of useless string_literal usage 2017-07-08 14:04:35 +02:00
louiz’ 7a9b2dca06 Use a more precise return type, instead of auto 2017-07-08 12:37:03 +02:00
louiz’ cf56b60fd3 Remove all the empty “options” members in Column classes
By using SFINAE to use that member only when it exists.
2017-07-08 12:36:08 +02:00
louiz’ 9f7782bb0c Add a global “persistent” option 2017-07-06 22:24:42 +02:00
louiz’ b71ca15a0f Move a few functions from select_query to query 2017-06-23 00:13:38 +02:00
louiz’ 8a7166eef9 Set the database pointer to nullptr after a close 2017-06-22 16:14:00 +02:00
louiz’ 4d55a120d8 Re-implement correctly the handling of failure to open the database
If we can’t open it at startup, we exit.
If we can’t open it on reload, we keep the previously-opened database.

This way, we’re assured to always have a valid and open database available.
2017-06-21 17:41:03 +02:00
louiz’ 40db183e37 Using OptionalBool, add RecordHistoryOptional col into IrcChannelOptions table
ref #3269
2017-06-16 09:54:36 +02:00
louiz’ 4a963cc480 At startup, upgrade all database tables by adding missing columns 2017-06-16 09:53:49 +02:00
louiz’ a77c982f63 Fix cstdint -> cstddef, to fix compilation on freebsd 2017-06-14 18:47:01 +02:00
louiz’ 34ed2cc1a9 Explicitely declare the add_param<Id> specialization 2017-06-14 17:25:15 +02:00
louiz’ 5834dd53f3 Add a 0 default value for template argument N 2017-06-14 16:21:23 +02:00
louiz’ 2677ac42e8 Fix compilation (many warnings, and a linkage error) with clang++ 2017-06-14 10:46:44 +02:00
louiz’ dac19da4c7 Fix an inversion of tlsPorts_ and ports_ 2017-06-14 10:46:44 +02:00
louiz’ 9defd0ccb7 Add a Statement class to manage the sqlite3_stmt objects and avoid leaks 2017-06-14 00:19:15 +02:00
louiz’ 369ccb0376 Add default values for the database columns 2017-06-14 00:19:15 +02:00
louiz’ 50cadf3dac Implement our own database ORM, and update the whole code to use it
Entirely replace LiteSQL

fix #3271
2017-06-14 00:19:15 +02:00
louiz’ 7f2127a7ea Add the archive ID to messages when they are sent to users
This makes us compatible with mam 6.0

fix #3249
2017-03-30 18:16:44 +02:00
louiz’ 1a09c965eb Remove two sneaky log_debug 2017-03-29 23:32:43 +02:00
louiz’ 379fe026fb Properly convert the data into a number of seconds by using duration_cast 2016-12-10 04:15:49 +01:00
louiz’ 363a0bf02c Look for uuid/uuid.h instead of just uuid.h
Avoids a conflict between /usr/include/uuid.h and
/usr/local/include/uuid/uuid.h on freebsd
2016-09-29 20:11:35 +02:00
louiz’ 3047bd41b2 MAM results can be filtered by start and end dates 2016-09-04 22:58:38 +02:00
louiz’ 7536a1b3f3 Respond to MAM requests on a channel JID
At the moment, result-set-management is not implemented, the whole history
(well, at most 1024 messages) is returned.
2016-08-28 22:42:50 +02:00
louiz’ 88499d0379 If the maxHistoryLength is negative, make it 0
Instead of doing a broken SQL request that returns weird lines
2016-08-23 01:28:12 +02:00
louiz’ d1626c929f When joining a channel, send the most recent history found in the database 2016-08-22 00:44:17 +02:00
louiz’ 593b326827 When saving the logs, the date must be in seconds, not nanoseconds 2016-08-22 00:39:11 +02:00
louiz’ 6776b827d2 Add a global configure ad-hoc command, with max history length 2016-08-22 00:38:44 +02:00