aboutsummaryrefslogtreecommitdiff
path: root/src/func.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/func.c')
-rw-r--r--src/func.c52
1 files changed, 43 insertions, 9 deletions
diff --git a/src/func.c b/src/func.c
index 19903e71d..bed675da8 100644
--- a/src/func.c
+++ b/src/func.c
@@ -775,19 +775,50 @@ static void sourceidFunc(
}
/*
-** Implementation of the sqlite_compile_opts() function. The result is a string
-** that identifies the compiler options used to build SQLite.
+** Implementation of the sqlite_compileoption_used() function.
+** The result is an integer that identifies if the compiler option
+** was used to build SQLite.
*/
-static void compileoptsFunc(
+#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
+static void compileoptionusedFunc(
sqlite3_context *context,
- int NotUsed,
- sqlite3_value **NotUsed2
+ int argc,
+ sqlite3_value **argv
){
- UNUSED_PARAMETER2(NotUsed, NotUsed2);
+ const char *zOptName;
+ assert( argc==1 );
+ UNUSED_PARAMETER(argc);
+ /* IMP: R-xxxx This function is an SQL wrapper around the
+ ** sqlite3_compileoption_used() C interface. */
+ if ( ( sqlite3_value_type(argv[0])==SQLITE_TEXT )
+ && ( (zOptName = sqlite3_value_text(argv[0]))!=0 )){
+ sqlite3_result_int(context, sqlite3_compileoption_used(zOptName));
+ }else{
+ sqlite3_result_null(context);
+ }
+}
+#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
+
+/*
+** Implementation of the sqlite_compileoption_get() function.
+** The result is a string that identifies the compiler options
+** used to build SQLite.
+*/
+#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
+static void compileoptiongetFunc(
+ sqlite3_context *context,
+ int argc,
+ sqlite3_value **argv
+){
+ int n;
+ assert( argc==1 );
+ UNUSED_PARAMETER(argc);
/* IMP: R-xxxx This function is an SQL wrapper around the
- ** sqlite3_compileopts() C interface. */
- sqlite3_result_text(context, sqlite3_compileopts(), -1, SQLITE_STATIC);
+ ** sqlite3_compileoption_get() C interface. */
+ n = sqlite3_value_int(argv[0]);
+ sqlite3_result_text(context, sqlite3_compileoption_get(n), -1, SQLITE_STATIC);
}
+#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
/* Array for converting from half-bytes (nybbles) into ASCII hex
** digits. */
@@ -1520,7 +1551,10 @@ void sqlite3RegisterGlobalFunctions(void){
FUNCTION(nullif, 2, 0, 1, nullifFunc ),
FUNCTION(sqlite_version, 0, 0, 0, versionFunc ),
FUNCTION(sqlite_source_id, 0, 0, 0, sourceidFunc ),
- FUNCTION(sqlite_compile_opts,0, 0, 0, compileoptsFunc ),
+#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
+ FUNCTION(sqlite_compile_option_used,1, 0, 0, compileoptionusedFunc ),
+ FUNCTION(sqlite_compile_option_get, 1, 0, 0, compileoptiongetFunc ),
+#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
FUNCTION(quote, 1, 0, 0, quoteFunc ),
FUNCTION(last_insert_rowid, 0, 0, 0, last_insert_rowid),
FUNCTION(changes, 0, 0, 0, changes ),