From 0295b255a5bede27b481aa6769469919a45a961a Mon Sep 17 00:00:00 2001 From: Stephen Lombardo Date: Wed, 12 Jun 2019 16:13:25 -0400 Subject: [PATCH] extension point for additional built in functions --- src/crypto.c | 4 ++++ src/func.c | 15 +++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/crypto.c b/src/crypto.c index 64d1eae..5016020 100644 --- a/src/crypto.c +++ b/src/crypto.c @@ -1151,5 +1151,9 @@ end_of_export: #endif +#ifdef SQLCIPHER_FUNCS +#include "sqlcipher-func.c" +#endif + /* END SQLCIPHER */ #endif diff --git a/src/func.c b/src/func.c index 2b4e54f..39bc754 100644 --- a/src/func.c +++ b/src/func.c @@ -1791,13 +1791,6 @@ static void groupConcatValue(sqlite3_context *context){ */ void sqlite3RegisterPerConnectionBuiltinFunctions(sqlite3 *db){ int rc = sqlite3_overload_function(db, "MATCH", 2); -/* BEGIN SQLCIPHER */ -#ifdef SQLITE_HAS_CODEC -#ifndef OMIT_EXPORT - extern void sqlcipher_exportFunc(sqlite3_context *, int, sqlite3_value **); -#endif -#endif -/* END SQLCIPHER */ assert( rc==SQLITE_NOMEM || rc==SQLITE_OK ); if( rc==SQLITE_NOMEM ){ sqlite3OomFault(db); @@ -1805,7 +1798,13 @@ void sqlite3RegisterPerConnectionBuiltinFunctions(sqlite3 *db){ /* BEGIN SQLCIPHER */ #ifdef SQLITE_HAS_CODEC #ifndef OMIT_EXPORT - sqlite3CreateFunc(db, "sqlcipher_export", -1, SQLITE_TEXT, 0, sqlcipher_exportFunc, 0, 0, 0, 0, 0); + { + extern void sqlcipher_exportFunc(sqlite3_context *, int, sqlite3_value **); + sqlite3CreateFunc(db, "sqlcipher_export", -1, SQLITE_TEXT, 0, sqlcipher_exportFunc, 0, 0, 0, 0, 0); + } +#endif +#ifdef SQLCIPHER_FUNCS +#include "sqlcipher-func.h" #endif #endif /* END SQLCIPHER */