Merge commit 'bb547abae4402ded3a9ac73f08340a1d8d743bbd'
This commit is contained in:
commit
22636219d8
@ -23,25 +23,6 @@
|
||||
# define SQLITE_PRIVATE static
|
||||
#endif
|
||||
|
||||
//My custom compile options
|
||||
#define SQLITE_DQS 0 //Doublequote names, single quote strings. This setting disables the double - quoted string literal misfeature.
|
||||
#define SQLITE_THREADSAFE 2 //Sets the default mode to SQLITE_CONFIG_MULTITHREAD. One thread, one database connection. Data structures such as compiled SQL are threadlocal. But sqlite3 is empowered to do its own multithreading. Many databases per database connection. Database connection and compiled sql statements are threadlocal. last_insert_rowid() is not subject to race conditions in this mode.
|
||||
#define SQLITE_DEFAULT_MEMSTATUS 0 //Don't track memory usage. Disables the ability of the program using sqlite3 to monitor its memory usage. This setting causes the sqlite3_status() interfaces that track memory usage to be disabled. This helps the sqlite3_malloc() routines run much faster, and since SQLite uses sqlite3_malloc() internally, this helps to make the entire library faster.
|
||||
#define SQLITE_DEFAULT_WAL_SYNCHRONOUS 1 // in WAL mode, recent changes to the database might be rolled back by a power loss, but the database will not be corrupted. Furthermore, transaction commit is much faster in WAL mode using synchronous=NORMAL than with the default synchronous=FULL. For these reasons, it is recommended that the synchronous setting be changed from FULL to NORMAL when switching to WAL mode. This compile-time option will accomplish that.
|
||||
#define SQLITE_DEFAULT_FOREIGN_KEYS 1 //if this compile-time parameter is set to 1, enforcement of foreign key constraints will be on by default.
|
||||
#define SQLITE_LIKE_DOESNT_MATCH_BLOBS 1 //Blobs are not strings. Historically, SQLite has allowed BLOB operands to the LIKE and GLOB operators. But having a BLOB as an operand of LIKE or GLOB complicates and slows the LIKE optimization. When this option is set, it means that the LIKE and GLOB operators always return FALSE if either operand is a BLOB. That simplifies the implementation of the LIKE optimization and allows queries that use the LIKE optimization to run faster.
|
||||
#define SQLITE_MAX_EXPR_DEPTH 0 //Setting the maximum expression parse-tree depth to zero disables all checking of the expression parse-tree depth, which simplifies the code resulting in faster execution, and helps the parse tree to use less memory.
|
||||
#define SQLITE_OMIT_DECLTYPE 1 // By omitting the (seldom-needed) ability to return the declared type of columns from the result set of query, prepared statements can be made to consume less memory.
|
||||
#define SQLITE_OMIT_DEPRECATED 1 //Omitting deprecated interfaces and features will not help SQLite to run any faster. It will reduce the library footprint, however. And it is the right thing to do.
|
||||
#define SQLITE_OMIT_PROGRESS_CALLBACK 1 // 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.
|
||||
#define SQLITE_OMIT_UTF16 1
|
||||
#define SQLITE_USE_ALLOCA 1 //Make use of alloca() for dynamically allocating temporary stack space for use within a single function, on systems that support alloca(). Without this option, temporary space is allocated from the heap
|
||||
#define SQLITE_OMIT_LOAD_EXTENSION 1
|
||||
#define SQLITE_TEMP_STORE 1 //Temporary files are stashed on disk when their cache overflows.
|
||||
#define SQLITE_OMIT_AUTOINIT 1 //.The SQLite library needs to be initialized using a call to sqlite3_initialize() before certain interfaces are used.This initialization normally happens automatically the first time it is needed.However, with the SQLITE_OMIT_AUTOINIT option, the automatic initialization is omitted.This helps many API calls to run a little faster(since they do not have to check to see if initialization has already occurred and then run initialization if it has not previously been invoked) but it also means that the application must call sqlite3_initialize() manually.If SQLite is compiled with - DSQLITE_OMIT_AUTOINIT and a routine like sqlite3_malloc() or sqlite3_vfs_find() or sqlite3_open() is invoked without first calling sqlite3_initialize(), the likely result will be a segfault
|
||||
#define SQLITE_OMIT_AUTORESET 1
|
||||
//end my custom compile options*/
|
||||
|
||||
/************** Begin file sqliteInt.h ***************************************/
|
||||
/*
|
||||
** 2001 September 15
|
||||
@ -322,6 +303,38 @@
|
||||
** first in QNX. Also, the _USE_32BIT_TIME_T macro must appear first for
|
||||
** MinGW.
|
||||
*/
|
||||
//My custom compile options
|
||||
#define SQLITE_DQS 0 //Doublequote names, single quote strings. This setting disables the double - quoted string literal misfeature.
|
||||
#define SQLITE_THREADSAFE 2 //Sets the default mode to SQLITE_CONFIG_MULTITHREAD. One thread, one database connection. Data structures such as compiled SQL are threadlocal. But sqlite3 is empowered to do its own multithreading. Many databases per database connection. Database connection and compiled sql statements are threadlocal. last_insert_rowid() is not subject to race conditions in this mode.
|
||||
#define SQLITE_DEFAULT_MEMSTATUS 0 //Don't track memory usage. Disables the ability of the program using sqlite3 to monitor its memory usage. This setting causes the sqlite3_status() interfaces that track memory usage to be disabled. This helps the sqlite3_malloc() routines run much faster, and since SQLite uses sqlite3_malloc() internally, this helps to make the entire library faster.
|
||||
#define SQLITE_DEFAULT_WAL_SYNCHRONOUS 1 // in WAL mode, recent changes to the database might be rolled back by a power loss, but the database will not be corrupted. Furthermore, transaction commit is much faster in WAL mode using synchronous=NORMAL than with the default synchronous=FULL. For these reasons, it is recommended that the synchronous setting be changed from FULL to NORMAL when switching to WAL mode. This compile-time option will accomplish that.
|
||||
#define SQLITE_DEFAULT_FOREIGN_KEYS 1 //if this compile-time parameter is set to 1, enforcement of foreign key constraints will be on by default.
|
||||
#define SQLITE_LIKE_DOESNT_MATCH_BLOBS 1 //Blobs are not strings. Historically, SQLite has allowed BLOB operands to the LIKE and GLOB operators. But having a BLOB as an operand of LIKE or GLOB complicates and slows the LIKE optimization. When this option is set, it means that the LIKE and GLOB operators always return FALSE if either operand is a BLOB. That simplifies the implementation of the LIKE optimization and allows queries that use the LIKE optimization to run faster.
|
||||
#define SQLITE_MAX_EXPR_DEPTH 0 //Setting the maximum expression parse-tree depth to zero disables all checking of the expression parse-tree depth, which simplifies the code resulting in faster execution, and helps the parse tree to use less memory.
|
||||
#define SQLITE_OMIT_DECLTYPE 1 // By omitting the (seldom-needed) ability to return the declared type of columns from the result set of query, prepared statements can be made to consume less memory.
|
||||
#define SQLITE_OMIT_DEPRECATED 1 //Omitting deprecated interfaces and features will not help SQLite to run any faster. It will reduce the library footprint, however. And it is the right thing to do.
|
||||
#define SQLITE_OMIT_PROGRESS_CALLBACK 1 // 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.
|
||||
#define SQLITE_OMIT_UTF16 1 //utf16 is long obsolete. Albeit it is a long running microsoft hangover which they are strangely late in fixing, though everyone, at great inconvenience, works around it and uses utf8 anyway.
|
||||
#define SQLITE_USE_ALLOCA 1 //Make use of alloca() for dynamically allocating temporary stack space for use within a single function, on systems that support alloca(). Without this option, temporary space is allocated from the heap
|
||||
#define SQLITE_OMIT_LOAD_EXTENSION 1
|
||||
#define SQLITE_TEMP_STORE 1 //Temporary files are stashed on disk when their cache overflows.
|
||||
#define SQLITE_OMIT_AUTOINIT 1 //The SQLite library needs to be initialized using a call to sqlite3_initialize() before certain interfaces are used.This initialization normally happens automatically the first time it is needed.However, with the SQLITE_OMIT_AUTOINIT option, the automatic initialization is omitted.This helps many API calls to run a little faster(since they do not have to check to see if initialization has already occurred and then run initialization if it has not previously been invoked) but it also means that the application must call sqlite3_initialize() manually.If SQLite is compiled with - DSQLITE_OMIT_AUTOINIT and a routine like sqlite3_malloc() or sqlite3_vfs_find() or sqlite3_open() is invoked without first calling sqlite3_initialize(), the likely result will be a segfault
|
||||
#define SQLITE_OMIT_AUTORESET 1 //Mandate explicit reset of each query.
|
||||
#define SQLITE_DEFAULT_MMAP_SIZE 0x800000 //Enable memory mapped IO
|
||||
#define SQLITE_OMIT_SHARED_CACHE 1 //Irrelevant and harmful when WAL mode operative
|
||||
#ifndef _NDEBUG
|
||||
#define SQLITE_DEBUG 1
|
||||
#endif
|
||||
//#define SQLITE_ENABLE_ICU 1 //This option causes the International Components for Unicode or "ICU" extension to SQLite to be added to the build.
|
||||
// enabling
|
||||
// int sqlite3_stricmp(const char *, const char *);
|
||||
// int sqlite3_strnicmp(const char*, const char*, int);
|
||||
// sqlite3_strlike(P,X,E)
|
||||
// to do unicode uppercase and lowercase
|
||||
// The UCL library also provides a regex function (sqlite3_strlike being a rather truncated fragment of regex capability) but it is not available in SQL unless the application installs it at run time:
|
||||
// "If an application-defined SQL function named "regexp" is added at run-time, then the "X REGEXP Y" operator will be implemented as a call to "regexp(Y,X)".
|
||||
//
|
||||
//end my custom compile options*/
|
||||
/************** Include sqlite3.h in the middle of sqliteInt.h ***************/
|
||||
/************** Begin file sqlite3.h *****************************************/
|
||||
/*
|
||||
@ -395,27 +408,6 @@ extern "C" {
|
||||
** that require non-default calling conventions.
|
||||
*/
|
||||
|
||||
//My custom compile options
|
||||
#define SQLITE_DQS 0 //Doublequote names, single quote strings. This setting disables the double - quoted string literal misfeature.
|
||||
#define SQLITE_THREADSAFE 2 //Sets the default mode to SQLITE_CONFIG_MULTITHREAD. One thread, one database connection. Data structures such as compiled SQL are threadlocal. But sqlite3 is empowered to do its own multithreading. Many databases per database connection. Database connection and compiled sql statements are threadlocal. last_insert_rowid() is not subject to race conditions in this mode.
|
||||
#define SQLITE_DEFAULT_MEMSTATUS 0 //Don't track memory usage. Disables the ability of the program using sqlite3 to monitor its memory usage. This setting causes the sqlite3_status() interfaces that track memory usage to be disabled. This helps the sqlite3_malloc() routines run much faster, and since SQLite uses sqlite3_malloc() internally, this helps to make the entire library faster.
|
||||
#define SQLITE_DEFAULT_WAL_SYNCHRONOUS 1 // in WAL mode, recent changes to the database might be rolled back by a power loss, but the database will not be corrupted. Furthermore, transaction commit is much faster in WAL mode using synchronous=NORMAL than with the default synchronous=FULL. For these reasons, it is recommended that the synchronous setting be changed from FULL to NORMAL when switching to WAL mode. This compile-time option will accomplish that.
|
||||
#define SQLITE_DEFAULT_FOREIGN_KEYS 0 //Dont handle foreign key constraints. Programmer has to do it himself.
|
||||
#define SQLITE_LIKE_DOESNT_MATCH_BLOBS 1 //Blobs are not strings. Historically, SQLite has allowed BLOB operands to the LIKE and GLOB operators. But having a BLOB as an operand of LIKE or GLOB complicates and slows the LIKE optimization. When this option is set, it means that the LIKE and GLOB operators always return FALSE if either operand is a BLOB. That simplifies the implementation of the LIKE optimization and allows queries that use the LIKE optimization to run faster.
|
||||
#define SQLITE_MAX_EXPR_DEPTH 0 //Setting the maximum expression parse-tree depth to zero disables all checking of the expression parse-tree depth, which simplifies the code resulting in faster execution, and helps the parse tree to use less memory.
|
||||
#define SQLITE_OMIT_DECLTYPE 1 // By omitting the (seldom-needed) ability to return the declared type of columns from the result set of query, prepared statements can be made to consume less memory.
|
||||
#define SQLITE_OMIT_DEPRECATED 1
|
||||
#define SQLITE_DQS 0 //Don't accept double quoted string literals.
|
||||
#define SQLITE_OMIT_PROGRESS_CALLBACK 1
|
||||
#define SQLITE_OMIT_SHARED_CACHE 1
|
||||
#define SQLITE_OMIT_UTF16 1
|
||||
#define SQLITE_USE_ALLOCA 1 //Make use of alloca() for dynamically allocating temporary stack space for use within a single function, on systems that support alloca(). Without this option, temporary space is allocated from the heap
|
||||
#define SQLITE_OMIT_LOAD_EXTENSION 1
|
||||
#define SQLITE_TEMP_STORE 1 //Temporary files are stashed on disk when their cache overflows.
|
||||
#define SQLITE_OMIT_AUTOINIT 1 //.The SQLite library needs to be initialized using a call to sqlite3_initialize() before certain interfaces are used.This initialization normally happens automatically the first time it is needed.However, with the SQLITE_OMIT_AUTOINIT option, the automatic initialization is omitted.This helps many API calls to run a little faster(since they do not have to check to see if initialization has already occurred and then run initialization if it has not previously been invoked) but it also means that the application must call sqlite3_initialize() manually.If SQLite is compiled with - DSQLITE_OMIT_AUTOINIT and a routine like sqlite3_malloc() or sqlite3_vfs_find() or sqlite3_open() is invoked without first calling sqlite3_initialize(), the likely result will be a segfault
|
||||
//end my custom compile options*/
|
||||
|
||||
|
||||
#ifndef SQLITE_EXTERN
|
||||
# define SQLITE_EXTERN extern
|
||||
#endif
|
||||
|
@ -9,7 +9,7 @@ display_wallet::display_wallet(wxWindow* parent, wxFileName& walletfile) :
|
||||
m_read_from_misc(m_db),
|
||||
m_insert_name(m_db),
|
||||
m_find_position(m_db, R"|( SELECT COUNT(*) FROM UserZookoIDs
|
||||
WHERE LOWER("name")<LOWER(?1) OR (LOWER("name")=LOWER(?1) AND "name"<?1);)|")
|
||||
WHERE LOWER("name")<LOWER(?1) OR UNLIKELY(LOWER("name")=LOWER(?1) AND "name"<?1);)|")
|
||||
{
|
||||
wxLogMessage(wxT("Loading %s"), walletfile.GetFullPath());
|
||||
try {
|
||||
|
@ -352,12 +352,17 @@ void Frame::NewWallet(wxFileName& filename, ristretto255::hash<256>& secret) {
|
||||
// Disk operations to create wallet, which may throw.
|
||||
// This try/catch block exists to catch disk io issues.
|
||||
db.reset(Sqlite3_create(filename.GetFullPath().ToUTF8()));
|
||||
// To avoid legacy quirks and backward bug compatibility, every sqlite3 table needs an INTEGER PRIMARY KEY or a WITHOUT ROWID.
|
||||
// if you want a non integer primary key and do not want to use sqlite3's complicated backward bug compatibility special feature,
|
||||
// To avoid legacy quirks and backward bug compatibility, every sqlite3 table needs an
|
||||
// INTEGER PRIMARY KEY or a WITHOUT ROWID.
|
||||
// if you want a non integer primary key and do not want to use sqlite3's complicated
|
||||
// backward bug compatibility special feature, you use WITHOUTROWID or
|
||||
// instead use a CREATE INDEX rather than making the thing a primary key.
|
||||
db->exec(R"|(
|
||||
PRAGMA encoding = 'UTF-8';
|
||||
PRAGMA journal_mode = WAL;
|
||||
PRAGMA synchronous = 1;
|
||||
PRAGMA application_id = 618087585;
|
||||
PRAGMA user_version = -477629973;
|
||||
BEGIN IMMEDIATE TRANSACTION;
|
||||
CREATE TABLE "Keys"(
|
||||
"ROWID" INTEGER PRIMARY KEY,
|
||||
|
@ -12,6 +12,7 @@ constexpr bool debug_mode = true;
|
||||
static_assert(__cplusplus >= 201703L, "Out of date C syntax");
|
||||
#ifdef _WIN64
|
||||
constexpr bool b_WINDOWS = true;
|
||||
constexpr bool b_Linux = false;
|
||||
#else
|
||||
constexpr bool b_WINDOWS = false;
|
||||
#endif
|
||||
|
@ -266,11 +266,12 @@ static bool checkDataConversionsProduceExpected(void){
|
||||
}
|
||||
|
||||
static bool CheckForUtfEnvironment(void) {
|
||||
ILogMessage("\tChecking for UTF locale. ☺");
|
||||
ILogMessage("\tChecking for UTF-8 locale. ☺");
|
||||
try {
|
||||
bool utfEnvironment{ true };
|
||||
std::string cum{};
|
||||
if constexpr (b_WINDOWS) {
|
||||
#ifdef _WIN32
|
||||
{
|
||||
auto ACP{ GetACP() };
|
||||
// Check that windows thinks this is UTF8
|
||||
utfEnvironment = utfEnvironment && (ACP == 65001);
|
||||
@ -278,6 +279,34 @@ static bool CheckForUtfEnvironment(void) {
|
||||
cum += std::format("current code page {}, —should be 65001☹, ", ACP);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef __linux
|
||||
{
|
||||
//assume that in startup we have done setlocale(LC_CTYPE, "something.utf-8")
|
||||
// LC_CTYPE=UTF-8)
|
||||
// Problem is that UTF-8 is not necessarily a valid value. Sometimes
|
||||
// it has to be something like en_US.UTF-8
|
||||
// If it does not end in UTF-8, needs to be setlocale to C.UTF-8
|
||||
// You don't know what locales are available. C.UTF-8 is usually
|
||||
// available, but anything of the form "something.UTF-8" or "something.utf-8"
|
||||
// should work.
|
||||
if (nl_langinfo(CODESET)) != "UFT-8"){
|
||||
utfEnvironment = false;
|
||||
cum += std::format("current code page {}, —should be UTF-8☹, ", nl_langinfo(CODESET));
|
||||
// Any linux C or C++ program should automatically and always find itself by default
|
||||
// in the UTF-8 codeset on linux these days.
|
||||
\*"7.2 POSIX Locale
|
||||
Conforming systems shall provide a POSIX locale, also known as the C locale.In POSIX.1 the requirements for the POSIX locale are more extensive than the requirements for the C locale as specified in the ISO C standard.However, in a conforming POSIX implementation, the POSIX locale and the C locale are identical.The behavior of standard utilities and functions in the POSIX locale shall be as if the locale was defined via the localedef utility with input data from the POSIX locale tables in Locale Definition.
|
||||
|
||||
For C - language programs, the POSIX locale shall be the default locale when the setlocale() function is not called"*/"
|
||||
// Unicode sort and search that treats case as significant is not globally defined, but is language dependent. Where
|
||||
// consistent behavior is required, go posix, as sqlite does. (andles case only for ABC...Z) The ICU extension, which can be loaded
|
||||
// into sqlite, provides no end of additional, difficult to comprehend, behavior, which however tends to be language specific
|
||||
// you have to tell it which language it is dealing with. So useful only where we do not care about consistency.
|
||||
// Unix evades the endless depths of this problem by cheerfully making everything case sensitive and using binary collate.
|
||||
}
|
||||
}
|
||||
#endif
|
||||
auto FontEncoding{ wxLocale::GetSystemEncoding() };
|
||||
// check that wxWidgets thinks this is UTF8
|
||||
utfEnvironment = utfEnvironment && (FontEncoding == wxFONTENCODING_UTF8);
|
||||
|
Loading…
Reference in New Issue
Block a user