Fossil SCM

Backout [77d37d910b], which puts back the "fossil sqlite3" command when compiled with --disable-internal-sqlite. Take over matching "shell.c" from SQLite, but relax SQLite version check, otherwise "fossil sqlite3" doesn't work (that was the reason for taking out "fossil sqlite3" in the first place, but at least OpenBSD wants to support it). See: [https://www.mail-archive.com/[email protected]/msg14185.html]

jan.nijtmans 2014-01-23 08:51 trunk
Commit d68cd57a9dcf5aafdb3c88bbdf88a42df234dcfa
+2 -2
--- src/main.mk
+++ src/main.mk
@@ -392,21 +392,21 @@
392392
# The USE_SYSTEM_SQLITE variable may be undefined, set to 0, or set
393393
# to 1. If it is set to 1, then there is no need to build or link
394394
# the sqlite3.o object. Instead, the system sqlite will be linked
395395
# using -lsqlite3.
396396
SQLITE3_OBJ.1 =
397
-SQLITE3_OBJ.0 = $(OBJDIR)/sqlite3.o $(OBJDIR)/shell.o
397
+SQLITE3_OBJ.0 = $(OBJDIR)/sqlite3.o
398398
SQLITE3_OBJ. = $(SQLITE3_OBJ.0)
399399
400400
# The FOSSIL_ENABLE_TCL variable may be undefined, set to 0, or set to 1.
401401
# If it is set to 1, then we need to build the Tcl integration code and
402402
# link to the Tcl library.
403403
TCL_OBJ.0 =
404404
TCL_OBJ.1 = $(OBJDIR)/th_tcl.o
405405
TCL_OBJ. = $(TCL_OBJ.0)
406406
407
-EXTRAOBJ = $(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE)) $(OBJDIR)/th.o $(OBJDIR)/th_lang.o $(TCL_OBJ.$(FOSSIL_ENABLE_TCL)) $(OBJDIR)/cson_amalgamation.o
407
+EXTRAOBJ = $(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE)) $(OBJDIR)/shell.o $(OBJDIR)/th.o $(OBJDIR)/th_lang.o $(TCL_OBJ.$(FOSSIL_ENABLE_TCL)) $(OBJDIR)/cson_amalgamation.o
408408
409409
$(APPNAME): $(OBJDIR)/headers $(OBJ) $(EXTRAOBJ)
410410
$(TCC) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB)
411411
412412
# This rule prevents make from using its default rules to try build
413413
--- src/main.mk
+++ src/main.mk
@@ -392,21 +392,21 @@
392 # The USE_SYSTEM_SQLITE variable may be undefined, set to 0, or set
393 # to 1. If it is set to 1, then there is no need to build or link
394 # the sqlite3.o object. Instead, the system sqlite will be linked
395 # using -lsqlite3.
396 SQLITE3_OBJ.1 =
397 SQLITE3_OBJ.0 = $(OBJDIR)/sqlite3.o $(OBJDIR)/shell.o
398 SQLITE3_OBJ. = $(SQLITE3_OBJ.0)
399
400 # The FOSSIL_ENABLE_TCL variable may be undefined, set to 0, or set to 1.
401 # If it is set to 1, then we need to build the Tcl integration code and
402 # link to the Tcl library.
403 TCL_OBJ.0 =
404 TCL_OBJ.1 = $(OBJDIR)/th_tcl.o
405 TCL_OBJ. = $(TCL_OBJ.0)
406
407 EXTRAOBJ = $(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE)) $(OBJDIR)/th.o $(OBJDIR)/th_lang.o $(TCL_OBJ.$(FOSSIL_ENABLE_TCL)) $(OBJDIR)/cson_amalgamation.o
408
409 $(APPNAME): $(OBJDIR)/headers $(OBJ) $(EXTRAOBJ)
410 $(TCC) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB)
411
412 # This rule prevents make from using its default rules to try build
413
--- src/main.mk
+++ src/main.mk
@@ -392,21 +392,21 @@
392 # The USE_SYSTEM_SQLITE variable may be undefined, set to 0, or set
393 # to 1. If it is set to 1, then there is no need to build or link
394 # the sqlite3.o object. Instead, the system sqlite will be linked
395 # using -lsqlite3.
396 SQLITE3_OBJ.1 =
397 SQLITE3_OBJ.0 = $(OBJDIR)/sqlite3.o
398 SQLITE3_OBJ. = $(SQLITE3_OBJ.0)
399
400 # The FOSSIL_ENABLE_TCL variable may be undefined, set to 0, or set to 1.
401 # If it is set to 1, then we need to build the Tcl integration code and
402 # link to the Tcl library.
403 TCL_OBJ.0 =
404 TCL_OBJ.1 = $(OBJDIR)/th_tcl.o
405 TCL_OBJ. = $(TCL_OBJ.0)
406
407 EXTRAOBJ = $(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE)) $(OBJDIR)/shell.o $(OBJDIR)/th.o $(OBJDIR)/th_lang.o $(TCL_OBJ.$(FOSSIL_ENABLE_TCL)) $(OBJDIR)/cson_amalgamation.o
408
409 $(APPNAME): $(OBJDIR)/headers $(OBJ) $(EXTRAOBJ)
410 $(TCC) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB)
411
412 # This rule prevents make from using its default rules to try build
413
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -261,11 +261,11 @@
261261
# The USE_SYSTEM_SQLITE variable may be undefined, set to 0, or set
262262
# to 1. If it is set to 1, then there is no need to build or link
263263
# the sqlite3.o object. Instead, the system sqlite will be linked
264264
# using -lsqlite3.
265265
SQLITE3_OBJ.1 =
266
-SQLITE3_OBJ.0 = $(OBJDIR)/sqlite3.o $(OBJDIR)/shell.o
266
+SQLITE3_OBJ.0 = $(OBJDIR)/sqlite3.o
267267
SQLITE3_OBJ. = $(SQLITE3_OBJ.0)
268268
269269
# The FOSSIL_ENABLE_TCL variable may be undefined, set to 0, or set to 1.
270270
# If it is set to 1, then we need to build the Tcl integration code and
271271
# link to the Tcl library.
@@ -273,10 +273,11 @@
273273
TCL_OBJ.1 = $(OBJDIR)/th_tcl.o
274274
TCL_OBJ. = $(TCL_OBJ.0)
275275
276276
EXTRAOBJ = \
277277
$(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE)) \
278
+ $(OBJDIR)/shell.o \
278279
$(OBJDIR)/th.o \
279280
$(OBJDIR)/th_lang.o \
280281
$(TCL_OBJ.$(FOSSIL_ENABLE_TCL)) \
281282
$(OBJDIR)/cson_amalgamation.o
282283
283284
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -261,11 +261,11 @@
261 # The USE_SYSTEM_SQLITE variable may be undefined, set to 0, or set
262 # to 1. If it is set to 1, then there is no need to build or link
263 # the sqlite3.o object. Instead, the system sqlite will be linked
264 # using -lsqlite3.
265 SQLITE3_OBJ.1 =
266 SQLITE3_OBJ.0 = $(OBJDIR)/sqlite3.o $(OBJDIR)/shell.o
267 SQLITE3_OBJ. = $(SQLITE3_OBJ.0)
268
269 # The FOSSIL_ENABLE_TCL variable may be undefined, set to 0, or set to 1.
270 # If it is set to 1, then we need to build the Tcl integration code and
271 # link to the Tcl library.
@@ -273,10 +273,11 @@
273 TCL_OBJ.1 = $(OBJDIR)/th_tcl.o
274 TCL_OBJ. = $(TCL_OBJ.0)
275
276 EXTRAOBJ = \
277 $(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE)) \
 
