Skip to content

Commit 9128aba

Browse files
authored
Merge 'Cosmetics for libSQL version 0.1.0' from Piotr Sarna (#73)
This pull request adds a LIBSQL_VERSION file where libSQL release number is stored (and currently set to 0.1.0), and also hooked to be available programmatically, just like its cousin, VERSION file, which still stores the SQLite release number we're based on. It also rebrands the shell to libsql, to be clear that we forked, and potenially leave us a gateway to break backward compatibility if necessary.
2 parents 7402694 + 30cff01 commit 9128aba

7 files changed

Lines changed: 26 additions & 7 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,4 @@ srcck1
5454
test-out.txt
5555
test/rust_suite/target
5656
testfixture
57+
libsql

LIBSQL_VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.1.0

Makefile.in

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ ST_OPT = -DSQLITE_OS_KV_OPTIONAL
651651
# This is the default Makefile target. The objects listed here
652652
# are what get build when you type just "make" with no arguments.
653653
#
654-
all: sqlite3.h libsqlite3.la sqlite3$(TEXE) $(HAVE_TCL:1=libtclsqlite3.la)
654+
all: sqlite3.h libsqlite3.la sqlite3$(TEXE) libsql$(TEXE) $(HAVE_TCL:1=libtclsqlite3.la)
655655

656656
Makefile: $(TOP)/Makefile.in
657657
./config.status
@@ -675,6 +675,9 @@ sqlite3$(TEXE): shell.c sqlite3.c
675675
shell.c sqlite3.c \
676676
$(LIBREADLINE) $(TLIBS) -rpath "$(libdir)"
677677

678+
libsql$(TEXE): sqlite3$(TEXE)
679+
cp sqlite3$(TEXE) libsql$(TEXE)
680+
678681
sqldiff$(TEXE): $(TOP)/tool/sqldiff.c sqlite3.lo sqlite3.h
679682
$(LTLINK) -o $@ $(TOP)/tool/sqldiff.c sqlite3.lo $(TLIBS)
680683

@@ -1494,7 +1497,7 @@ tcl_install: lib_install libtclsqlite3.la pkgIndex.tcl
14941497
$(INSTALL) -m 0644 pkgIndex.tcl $(DESTDIR)$(TCLLIBDIR)
14951498

14961499
clean:
1497-
rm -f *.lo *.la *.o sqlite3$(TEXE) libsqlite3.la
1500+
rm -f *.lo *.la *.o sqlite3$(TEXE) libsql$(TEXE) libsqlite3.la
14981501
rm -f sqlite3.h opcodes.*
14991502
rm -rf .libs .deps
15001503
rm -f lemon$(BEXE) lempar.c parse.* sqlite*.tar.gz

src/main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,16 @@ static int (*const sqlite3BuiltinExtensions[])(sqlite3*) = {
100100
** contains the text of SQLITE_VERSION macro.
101101
*/
102102
const char sqlite3_version[] = SQLITE_VERSION;
103+
const char libsql_version[] = LIBSQL_VERSION;
103104
#endif
104105

105106
/* IMPLEMENTATION-OF: R-53536-42575 The sqlite3_libversion() function returns
106107
** a pointer to the to the sqlite3_version[] string constant.
107108
*/
108109
const char *sqlite3_libversion(void){ return sqlite3_version; }
109110

111+
const char *libsql_libversion(void){ return LIBSQL_VERSION; }
112+
110113
/* IMPLEMENTATION-OF: R-25063-23286 The sqlite3_sourceid() function returns a
111114
** pointer to a string constant whose value is the same as the
112115
** SQLITE_SOURCE_ID C preprocessor macro. Except if SQLite is built using

src/shell.c.in

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10758,8 +10758,8 @@ static int do_meta_command(char *zLine, ShellState *p){
1075810758
#endif /* SQLITE_USER_AUTHENTICATION */
1075910759

1076010760
if( c=='v' && cli_strncmp(azArg[0], "version", n)==0 ){
10761-
utf8_printf(p->out, "SQLite %s %s\n" /*extra-version-info*/,
10762-
sqlite3_libversion(), sqlite3_sourceid());
10761+
utf8_printf(p->out, "libSQL %s (based on SQLite %s) %s\n" /*extra-version-info*/,
10762+
libsql_libversion(), sqlite3_libversion(), sqlite3_sourceid());
1076310763
#if SQLITE_HAVE_ZLIB
1076410764
utf8_printf(p->out, "zlib version %s\n", zlibVersion());
1076510765
#endif
@@ -11860,7 +11860,7 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
1186011860
}else if( cli_strcmp(z,"-bail")==0 ){
1186111861
/* No-op. The bail_on_error flag should already be set. */
1186211862
}else if( cli_strcmp(z,"-version")==0 ){
11863-
printf("%s %s\n", sqlite3_libversion(), sqlite3_sourceid());
11863+
printf("%s %s (libSQL %s)\n", sqlite3_libversion(), sqlite3_sourceid(), libsql_libversion());
1186411864
return 0;
1186511865
}else if( cli_strcmp(z,"-interactive")==0 ){
1186611866
stdin_is_interactive = 1;
@@ -11979,9 +11979,9 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
1197911979
char *zHistory;
1198011980
int nHistory;
1198111981
printf(
11982-
"SQLite version %s %.19s\n" /*extra-version-info*/
11982+
"libSQL version %s (based on SQLite version %s) %.19s\n" /*extra-version-info*/
1198311983
"Enter \".help\" for usage hints.\n",
11984-
sqlite3_libversion(), sqlite3_sourceid()
11984+
libsql_libversion(), sqlite3_libversion(), sqlite3_sourceid()
1198511985
);
1198611986
if( warnInmemoryDb ){
1198711987
printf("Connected to a ");

src/sqlite.h.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ extern "C" {
150150
#define SQLITE_VERSION_NUMBER --VERSION-NUMBER--
151151
#define SQLITE_SOURCE_ID "--SOURCE-ID--"
152152

153+
#define LIBSQL_VERSION "--LIBSQL-VERS--"
154+
153155
/*
154156
** CAPI3REF: Run-Time Library Version Numbers
155157
** KEYWORDS: sqlite3_version sqlite3_sourceid
@@ -187,6 +189,8 @@ const char *sqlite3_libversion(void);
187189
const char *sqlite3_sourceid(void);
188190
int sqlite3_libversion_number(void);
189191

192+
const char *libsql_libversion(void);
193+
190194
/*
191195
** CAPI3REF: Run-Time Library Compilation Options Diagnostics
192196
**

tool/mksqlite3h.tcl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ set zVersion [string trim [read $in]]
5151
close $in
5252
set nVersion [eval format "%d%03d%03d" [split $zVersion .]]
5353

54+
# Get libSQL version number accordingly
55+
set in [open $TOP/LIBSQL_VERSION]
56+
set zLibSQLVersion [string trim [read $in]]
57+
close $in
58+
5459
# Get the source-id
5560
#
5661
set PWD [pwd]
@@ -118,6 +123,8 @@ foreach file $filelist {
118123
regsub -- --VERSION-NUMBER-- $line $nVersion line
119124
regsub -- --SOURCE-ID-- $line "$zSourceId" line
120125
126+
regsub -- --LIBSQL-VERS-- $line $zLibSQLVersion line
127+
121128
if {[regexp $varpattern $line] && ![regexp {^ *typedef} $line]} {
122129
set line "SQLITE_API $line"
123130
} else {

0 commit comments

Comments
 (0)