Commit Graph

25 Commits

Author SHA1 Message Date
DL6ER 0aad3533e2 Check return values of both dbquery() and sqlite3_finalize()
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-31 01:13:10 +01:00
DL6ER 90cf01bbc5 Have to finalize all statements before sqlite3_close() can succeed. Also print some error message in the future if closeing the database failed.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-31 00:54:21 +01:00
DL6ER d0968c68aa Close database after initial check so we dont keep it open forever and hence lock it.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-30 22:34:20 +01:00
DL6ER d669a65067 Compare age of query against current time to decide if we should give a query more time to get completed
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-28 21:02:10 +01:00
DL6ER 8035d9f5a4 Save only complete queries into the database
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-22 12:31:08 +01:00
DL6ER 5951e5bde5 Ensure that data is also written to the DB when DB garbage collection is done (but before). This ensures that the queries will be written to the database even if the user specifies DBINTERVAL=n*60 (where n=1,2,3,...) which is a special that was not explicitly considered so far.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-13 18:25:23 +01:00
Mark Drobnak 95bdd62777 Merge pull request #167 from pi-hole/new/variablefilenames
Make long-term database location adjustable
2017-12-12 12:16:06 -05:00
DL6ER 4da545e057 Tweaks for Travis automated testing
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-07 22:20:34 +01:00
DL6ER 8124cf24bd SQLITE_OK, SQLITE_DONE, and SQLITE_ROW are success codes, i.e. they should not lead to disabling of the database
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-11-29 23:45:39 +01:00
DL6ER ac0c98d5c7 Disable FTL's database functionality on all errors (except DATABASE BUSY)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-11-29 19:24:18 +01:00
DL6ER c93482b85f Avoid passing unused parameter to logg()
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-08-02 17:47:29 +02:00
DL6ER 38dbe66a37 Limit maximum number of loged errors
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-08-02 17:34:21 +02:00
DL6ER 152e2c922e Improve error messages and check for more return codes in various database subroutines
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-07-18 12:09:49 +02:00
DL6ER 0fee00ad70 Define ret bool 2017-07-13 16:59:17 +02:00
DL6ER d0da785ac8 In case a DB action failed, we now log the failed request string. Also add some improvements with respect to error checking (don't silently ignore when begin of a transaction failed, related to #112)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-07-13 16:56:08 +02:00
DL6ER 66ecea9c59 Replace printf by logg since we want this messages to go to the log 2017-06-26 10:42:23 +02:00
DL6ER 9035b76cdb Revert "Fix SQLite3 function that is crashing" 2017-06-24 15:44:44 +02:00
DL6ER 01dc64cea4 Refactor DB thread to run exclusively either saving queries into the DB *or* deleting old queries (i.e. every hour at minute 59 no queries will be saved to the DB, but instead, two minutes of data will be saved at the full hour) 2017-06-22 23:14:13 +02:00
DL6ER 972bce1c49 Remove code around sqlite3_changes(). Fixes #94 2017-06-21 19:57:43 +02:00
DL6ER 685f4f4218 Specify fixed age of queries until they get deleted and remove VACUUM instructions. 2017-06-19 19:20:30 +02:00
DL6ER 1755c71a2b Restructure DELETE statement because it didn't work as expected (#81)
* Restructure DELETE statement because it didn't work as expected

* Revert changes in the Makefile
2017-06-16 12:33:44 +02:00
DL6ER 494415de30 INT -> INTEGER 2017-06-12 12:30:09 +02:00
DL6ER 2f05cec1a3 Add va_end into error catcher routine to be sure to leave the subroutine cleanly 2017-06-09 12:15:22 +02:00
DL6ER 05d9c521e7 Actually use the file size from the config file in the DB GC thread 2017-06-09 11:46:51 +02:00
DL6ER 692d69947e Add FTL SQLite3 implementation, we compile SQLite3 on-the-fly to become independent of installed libraries
Limit DB filesize, configureable via config file, if set to zero, the DB functionality is disabled altogether
Add ">dbstats" to the telnet interface
2017-06-09 09:47:13 +02:00