278 $(OBJDIR)/th.o \
279 $(OBJDIR)/th_lang.o \
280 $(TCL_OBJ.$(FOSSIL_ENABLE_TCL)) \
281 $(OBJDIR)/cson_amalgamation.o
282
283
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -261,11 +261,11 @@
261 # The USE_SYSTEM_SQLITE variable may be undefined, set to 0, or set
262 # to 1. If it is set to 1, then there is no need to build or link
263 # the sqlite3.o object. Instead, the system sqlite will be linked
264 # using -lsqlite3.
265 SQLITE3_OBJ.1 =
266 SQLITE3_OBJ.0 = $(OBJDIR)/sqlite3.o
267 SQLITE3_OBJ. = $(SQLITE3_OBJ.0)
268
269 # The FOSSIL_ENABLE_TCL variable may be undefined, set to 0, or set to 1.
270 # If it is set to 1, then we need to build the Tcl integration code and
271 # link to the Tcl library.
@@ -273,10 +273,11 @@
273 TCL_OBJ.1 = $(OBJDIR)/th_tcl.o
274 TCL_OBJ. = $(TCL_OBJ.0)
275
276 EXTRAOBJ = \
277 $(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE)) \
278 $(OBJDIR)/shell.o \
279 $(OBJDIR)/th.o \
280 $(OBJDIR)/th_lang.o \
281 $(TCL_OBJ.$(FOSSIL_ENABLE_TCL)) \
282 $(OBJDIR)/cson_amalgamation.o
283
284
+6 -6
--- src/shell.c
+++ src/shell.c
@@ -1175,11 +1175,11 @@
11751175
** all opcodes that occur between the p2 jump destination and the opcode
11761176
** itself by 2 spaces.
11771177
**
11781178
** * For each "Goto", if the jump destination is earlier in the program
11791179
** and ends on one of:
1180
-** Yield SeekGt SeekLt RowSetRead
1180
+** Yield SeekGt SeekLt RowSetRead Rewind
11811181
** then indent all opcodes between the earlier instruction
11821182
** and "Goto" by 2 spaces.
11831183
*/
11841184
static void explain_data_prepare(struct callback_data *p, sqlite3_stmt *pSql){
11851185
const char *zSql; /* The text of the SQL statement */
@@ -1187,11 +1187,11 @@
11871187
int *abYield = 0; /* True if op is an OP_Yield */
11881188
int nAlloc = 0; /* Allocated size of p->aiIndent[], abYield */
11891189
int iOp; /* Index of operation in p->aiIndent[] */
11901190
11911191
const char *azNext[] = { "Next", "Prev", "VPrev", "VNext", "SorterNext", 0 };
1192
- const char *azYield[] = { "Yield", "SeekLt", "SeekGt", "RowSetRead", 0 };
1192
+ const char *azYield[] = { "Yield", "SeekLt", "SeekGt", "RowSetRead", "Rewind", 0 };
11931193
const char *azGoto[] = { "Goto", 0 };
11941194
11951195
/* Try to figure out if this is really an EXPLAIN statement. If this
11961196
** cannot be verified, return early. */
11971197
zSql = sqlite3_sql(pSql);
@@ -1224,11 +1224,11 @@
12241224
12251225
if( str_in_array(zOp, azNext) ){
12261226
for(i=p2op; i<iOp; i++) p->aiIndent[i] += 2;
12271227
}
12281228
if( str_in_array(zOp, azGoto) && p2op<p->nIndent && abYield[p2op] ){
1229
- for(i=p2op; i<iOp; i++) p->aiIndent[i] += 2;
1229
+ for(i=p2op+1; i<iOp; i++) p->aiIndent[i] += 2;
12301230
}
12311231
}
12321232
12331233
p->iIndent = 0;
12341234
sqlite3_free(abYield);
@@ -3301,13 +3301,13 @@
33013301
const char *zInitFile = 0;
33023302
char *zFirstCmd = 0;
33033303
int i;
33043304
int rc = 0;
33053305
3306
- if( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)!=0 ){
3307
- fprintf(stderr, "SQLite header and source version mismatch\n%s\n%s\n",
3308
- sqlite3_sourceid(), SQLITE_SOURCE_ID);
3306
+ if( sqlite3_libversion_number()<3008003 ){
3307
+ fprintf(stderr, "Unsuitable SQLite version %s, must be at least 3.8.3",
3308
+ sqlite3_libversion());
33093309
exit(1);
33103310
}
33113311
Argv0 = argv[0];
33123312
main_init(&data);
33133313
stdin_is_interactive = isatty(0);
33143314
--- src/shell.c
+++ src/shell.c
@@ -1175,11 +1175,11 @@
1175 ** all opcodes that occur between the p2 jump destination and the opcode
1176 ** itself by 2 spaces.
1177 **
1178 ** * For each "Goto", if the jump destination is earlier in the program
1179 ** and ends on one of:
1180 ** Yield SeekGt SeekLt RowSetRead
1181 ** then indent all opcodes between the earlier instruction
1182 ** and "Goto" by 2 spaces.
1183 */
1184 static void explain_data_prepare(struct callback_data *p, sqlite3_stmt *pSql){
1185 const char *zSql; /* The text of the SQL statement */
@@ -1187,11 +1187,11 @@
1187 int *abYield = 0; /* True if op is an OP_Yield */
1188 int nAlloc = 0; /* Allocated size of p->aiIndent[], abYield */
1189 int iOp; /* Index of operation in p->aiIndent[] */
1190
1191 const char *azNext[] = { "Next", "Prev", "VPrev", "VNext", "SorterNext", 0 };
1192 const char *azYield[] = { "Yield", "SeekLt", "SeekGt", "RowSetRead", 0 };
1193 const char *azGoto[] = { "Goto", 0 };
1194
1195 /* Try to figure out if this is really an EXPLAIN statement. If this
1196 ** cannot be verified, return early. */
1197 zSql = sqlite3_sql(pSql);
@@ -1224,11 +1224,11 @@
1224
1225 if( str_in_array(zOp, azNext) ){
1226 for(i=p2op; i<iOp; i++) p->aiIndent[i] += 2;
1227 }
1228 if( str_in_array(zOp, azGoto) && p2op<p->nIndent && abYield[p2op] ){
1229 for(i=p2op; i<iOp; i++) p->aiIndent[i] += 2;
1230 }
1231 }
1232
1233 p->iIndent = 0;
1234 sqlite3_free(abYield);
@@ -3301,13 +3301,13 @@
3301 const char *zInitFile = 0;
3302 char *zFirstCmd = 0;
3303 int i;
3304 int rc = 0;
3305
3306 if( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)!=0 ){
3307 fprintf(stderr, "SQLite header and source version mismatch\n%s\n%s\n",
3308 sqlite3_sourceid(), SQLITE_SOURCE_ID);
3309 exit(1);
3310 }
3311 Argv0 = argv[0];
3312 main_init(&data);
3313 stdin_is_interactive = isatty(0);
3314
--- src/shell.c
+++ src/shell.c
@@ -1175,11 +1175,11 @@
1175 ** all opcodes that occur between the p2 jump destination and the opcode
1176 ** itself by 2 spaces.
1177 **
1178 ** * For each "Goto", if the jump destination is earlier in the program
1179 ** and ends on one of:
1180 ** Yield SeekGt SeekLt RowSetRead Rewind
1181 ** then indent all opcodes between the earlier instruction
1182 ** and "Goto" by 2 spaces.
1183 */
1184 static void explain_data_prepare(struct callback_data *p, sqlite3_stmt *pSql){
1185 const char *zSql; /* The text of the SQL statement */
@@ -1187,11 +1187,11 @@
1187 int *abYield = 0; /* True if op is an OP_Yield */
1188 int nAlloc = 0; /* Allocated size of p->aiIndent[], abYield */
1189 int iOp; /* Index of operation in p->aiIndent[] */
1190
1191 const char *azNext[] = { "Next", "Prev", "VPrev", "VNext", "SorterNext", 0 };
1192 const char *azYield[] = { "Yield", "SeekLt", "SeekGt", "RowSetRead", "Rewind", 0 };
1193 const char *azGoto[] = { "Goto", 0 };
1194
1195 /* Try to figure out if this is really an EXPLAIN statement. If this
1196 ** cannot be verified, return early. */
1197 zSql = sqlite3_sql(pSql);
@@ -1224,11 +1224,11 @@
1224
1225 if( str_in_array(zOp, azNext) ){
1226 for(i=p2op; i<iOp; i++) p->aiIndent[i] += 2;
1227 }
1228 if( str_in_array(zOp, azGoto) && p2op<p->nIndent && abYield[p2op] ){
1229 for(i=p2op+1; i<iOp; i++) p->aiIndent[i] += 2;
1230 }
1231 }
1232
1233 p->iIndent = 0;
1234 sqlite3_free(abYield);
@@ -3301,13 +3301,13 @@
3301 const char *zInitFile = 0;
3302 char *zFirstCmd = 0;
3303 int i;
3304 int rc = 0;
3305
3306 if( sqlite3_libversion_number()<3008003 ){
3307 fprintf(stderr, "Unsuitable SQLite version %s, must be at least 3.8.3",
3308 sqlite3_libversion());
3309 exit(1);
3310 }
3311 Argv0 = argv[0];
3312 main_init(&data);
3313 stdin_is_interactive = isatty(0);
3314
--- src/sqlcmd.c
+++ src/sqlcmd.c
@@ -19,11 +19,10 @@
1919
** shell against the repository database. The command-line shell itself
2020
** is a copy of the "shell.c" code from SQLite. This file contains logic
2121
** to initialize the code in shell.c.
2222
*/
2323
#include "config.h"
24
-#if !defined(USE_SYSTEM_SQLITE) || !USE_SYSTEM_SQLITE
2524
#include "sqlcmd.h"
2625
#include <zlib.h>
2726
2827
/*
2928
** Implementation of the "content(X)" SQL function. Return the complete
@@ -155,7 +154,5 @@
155154
*/
156155
void fossil_open(const char **pzRepoName){
157156
sqlite3_auto_extension((void(*)(void))sqlcmd_autoinit);
158157
*pzRepoName = g.zRepositoryName;
159158
}
160
-
161
-#endif /* !USE_SYSTEM_SQLITE */
162159
--- src/sqlcmd.c
+++ src/sqlcmd.c
@@ -19,11 +19,10 @@
19 ** shell against the repository database. The command-line shell itself
20 ** is a copy of the "shell.c" code from SQLite. This file contains logic
21 ** to initialize the code in shell.c.
22 */
23 #include "config.h"
24 #if !defined(USE_SYSTEM_SQLITE) || !USE_SYSTEM_SQLITE
25 #include "sqlcmd.h"
26 #include <zlib.h>
27
28 /*
29 ** Implementation of the "content(X)" SQL function. Return the complete
@@ -155,7 +154,5 @@
155 */
156 void fossil_open(const char **pzRepoName){
157 sqlite3_auto_extension((void(*)(void))sqlcmd_autoinit);
158 *pzRepoName = g.zRepositoryName;
159 }
160
161 #endif /* !USE_SYSTEM_SQLITE */
162
--- src/sqlcmd.c
+++ src/sqlcmd.c
@@ -19,11 +19,10 @@
19 ** shell against the repository database. The command-line shell itself
20 ** is a copy of the "shell.c" code from SQLite. This file contains logic
21 ** to initialize the code in shell.c.
22 */
23 #include "config.h"
 
24 #include "sqlcmd.h"
25 #include <zlib.h>
26
27 /*
28 ** Implementation of the "content(X)" SQL function. Return the complete
@@ -155,7 +154,5 @@
154 */
155 void fossil_open(const char **pzRepoName){
156 sqlite3_auto_extension((void(*)(void))sqlcmd_autoinit);
157 *pzRepoName = g.zRepositoryName;
158 }
 
 
159

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button