Reference sqlite3ErrName instead of copying it. This requires SQLite3 patching

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2022-11-25 11:31:05 +01:00
parent 51b2b71756
commit 5252aeb077
5 changed files with 59 additions and 112 deletions
@@ -0,0 +1,30 @@
diff --git a/src/database/shell.c b/src/database/shell.c
index 6280ebf6..a5e82f70 100644
--- a/src/database/shell.c
+++ b/src/database/shell.c
@@ -126,6 +126,8 @@ typedef unsigned char u8;
#endif
#include <ctype.h>
#include <stdarg.h>
+// print_FTL_version()
+#include "../log.h"
#if !defined(_WIN32) && !defined(WIN32)
# include <signal.h>
@@ -25855,7 +25857,7 @@ static char *cmdline_option_value(int argc, char **argv, int i){
#endif
#if SQLITE_SHELL_IS_UTF8
-int SQLITE_CDECL main(int argc, char **argv){
+int SQLITE_CDECL sqlite3_shell_main(int argc, char **argv){
#else
int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
char **argv;
@@ -26377,6 +26379,7 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
char *zHome;
char *zHistory;
int nHistory;
+ print_FTL_version();
printf(
"SQLite version %s %.19s\n" /*extra-version-info*/
"Enter \".help\" for usage hints.\n",
@@ -0,0 +1,22 @@
diff --git a/src/database/sqlite3.c b/src/database/sqlite3.c
index 2763b1b4..55f88efb 100644
--- a/src/database/sqlite3.c
+++ b/src/database/sqlite3.c
@@ -173885,8 +173885,7 @@ SQLITE_PRIVATE void sqlite3RollbackAll(sqlite3 *db, int tripCode){
** Return a static string containing the name corresponding to the error code
** specified in the argument.
*/
-#if defined(SQLITE_NEED_ERR_NAME)
-SQLITE_PRIVATE const char *sqlite3ErrName(int rc){
+SQLITE_API const char *sqlite3ErrName(int rc){
const char *zName = 0;
int i, origRc = rc;
for(i=0; i<2 && zName==0; i++, rc &= 0xff){
@@ -173991,7 +173990,6 @@ SQLITE_PRIVATE const char *sqlite3ErrName(int rc){
}
return zName;
}
-#endif
/*
** Return a static string that describes the kind of error specified in the