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
diff --git a/src/func.c b/src/func.c
index 6243536..2766fa3 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 @@
}
/*
-** 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 @@
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 @@
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 994cc07..b739d0d 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 87996db..24c8d88 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 @@
** 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);
/*