94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
-
-
+
+
-
+
|
/*
** All global variables are in this structure.
*/
struct Global {
int argc; char **argv; /* Command-line arguments to the program */
int isConst; /* True if the output is unchanging */
sqlite3 *db; /* The connection to the databases */
sqlite3 *dbConfig; /* Separate connection for global_config table */
sqlite4 *db; /* The connection to the databases */
sqlite4 *dbConfig; /* Separate connection for global_config table */
int useAttach; /* True if global_config is attached to repository */
int configOpen; /* True if the config database is open */
sqlite3_int64 now; /* Seconds since 1970 */
sqlite4_int64 now; /* Seconds since 1970 */
int repositoryOpen; /* True if the main repository database is open */
char *zRepositoryName; /* Name of the repository database */
const char *zMainDbType;/* "configdb", "localdb", or "repository" */
const char *zHome; /* Name of user home directory */
int localOpen; /* True if the local database is open */
char *zLocalRoot; /* The directory holding the local database */
int minPrefix; /* Number of digits needed for a distinct UUID */
|
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
|
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
|
-
+
|
#ifdef FOSSIL_ENABLE_TCL
g.tcl.argc = argc;
g.tcl.argv = argv;
g.tcl.interp = 0;
#endif
sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0);
sqlite4_env_config(0, SQLITE_ENVCONFIG_LOG, fossil_sqlite_log, 0);
memset(&g, 0, sizeof(g));
g.now = time(0);
g.argc = argc;
g.argv = argv;
#ifdef FOSSIL_ENABLE_JSON
#if defined(NDEBUG)
g.json.errorDetailParanoia = 2 /* FIXME: make configurable
|
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
|
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
|
-
+
|
case SQLITE_MISMATCH: return "SQLITE_MISMATCH";
case SQLITE_MISUSE: return "SQLITE_MISUSE";
case SQLITE_NOLFS: return "SQLITE_NOLFS";
case SQLITE_FORMAT: return "SQLITE_FORMAT";
case SQLITE_RANGE: return "SQLITE_RANGE";
case SQLITE_NOTADB: return "SQLITE_NOTADB";
default: {
sqlite3_snprintf(sizeof(zCode),zCode,"error code %d",iCode);
sqlite4_snprintf(zCode, sizeof(zCode), "error code %d",iCode);
}
}
return zCode;
}
/* Error logs from SQLite */
void fossil_sqlite_log(void *notUsed, int iCode, const char *zErrmsg){
|