diff options
author | drh <drh@noemail.net> | 2009-08-14 16:01:24 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2009-08-14 16:01:24 +0000 |
commit | 47baebc2a68f03c7625b48d94df2df0c54cc0f99 (patch) | |
tree | 7474018643d0fbc508a6b2a77b3cf211fcc91c1c /src | |
parent | 9e42f8ac1a132d19fbba1b5a8f1d66f4d36c71ca (diff) | |
download | sqlite-47baebc2a68f03c7625b48d94df2df0c54cc0f99.tar.gz sqlite-47baebc2a68f03c7625b48d94df2df0c54cc0f99.zip |
Incorporate fossil-scm version information into the build. Add the
SQLITE_SOURCE_ID macro to the header. Add the sqlite3_sourceid() interface.
Add the sqlite_source_id() SQL function.
FossilOrigin-Name: 302dabe98f50b472bccd65c58504bc8a330049c4
Diffstat (limited to 'src')
-rw-r--r-- | src/func.c | 19 | ||||
-rw-r--r-- | src/main.c | 3 | ||||
-rw-r--r-- | src/sqlite.h.in | 27 |
3 files changed, 35 insertions, 14 deletions
diff --git a/src/func.c b/src/func.c index 6243536cb..2766fa3b1 100644 --- a/src/func.c +++ b/src/func.c @@ -15,8 +15,6 @@ ** There is only one exported symbol in this file - the function ** sqliteRegisterBuildinFunctions() found at the bottom of the file. ** All other code has file scope. -** -** $Id: func.c,v 1.239 2009/06/19 16:44:41 drh Exp $ */ #include "sqliteInt.h" #include <stdlib.h> @@ -702,7 +700,7 @@ static void nullifFunc( } /* -** Implementation of the VERSION(*) function. The result is the version +** Implementation of the sqlite_version() function. The result is the version ** of the SQLite library that is running. */ static void versionFunc( @@ -714,6 +712,20 @@ static void versionFunc( sqlite3_result_text(context, sqlite3_version, -1, SQLITE_STATIC); } +/* +** Implementation of the sqlite_source_id() function. The result is a string +** that identifies the particular version of the source code used to build +** SQLite. +*/ +static void sourceidFunc( + sqlite3_context *context, + int NotUsed, + sqlite3_value **NotUsed2 +){ + UNUSED_PARAMETER2(NotUsed, NotUsed2); + sqlite3_result_text(context, SQLITE_SOURCE_ID, -1, SQLITE_STATIC); +} + /* Array for converting from half-bytes (nybbles) into ASCII hex ** digits. */ static const char hexdigits[] = { @@ -1433,6 +1445,7 @@ void sqlite3RegisterGlobalFunctions(void){ FUNCTION(randomblob, 1, 0, 0, randomBlob ), FUNCTION(nullif, 2, 0, 1, nullifFunc ), FUNCTION(sqlite_version, 0, 0, 0, versionFunc ), + FUNCTION(sqlite_source_id, 0, 0, 0, sourceidFunc ), FUNCTION(quote, 1, 0, 0, quoteFunc ), FUNCTION(last_insert_rowid, 0, 0, 0, last_insert_rowid), FUNCTION(changes, 0, 0, 0, changes ), diff --git a/src/main.c b/src/main.c index 994cc0770..b739d0d20 100644 --- a/src/main.c +++ b/src/main.c @@ -13,8 +13,6 @@ ** implement the programmer interface to the library. Routines in ** other files are for internal use by SQLite and should not be ** accessed by users of the library. -** -** $Id: main.c,v 1.562 2009/07/20 11:32:03 drh Exp $ */ #include "sqliteInt.h" @@ -35,6 +33,7 @@ const char sqlite3_version[] = SQLITE_VERSION; #endif const char *sqlite3_libversion(void){ return sqlite3_version; } +const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; } int sqlite3_libversion_number(void){ return SQLITE_VERSION_NUMBER; } int sqlite3_threadsafe(void){ return SQLITE_THREADSAFE; } diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 87996dbd9..24c8d884e 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -29,8 +29,6 @@ ** The makefile makes some minor changes to this file (such as inserting ** the version number) and changes its name to "sqlite3.h" as ** part of the build process. -** -** @(#) $Id: sqlite.h.in,v 1.462 2009/08/06 17:40:46 drh Exp $ */ #ifndef _SQLITE3_H_ #define _SQLITE3_H_ @@ -95,33 +93,44 @@ extern "C" { ** The Z value is the release number and is incremented with ** each release but resets back to 0 whenever Y is incremented. ** +** Since version 3.6.18, SQLite source code has been stored in the +** "fossil" configuration management system. The SQLITE_SOURCE_ID +** macro is a string which identifies a particular check-in of SQLite +** within its configuration management system. The string contains the +** date and time of the check-in (UTC) and an SHA1 hash of the entire +** source tree. +** ** See also: [sqlite3_libversion()] and [sqlite3_libversion_number()]. ** ** Requirements: [H10011] [H10014] */ -#define SQLITE_VERSION "--VERS--" -#define SQLITE_VERSION_NUMBER --VERSION-NUMBER-- +#define SQLITE_VERSION "--VERS--" +#define SQLITE_VERSION_NUMBER --VERSION-NUMBER-- +#define SQLITE_SOURCE_ID "--SOURCE-ID--" /* ** CAPI3REF: Run-Time Library Version Numbers {H10020} <S60100> ** KEYWORDS: sqlite3_version ** -** These features provide the same information as the [SQLITE_VERSION] -** and [SQLITE_VERSION_NUMBER] #defines in the header, but are associated -** with the library instead of the header file. Cautious programmers might -** include a check in their application to verify that +** These interfaces provide the same information as the [SQLITE_VERSION], +** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] #defines in the header, +** but are associated with the library instead of the header file. Cautious +** programmers might include a check in their application to verify that ** sqlite3_libversion_number() always returns the value ** [SQLITE_VERSION_NUMBER]. ** ** The sqlite3_libversion() function returns the same information as is ** in the sqlite3_version[] string constant. The function is provided ** for use in DLLs since DLL users usually do not have direct access to string -** constants within the DLL. +** constants within the DLL. Similarly, the sqlite3_sourceid() function +** returns the same information as is in the [SQLITE_SOURCE_ID] #define of +** the header file. ** ** Requirements: [H10021] [H10022] [H10023] */ SQLITE_EXTERN const char sqlite3_version[]; const char *sqlite3_libversion(void); +const char *sqlite3_sourceid(void); int sqlite3_libversion_number(void); /* |