Enable compile-time flag SQLITE_ENABLE_DBPAGE_VTAB to add support for .recover shell option.

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2021-04-23 17:29:10 +02:00
parent 74a6b073f1
commit 49094570c4
2 changed files with 13 additions and 1 deletions
+2 -1
View File
@@ -26,7 +26,8 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
# SQLITE_OMIT_PROGRESS_CALLBACK: The progress handler callback counter must be checked in the inner loop of the bytecode engine. By omitting this interface, a single conditional is removed from the inner loop of the bytecode engine, helping SQL statements to run slightly faster.
# SQLITE_DEFAULT_FOREIGN_KEYS=1: This macro determines whether enforcement of foreign key constraints is enabled or disabled by default for new database connections.
# SQLITE_DQS=0: This setting disables the double-quoted string literal misfeature.
set(SQLITE_DEFINES "-DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_DEFAULT_FOREIGN_KEYS=1 -DSQLITE_DQS=0")
# SQLITE_ENABLE_DBPAGE_VTAB: Enables the SQLITE_DBPAGE virtual table. Warning: writing to the SQLITE_DBPAGE virtual table can very easily cause unrecoverably database corruption.
set(SQLITE_DEFINES "-DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_DEFAULT_FOREIGN_KEYS=1 -DSQLITE_DQS=0 -DSQLITE_ENABLE_DBPAGE_VTAB")
# Code hardening and debugging improvements
# -fstack-protector-strong: The program will be resistant to having its stack overflowed
+11
View File
@@ -193,6 +193,17 @@ void db_init(void)
// explicitly check for failures to have happened
sqlite3_config(SQLITE_CONFIG_LOG, SQLite3LogCallback, NULL);
// SQLITE_DBCONFIG_DEFENSIVE
// Disbale language features that allow ordinary SQL to deliberately corrupt
// the database file. The disabled features include but are not limited to
// the following:
//
// - The PRAGMA writable_schema=ON statement.
// - The PRAGMA journal_mode=OFF statement.
// - Writes to the sqlite_dbpage virtual table.
// - Direct writes to shadow tables.
sqlite3_config(SQLITE_DBCONFIG_DEFENSIVE, true);
// Register Pi-hole provided SQLite3 extensions (see sqlite3-ext.c)
sqlite3_auto_extension((void (*)(void))sqlite3_pihole_extensions_init);