1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Rework the code in ctime.c a bit to report on more compile time options. And

to only output configuration options passed in to SQLite, not the default
values of #define symbols set automatically. Also generate the large array in
ctime.c using new script tool/mkctime.tcl, instead of entering it manually.

FossilOrigin-Name: bc1951d699e6eeacbe15776a37cd0f5cf3f09eb85d3ae01cff43293cb286fcd7
This commit is contained in:
dan
2017-06-16 19:51:47 +00:00
parent ba87c6c2cd
commit da1f49b83f
8 changed files with 725 additions and 114 deletions

View File

@@ -4102,3 +4102,55 @@ void sqlite3_snapshot_free(sqlite3_snapshot *pSnapshot){
sqlite3_free(pSnapshot);
}
#endif /* SQLITE_ENABLE_SNAPSHOT */
#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
/*
** Given the name of a compile-time option, return true if that option
** was used and false if not.
**
** The name can optionally begin with "SQLITE_" but the "SQLITE_" prefix
** is not required for a match.
*/
int sqlite3_compileoption_used(const char *zOptName){
int i, n;
int nOpt;
const char **azCompileOpt;
#if SQLITE_ENABLE_API_ARMOR
if( zOptName==0 ){
(void)SQLITE_MISUSE_BKPT;
return 0;
}
#endif
azCompileOpt = sqlite3CompileOptions(&nOpt);
if( sqlite3StrNICmp(zOptName, "SQLITE_", 7)==0 ) zOptName += 7;
n = sqlite3Strlen30(zOptName);
/* Since nOpt is normally in single digits, a linear search is
** adequate. No need for a binary search. */
for(i=0; i<nOpt; i++){
if( sqlite3StrNICmp(zOptName, azCompileOpt[i], n)==0
&& sqlite3IsIdChar((unsigned char)azCompileOpt[i][n])==0
){
return 1;
}
}
return 0;
}
/*
** Return the N-th compile-time option string. If N is out of range,
** return a NULL pointer.
*/
const char *sqlite3_compileoption_get(int N){
int nOpt;
const char **azCompileOpt;
azCompileOpt = sqlite3CompileOptions(&nOpt);
if( N>=0 && N<nOpt ){
return azCompileOpt[N];
}
return 0;
}
#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */