adjustments to version reporting

This commit is contained in:
Stephen Lombardo 2018-10-17 20:31:23 -04:00
parent 7e805e5388
commit 787cbae31a
2 changed files with 16 additions and 7 deletions

View File

@ -39,10 +39,6 @@
#include "sqlcipher-license.h"
#endif
static const char* codec_get_cipher_version() {
return CIPHER_VERSION;
}
/* Generate code to return a string value */
static void codec_vdbe_return_static_string(Parse *pParse, const char *zLabel, const char *value){
Vdbe *v = sqlite3GetVdbe(pParse);
@ -166,7 +162,13 @@ int sqlcipher_codec_pragma(sqlite3* db, int iDb, Parse *pParse, const char *zLef
}
} else
if( sqlite3StrICmp(zLeft, "cipher_version")==0 && !zRight ){
codec_vdbe_return_static_string(pParse, "cipher_version", codec_get_cipher_version());
#ifdef CIPHER_VERSION_QUALIFIER
char *version = sqlite3_mprintf("%s %s %s", CIPHER_XSTR(CIPHER_VERSION_NUMBER), CIPHER_XSTR(CIPHER_VERSION_QUALIFIER), CIPHER_XSTR(CIPHER_VERSION_BUILD));
#else
char *version = sqlite3_mprintf("%s %s", CIPHER_XSTR(CIPHER_VERSION_NUMBER), CIPHER_XSTR(CIPHER_VERSION_BUILD));
#endif
codec_vdbe_return_static_string(pParse, "cipher_version", version);
sqlite3_free(version);
}else
if( sqlite3StrICmp(zLeft, "cipher")==0 ){
if(ctx) {

View File

@ -54,8 +54,15 @@ void sqlite3pager_reset(Pager *pPager);
#define FILE_HEADER_SZ 16
#ifndef CIPHER_VERSION
#define CIPHER_VERSION "4.0.0 community"
#define CIPHER_XSTR(s) CIPHER_STR(s)
#define CIPHER_STR(s) #s
#ifndef CIPHER_VERSION_NUMBER
#define CIPHER_VERSION_NUMBER 4.0.0
#endif
#ifndef CIPHER_VERSION_BUILD
#define CIPHER_VERSION_BUILD community
#endif
#define CIPHER_DECRYPT 0