Fossil SCM

merge trunk

jan.nijtmans 2014-12-09 10:34 UTC svn-import merge
Commit c9dae7ab66e97e7f777674633245132a1e35c5b9
+1 -1
--- Makefile.in
+++ Makefile.in
@@ -37,11 +37,11 @@
3737
# care about testing the end result, this can be blank.
3838
#
3939
TCLSH = tclsh
4040
4141
LIB = @LDFLAGS@ @EXTRA_LDFLAGS@ @LIBS@
42
-TCC += @EXTRA_CFLAGS@ @CPPFLAGS@ @CFLAGS@ -DHAVE_AUTOCONFIG_H -D_HAVE_SQLITE_CONFIG_H
42
+TCCFLAGS = @EXTRA_CFLAGS@ @CPPFLAGS@ @CFLAGS@ -DHAVE_AUTOCONFIG_H -D_HAVE_SQLITE_CONFIG_H
4343
INSTALLDIR = $(DESTDIR)@prefix@/bin
4444
USE_SYSTEM_SQLITE = @USE_SYSTEM_SQLITE@
4545
FOSSIL_ENABLE_MINIZ = @FOSSIL_ENABLE_MINIZ@
4646
4747
include $(SRCDIR)/main.mk
4848
--- Makefile.in
+++ Makefile.in
@@ -37,11 +37,11 @@
37 # care about testing the end result, this can be blank.
38 #
39 TCLSH = tclsh
40
41 LIB = @LDFLAGS@ @EXTRA_LDFLAGS@ @LIBS@
42 TCC += @EXTRA_CFLAGS@ @CPPFLAGS@ @CFLAGS@ -DHAVE_AUTOCONFIG_H -D_HAVE_SQLITE_CONFIG_H
43 INSTALLDIR = $(DESTDIR)@prefix@/bin
44 USE_SYSTEM_SQLITE = @USE_SYSTEM_SQLITE@
45 FOSSIL_ENABLE_MINIZ = @FOSSIL_ENABLE_MINIZ@
46
47 include $(SRCDIR)/main.mk
48
--- Makefile.in
+++ Makefile.in
@@ -37,11 +37,11 @@
37 # care about testing the end result, this can be blank.
38 #
39 TCLSH = tclsh
40
41 LIB = @LDFLAGS@ @EXTRA_LDFLAGS@ @LIBS@
42 TCCFLAGS = @EXTRA_CFLAGS@ @CPPFLAGS@ @CFLAGS@ -DHAVE_AUTOCONFIG_H -D_HAVE_SQLITE_CONFIG_H
43 INSTALLDIR = $(DESTDIR)@prefix@/bin
44 USE_SYSTEM_SQLITE = @USE_SYSTEM_SQLITE@
45 FOSSIL_ENABLE_MINIZ = @FOSSIL_ENABLE_MINIZ@
46
47 include $(SRCDIR)/main.mk
48
+14 -2
--- src/blob.c
+++ src/blob.c
@@ -24,10 +24,14 @@
2424
# include "miniz.c"
2525
#else
2626
# include <zlib.h>
2727
#endif
2828
#include "blob.h"
29
+#if defined(_WIN32)
30
+#include <fcntl.h>
31
+#include <io.h>
32
+#endif
2933
3034
#if INTERFACE
3135
/*
3236
** A Blob can hold a string or a binary object of arbitrary size. The
3337
** size changes as necessary.
@@ -823,12 +827,18 @@
823827
nWrote = blob_size(pBlob);
824828
#if defined(_WIN32)
825829
if( fossil_utf8_to_console(blob_buffer(pBlob), nWrote, 0) >= 0 ){
826830
return nWrote;
827831
}
832
+ fflush(stdout);
833
+ _setmode(_fileno(stdout), _O_BINARY);
828834
#endif
829835
fwrite(blob_buffer(pBlob), 1, nWrote, stdout);
836
+#if defined(_WIN32)
837
+ fflush(stdout);
838
+ _setmode(_fileno(stdout), _O_TEXT);
839
+#endif
830840
}else{
831841
file_mkfolder(zFilename, 1);
832842
out = fossil_fopen(zFilename, "wb");
833843
if( out==0 ){
834844
fossil_fatal_recursive("unable to open file \"%s\" for writing",
@@ -1193,14 +1203,16 @@
11931203
/* Make sure the blob contains two terminating 0-bytes */
11941204
blob_append(pBlob, "", 1);
11951205
zUtf8 = blob_str(pBlob) + bomSize;
11961206
zUtf8 = fossil_unicode_to_utf8(zUtf8);
11971207
blob_set_dynamic(pBlob, zUtf8);
1198
-#if defined(_WIN32)
1199
- }else if( useMbcs ){
1208
+ }else if( useMbcs && invalid_utf8(pBlob) ){
1209
+#if defined(_WIN32) || defined(__CYGWIN__)
12001210
zUtf8 = fossil_mbcs_to_utf8(blob_str(pBlob));
12011211
blob_reset(pBlob);
12021212
blob_append(pBlob, zUtf8, -1);
12031213
fossil_mbcs_free(zUtf8);
1214
+#else
1215
+ blob_cp1252_to_utf8(pBlob);
12041216
#endif /* _WIN32 */
12051217
}
12061218
}
12071219
--- src/blob.c
+++ src/blob.c
@@ -24,10 +24,14 @@
24 # include "miniz.c"
25 #else
26 # include <zlib.h>
27 #endif
28 #include "blob.h"
 
 
 
 
29
30 #if INTERFACE
31 /*
32 ** A Blob can hold a string or a binary object of arbitrary size. The
33 ** size changes as necessary.
@@ -823,12 +827,18 @@
823 nWrote = blob_size(pBlob);
824 #if defined(_WIN32)
825 if( fossil_utf8_to_console(blob_buffer(pBlob), nWrote, 0) >= 0 ){
826 return nWrote;
827 }
 
 
828 #endif
829 fwrite(blob_buffer(pBlob), 1, nWrote, stdout);
 
 
 
 
830 }else{
831 file_mkfolder(zFilename, 1);
832 out = fossil_fopen(zFilename, "wb");
833 if( out==0 ){
834 fossil_fatal_recursive("unable to open file \"%s\" for writing",
@@ -1193,14 +1203,16 @@
1193 /* Make sure the blob contains two terminating 0-bytes */
1194 blob_append(pBlob, "", 1);
1195 zUtf8 = blob_str(pBlob) + bomSize;
1196 zUtf8 = fossil_unicode_to_utf8(zUtf8);
1197 blob_set_dynamic(pBlob, zUtf8);
1198 #if defined(_WIN32)
1199 }else if( useMbcs ){
1200 zUtf8 = fossil_mbcs_to_utf8(blob_str(pBlob));
1201 blob_reset(pBlob);
1202 blob_append(pBlob, zUtf8, -1);
1203 fossil_mbcs_free(zUtf8);
 
 
1204 #endif /* _WIN32 */
1205 }
1206 }
1207
--- src/blob.c
+++ src/blob.c
@@ -24,10 +24,14 @@
24 # include "miniz.c"
25 #else
26 # include <zlib.h>
27 #endif
28 #include "blob.h"
29 #if defined(_WIN32)
30 #include <fcntl.h>
31 #include <io.h>
32 #endif
33
34 #if INTERFACE
35 /*
36 ** A Blob can hold a string or a binary object of arbitrary size. The
37 ** size changes as necessary.
@@ -823,12 +827,18 @@
827 nWrote = blob_size(pBlob);
828 #if defined(_WIN32)
829 if( fossil_utf8_to_console(blob_buffer(pBlob), nWrote, 0) >= 0 ){
830 return nWrote;
831 }
832 fflush(stdout);
833 _setmode(_fileno(stdout), _O_BINARY);
834 #endif
835 fwrite(blob_buffer(pBlob), 1, nWrote, stdout);
836 #if defined(_WIN32)
837 fflush(stdout);
838 _setmode(_fileno(stdout), _O_TEXT);
839 #endif
840 }else{
841 file_mkfolder(zFilename, 1);
842 out = fossil_fopen(zFilename, "wb");
843 if( out==0 ){
844 fossil_fatal_recursive("unable to open file \"%s\" for writing",
@@ -1193,14 +1203,16 @@
1203 /* Make sure the blob contains two terminating 0-bytes */
1204 blob_append(pBlob, "", 1);
1205 zUtf8 = blob_str(pBlob) + bomSize;
1206 zUtf8 = fossil_unicode_to_utf8(zUtf8);
1207 blob_set_dynamic(pBlob, zUtf8);
1208 }else if( useMbcs && invalid_utf8(pBlob) ){
1209 #if defined(_WIN32) || defined(__CYGWIN__)
1210 zUtf8 = fossil_mbcs_to_utf8(blob_str(pBlob));
1211 blob_reset(pBlob);
1212 blob_append(pBlob, zUtf8, -1);
1213 fossil_mbcs_free(zUtf8);
1214 #else
1215 blob_cp1252_to_utf8(pBlob);
1216 #endif /* _WIN32 */
1217 }
1218 }
1219
+2 -2
--- src/branch.c
+++ src/branch.c
@@ -357,11 +357,11 @@
357357
if( colorTest ){
358358
const char *zColor = hash_color(zBr);
359359
@ <li><span style="background-color: %s(zColor)">
360360
@ %h(zBr) &rarr; %s(zColor)</span></li>
361361
}else{
362
- @ <li>%z(href("%R/timeline?r=%T",zBr))%h(zBr)</a></li>
362
+ @ <li>%z(href("%R/timeline?r=%T&n=200",zBr))%h(zBr)</a></li>
363363
}
364364
}
365365
if( cnt ){
366366
@ </ul>
367367
}
@@ -385,11 +385,11 @@
385385
" AND tag.tagname GLOB 'sym-*'",
386386
rid
387387
);
388388
while( db_step(&q)==SQLITE_ROW ){
389389
const char *zTagName = db_column_text(&q, 0);
390
- @ %z(href("%R/timeline?r=%T",zTagName))[timeline]</a>
390
+ @ %z(href("%R/timeline?r=%T&n=200",zTagName))[timeline]</a>
391391
}
392392
db_finalize(&q);
393393
}
394394
395395
/*
396396
397397
ADDED src/bundle.c
--- src/branch.c
+++ src/branch.c
@@ -357,11 +357,11 @@
357 if( colorTest ){
358 const char *zColor = hash_color(zBr);
359 @ <li><span style="background-color: %s(zColor)">
360 @ %h(zBr) &rarr; %s(zColor)</span></li>
361 }else{
362 @ <li>%z(href("%R/timeline?r=%T",zBr))%h(zBr)</a></li>
363 }
364 }
365 if( cnt ){
366 @ </ul>
367 }
@@ -385,11 +385,11 @@
385 " AND tag.tagname GLOB 'sym-*'",
386 rid
387 );
388 while( db_step(&q)==SQLITE_ROW ){
389 const char *zTagName = db_column_text(&q, 0);
390 @ %z(href("%R/timeline?r=%T",zTagName))[timeline]</a>
391 }
392 db_finalize(&q);
393 }
394
395 /*
396
397 DDED src/bundle.c
--- src/branch.c
+++ src/branch.c
@@ -357,11 +357,11 @@
357 if( colorTest ){
358 const char *zColor = hash_color(zBr);
359 @ <li><span style="background-color: %s(zColor)">
360 @ %h(zBr) &rarr; %s(zColor)</span></li>
361 }else{
362 @ <li>%z(href("%R/timeline?r=%T&n=200",zBr))%h(zBr)</a></li>
363 }
364 }
365 if( cnt ){
366 @ </ul>
367 }
@@ -385,11 +385,11 @@
385 " AND tag.tagname GLOB 'sym-*'",
386 rid
387 );
388 while( db_step(&q)==SQLITE_ROW ){
389 const char *zTagName = db_column_text(&q, 0);
390 @ %z(href("%R/timeline?r=%T&n=200",zTagName))[timeline]</a>
391 }
392 db_finalize(&q);
393 }
394
395 /*
396
397 DDED src/bundle.c
+307
--- a/src/bundle.c
+++ b/src/bundle.c
@@ -0,0 +1,307 @@
1
+/*
2
+** Copyright (==40** Copyright (c) 2014 D/*
3
+** Copyright (c) 2014 D. Richard Hipp
4
+**
5
+** This program is free software; you can redistribute it and/or
6
+** modify it under the terms of the Simplified BSD License (also
7
+** known as the "2-Clause License" or "FreeBSD License".)
8
+
9
+** This program is distributed in the hope that it will be useful,
10
+** but without any warranty; without even the implied warranty of
11
+** merchantability or fitness for a particular purpose.
12
+**
13
+** Author contact information:
14
+** [email protected]
15
+** http://www.hwaci.com/drh/
16
+**
17
+*******************************************************************************
18
+**
19
+** This file contains code used to implement and manage a "bundle" file.
20
+*/
21
+#include "config.h"
22
+#include "bundle.h"
23
+#include <assert.h>
24
+
25
+/*
26
+** SQL code used to initialize the schema of a bundle.
27
+**
28
+** The bblob.delta field can be an integer, a text string, or NULL.
29
+** If an integer, then the corresponding blobid is the delta basis.
30
+** If a text string, then that string is a SHA1 hash for the delta
31
+** basis, whister is ainory. If NULL, then
32
+** data contains content without delta compression.
33
+*/
34
+static const cha r zBundleInit[] =
35
+@ CREATE TABLE IF NOT EXISTS "%w".bconfig(
36
+@ bcname TEXT,
37
+@ bcvalue ANY
38
+@ );
39
+@ CREATE TABLE IF NOT EXISTS "%w".bblob(
40
+@ blobid INTEGER PRIMARY KEY, -- Blob ID
41
+@ uuid TEXT SHA1 NOT NULL, -- hash of expanded blob
42
+@ sz INT NOT NULL, -- Size of blob after expansion
43
+@ delta ANY, -- Delta compression basis, or NULL
44
+@ notes TEXT, -- Description of content
45
+@ data BLOB -- compressed content
46
+@ );
47
+;
48
+
49
+/*
50
+** Attach a bundle file to the current database connection using the
51
+** attachment name zBName.
52
+*/
53
+static void bundle_attach_file(
54
+ const char *zFile, /* Name of the file that contains the bundle */
55
+ const char *zBName, /* Attachment name */
56
+ int doInit /* Initialize a new bundle, if true */
57
+){
58
+ int rc;
59
+ char *zErrMsg = 0;
60
+ char *zSql;
61
+ if( )<0 ){blob.rid=tobundle.rid"
62
+ _size(zFile, ExtFILE)<0 ){
63
+ fossil_fatal("no such file: %s", zFile);
64
+ }
65
+ assert( g.db );
66
+ zSql = sqlite3_mprintf("ATTAfatalhat string is a SHA1 c = sqlite3_exec(g.db, zSql, 0, 0, &zErrMsg);
67
+ sqlite3_free(zSql);
68
+ if( rc!=SQLITE_OK || zErrMsg ){
69
+ if( zErrMsg==0 ) zErrMsg = (char*)sqlite3_errmsg(g.db);
70
+ fossil_fatal("not a valid bundle: %s", zFile);
71
+ }
72
+ if( doInit ){
73
+ db_multi_exec(zBundleInit /*works-like:"%w%w"*/, zBName, zBName);
74
+ }else{
75
+ sqlite3_stmt *pStmt;
76
+ zSql = sqlite3_mprintf("SELECT bcname, bcvalue"
77
+ " FROM \"%w\".bconfig", zBName);panic that string is a SHA1fatalhat string is a SHA1 hash for the delta
78
+** basis, whister is presumably in the main repository. If NULL, then
79
+** data contains content without delta compression.
80
+*/
81
+static const char zBundleInit[] =
82
+@ CREATE TABLE IF NOT EXISTS "%w".bconfig(
83
+@ bcname TEXT,
84
+@ bcvalue ANY
85
+@ );
86
+@ CREATE TABLE IF NOT EXISTS "%w".bblob(
87
+@ blobid INTEGER Pfatalhat string is a SHA1 hash for the delta
88
+** basis, whister is presumably in the main repository. If NULL, then
89
+** data contains content without delta compressio}
90
+}
91
+
92
+/*
93
+**sociates("ok", 1);
94
+
95
+ /* NULL
96
+@ notes TEXT, -- Description of content
97
+@ data BLOB -- compressed content
98
+@ );
99
+;
100
+
101
+/*
102
+** Attac ter is presumably iHipp
103
+**
104
+** This program is free software; you can redistribute it and/or
105
+** modify it under the terms of the Simplified BSD License (also
106
+** known as the "2-Clause License" or "FreeBSD License".)
107
+
108
+** This program is distributed in the hope that it will be useful,
109
+** but without any warranty; without even the implied warranty of
110
+** merchantability or fitness for a particular purpose.
111
+**
112
+** Author contact information:
113
+** [email protected]
114
+** http://www.hwaci.com/drh/
115
+**
116
+*******************************************************************************
117
+**
118
+** This file contains code used to implement and manage a "bundle" file.
119
+*/
120
+#include "config.h"
121
+#include "bundle.h"
122
+#include <assert.h>
123
+
124
+/*
125
+** SQL code used to initialize the schema of a bundle.
126
+**
127
+** The bblob.delta field can be an integer, a text string, or NULL.
128
+** If an integer, then the corresponding blobid is the delta basis.
129
+** If a text string, then that string is a SHA1 hash for the delta
130
+** basis, whister is ainory. If NULL, then
131
+** data contains content without delta compression.
132
+*/
133
+static const char zBundleInit[] =
134
+@ CREATE TABLE IF NOT EXISTS "%w/mpressed content
135
+@ );
136
+;
137
+
138
+/*
139
+** Attach a bundle file to the current database connection using the
140
+** attachment name zBName.
141
+*/
142
+static void bundle_attach_file(
143
+ const char *zFile, /* Name of the file that contains the bundle */
144
+ const char *zBName, /* Attachment name */
145
+ int doInit /* Initialize a new bundle, if true */
146
+){
147
+ int rc;
148
+ char *zErrMsg = 0;
149
+ char *zSql;
150
+ if( )<0 ){blob.rid=tobundle.rid"
151
+ _size(zFile, ExtFILE)<0 ){
152
+ fossil_fatal("no such file: %s", zFile);
153
+ }
154
+ assert( g.db );
155
+ zSql = sqlite3_mprintf("ATTAfatalhat string is a SHA1 c = sqlite3_exec(g.db, zSql, 0, 0, &zErrMsg);
156
+ sqlite3_free(zSql);
157
+ if( rc!=SQLITE_OK || zErrMsg ){
158
+ if( zErrMsg==0 ) zErrMsg = (char*)sqlite3_errmsg(g.db);
159
+ fossil_fatal("not a valid bundle: %s", zFile);
160
+ }
161
+ if( doInit ){
162
+ db_multi_exec(zBundleInit /*works-like:"%w%w"*/, zBName, zBName);
163
+ }else{
164
+ sqlite3_stmt *pStmt;
165
+ zSql = sqlite3_mprintf("SELECT bcname, bcvalue"
166
+ " FROM \"%w\".bconfig", zBName);panic that string is a SHA1fatalhat string is a SHA1 hash for the delta
167
+** basis, whister is presumably in the main repository. If NULL, then
168
+** data contains content without delta compression.
169
+*/
170
+statc const char zBundleInit[] =
171
+@ CREATE TABLE IF NOT EXISTS "%w".bconfig(
172
+@ bcname TEXT,
173
+@ bcvalue ANY
174
+@ );
175
+@ CREATE TABLE IF NOT EXISTS "% Pfatalhat string is a SHA1 hash for the delta
176
+** basis, whister is presumably in the main reposa contains content without delta compressio}
177
+}
178
+
179
+/*
180
+**sociates("ok", 1);
181
+
182
+ /* NULL
183
+@ notes TEXT, -- Description of ontent
184
+@ data BLOB content
185
+@ );
186
+;
187
+
188
+/*
189
+** Attach a bundle file to the current database connection using the
190
+** attachment name zBName.
191
+*/
192
+static void bundle_attach_file(
193
+ const char *zFile, /* Name of the file that contains the bundle */
194
+ const char *zBName, */
195
+){
196
+ int rc;
197
+ char *zErrMsg = 0;
198
+ char *zSql;
199
+ if( !doInit && file_size(zFile, ExtFILE)<0 ){
200
+ fossil_fatal("no such file: %s", zFile);
201
+ }
202
+ assert( g.db );
203
+ zSql = sqlite3_mprintf("ATTACH %Q AS %Q", zFile, zBName);
204
+ if( zSql==0 ) fossil_fatal("out of memory");
205
+ rc = sqlite3_exec(g.db, zSql, 0, 0, &zErrMsg);
206
+ sqlite3_free(zSql);
207
+ if( rc!=SQLITE_OK || zErrMsg ){
208
+ if( zErrMsg==0 ) zErrMsg = (char*)sqlite3_errmsg(g.db);
209
+ fossil_fatal("not a valid bundle: %s", zFile);
210
+ }
211
+ if( doInit ){
212
+ db_multi_exec(zBundleInit /*works-like:"%w%w"*/, zBName, zBName);
213
+ }else{
214
+ sqlite3_stmt *pStmt;
215
+ zSql = sqlite3_mprintf("SELECT bcname, bcvalue"
216
+ " FROM \"%w\".bconfig", zBName);
217
+ if( zSql==0 ) fossil_fatal("out of memory");
218
+ rc = sqlite3_prepare(g.db, zSql, -1, &pStmt, 0);
219
+ if( rc ) fossil_fatal("not a valid bundle: %s", zFile);
220
+ sqlite3_free(zSql);
221
+ sqlite3_finalize(pStmt);
222
+ zSql = sqlite3_mprintf("SELECT blobid, uuid,
223
+**makesright (==40** Copyright (c) 2014 D/*
224
+** Copyright (c) 2014 D. Richard Hipp
225
+**
226
+** This program is free software; you can redistribute it and/or
227
+** modify it under the terms of the Simplified BSD License (also
228
+** known as the "2-Clause License" or "FreeBSD License".)
229
+
230
+** This program is distributed in the hope that it will be useful,
231
+** but without any warranty; without even the implied warranty of
232
+** merchantability or fitness for a particular purpose.
233
+**
234
+** Author contact information:
235
+** [email protected]
236
+** http://www.hwaci.com/drh/
237
+**
238
+*******************************************************************************
239
+**
240
+** This file contains code used to implement and manage a "bundle" file.
241
+*/
242
+#include "config.h"
243
+#include "bundle.h"
244
+#include <assert.h>
245
+
246
+/*
247
+** SQe schema of a bundle.
248
+**
249
+** The bblob.delta field can be an integer, a text string, or NULL.
250
+** If an integer, then the corresponding blobid is the delta basis.
251
+** If a text string, then that string is a SHA1 hash for the delta
252
+** basis, whister is presumably in the ain repository. If NULL, then
253
+** data contains content without delta compression.
254
+*/
255
+static const char zBundleInit[] =
256
+@ CREATE TABLE IF NOT EXISTS "%w".bconfig(e ANY
257
+@ );
258
+@ CREATE TABLE IF NOT EXISTS "%w".bblob(
259
+@ blobid INTEGER PRIMARY KEY, -- Blob ID
260
+@ uuid TEXT SHA1 NOT NULL, -- hash of expanded blob
261
+@ sz INT NOT NULL, -- Size of blob after expansion
262
+@ delta ANY, -- Delta compression basis, or NULL
263
+@ notes TEXT, -- Description of content
264
+@ data BLOB -- compressed content
265
+@ );
266
+;
267
+
268
+/*
269
+** Attach a bundle file to the current database connection using the
270
+** attachment name zBName.
271
+*/
272
+static void bundle_attach_file(
273
+ const char *zFile, /* Name of the file that contains the bundle */
274
+ const char *zBName, /* Attachment name */
275
+ int doInit /* Initialize a new bundle, if true */
276
+){
277
+ int rc;
278
+ char *zErrMsg = 0;
279
+ char *zSql;
280
+ if( )<0 ){blob.rid=tobundle.rid"
281
+ _size(zFile, ExtFILE)<0 ){
282
+ fossil_fatal("no such file: %s", zFile);
283
+ }
284
+ assert( g.db );
285
+ zSql = sqlite3_mprintf("ATTAfatalhat string is a SHA1 c = sqlite3_exec(g.db, zSql, 0, 0, &zErrMsg);
286
+ sqlite3_free(zSql);
287
+ if( rc!=SQLITE_OK || zErrMsg ){
288
+ if( zErrMsg==0 ) zErrMsg = (char*)sqlite3_errmsg(g.db);
289
+ fossil_fatal("not a valid bundle: %s", zFile);
290
+ }
291
+ if( doInit ){
292
+ db_multi_exec(zBundleInit /*works-like:"%w%w"*/, zBName, zBName);
293
+ }else{
294
+ sqlite3_stmt *pStmt;
295
+ zSql = sqlite3_mprintf("SELECT bcname, bcvalue"
296
+ " FROM \"%w\".bconfig", zBName);panic that string is a SHA1fatalhat string is a SHA1 hash for the delta
297
+** basis, whister is presumably in the main repository. If NULL, then
298
+** data contains content without delta compression.
299
+*/
300
+static const char zBundleInit[] =
301
+@ CREATE TABLE IF NOT EXISTS "%w".bconfig(
302
+@ bcname TEXT,
303
+@ bcvalue ANY
304
+@ );
305
+@ CREATE TABLE IF NOT EXISTS "%w".bblob(
306
+@ blobid INTEGER Pfatalhat string is a SHA1 hash for the delta
307
+** basis, whist ins
--- a/src/bundle.c
+++ b/src/bundle.c
@@ -0,0 +1,307 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/src/bundle.c
+++ b/src/bundle.c
@@ -0,0 +1,307 @@
1 /*
2 ** Copyright (==40** Copyright (c) 2014 D/*
3 ** Copyright (c) 2014 D. Richard Hipp
4 **
5 ** This program is free software; you can redistribute it and/or
6 ** modify it under the terms of the Simplified BSD License (also
7 ** known as the "2-Clause License" or "FreeBSD License".)
8
9 ** This program is distributed in the hope that it will be useful,
10 ** but without any warranty; without even the implied warranty of
11 ** merchantability or fitness for a particular purpose.
12 **
13 ** Author contact information:
14 ** [email protected]
15 ** http://www.hwaci.com/drh/
16 **
17 *******************************************************************************
18 **
19 ** This file contains code used to implement and manage a "bundle" file.
20 */
21 #include "config.h"
22 #include "bundle.h"
23 #include <assert.h>
24
25 /*
26 ** SQL code used to initialize the schema of a bundle.
27 **
28 ** The bblob.delta field can be an integer, a text string, or NULL.
29 ** If an integer, then the corresponding blobid is the delta basis.
30 ** If a text string, then that string is a SHA1 hash for the delta
31 ** basis, whister is ainory. If NULL, then
32 ** data contains content without delta compression.
33 */
34 static const cha r zBundleInit[] =
35 @ CREATE TABLE IF NOT EXISTS "%w".bconfig(
36 @ bcname TEXT,
37 @ bcvalue ANY
38 @ );
39 @ CREATE TABLE IF NOT EXISTS "%w".bblob(
40 @ blobid INTEGER PRIMARY KEY, -- Blob ID
41 @ uuid TEXT SHA1 NOT NULL, -- hash of expanded blob
42 @ sz INT NOT NULL, -- Size of blob after expansion
43 @ delta ANY, -- Delta compression basis, or NULL
44 @ notes TEXT, -- Description of content
45 @ data BLOB -- compressed content
46 @ );
47 ;
48
49 /*
50 ** Attach a bundle file to the current database connection using the
51 ** attachment name zBName.
52 */
53 static void bundle_attach_file(
54 const char *zFile, /* Name of the file that contains the bundle */
55 const char *zBName, /* Attachment name */
56 int doInit /* Initialize a new bundle, if true */
57 ){
58 int rc;
59 char *zErrMsg = 0;
60 char *zSql;
61 if( )<0 ){blob.rid=tobundle.rid"
62 _size(zFile, ExtFILE)<0 ){
63 fossil_fatal("no such file: %s", zFile);
64 }
65 assert( g.db );
66 zSql = sqlite3_mprintf("ATTAfatalhat string is a SHA1 c = sqlite3_exec(g.db, zSql, 0, 0, &zErrMsg);
67 sqlite3_free(zSql);
68 if( rc!=SQLITE_OK || zErrMsg ){
69 if( zErrMsg==0 ) zErrMsg = (char*)sqlite3_errmsg(g.db);
70 fossil_fatal("not a valid bundle: %s", zFile);
71 }
72 if( doInit ){
73 db_multi_exec(zBundleInit /*works-like:"%w%w"*/, zBName, zBName);
74 }else{
75 sqlite3_stmt *pStmt;
76 zSql = sqlite3_mprintf("SELECT bcname, bcvalue"
77 " FROM \"%w\".bconfig", zBName);panic that string is a SHA1fatalhat string is a SHA1 hash for the delta
78 ** basis, whister is presumably in the main repository. If NULL, then
79 ** data contains content without delta compression.
80 */
81 static const char zBundleInit[] =
82 @ CREATE TABLE IF NOT EXISTS "%w".bconfig(
83 @ bcname TEXT,
84 @ bcvalue ANY
85 @ );
86 @ CREATE TABLE IF NOT EXISTS "%w".bblob(
87 @ blobid INTEGER Pfatalhat string is a SHA1 hash for the delta
88 ** basis, whister is presumably in the main repository. If NULL, then
89 ** data contains content without delta compressio}
90 }
91
92 /*
93 **sociates("ok", 1);
94
95 /* NULL
96 @ notes TEXT, -- Description of content
97 @ data BLOB -- compressed content
98 @ );
99 ;
100
101 /*
102 ** Attac ter is presumably iHipp
103 **
104 ** This program is free software; you can redistribute it and/or
105 ** modify it under the terms of the Simplified BSD License (also
106 ** known as the "2-Clause License" or "FreeBSD License".)
107
108 ** This program is distributed in the hope that it will be useful,
109 ** but without any warranty; without even the implied warranty of
110 ** merchantability or fitness for a particular purpose.
111 **
112 ** Author contact information:
113 ** [email protected]
114 ** http://www.hwaci.com/drh/
115 **
116 *******************************************************************************
117 **
118 ** This file contains code used to implement and manage a "bundle" file.
119 */
120 #include "config.h"
121 #include "bundle.h"
122 #include <assert.h>
123
124 /*
125 ** SQL code used to initialize the schema of a bundle.
126 **
127 ** The bblob.delta field can be an integer, a text string, or NULL.
128 ** If an integer, then the corresponding blobid is the delta basis.
129 ** If a text string, then that string is a SHA1 hash for the delta
130 ** basis, whister is ainory. If NULL, then
131 ** data contains content without delta compression.
132 */
133 static const char zBundleInit[] =
134 @ CREATE TABLE IF NOT EXISTS "%w/mpressed content
135 @ );
136 ;
137
138 /*
139 ** Attach a bundle file to the current database connection using the
140 ** attachment name zBName.
141 */
142 static void bundle_attach_file(
143 const char *zFile, /* Name of the file that contains the bundle */
144 const char *zBName, /* Attachment name */
145 int doInit /* Initialize a new bundle, if true */
146 ){
147 int rc;
148 char *zErrMsg = 0;
149 char *zSql;
150 if( )<0 ){blob.rid=tobundle.rid"
151 _size(zFile, ExtFILE)<0 ){
152 fossil_fatal("no such file: %s", zFile);
153 }
154 assert( g.db );
155 zSql = sqlite3_mprintf("ATTAfatalhat string is a SHA1 c = sqlite3_exec(g.db, zSql, 0, 0, &zErrMsg);
156 sqlite3_free(zSql);
157 if( rc!=SQLITE_OK || zErrMsg ){
158 if( zErrMsg==0 ) zErrMsg = (char*)sqlite3_errmsg(g.db);
159 fossil_fatal("not a valid bundle: %s", zFile);
160 }
161 if( doInit ){
162 db_multi_exec(zBundleInit /*works-like:"%w%w"*/, zBName, zBName);
163 }else{
164 sqlite3_stmt *pStmt;
165 zSql = sqlite3_mprintf("SELECT bcname, bcvalue"
166 " FROM \"%w\".bconfig", zBName);panic that string is a SHA1fatalhat string is a SHA1 hash for the delta
167 ** basis, whister is presumably in the main repository. If NULL, then
168 ** data contains content without delta compression.
169 */
170 statc const char zBundleInit[] =
171 @ CREATE TABLE IF NOT EXISTS "%w".bconfig(
172 @ bcname TEXT,
173 @ bcvalue ANY
174 @ );
175 @ CREATE TABLE IF NOT EXISTS "% Pfatalhat string is a SHA1 hash for the delta
176 ** basis, whister is presumably in the main reposa contains content without delta compressio}
177 }
178
179 /*
180 **sociates("ok", 1);
181
182 /* NULL
183 @ notes TEXT, -- Description of ontent
184 @ data BLOB content
185 @ );
186 ;
187
188 /*
189 ** Attach a bundle file to the current database connection using the
190 ** attachment name zBName.
191 */
192 static void bundle_attach_file(
193 const char *zFile, /* Name of the file that contains the bundle */
194 const char *zBName, */
195 ){
196 int rc;
197 char *zErrMsg = 0;
198 char *zSql;
199 if( !doInit && file_size(zFile, ExtFILE)<0 ){
200 fossil_fatal("no such file: %s", zFile);
201 }
202 assert( g.db );
203 zSql = sqlite3_mprintf("ATTACH %Q AS %Q", zFile, zBName);
204 if( zSql==0 ) fossil_fatal("out of memory");
205 rc = sqlite3_exec(g.db, zSql, 0, 0, &zErrMsg);
206 sqlite3_free(zSql);
207 if( rc!=SQLITE_OK || zErrMsg ){
208 if( zErrMsg==0 ) zErrMsg = (char*)sqlite3_errmsg(g.db);
209 fossil_fatal("not a valid bundle: %s", zFile);
210 }
211 if( doInit ){
212 db_multi_exec(zBundleInit /*works-like:"%w%w"*/, zBName, zBName);
213 }else{
214 sqlite3_stmt *pStmt;
215 zSql = sqlite3_mprintf("SELECT bcname, bcvalue"
216 " FROM \"%w\".bconfig", zBName);
217 if( zSql==0 ) fossil_fatal("out of memory");
218 rc = sqlite3_prepare(g.db, zSql, -1, &pStmt, 0);
219 if( rc ) fossil_fatal("not a valid bundle: %s", zFile);
220 sqlite3_free(zSql);
221 sqlite3_finalize(pStmt);
222 zSql = sqlite3_mprintf("SELECT blobid, uuid,
223 **makesright (==40** Copyright (c) 2014 D/*
224 ** Copyright (c) 2014 D. Richard Hipp
225 **
226 ** This program is free software; you can redistribute it and/or
227 ** modify it under the terms of the Simplified BSD License (also
228 ** known as the "2-Clause License" or "FreeBSD License".)
229
230 ** This program is distributed in the hope that it will be useful,
231 ** but without any warranty; without even the implied warranty of
232 ** merchantability or fitness for a particular purpose.
233 **
234 ** Author contact information:
235 ** [email protected]
236 ** http://www.hwaci.com/drh/
237 **
238 *******************************************************************************
239 **
240 ** This file contains code used to implement and manage a "bundle" file.
241 */
242 #include "config.h"
243 #include "bundle.h"
244 #include <assert.h>
245
246 /*
247 ** SQe schema of a bundle.
248 **
249 ** The bblob.delta field can be an integer, a text string, or NULL.
250 ** If an integer, then the corresponding blobid is the delta basis.
251 ** If a text string, then that string is a SHA1 hash for the delta
252 ** basis, whister is presumably in the ain repository. If NULL, then
253 ** data contains content without delta compression.
254 */
255 static const char zBundleInit[] =
256 @ CREATE TABLE IF NOT EXISTS "%w".bconfig(e ANY
257 @ );
258 @ CREATE TABLE IF NOT EXISTS "%w".bblob(
259 @ blobid INTEGER PRIMARY KEY, -- Blob ID
260 @ uuid TEXT SHA1 NOT NULL, -- hash of expanded blob
261 @ sz INT NOT NULL, -- Size of blob after expansion
262 @ delta ANY, -- Delta compression basis, or NULL
263 @ notes TEXT, -- Description of content
264 @ data BLOB -- compressed content
265 @ );
266 ;
267
268 /*
269 ** Attach a bundle file to the current database connection using the
270 ** attachment name zBName.
271 */
272 static void bundle_attach_file(
273 const char *zFile, /* Name of the file that contains the bundle */
274 const char *zBName, /* Attachment name */
275 int doInit /* Initialize a new bundle, if true */
276 ){
277 int rc;
278 char *zErrMsg = 0;
279 char *zSql;
280 if( )<0 ){blob.rid=tobundle.rid"
281 _size(zFile, ExtFILE)<0 ){
282 fossil_fatal("no such file: %s", zFile);
283 }
284 assert( g.db );
285 zSql = sqlite3_mprintf("ATTAfatalhat string is a SHA1 c = sqlite3_exec(g.db, zSql, 0, 0, &zErrMsg);
286 sqlite3_free(zSql);
287 if( rc!=SQLITE_OK || zErrMsg ){
288 if( zErrMsg==0 ) zErrMsg = (char*)sqlite3_errmsg(g.db);
289 fossil_fatal("not a valid bundle: %s", zFile);
290 }
291 if( doInit ){
292 db_multi_exec(zBundleInit /*works-like:"%w%w"*/, zBName, zBName);
293 }else{
294 sqlite3_stmt *pStmt;
295 zSql = sqlite3_mprintf("SELECT bcname, bcvalue"
296 " FROM \"%w\".bconfig", zBName);panic that string is a SHA1fatalhat string is a SHA1 hash for the delta
297 ** basis, whister is presumably in the main repository. If NULL, then
298 ** data contains content without delta compression.
299 */
300 static const char zBundleInit[] =
301 @ CREATE TABLE IF NOT EXISTS "%w".bconfig(
302 @ bcname TEXT,
303 @ bcvalue ANY
304 @ );
305 @ CREATE TABLE IF NOT EXISTS "%w".bblob(
306 @ blobid INTEGER Pfatalhat string is a SHA1 hash for the delta
307 ** basis, whist ins
+1 -1
--- src/clone.c
+++ src/clone.c
@@ -164,11 +164,11 @@
164164
db_begin_transaction();
165165
db_record_repository_filename(g.argv[3]);
166166
db_initial_setup(0, 0, zDefaultUser, 0);
167167
user_select();
168168
db_set("content-schema", CONTENT_SCHEMA, 0);
169
- db_set("aux-schema", AUX_SCHEMA, 0);
169
+ db_set("aux-schema", AUX_SCHEMA_MAX, 0);
170170
db_set("rebuilt", get_version(), 0);
171171
remember_or_get_http_auth(zHttpAuth, urlFlags & URL_REMEMBER, g.argv[2]);
172172
url_remember();
173173
if( g.zSSLIdentity!=0 ){
174174
/* If the --ssl-identity option was specified, store it as a setting */
175175
--- src/clone.c
+++ src/clone.c
@@ -164,11 +164,11 @@
164 db_begin_transaction();
165 db_record_repository_filename(g.argv[3]);
166 db_initial_setup(0, 0, zDefaultUser, 0);
167 user_select();
168 db_set("content-schema", CONTENT_SCHEMA, 0);
169 db_set("aux-schema", AUX_SCHEMA, 0);
170 db_set("rebuilt", get_version(), 0);
171 remember_or_get_http_auth(zHttpAuth, urlFlags & URL_REMEMBER, g.argv[2]);
172 url_remember();
173 if( g.zSSLIdentity!=0 ){
174 /* If the --ssl-identity option was specified, store it as a setting */
175
--- src/clone.c
+++ src/clone.c
@@ -164,11 +164,11 @@
164 db_begin_transaction();
165 db_record_repository_filename(g.argv[3]);
166 db_initial_setup(0, 0, zDefaultUser, 0);
167 user_select();
168 db_set("content-schema", CONTENT_SCHEMA, 0);
169 db_set("aux-schema", AUX_SCHEMA_MAX, 0);
170 db_set("rebuilt", get_version(), 0);
171 remember_or_get_http_auth(zHttpAuth, urlFlags & URL_REMEMBER, g.argv[2]);
172 url_remember();
173 if( g.zSSLIdentity!=0 ){
174 /* If the --ssl-identity option was specified, store it as a setting */
175
--- src/codecheck1.c
+++ src/codecheck1.c
@@ -309,10 +309,11 @@
309309
struct {
310310
const char *zFName; /* Name of the function */
311311
int iFmtArg; /* Index of format argument. Leftmost is 1. */
312312
unsigned fmtFlags; /* Processing flags */
313313
} aFmtFunc[] = {
314
+ { "admin_log", 1, 0 },
314315
{ "blob_append_sql", 2, FMT_NO_S },
315316
{ "blob_appendf", 2, 0 },
316317
{ "cgi_panic", 1, 0 },
317318
{ "cgi_redirectf", 1, 0 },
318319
{ "db_blob", 2, FMT_NO_S },
319320
--- src/codecheck1.c
+++ src/codecheck1.c
@@ -309,10 +309,11 @@
309 struct {
310 const char *zFName; /* Name of the function */
311 int iFmtArg; /* Index of format argument. Leftmost is 1. */
312 unsigned fmtFlags; /* Processing flags */
313 } aFmtFunc[] = {
 
314 { "blob_append_sql", 2, FMT_NO_S },
315 { "blob_appendf", 2, 0 },
316 { "cgi_panic", 1, 0 },
317 { "cgi_redirectf", 1, 0 },
318 { "db_blob", 2, FMT_NO_S },
319
--- src/codecheck1.c
+++ src/codecheck1.c
@@ -309,10 +309,11 @@
309 struct {
310 const char *zFName; /* Name of the function */
311 int iFmtArg; /* Index of format argument. Leftmost is 1. */
312 unsigned fmtFlags; /* Processing flags */
313 } aFmtFunc[] = {
314 { "admin_log", 1, 0 },
315 { "blob_append_sql", 2, FMT_NO_S },
316 { "blob_appendf", 2, 0 },
317 { "cgi_panic", 1, 0 },
318 { "cgi_redirectf", 1, 0 },
319 { "db_blob", 2, FMT_NO_S },
320
+4 -4
--- src/content.c
+++ src/content.c
@@ -567,14 +567,14 @@
567567
db_exec(&s1);
568568
rid = db_last_insert_rowid();
569569
if( !pBlob ){
570570
db_multi_exec("INSERT OR IGNORE INTO phantom VALUES(%d)", rid);
571571
}
572
- if( g.markPrivate || isPrivate ){
573
- db_multi_exec("INSERT INTO private VALUES(%d)", rid);
574
- markAsUnclustered = 0;
575
- }
572
+ }
573
+ if( g.markPrivate || isPrivate ){
574
+ db_multi_exec("INSERT INTO private VALUES(%d)", rid);
575
+ markAsUnclustered = 0;
576576
}
577577
if( nBlob==0 ) blob_reset(&cmpr);
578578
579579
/* If the srcId is specified, then the data we just added is
580580
** really a delta. Record this fact in the delta table.
581581
--- src/content.c
+++ src/content.c
@@ -567,14 +567,14 @@
567 db_exec(&s1);
568 rid = db_last_insert_rowid();
569 if( !pBlob ){
570 db_multi_exec("INSERT OR IGNORE INTO phantom VALUES(%d)", rid);
571 }
572 if( g.markPrivate || isPrivate ){
573 db_multi_exec("INSERT INTO private VALUES(%d)", rid);
574 markAsUnclustered = 0;
575 }
576 }
577 if( nBlob==0 ) blob_reset(&cmpr);
578
579 /* If the srcId is specified, then the data we just added is
580 ** really a delta. Record this fact in the delta table.
581
--- src/content.c
+++ src/content.c
@@ -567,14 +567,14 @@
567 db_exec(&s1);
568 rid = db_last_insert_rowid();
569 if( !pBlob ){
570 db_multi_exec("INSERT OR IGNORE INTO phantom VALUES(%d)", rid);
571 }
572 }
573 if( g.markPrivate || isPrivate ){
574 db_multi_exec("INSERT INTO private VALUES(%d)", rid);
575 markAsUnclustered = 0;
576 }
577 if( nBlob==0 ) blob_reset(&cmpr);
578
579 /* If the srcId is specified, then the data we just added is
580 ** really a delta. Record this fact in the delta table.
581
+139 -11
--- src/db.c
+++ src/db.c
@@ -424,10 +424,13 @@
424424
425425
/*
426426
** Extract text, integer, or blob values from the N-th column of the
427427
** current row.
428428
*/
429
+int db_column_type(Stmt *pStmt, int N){
430
+ return sqlite3_column_type(pStmt->pStmt, N);
431
+}
429432
int db_column_bytes(Stmt *pStmt, int N){
430433
return sqlite3_column_bytes(pStmt->pStmt, N);
431434
}
432435
int db_column_int(Stmt *pStmt, int N){
433436
return sqlite3_column_int(pStmt->pStmt, N);
@@ -486,10 +489,50 @@
486489
while( (rc = db_step(pStmt))==SQLITE_ROW ){}
487490
rc = db_reset(pStmt);
488491
db_check_result(rc);
489492
return rc;
490493
}
494
+
495
+/*
496
+** Print the output of one or more SQL queries on standard output.
497
+** This routine is used for debugging purposes only.
498
+*/
499
+int db_debug(const char *zSql, ...){
500
+ Blob sql;
501
+ int rc = SQLITE_OK;
502
+ va_list ap;
503
+ const char *z, *zEnd;
504
+ sqlite3_stmt *pStmt;
505
+ blob_init(&sql, 0, 0);
506
+ va_start(ap, zSql);
507
+ blob_vappendf(&sql, zSql, ap);
508
+ va_end(ap);
509
+ z = blob_str(&sql);
510
+ while( rc==SQLITE_OK && z[0] ){
511
+ pStmt = 0;
512
+ rc = sqlite3_prepare_v2(g.db, z, -1, &pStmt, &zEnd);
513
+ if( rc!=SQLITE_OK ) break;
514
+ if( pStmt ){
515
+ int nRow = 0;
516
+ db.nPrepare++;
517
+ while( sqlite3_step(pStmt)==SQLITE_ROW ){
518
+ int i, n;
519
+ if( nRow++ > 0 ) fossil_print("\n");
520
+ n = sqlite3_column_count(pStmt);
521
+ for(i=0; i<n; i++){
522
+ fossil_print("%s = %s\n", sqlite3_column_name(pStmt, i),
523
+ sqlite3_column_text(pStmt,i));
524
+ }
525
+ }
526
+ rc = sqlite3_finalize(pStmt);
527
+ if( rc ) db_err("%s: {%.*s}", sqlite3_errmsg(g.db), (int)(zEnd-z), z);
528
+ }
529
+ z = zEnd;
530
+ }
531
+ blob_reset(&sql);
532
+ return rc;
533
+}
491534
492535
/*
493536
** Execute multiple SQL statements.
494537
*/
495538
int db_multi_exec(const char *zSql, ...){
@@ -706,10 +749,39 @@
706749
if( rc==0 ){
707750
sqlite3_result_int64(context, mtime);
708751
}
709752
}
710753
754
+void db_sym2rid_function(
755
+ sqlite3_context *context,
756
+ int argc,
757
+ sqlite3_value **argv
758
+){
759
+ char const * arg;
760
+ char const * type;
761
+ if(1 != argc && 2 != argc){
762
+ sqlite3_result_error(context, "Expecting one or two arguments", -1);
763
+ return;
764
+ }
765
+ arg = (const char*)sqlite3_value_text(argv[0]);
766
+ if(!arg){
767
+ sqlite3_result_error(context, "Expecting a STRING argument", -1);
768
+ }else{
769
+ int rid;
770
+ type = (2==argc) ? (const char*)sqlite3_value_text(argv[1]) : 0;
771
+ if(!type) type = "ci";
772
+ rid = symbolic_name_to_rid( arg, type );
773
+ if(rid<0){
774
+ sqlite3_result_error(context, "Symbolic name is ambiguous.", -1);
775
+ }else if(0==rid){
776
+ sqlite3_result_null(context);
777
+ }else{
778
+ sqlite3_result_int64(context, rid);
779
+ }
780
+ }
781
+}
782
+
711783
712784
/*
713785
** Open a database file. Return a pointer to the new database
714786
** connection. An error results in process abort.
715787
*/
@@ -738,13 +810,22 @@
738810
sqlite3_create_function(
739811
db, "is_selected", 1, SQLITE_UTF8, 0, file_is_selected,0,0
740812
);
741813
sqlite3_create_function(
742814
db, "if_selected", 3, SQLITE_UTF8, 0, file_is_selected,0,0
815
+ );
816
+ sqlite3_create_function(
817
+ db, "symbolic_name_to_rid", 1, SQLITE_UTF8, 0, db_sym2rid_function,
818
+ 0, 0
819
+ );
820
+ sqlite3_create_function(
821
+ db, "symbolic_name_to_rid", 2, SQLITE_UTF8, 0, db_sym2rid_function,
822
+ 0, 0
743823
);
744824
if( g.fSqlTrace ) sqlite3_trace(db, db_sql_trace, 0);
745825
re_add_sql_func(db);
826
+ foci_register(db);
746827
sqlite3_exec(db, "PRAGMA foreign_keys=OFF;", 0, 0, 0);
747828
return db;
748829
}
749830
750831
@@ -962,20 +1043,21 @@
9621043
** is found, it is attached to the open database connection too.
9631044
*/
9641045
int db_open_local(const char *zDbName){
9651046
int i, n;
9661047
char zPwd[2000];
967
- static const char aDbName[][10] = { "_FOSSIL_", ".fslckout", ".fos" };
1048
+ static const char *(aDbName[]) = { "_FOSSIL_", ".fslckout", ".fos" };
9681049
9691050
if( g.localOpen ) return 1;
9701051
file_getcwd(zPwd, sizeof(zPwd)-20);
9711052
n = strlen(zPwd);
9721053
while( n>0 ){
9731054
for(i=0; i<count(aDbName); i++){
9741055
sqlite3_snprintf(sizeof(zPwd)-n, &zPwd[n], "/%s", aDbName[i]);
9751056
if( isValidLocalDb(zPwd) ){
9761057
/* Found a valid checkout database file */
1058
+ g.zLocalDbName = mprintf("%s", zPwd);
9771059
zPwd[n] = 0;
9781060
while( n>0 && zPwd[n-1]=='/' ){
9791061
n--;
9801062
zPwd[n] = 0;
9811063
}
@@ -1117,13 +1199,13 @@
11171199
11181200
/*
11191201
** Return TRUE if the schema is out-of-date
11201202
*/
11211203
int db_schema_is_outofdate(void){
1122
- return db_exists("SELECT 1 FROM config"
1123
- " WHERE name='aux-schema'"
1124
- " AND value<>%Q", AUX_SCHEMA);
1204
+ if( g.zAuxSchema==0 ) g.zAuxSchema = db_get("aux-schema","");
1205
+ return strcmp(g.zAuxSchema,AUX_SCHEMA_MIN)<0
1206
+ || strcmp(g.zAuxSchema,AUX_SCHEMA_MAX)>0;
11251207
}
11261208
11271209
/*
11281210
** Return true if the database is writeable
11291211
*/
@@ -1138,14 +1220,14 @@
11381220
void db_verify_schema(void){
11391221
if( db_schema_is_outofdate() ){
11401222
#ifdef FOSSIL_ENABLE_JSON
11411223
g.json.resultCode = FSL_JSON_E_DB_NEEDS_REBUILD;
11421224
#endif
1143
- fossil_warning("incorrect repository schema version");
1144
- fossil_warning("your repository has schema version \"%s\" "
1145
- "but this binary expects version \"%s\"",
1146
- db_get("aux-schema",0), AUX_SCHEMA);
1225
+ fossil_warning("incorrect repository schema version: "
1226
+ "current repository schema version is \"%s\" "
1227
+ "but need versions between \"%s\" and \"%s\".",
1228
+ g.zAuxSchema, AUX_SCHEMA_MIN, AUX_SCHEMA_MAX);
11471229
fossil_fatal("run \"fossil rebuild\" to fix this problem");
11481230
}
11491231
}
11501232
11511233
@@ -1393,11 +1475,11 @@
13931475
char *zDate;
13941476
Blob hash;
13951477
Blob manifest;
13961478
13971479
db_set("content-schema", CONTENT_SCHEMA, 0);
1398
- db_set("aux-schema", AUX_SCHEMA, 0);
1480
+ db_set("aux-schema", AUX_SCHEMA_MAX, 0);
13991481
db_set("rebuilt", get_version(), 0);
14001482
if( makeServerCodes ){
14011483
db_setup_server_and_project_codes(0);
14021484
}
14031485
if( !db_is_global("autosync") ) db_set_int("autosync", 1, 0);
@@ -2204,10 +2286,11 @@
22042286
const char *def; /* Default value */
22052287
};
22062288
#endif /* INTERFACE */
22072289
struct stControlSettings const ctrlSettings[] = {
22082290
{ "access-log", 0, 0, 0, 0, "off" },
2291
+ { "admin-log", 0, 0, 0, 0, "off" },
22092292
{ "allow-symlinks", 0, 0, 1, 0, "off" },
22102293
{ "auto-captcha", "autocaptcha", 0, 0, 0, "on" },
22112294
{ "auto-hyperlink", 0, 0, 0, 0, "on", },
22122295
{ "auto-shun", 0, 0, 0, 0, "on" },
22132296
{ "autosync", 0, 0, 0, 0, "on" },
@@ -2284,10 +2367,13 @@
22842367
** The "unset" command clears a property setting.
22852368
**
22862369
**
22872370
** access-log If enabled, record successful and failed login attempts
22882371
** in the "accesslog" table. Default: off
2372
+**
2373
+** admin-log If enabled, record configuration changes in the
2374
+** "admin_log" table. Default: off
22892375
**
22902376
** allow-symlinks If enabled, don't follow symlinks, and instead treat
22912377
** (versionable) them as symlinks on Unix. Has no effect on Windows
22922378
** (existing links in repository created on Unix become
22932379
** plain-text files with link destination path inside).
@@ -2660,21 +2746,63 @@
26602746
"%s WITHOUT ROWID;\n"
26612747
"INSERT INTO \"%w\" SELECT * FROM \"x_%w\";\n"
26622748
"DROP TABLE \"x_%w\";\n",
26632749
zTName, zTName, blob_sql_text(&newSql), zTName, zTName, zTName
26642750
);
2665
- fossil_print("Converting table %s of %s to WITHOUT ROWID.\n", zTName, g.argv[i]);
2751
+ fossil_print("Converting table %s of %s to WITHOUT ROWID.\n",
2752
+ zTName, g.argv[i]);
26662753
blob_reset(&newSql);
26672754
}
26682755
blob_append_sql(&allSql, "COMMIT;\n");
26692756
db_finalize(&q);
26702757
if( dryRun ){
26712758
fossil_print("SQL that would have been evaluated:\n");
2672
- fossil_print("-------------------------------------------------------------\n");
2759
+ fossil_print("%.78c\n", '-');
26732760
fossil_print("%s", blob_sql_text(&allSql));
26742761
}else{
26752762
db_multi_exec("%s", blob_sql_text(&allSql));
26762763
}
26772764
blob_reset(&allSql);
26782765
db_close(1);
26792766
}
26802767
}
2768
+
2769
+/*
2770
+** Make sure the adminlog table exists. Create it if it does not
2771
+*/
2772
+void create_admin_log_table(void){
2773
+ static int once = 0;
2774
+ if( once ) return;
2775
+ once = 1;
2776
+ db_multi_exec(
2777
+ "CREATE TABLE IF NOT EXISTS \"%w\".admin_log(\n"
2778
+ " id INTEGER PRIMARY KEY,\n"
2779
+ " time INTEGER, -- Seconds since 1970\n"
2780
+ " page TEXT, -- path of page\n"
2781
+ " who TEXT, -- User who made the change\n "
2782
+ " what TEXT -- What changed\n"
2783
+ ")", db_name("repository")
2784
+ );
2785
+}
2786
+
2787
+/*
2788
+** Write a message into the admin_event table, if admin logging is
2789
+** enabled via the admin-log configuration option.
2790
+*/
2791
+void admin_log(const char *zFormat, ...){
2792
+ Blob what = empty_blob;
2793
+ va_list ap;
2794
+ if( !db_get_boolean("admin-log", 0) ){
2795
+ /* Potential leak here (on %z params) but
2796
+ the alternative is to let blob_vappendf()
2797
+ do it below. */
2798
+ return;
2799
+ }
2800
+ create_admin_log_table();
2801
+ va_start(ap,zFormat);
2802
+ blob_vappendf( &what, zFormat, ap );
2803
+ va_end(ap);
2804
+ db_multi_exec("INSERT INTO admin_log(time,page,who,what)"
2805
+ " VALUES(now(), %Q, %Q, %B)",
2806
+ g.zPath, g.zLogin, &what);
2807
+ blob_reset(&what);
2808
+}
26812809
--- src/db.c
+++ src/db.c
@@ -424,10 +424,13 @@
424
425 /*
426 ** Extract text, integer, or blob values from the N-th column of the
427 ** current row.
428 */
 
 
 
429 int db_column_bytes(Stmt *pStmt, int N){
430 return sqlite3_column_bytes(pStmt->pStmt, N);
431 }
432 int db_column_int(Stmt *pStmt, int N){
433 return sqlite3_column_int(pStmt->pStmt, N);
@@ -486,10 +489,50 @@
486 while( (rc = db_step(pStmt))==SQLITE_ROW ){}
487 rc = db_reset(pStmt);
488 db_check_result(rc);
489 return rc;
490 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
491
492 /*
493 ** Execute multiple SQL statements.
494 */
495 int db_multi_exec(const char *zSql, ...){
@@ -706,10 +749,39 @@
706 if( rc==0 ){
707 sqlite3_result_int64(context, mtime);
708 }
709 }
710
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
711
712 /*
713 ** Open a database file. Return a pointer to the new database
714 ** connection. An error results in process abort.
715 */
@@ -738,13 +810,22 @@
738 sqlite3_create_function(
739 db, "is_selected", 1, SQLITE_UTF8, 0, file_is_selected,0,0
740 );
741 sqlite3_create_function(
742 db, "if_selected", 3, SQLITE_UTF8, 0, file_is_selected,0,0
 
 
 
 
 
 
 
 
743 );
744 if( g.fSqlTrace ) sqlite3_trace(db, db_sql_trace, 0);
745 re_add_sql_func(db);
 
746 sqlite3_exec(db, "PRAGMA foreign_keys=OFF;", 0, 0, 0);
747 return db;
748 }
749
750
@@ -962,20 +1043,21 @@
962 ** is found, it is attached to the open database connection too.
963 */
964 int db_open_local(const char *zDbName){
965 int i, n;
966 char zPwd[2000];
967 static const char aDbName[][10] = { "_FOSSIL_", ".fslckout", ".fos" };
968
969 if( g.localOpen ) return 1;
970 file_getcwd(zPwd, sizeof(zPwd)-20);
971 n = strlen(zPwd);
972 while( n>0 ){
973 for(i=0; i<count(aDbName); i++){
974 sqlite3_snprintf(sizeof(zPwd)-n, &zPwd[n], "/%s", aDbName[i]);
975 if( isValidLocalDb(zPwd) ){
976 /* Found a valid checkout database file */
 
977 zPwd[n] = 0;
978 while( n>0 && zPwd[n-1]=='/' ){
979 n--;
980 zPwd[n] = 0;
981 }
@@ -1117,13 +1199,13 @@
1117
1118 /*
1119 ** Return TRUE if the schema is out-of-date
1120 */
1121 int db_schema_is_outofdate(void){
1122 return db_exists("SELECT 1 FROM config"
1123 " WHERE name='aux-schema'"
1124 " AND value<>%Q", AUX_SCHEMA);
1125 }
1126
1127 /*
1128 ** Return true if the database is writeable
1129 */
@@ -1138,14 +1220,14 @@
1138 void db_verify_schema(void){
1139 if( db_schema_is_outofdate() ){
1140 #ifdef FOSSIL_ENABLE_JSON
1141 g.json.resultCode = FSL_JSON_E_DB_NEEDS_REBUILD;
1142 #endif
1143 fossil_warning("incorrect repository schema version");
1144 fossil_warning("your repository has schema version \"%s\" "
1145 "but this binary expects version \"%s\"",
1146 db_get("aux-schema",0), AUX_SCHEMA);
1147 fossil_fatal("run \"fossil rebuild\" to fix this problem");
1148 }
1149 }
1150
1151
@@ -1393,11 +1475,11 @@
1393 char *zDate;
1394 Blob hash;
1395 Blob manifest;
1396
1397 db_set("content-schema", CONTENT_SCHEMA, 0);
1398 db_set("aux-schema", AUX_SCHEMA, 0);
1399 db_set("rebuilt", get_version(), 0);
1400 if( makeServerCodes ){
1401 db_setup_server_and_project_codes(0);
1402 }
1403 if( !db_is_global("autosync") ) db_set_int("autosync", 1, 0);
@@ -2204,10 +2286,11 @@
2204 const char *def; /* Default value */
2205 };
2206 #endif /* INTERFACE */
2207 struct stControlSettings const ctrlSettings[] = {
2208 { "access-log", 0, 0, 0, 0, "off" },
 
2209 { "allow-symlinks", 0, 0, 1, 0, "off" },
2210 { "auto-captcha", "autocaptcha", 0, 0, 0, "on" },
2211 { "auto-hyperlink", 0, 0, 0, 0, "on", },
2212 { "auto-shun", 0, 0, 0, 0, "on" },
2213 { "autosync", 0, 0, 0, 0, "on" },
@@ -2284,10 +2367,13 @@
2284 ** The "unset" command clears a property setting.
2285 **
2286 **
2287 ** access-log If enabled, record successful and failed login attempts
2288 ** in the "accesslog" table. Default: off
 
 
 
2289 **
2290 ** allow-symlinks If enabled, don't follow symlinks, and instead treat
2291 ** (versionable) them as symlinks on Unix. Has no effect on Windows
2292 ** (existing links in repository created on Unix become
2293 ** plain-text files with link destination path inside).
@@ -2660,21 +2746,63 @@
2660 "%s WITHOUT ROWID;\n"
2661 "INSERT INTO \"%w\" SELECT * FROM \"x_%w\";\n"
2662 "DROP TABLE \"x_%w\";\n",
2663 zTName, zTName, blob_sql_text(&newSql), zTName, zTName, zTName
2664 );
2665 fossil_print("Converting table %s of %s to WITHOUT ROWID.\n", zTName, g.argv[i]);
 
2666 blob_reset(&newSql);
2667 }
2668 blob_append_sql(&allSql, "COMMIT;\n");
2669 db_finalize(&q);
2670 if( dryRun ){
2671 fossil_print("SQL that would have been evaluated:\n");
2672 fossil_print("-------------------------------------------------------------\n");
2673 fossil_print("%s", blob_sql_text(&allSql));
2674 }else{
2675 db_multi_exec("%s", blob_sql_text(&allSql));
2676 }
2677 blob_reset(&allSql);
2678 db_close(1);
2679 }
2680 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2681
--- src/db.c
+++ src/db.c
@@ -424,10 +424,13 @@
424
425 /*
426 ** Extract text, integer, or blob values from the N-th column of the
427 ** current row.
428 */
429 int db_column_type(Stmt *pStmt, int N){
430 return sqlite3_column_type(pStmt->pStmt, N);
431 }
432 int db_column_bytes(Stmt *pStmt, int N){
433 return sqlite3_column_bytes(pStmt->pStmt, N);
434 }
435 int db_column_int(Stmt *pStmt, int N){
436 return sqlite3_column_int(pStmt->pStmt, N);
@@ -486,10 +489,50 @@
489 while( (rc = db_step(pStmt))==SQLITE_ROW ){}
490 rc = db_reset(pStmt);
491 db_check_result(rc);
492 return rc;
493 }
494
495 /*
496 ** Print the output of one or more SQL queries on standard output.
497 ** This routine is used for debugging purposes only.
498 */
499 int db_debug(const char *zSql, ...){
500 Blob sql;
501 int rc = SQLITE_OK;
502 va_list ap;
503 const char *z, *zEnd;
504 sqlite3_stmt *pStmt;
505 blob_init(&sql, 0, 0);
506 va_start(ap, zSql);
507 blob_vappendf(&sql, zSql, ap);
508 va_end(ap);
509 z = blob_str(&sql);
510 while( rc==SQLITE_OK && z[0] ){
511 pStmt = 0;
512 rc = sqlite3_prepare_v2(g.db, z, -1, &pStmt, &zEnd);
513 if( rc!=SQLITE_OK ) break;
514 if( pStmt ){
515 int nRow = 0;
516 db.nPrepare++;
517 while( sqlite3_step(pStmt)==SQLITE_ROW ){
518 int i, n;
519 if( nRow++ > 0 ) fossil_print("\n");
520 n = sqlite3_column_count(pStmt);
521 for(i=0; i<n; i++){
522 fossil_print("%s = %s\n", sqlite3_column_name(pStmt, i),
523 sqlite3_column_text(pStmt,i));
524 }
525 }
526 rc = sqlite3_finalize(pStmt);
527 if( rc ) db_err("%s: {%.*s}", sqlite3_errmsg(g.db), (int)(zEnd-z), z);
528 }
529 z = zEnd;
530 }
531 blob_reset(&sql);
532 return rc;
533 }
534
535 /*
536 ** Execute multiple SQL statements.
537 */
538 int db_multi_exec(const char *zSql, ...){
@@ -706,10 +749,39 @@
749 if( rc==0 ){
750 sqlite3_result_int64(context, mtime);
751 }
752 }
753
754 void db_sym2rid_function(
755 sqlite3_context *context,
756 int argc,
757 sqlite3_value **argv
758 ){
759 char const * arg;
760 char const * type;
761 if(1 != argc && 2 != argc){
762 sqlite3_result_error(context, "Expecting one or two arguments", -1);
763 return;
764 }
765 arg = (const char*)sqlite3_value_text(argv[0]);
766 if(!arg){
767 sqlite3_result_error(context, "Expecting a STRING argument", -1);
768 }else{
769 int rid;
770 type = (2==argc) ? (const char*)sqlite3_value_text(argv[1]) : 0;
771 if(!type) type = "ci";
772 rid = symbolic_name_to_rid( arg, type );
773 if(rid<0){
774 sqlite3_result_error(context, "Symbolic name is ambiguous.", -1);
775 }else if(0==rid){
776 sqlite3_result_null(context);
777 }else{
778 sqlite3_result_int64(context, rid);
779 }
780 }
781 }
782
783
784 /*
785 ** Open a database file. Return a pointer to the new database
786 ** connection. An error results in process abort.
787 */
@@ -738,13 +810,22 @@
810 sqlite3_create_function(
811 db, "is_selected", 1, SQLITE_UTF8, 0, file_is_selected,0,0
812 );
813 sqlite3_create_function(
814 db, "if_selected", 3, SQLITE_UTF8, 0, file_is_selected,0,0
815 );
816 sqlite3_create_function(
817 db, "symbolic_name_to_rid", 1, SQLITE_UTF8, 0, db_sym2rid_function,
818 0, 0
819 );
820 sqlite3_create_function(
821 db, "symbolic_name_to_rid", 2, SQLITE_UTF8, 0, db_sym2rid_function,
822 0, 0
823 );
824 if( g.fSqlTrace ) sqlite3_trace(db, db_sql_trace, 0);
825 re_add_sql_func(db);
826 foci_register(db);
827 sqlite3_exec(db, "PRAGMA foreign_keys=OFF;", 0, 0, 0);
828 return db;
829 }
830
831
@@ -962,20 +1043,21 @@
1043 ** is found, it is attached to the open database connection too.
1044 */
1045 int db_open_local(const char *zDbName){
1046 int i, n;
1047 char zPwd[2000];
1048 static const char *(aDbName[]) = { "_FOSSIL_", ".fslckout", ".fos" };
1049
1050 if( g.localOpen ) return 1;
1051 file_getcwd(zPwd, sizeof(zPwd)-20);
1052 n = strlen(zPwd);
1053 while( n>0 ){
1054 for(i=0; i<count(aDbName); i++){
1055 sqlite3_snprintf(sizeof(zPwd)-n, &zPwd[n], "/%s", aDbName[i]);
1056 if( isValidLocalDb(zPwd) ){
1057 /* Found a valid checkout database file */
1058 g.zLocalDbName = mprintf("%s", zPwd);
1059 zPwd[n] = 0;
1060 while( n>0 && zPwd[n-1]=='/' ){
1061 n--;
1062 zPwd[n] = 0;
1063 }
@@ -1117,13 +1199,13 @@
1199
1200 /*
1201 ** Return TRUE if the schema is out-of-date
1202 */
1203 int db_schema_is_outofdate(void){
1204 if( g.zAuxSchema==0 ) g.zAuxSchema = db_get("aux-schema","");
1205 return strcmp(g.zAuxSchema,AUX_SCHEMA_MIN)<0
1206 || strcmp(g.zAuxSchema,AUX_SCHEMA_MAX)>0;
1207 }
1208
1209 /*
1210 ** Return true if the database is writeable
1211 */
@@ -1138,14 +1220,14 @@
1220 void db_verify_schema(void){
1221 if( db_schema_is_outofdate() ){
1222 #ifdef FOSSIL_ENABLE_JSON
1223 g.json.resultCode = FSL_JSON_E_DB_NEEDS_REBUILD;
1224 #endif
1225 fossil_warning("incorrect repository schema version: "
1226 "current repository schema version is \"%s\" "
1227 "but need versions between \"%s\" and \"%s\".",
1228 g.zAuxSchema, AUX_SCHEMA_MIN, AUX_SCHEMA_MAX);
1229 fossil_fatal("run \"fossil rebuild\" to fix this problem");
1230 }
1231 }
1232
1233
@@ -1393,11 +1475,11 @@
1475 char *zDate;
1476 Blob hash;
1477 Blob manifest;
1478
1479 db_set("content-schema", CONTENT_SCHEMA, 0);
1480 db_set("aux-schema", AUX_SCHEMA_MAX, 0);
1481 db_set("rebuilt", get_version(), 0);
1482 if( makeServerCodes ){
1483 db_setup_server_and_project_codes(0);
1484 }
1485 if( !db_is_global("autosync") ) db_set_int("autosync", 1, 0);
@@ -2204,10 +2286,11 @@
2286 const char *def; /* Default value */
2287 };
2288 #endif /* INTERFACE */
2289 struct stControlSettings const ctrlSettings[] = {
2290 { "access-log", 0, 0, 0, 0, "off" },
2291 { "admin-log", 0, 0, 0, 0, "off" },
2292 { "allow-symlinks", 0, 0, 1, 0, "off" },
2293 { "auto-captcha", "autocaptcha", 0, 0, 0, "on" },
2294 { "auto-hyperlink", 0, 0, 0, 0, "on", },
2295 { "auto-shun", 0, 0, 0, 0, "on" },
2296 { "autosync", 0, 0, 0, 0, "on" },
@@ -2284,10 +2367,13 @@
2367 ** The "unset" command clears a property setting.
2368 **
2369 **
2370 ** access-log If enabled, record successful and failed login attempts
2371 ** in the "accesslog" table. Default: off
2372 **
2373 ** admin-log If enabled, record configuration changes in the
2374 ** "admin_log" table. Default: off
2375 **
2376 ** allow-symlinks If enabled, don't follow symlinks, and instead treat
2377 ** (versionable) them as symlinks on Unix. Has no effect on Windows
2378 ** (existing links in repository created on Unix become
2379 ** plain-text files with link destination path inside).
@@ -2660,21 +2746,63 @@
2746 "%s WITHOUT ROWID;\n"
2747 "INSERT INTO \"%w\" SELECT * FROM \"x_%w\";\n"
2748 "DROP TABLE \"x_%w\";\n",
2749 zTName, zTName, blob_sql_text(&newSql), zTName, zTName, zTName
2750 );
2751 fossil_print("Converting table %s of %s to WITHOUT ROWID.\n",
2752 zTName, g.argv[i]);
2753 blob_reset(&newSql);
2754 }
2755 blob_append_sql(&allSql, "COMMIT;\n");
2756 db_finalize(&q);
2757 if( dryRun ){
2758 fossil_print("SQL that would have been evaluated:\n");
2759 fossil_print("%.78c\n", '-');
2760 fossil_print("%s", blob_sql_text(&allSql));
2761 }else{
2762 db_multi_exec("%s", blob_sql_text(&allSql));
2763 }
2764 blob_reset(&allSql);
2765 db_close(1);
2766 }
2767 }
2768
2769 /*
2770 ** Make sure the adminlog table exists. Create it if it does not
2771 */
2772 void create_admin_log_table(void){
2773 static int once = 0;
2774 if( once ) return;
2775 once = 1;
2776 db_multi_exec(
2777 "CREATE TABLE IF NOT EXISTS \"%w\".admin_log(\n"
2778 " id INTEGER PRIMARY KEY,\n"
2779 " time INTEGER, -- Seconds since 1970\n"
2780 " page TEXT, -- path of page\n"
2781 " who TEXT, -- User who made the change\n "
2782 " what TEXT -- What changed\n"
2783 ")", db_name("repository")
2784 );
2785 }
2786
2787 /*
2788 ** Write a message into the admin_event table, if admin logging is
2789 ** enabled via the admin-log configuration option.
2790 */
2791 void admin_log(const char *zFormat, ...){
2792 Blob what = empty_blob;
2793 va_list ap;
2794 if( !db_get_boolean("admin-log", 0) ){
2795 /* Potential leak here (on %z params) but
2796 the alternative is to let blob_vappendf()
2797 do it below. */
2798 return;
2799 }
2800 create_admin_log_table();
2801 va_start(ap,zFormat);
2802 blob_vappendf( &what, zFormat, ap );
2803 va_end(ap);
2804 db_multi_exec("INSERT INTO admin_log(time,page,who,what)"
2805 " VALUES(now(), %Q, %Q, %B)",
2806 g.zPath, g.zLogin, &what);
2807 blob_reset(&what);
2808 }
2809
+139 -11
--- src/db.c
+++ src/db.c
@@ -424,10 +424,13 @@
424424
425425
/*
426426
** Extract text, integer, or blob values from the N-th column of the
427427
** current row.
428428
*/
429
+int db_column_type(Stmt *pStmt, int N){
430
+ return sqlite3_column_type(pStmt->pStmt, N);
431
+}
429432
int db_column_bytes(Stmt *pStmt, int N){
430433
return sqlite3_column_bytes(pStmt->pStmt, N);
431434
}
432435
int db_column_int(Stmt *pStmt, int N){
433436
return sqlite3_column_int(pStmt->pStmt, N);
@@ -486,10 +489,50 @@
486489
while( (rc = db_step(pStmt))==SQLITE_ROW ){}
487490
rc = db_reset(pStmt);
488491
db_check_result(rc);
489492
return rc;
490493
}
494
+
495
+/*
496
+** Print the output of one or more SQL queries on standard output.
497
+** This routine is used for debugging purposes only.
498
+*/
499
+int db_debug(const char *zSql, ...){
500
+ Blob sql;
501
+ int rc = SQLITE_OK;
502
+ va_list ap;
503
+ const char *z, *zEnd;
504
+ sqlite3_stmt *pStmt;
505
+ blob_init(&sql, 0, 0);
506
+ va_start(ap, zSql);
507
+ blob_vappendf(&sql, zSql, ap);
508
+ va_end(ap);
509
+ z = blob_str(&sql);
510
+ while( rc==SQLITE_OK && z[0] ){
511
+ pStmt = 0;
512
+ rc = sqlite3_prepare_v2(g.db, z, -1, &pStmt, &zEnd);
513
+ if( rc!=SQLITE_OK ) break;
514
+ if( pStmt ){
515
+ int nRow = 0;
516
+ db.nPrepare++;
517
+ while( sqlite3_step(pStmt)==SQLITE_ROW ){
518
+ int i, n;
519
+ if( nRow++ > 0 ) fossil_print("\n");
520
+ n = sqlite3_column_count(pStmt);
521
+ for(i=0; i<n; i++){
522
+ fossil_print("%s = %s\n", sqlite3_column_name(pStmt, i),
523
+ sqlite3_column_text(pStmt,i));
524
+ }
525
+ }
526
+ rc = sqlite3_finalize(pStmt);
527
+ if( rc ) db_err("%s: {%.*s}", sqlite3_errmsg(g.db), (int)(zEnd-z), z);
528
+ }
529
+ z = zEnd;
530
+ }
531
+ blob_reset(&sql);
532
+ return rc;
533
+}
491534
492535
/*
493536
** Execute multiple SQL statements.
494537
*/
495538
int db_multi_exec(const char *zSql, ...){
@@ -706,10 +749,39 @@
706749
if( rc==0 ){
707750
sqlite3_result_int64(context, mtime);
708751
}
709752
}
710753
754
+void db_sym2rid_function(
755
+ sqlite3_context *context,
756
+ int argc,
757
+ sqlite3_value **argv
758
+){
759
+ char const * arg;
760
+ char const * type;
761
+ if(1 != argc && 2 != argc){
762
+ sqlite3_result_error(context, "Expecting one or two arguments", -1);
763
+ return;
764
+ }
765
+ arg = (const char*)sqlite3_value_text(argv[0]);
766
+ if(!arg){
767
+ sqlite3_result_error(context, "Expecting a STRING argument", -1);
768
+ }else{
769
+ int rid;
770
+ type = (2==argc) ? (const char*)sqlite3_value_text(argv[1]) : 0;
771
+ if(!type) type = "ci";
772
+ rid = symbolic_name_to_rid( arg, type );
773
+ if(rid<0){
774
+ sqlite3_result_error(context, "Symbolic name is ambiguous.", -1);
775
+ }else if(0==rid){
776
+ sqlite3_result_null(context);
777
+ }else{
778
+ sqlite3_result_int64(context, rid);
779
+ }
780
+ }
781
+}
782
+
711783
712784
/*
713785
** Open a database file. Return a pointer to the new database
714786
** connection. An error results in process abort.
715787
*/
@@ -738,13 +810,22 @@
738810
sqlite3_create_function(
739811
db, "is_selected", 1, SQLITE_UTF8, 0, file_is_selected,0,0
740812
);
741813
sqlite3_create_function(
742814
db, "if_selected", 3, SQLITE_UTF8, 0, file_is_selected,0,0
815
+ );
816
+ sqlite3_create_function(
817
+ db, "symbolic_name_to_rid", 1, SQLITE_UTF8, 0, db_sym2rid_function,
818
+ 0, 0
819
+ );
820
+ sqlite3_create_function(
821
+ db, "symbolic_name_to_rid", 2, SQLITE_UTF8, 0, db_sym2rid_function,
822
+ 0, 0
743823
);
744824
if( g.fSqlTrace ) sqlite3_trace(db, db_sql_trace, 0);
745825
re_add_sql_func(db);
826
+ foci_register(db);
746827
sqlite3_exec(db, "PRAGMA foreign_keys=OFF;", 0, 0, 0);
747828
return db;
748829
}
749830
750831
@@ -962,20 +1043,21 @@
9621043
** is found, it is attached to the open database connection too.
9631044
*/
9641045
int db_open_local(const char *zDbName){
9651046
int i, n;
9661047
char zPwd[2000];
967
- static const char aDbName[][10] = { "_FOSSIL_", ".fslckout", ".fos" };
1048
+ static const char *(aDbName[]) = { "_FOSSIL_", ".fslckout", ".fos" };
9681049
9691050
if( g.localOpen ) return 1;
9701051
file_getcwd(zPwd, sizeof(zPwd)-20);
9711052
n = strlen(zPwd);
9721053
while( n>0 ){
9731054
for(i=0; i<count(aDbName); i++){
9741055
sqlite3_snprintf(sizeof(zPwd)-n, &zPwd[n], "/%s", aDbName[i]);
9751056
if( isValidLocalDb(zPwd) ){
9761057
/* Found a valid checkout database file */
1058
+ g.zLocalDbName = mprintf("%s", zPwd);
9771059
zPwd[n] = 0;
9781060
while( n>0 && zPwd[n-1]=='/' ){
9791061
n--;
9801062
zPwd[n] = 0;
9811063
}
@@ -1117,13 +1199,13 @@
11171199
11181200
/*
11191201
** Return TRUE if the schema is out-of-date
11201202
*/
11211203
int db_schema_is_outofdate(void){
1122
- return db_exists("SELECT 1 FROM config"
1123
- " WHERE name='aux-schema'"
1124
- " AND value<>%Q", AUX_SCHEMA);
1204
+ if( g.zAuxSchema==0 ) g.zAuxSchema = db_get("aux-schema","");
1205
+ return strcmp(g.zAuxSchema,AUX_SCHEMA_MIN)<0
1206
+ || strcmp(g.zAuxSchema,AUX_SCHEMA_MAX)>0;
11251207
}
11261208
11271209
/*
11281210
** Return true if the database is writeable
11291211
*/
@@ -1138,14 +1220,14 @@
11381220
void db_verify_schema(void){
11391221
if( db_schema_is_outofdate() ){
11401222
#ifdef FOSSIL_ENABLE_JSON
11411223
g.json.resultCode = FSL_JSON_E_DB_NEEDS_REBUILD;
11421224
#endif
1143
- fossil_warning("incorrect repository schema version");
1144
- fossil_warning("your repository has schema version \"%s\" "
1145
- "but this binary expects version \"%s\"",
1146
- db_get("aux-schema",0), AUX_SCHEMA);
1225
+ fossil_warning("incorrect repository schema version: "
1226
+ "current repository schema version is \"%s\" "
1227
+ "but need versions between \"%s\" and \"%s\".",
1228
+ g.zAuxSchema, AUX_SCHEMA_MIN, AUX_SCHEMA_MAX);
11471229
fossil_fatal("run \"fossil rebuild\" to fix this problem");
11481230
}
11491231
}
11501232
11511233
@@ -1393,11 +1475,11 @@
13931475
char *zDate;
13941476
Blob hash;
13951477
Blob manifest;
13961478
13971479
db_set("content-schema", CONTENT_SCHEMA, 0);
1398
- db_set("aux-schema", AUX_SCHEMA, 0);
1480
+ db_set("aux-schema", AUX_SCHEMA_MAX, 0);
13991481
db_set("rebuilt", get_version(), 0);
14001482
if( makeServerCodes ){
14011483
db_setup_server_and_project_codes(0);
14021484
}
14031485
if( !db_is_global("autosync") ) db_set_int("autosync", 1, 0);
@@ -2204,10 +2286,11 @@
22042286
const char *def; /* Default value */
22052287
};
22062288
#endif /* INTERFACE */
22072289
struct stControlSettings const ctrlSettings[] = {
22082290
{ "access-log", 0, 0, 0, 0, "off" },
2291
+ { "admin-log", 0, 0, 0, 0, "off" },
22092292
{ "allow-symlinks", 0, 0, 1, 0, "off" },
22102293
{ "auto-captcha", "autocaptcha", 0, 0, 0, "on" },
22112294
{ "auto-hyperlink", 0, 0, 0, 0, "on", },
22122295
{ "auto-shun", 0, 0, 0, 0, "on" },
22132296
{ "autosync", 0, 0, 0, 0, "on" },
@@ -2284,10 +2367,13 @@
22842367
** The "unset" command clears a property setting.
22852368
**
22862369
**
22872370
** access-log If enabled, record successful and failed login attempts
22882371
** in the "accesslog" table. Default: off
2372
+**
2373
+** admin-log If enabled, record configuration changes in the
2374
+** "admin_log" table. Default: off
22892375
**
22902376
** allow-symlinks If enabled, don't follow symlinks, and instead treat
22912377
** (versionable) them as symlinks on Unix. Has no effect on Windows
22922378
** (existing links in repository created on Unix become
22932379
** plain-text files with link destination path inside).
@@ -2660,21 +2746,63 @@
26602746
"%s WITHOUT ROWID;\n"
26612747
"INSERT INTO \"%w\" SELECT * FROM \"x_%w\";\n"
26622748
"DROP TABLE \"x_%w\";\n",
26632749
zTName, zTName, blob_sql_text(&newSql), zTName, zTName, zTName
26642750
);
2665
- fossil_print("Converting table %s of %s to WITHOUT ROWID.\n", zTName, g.argv[i]);
2751
+ fossil_print("Converting table %s of %s to WITHOUT ROWID.\n",
2752
+ zTName, g.argv[i]);
26662753
blob_reset(&newSql);
26672754
}
26682755
blob_append_sql(&allSql, "COMMIT;\n");
26692756
db_finalize(&q);
26702757
if( dryRun ){
26712758
fossil_print("SQL that would have been evaluated:\n");
2672
- fossil_print("-------------------------------------------------------------\n");
2759
+ fossil_print("%.78c\n", '-');
26732760
fossil_print("%s", blob_sql_text(&allSql));
26742761
}else{
26752762
db_multi_exec("%s", blob_sql_text(&allSql));
26762763
}
26772764
blob_reset(&allSql);
26782765
db_close(1);
26792766
}
26802767
}
2768
+
2769
+/*
2770
+** Make sure the adminlog table exists. Create it if it does not
2771
+*/
2772
+void create_admin_log_table(void){
2773
+ static int once = 0;
2774
+ if( once ) return;
2775
+ once = 1;
2776
+ db_multi_exec(
2777
+ "CREATE TABLE IF NOT EXISTS \"%w\".admin_log(\n"
2778
+ " id INTEGER PRIMARY KEY,\n"
2779
+ " time INTEGER, -- Seconds since 1970\n"
2780
+ " page TEXT, -- path of page\n"
2781
+ " who TEXT, -- User who made the change\n "
2782
+ " what TEXT -- What changed\n"
2783
+ ")", db_name("repository")
2784
+ );
2785
+}
2786
+
2787
+/*
2788
+** Write a message into the admin_event table, if admin logging is
2789
+** enabled via the admin-log configuration option.
2790
+*/
2791
+void admin_log(const char *zFormat, ...){
2792
+ Blob what = empty_blob;
2793
+ va_list ap;
2794
+ if( !db_get_boolean("admin-log", 0) ){
2795
+ /* Potential leak here (on %z params) but
2796
+ the alternative is to let blob_vappendf()
2797
+ do it below. */
2798
+ return;
2799
+ }
2800
+ create_admin_log_table();
2801
+ va_start(ap,zFormat);
2802
+ blob_vappendf( &what, zFormat, ap );
2803
+ va_end(ap);
2804
+ db_multi_exec("INSERT INTO admin_log(time,page,who,what)"
2805
+ " VALUES(now(), %Q, %Q, %B)",
2806
+ g.zPath, g.zLogin, &what);
2807
+ blob_reset(&what);
2808
+}
26812809
--- src/db.c
+++ src/db.c
@@ -424,10 +424,13 @@
424
425 /*
426 ** Extract text, integer, or blob values from the N-th column of the
427 ** current row.
428 */
 
 
 
429 int db_column_bytes(Stmt *pStmt, int N){
430 return sqlite3_column_bytes(pStmt->pStmt, N);
431 }
432 int db_column_int(Stmt *pStmt, int N){
433 return sqlite3_column_int(pStmt->pStmt, N);
@@ -486,10 +489,50 @@
486 while( (rc = db_step(pStmt))==SQLITE_ROW ){}
487 rc = db_reset(pStmt);
488 db_check_result(rc);
489 return rc;
490 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
491
492 /*
493 ** Execute multiple SQL statements.
494 */
495 int db_multi_exec(const char *zSql, ...){
@@ -706,10 +749,39 @@
706 if( rc==0 ){
707 sqlite3_result_int64(context, mtime);
708 }
709 }
710
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
711
712 /*
713 ** Open a database file. Return a pointer to the new database
714 ** connection. An error results in process abort.
715 */
@@ -738,13 +810,22 @@
738 sqlite3_create_function(
739 db, "is_selected", 1, SQLITE_UTF8, 0, file_is_selected,0,0
740 );
741 sqlite3_create_function(
742 db, "if_selected", 3, SQLITE_UTF8, 0, file_is_selected,0,0
 
 
 
 
 
 
 
 
743 );
744 if( g.fSqlTrace ) sqlite3_trace(db, db_sql_trace, 0);
745 re_add_sql_func(db);
 
746 sqlite3_exec(db, "PRAGMA foreign_keys=OFF;", 0, 0, 0);
747 return db;
748 }
749
750
@@ -962,20 +1043,21 @@
962 ** is found, it is attached to the open database connection too.
963 */
964 int db_open_local(const char *zDbName){
965 int i, n;
966 char zPwd[2000];
967 static const char aDbName[][10] = { "_FOSSIL_", ".fslckout", ".fos" };
968
969 if( g.localOpen ) return 1;
970 file_getcwd(zPwd, sizeof(zPwd)-20);
971 n = strlen(zPwd);
972 while( n>0 ){
973 for(i=0; i<count(aDbName); i++){
974 sqlite3_snprintf(sizeof(zPwd)-n, &zPwd[n], "/%s", aDbName[i]);
975 if( isValidLocalDb(zPwd) ){
976 /* Found a valid checkout database file */
 
977 zPwd[n] = 0;
978 while( n>0 && zPwd[n-1]=='/' ){
979 n--;
980 zPwd[n] = 0;
981 }
@@ -1117,13 +1199,13 @@
1117
1118 /*
1119 ** Return TRUE if the schema is out-of-date
1120 */
1121 int db_schema_is_outofdate(void){
1122 return db_exists("SELECT 1 FROM config"
1123 " WHERE name='aux-schema'"
1124 " AND value<>%Q", AUX_SCHEMA);
1125 }
1126
1127 /*
1128 ** Return true if the database is writeable
1129 */
@@ -1138,14 +1220,14 @@
1138 void db_verify_schema(void){
1139 if( db_schema_is_outofdate() ){
1140 #ifdef FOSSIL_ENABLE_JSON
1141 g.json.resultCode = FSL_JSON_E_DB_NEEDS_REBUILD;
1142 #endif
1143 fossil_warning("incorrect repository schema version");
1144 fossil_warning("your repository has schema version \"%s\" "
1145 "but this binary expects version \"%s\"",
1146 db_get("aux-schema",0), AUX_SCHEMA);
1147 fossil_fatal("run \"fossil rebuild\" to fix this problem");
1148 }
1149 }
1150
1151
@@ -1393,11 +1475,11 @@
1393 char *zDate;
1394 Blob hash;
1395 Blob manifest;
1396
1397 db_set("content-schema", CONTENT_SCHEMA, 0);
1398 db_set("aux-schema", AUX_SCHEMA, 0);
1399 db_set("rebuilt", get_version(), 0);
1400 if( makeServerCodes ){
1401 db_setup_server_and_project_codes(0);
1402 }
1403 if( !db_is_global("autosync") ) db_set_int("autosync", 1, 0);
@@ -2204,10 +2286,11 @@
2204 const char *def; /* Default value */
2205 };
2206 #endif /* INTERFACE */
2207 struct stControlSettings const ctrlSettings[] = {
2208 { "access-log", 0, 0, 0, 0, "off" },
 
2209 { "allow-symlinks", 0, 0, 1, 0, "off" },
2210 { "auto-captcha", "autocaptcha", 0, 0, 0, "on" },
2211 { "auto-hyperlink", 0, 0, 0, 0, "on", },
2212 { "auto-shun", 0, 0, 0, 0, "on" },
2213 { "autosync", 0, 0, 0, 0, "on" },
@@ -2284,10 +2367,13 @@
2284 ** The "unset" command clears a property setting.
2285 **
2286 **
2287 ** access-log If enabled, record successful and failed login attempts
2288 ** in the "accesslog" table. Default: off
 
 
 
2289 **
2290 ** allow-symlinks If enabled, don't follow symlinks, and instead treat
2291 ** (versionable) them as symlinks on Unix. Has no effect on Windows
2292 ** (existing links in repository created on Unix become
2293 ** plain-text files with link destination path inside).
@@ -2660,21 +2746,63 @@
2660 "%s WITHOUT ROWID;\n"
2661 "INSERT INTO \"%w\" SELECT * FROM \"x_%w\";\n"
2662 "DROP TABLE \"x_%w\";\n",
2663 zTName, zTName, blob_sql_text(&newSql), zTName, zTName, zTName
2664 );
2665 fossil_print("Converting table %s of %s to WITHOUT ROWID.\n", zTName, g.argv[i]);
 
2666 blob_reset(&newSql);
2667 }
2668 blob_append_sql(&allSql, "COMMIT;\n");
2669 db_finalize(&q);
2670 if( dryRun ){
2671 fossil_print("SQL that would have been evaluated:\n");
2672 fossil_print("-------------------------------------------------------------\n");
2673 fossil_print("%s", blob_sql_text(&allSql));
2674 }else{
2675 db_multi_exec("%s", blob_sql_text(&allSql));
2676 }
2677 blob_reset(&allSql);
2678 db_close(1);
2679 }
2680 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2681
--- src/db.c
+++ src/db.c
@@ -424,10 +424,13 @@
424
425 /*
426 ** Extract text, integer, or blob values from the N-th column of the
427 ** current row.
428 */
429 int db_column_type(Stmt *pStmt, int N){
430 return sqlite3_column_type(pStmt->pStmt, N);
431 }
432 int db_column_bytes(Stmt *pStmt, int N){
433 return sqlite3_column_bytes(pStmt->pStmt, N);
434 }
435 int db_column_int(Stmt *pStmt, int N){
436 return sqlite3_column_int(pStmt->pStmt, N);
@@ -486,10 +489,50 @@
489 while( (rc = db_step(pStmt))==SQLITE_ROW ){}
490 rc = db_reset(pStmt);
491 db_check_result(rc);
492 return rc;
493 }
494
495 /*
496 ** Print the output of one or more SQL queries on standard output.
497 ** This routine is used for debugging purposes only.
498 */
499 int db_debug(const char *zSql, ...){
500 Blob sql;
501 int rc = SQLITE_OK;
502 va_list ap;
503 const char *z, *zEnd;
504 sqlite3_stmt *pStmt;
505 blob_init(&sql, 0, 0);
506 va_start(ap, zSql);
507 blob_vappendf(&sql, zSql, ap);
508 va_end(ap);
509 z = blob_str(&sql);
510 while( rc==SQLITE_OK && z[0] ){
511 pStmt = 0;
512 rc = sqlite3_prepare_v2(g.db, z, -1, &pStmt, &zEnd);
513 if( rc!=SQLITE_OK ) break;
514 if( pStmt ){
515 int nRow = 0;
516 db.nPrepare++;
517 while( sqlite3_step(pStmt)==SQLITE_ROW ){
518 int i, n;
519 if( nRow++ > 0 ) fossil_print("\n");
520 n = sqlite3_column_count(pStmt);
521 for(i=0; i<n; i++){
522 fossil_print("%s = %s\n", sqlite3_column_name(pStmt, i),
523 sqlite3_column_text(pStmt,i));
524 }
525 }
526 rc = sqlite3_finalize(pStmt);
527 if( rc ) db_err("%s: {%.*s}", sqlite3_errmsg(g.db), (int)(zEnd-z), z);
528 }
529 z = zEnd;
530 }
531 blob_reset(&sql);
532 return rc;
533 }
534
535 /*
536 ** Execute multiple SQL statements.
537 */
538 int db_multi_exec(const char *zSql, ...){
@@ -706,10 +749,39 @@
749 if( rc==0 ){
750 sqlite3_result_int64(context, mtime);
751 }
752 }
753
754 void db_sym2rid_function(
755 sqlite3_context *context,
756 int argc,
757 sqlite3_value **argv
758 ){
759 char const * arg;
760 char const * type;
761 if(1 != argc && 2 != argc){
762 sqlite3_result_error(context, "Expecting one or two arguments", -1);
763 return;
764 }
765 arg = (const char*)sqlite3_value_text(argv[0]);
766 if(!arg){
767 sqlite3_result_error(context, "Expecting a STRING argument", -1);
768 }else{
769 int rid;
770 type = (2==argc) ? (const char*)sqlite3_value_text(argv[1]) : 0;
771 if(!type) type = "ci";
772 rid = symbolic_name_to_rid( arg, type );
773 if(rid<0){
774 sqlite3_result_error(context, "Symbolic name is ambiguous.", -1);
775 }else if(0==rid){
776 sqlite3_result_null(context);
777 }else{
778 sqlite3_result_int64(context, rid);
779 }
780 }
781 }
782
783
784 /*
785 ** Open a database file. Return a pointer to the new database
786 ** connection. An error results in process abort.
787 */
@@ -738,13 +810,22 @@
810 sqlite3_create_function(
811 db, "is_selected", 1, SQLITE_UTF8, 0, file_is_selected,0,0
812 );
813 sqlite3_create_function(
814 db, "if_selected", 3, SQLITE_UTF8, 0, file_is_selected,0,0
815 );
816 sqlite3_create_function(
817 db, "symbolic_name_to_rid", 1, SQLITE_UTF8, 0, db_sym2rid_function,
818 0, 0
819 );
820 sqlite3_create_function(
821 db, "symbolic_name_to_rid", 2, SQLITE_UTF8, 0, db_sym2rid_function,
822 0, 0
823 );
824 if( g.fSqlTrace ) sqlite3_trace(db, db_sql_trace, 0);
825 re_add_sql_func(db);
826 foci_register(db);
827 sqlite3_exec(db, "PRAGMA foreign_keys=OFF;", 0, 0, 0);
828 return db;
829 }
830
831
@@ -962,20 +1043,21 @@
1043 ** is found, it is attached to the open database connection too.
1044 */
1045 int db_open_local(const char *zDbName){
1046 int i, n;
1047 char zPwd[2000];
1048 static const char *(aDbName[]) = { "_FOSSIL_", ".fslckout", ".fos" };
1049
1050 if( g.localOpen ) return 1;
1051 file_getcwd(zPwd, sizeof(zPwd)-20);
1052 n = strlen(zPwd);
1053 while( n>0 ){
1054 for(i=0; i<count(aDbName); i++){
1055 sqlite3_snprintf(sizeof(zPwd)-n, &zPwd[n], "/%s", aDbName[i]);
1056 if( isValidLocalDb(zPwd) ){
1057 /* Found a valid checkout database file */
1058 g.zLocalDbName = mprintf("%s", zPwd);
1059 zPwd[n] = 0;
1060 while( n>0 && zPwd[n-1]=='/' ){
1061 n--;
1062 zPwd[n] = 0;
1063 }
@@ -1117,13 +1199,13 @@
1199
1200 /*
1201 ** Return TRUE if the schema is out-of-date
1202 */
1203 int db_schema_is_outofdate(void){
1204 if( g.zAuxSchema==0 ) g.zAuxSchema = db_get("aux-schema","");
1205 return strcmp(g.zAuxSchema,AUX_SCHEMA_MIN)<0
1206 || strcmp(g.zAuxSchema,AUX_SCHEMA_MAX)>0;
1207 }
1208
1209 /*
1210 ** Return true if the database is writeable
1211 */
@@ -1138,14 +1220,14 @@
1220 void db_verify_schema(void){
1221 if( db_schema_is_outofdate() ){
1222 #ifdef FOSSIL_ENABLE_JSON
1223 g.json.resultCode = FSL_JSON_E_DB_NEEDS_REBUILD;
1224 #endif
1225 fossil_warning("incorrect repository schema version: "
1226 "current repository schema version is \"%s\" "
1227 "but need versions between \"%s\" and \"%s\".",
1228 g.zAuxSchema, AUX_SCHEMA_MIN, AUX_SCHEMA_MAX);
1229 fossil_fatal("run \"fossil rebuild\" to fix this problem");
1230 }
1231 }
1232
1233
@@ -1393,11 +1475,11 @@
1475 char *zDate;
1476 Blob hash;
1477 Blob manifest;
1478
1479 db_set("content-schema", CONTENT_SCHEMA, 0);
1480 db_set("aux-schema", AUX_SCHEMA_MAX, 0);
1481 db_set("rebuilt", get_version(), 0);
1482 if( makeServerCodes ){
1483 db_setup_server_and_project_codes(0);
1484 }
1485 if( !db_is_global("autosync") ) db_set_int("autosync", 1, 0);
@@ -2204,10 +2286,11 @@
2286 const char *def; /* Default value */
2287 };
2288 #endif /* INTERFACE */
2289 struct stControlSettings const ctrlSettings[] = {
2290 { "access-log", 0, 0, 0, 0, "off" },
2291 { "admin-log", 0, 0, 0, 0, "off" },
2292 { "allow-symlinks", 0, 0, 1, 0, "off" },
2293 { "auto-captcha", "autocaptcha", 0, 0, 0, "on" },
2294 { "auto-hyperlink", 0, 0, 0, 0, "on", },
2295 { "auto-shun", 0, 0, 0, 0, "on" },
2296 { "autosync", 0, 0, 0, 0, "on" },
@@ -2284,10 +2367,13 @@
2367 ** The "unset" command clears a property setting.
2368 **
2369 **
2370 ** access-log If enabled, record successful and failed login attempts
2371 ** in the "accesslog" table. Default: off
2372 **
2373 ** admin-log If enabled, record configuration changes in the
2374 ** "admin_log" table. Default: off
2375 **
2376 ** allow-symlinks If enabled, don't follow symlinks, and instead treat
2377 ** (versionable) them as symlinks on Unix. Has no effect on Windows
2378 ** (existing links in repository created on Unix become
2379 ** plain-text files with link destination path inside).
@@ -2660,21 +2746,63 @@
2746 "%s WITHOUT ROWID;\n"
2747 "INSERT INTO \"%w\" SELECT * FROM \"x_%w\";\n"
2748 "DROP TABLE \"x_%w\";\n",
2749 zTName, zTName, blob_sql_text(&newSql), zTName, zTName, zTName
2750 );
2751 fossil_print("Converting table %s of %s to WITHOUT ROWID.\n",
2752 zTName, g.argv[i]);
2753 blob_reset(&newSql);
2754 }
2755 blob_append_sql(&allSql, "COMMIT;\n");
2756 db_finalize(&q);
2757 if( dryRun ){
2758 fossil_print("SQL that would have been evaluated:\n");
2759 fossil_print("%.78c\n", '-');
2760 fossil_print("%s", blob_sql_text(&allSql));
2761 }else{
2762 db_multi_exec("%s", blob_sql_text(&allSql));
2763 }
2764 blob_reset(&allSql);
2765 db_close(1);
2766 }
2767 }
2768
2769 /*
2770 ** Make sure the adminlog table exists. Create it if it does not
2771 */
2772 void create_admin_log_table(void){
2773 static int once = 0;
2774 if( once ) return;
2775 once = 1;
2776 db_multi_exec(
2777 "CREATE TABLE IF NOT EXISTS \"%w\".admin_log(\n"
2778 " id INTEGER PRIMARY KEY,\n"
2779 " time INTEGER, -- Seconds since 1970\n"
2780 " page TEXT, -- path of page\n"
2781 " who TEXT, -- User who made the change\n "
2782 " what TEXT -- What changed\n"
2783 ")", db_name("repository")
2784 );
2785 }
2786
2787 /*
2788 ** Write a message into the admin_event table, if admin logging is
2789 ** enabled via the admin-log configuration option.
2790 */
2791 void admin_log(const char *zFormat, ...){
2792 Blob what = empty_blob;
2793 va_list ap;
2794 if( !db_get_boolean("admin-log", 0) ){
2795 /* Potential leak here (on %z params) but
2796 the alternative is to let blob_vappendf()
2797 do it below. */
2798 return;
2799 }
2800 create_admin_log_table();
2801 va_start(ap,zFormat);
2802 blob_vappendf( &what, zFormat, ap );
2803 va_end(ap);
2804 db_multi_exec("INSERT INTO admin_log(time,page,who,what)"
2805 " VALUES(now(), %Q, %Q, %B)",
2806 g.zPath, g.zLogin, &what);
2807 blob_reset(&what);
2808 }
2809
--- src/descendants.c
+++ src/descendants.c
@@ -289,14 +289,14 @@
289289
}
290290
291291
/*
292292
** COMMAND: descendants*
293293
**
294
-** Usage: %fossil descendants ?BASELINE-ID? ?OPTIONS?
294
+** Usage: %fossil descendants ?CHECKIN? ?OPTIONS?
295295
**
296
-** Find all leaf descendants of the baseline specified or if the argument
297
-** is omitted, of the baseline currently checked out.
296
+** Find all leaf descendants of the checkin specified or if the argument
297
+** is omitted, of the checkin currently checked out.
298298
**
299299
** Options:
300300
** -R|--repository FILE Extract info from repository FILE
301301
** -W|--width <num> Width of lines (default is to auto-detect).
302302
** Must be >20 or 0 (= no limit, resulting in a
@@ -334,11 +334,11 @@
334334
"%s"
335335
" AND event.objid IN (SELECT rid FROM leaves)"
336336
" ORDER BY event.mtime DESC",
337337
timeline_query_for_tty()
338338
);
339
- print_timeline(&q, -20, width, 0);
339
+ print_timeline(&q, 0, width, 0);
340340
db_finalize(&q);
341341
}
342342
343343
/*
344344
** COMMAND: leaves*
345345
--- src/descendants.c
+++ src/descendants.c
@@ -289,14 +289,14 @@
289 }
290
291 /*
292 ** COMMAND: descendants*
293 **
294 ** Usage: %fossil descendants ?BASELINE-ID? ?OPTIONS?
295 **
296 ** Find all leaf descendants of the baseline specified or if the argument
297 ** is omitted, of the baseline currently checked out.
298 **
299 ** Options:
300 ** -R|--repository FILE Extract info from repository FILE
301 ** -W|--width <num> Width of lines (default is to auto-detect).
302 ** Must be >20 or 0 (= no limit, resulting in a
@@ -334,11 +334,11 @@
334 "%s"
335 " AND event.objid IN (SELECT rid FROM leaves)"
336 " ORDER BY event.mtime DESC",
337 timeline_query_for_tty()
338 );
339 print_timeline(&q, -20, width, 0);
340 db_finalize(&q);
341 }
342
343 /*
344 ** COMMAND: leaves*
345
--- src/descendants.c
+++ src/descendants.c
@@ -289,14 +289,14 @@
289 }
290
291 /*
292 ** COMMAND: descendants*
293 **
294 ** Usage: %fossil descendants ?CHECKIN? ?OPTIONS?
295 **
296 ** Find all leaf descendants of the checkin specified or if the argument
297 ** is omitted, of the checkin currently checked out.
298 **
299 ** Options:
300 ** -R|--repository FILE Extract info from repository FILE
301 ** -W|--width <num> Width of lines (default is to auto-detect).
302 ** Must be >20 or 0 (= no limit, resulting in a
@@ -334,11 +334,11 @@
334 "%s"
335 " AND event.objid IN (SELECT rid FROM leaves)"
336 " ORDER BY event.mtime DESC",
337 timeline_query_for_tty()
338 );
339 print_timeline(&q, 0, width, 0);
340 db_finalize(&q);
341 }
342
343 /*
344 ** COMMAND: leaves*
345
--- src/finfo.c
+++ src/finfo.c
@@ -495,10 +495,11 @@
495495
@ <br>fid=%d(frid) pid=%d(fpid) mid=%d(fmid) sz=%d(sz)
496496
if( srcid ){
497497
@ srcid=%d(srcid)
498498
}
499499
}
500
+ tag_private_status(frid);
500501
@ </td></tr>
501502
}
502503
db_finalize(&q);
503504
if( pGraph ){
504505
graph_finish(pGraph, 0);
505506
506507
ADDED src/foci.c
--- src/finfo.c
+++ src/finfo.c
@@ -495,10 +495,11 @@
495 @ <br>fid=%d(frid) pid=%d(fpid) mid=%d(fmid) sz=%d(sz)
496 if( srcid ){
497 @ srcid=%d(srcid)
498 }
499 }
 
500 @ </td></tr>
501 }
502 db_finalize(&q);
503 if( pGraph ){
504 graph_finish(pGraph, 0);
505
506 DDED src/foci.c
--- src/finfo.c
+++ src/finfo.c
@@ -495,10 +495,11 @@
495 @ <br>fid=%d(frid) pid=%d(fpid) mid=%d(fmid) sz=%d(sz)
496 if( srcid ){
497 @ srcid=%d(srcid)
498 }
499 }
500 tag_private_status(frid);
501 @ </td></tr>
502 }
503 db_finalize(&q);
504 if( pGraph ){
505 graph_finish(pGraph, 0);
506
507 DDED src/foci.c
+10
--- a/src/foci.c
+++ b/src/foci.c
@@ -0,0 +1,10 @@
1
+//* The function finds the BLOB.RID value
2
+** corresponding to the 'trunk' tag. Then the
3
+** decodes the manifest defined by that BLOB and returns all files described
4
+** by that manifest. / /an SQLite virtual tabCREATE VIRTUAL TABLE temp.focipCur->iFile = 0;
5
+pCuur->pMan, 0); Then the
6
+** decodes//* The function finds ttion finds the BL//* Of CheckI rem
7
+ sqlite3_context *ctx, int iFile;Index of cfileLOB.RID value
8
+** corresponding to the 'trunk' tag. Then the
9
+** decodes the manifest defined by that BLOB and returns all files described
10
+** b//* The funcMan->aFile[pCsr->iFile].Man->aFile[pCsr->iFile].Man->aFile[pCsr->iFile].Man->aFile[pCsr->iFile].
--- a/src/foci.c
+++ b/src/foci.c
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
--- a/src/foci.c
+++ b/src/foci.c
@@ -0,0 +1,10 @@
1 //* The function finds the BLOB.RID value
2 ** corresponding to the 'trunk' tag. Then the
3 ** decodes the manifest defined by that BLOB and returns all files described
4 ** by that manifest. / /an SQLite virtual tabCREATE VIRTUAL TABLE temp.focipCur->iFile = 0;
5 pCuur->pMan, 0); Then the
6 ** decodes//* The function finds ttion finds the BL//* Of CheckI rem
7 sqlite3_context *ctx, int iFile;Index of cfileLOB.RID value
8 ** corresponding to the 'trunk' tag. Then the
9 ** decodes the manifest defined by that BLOB and returns all files described
10 ** b//* The funcMan->aFile[pCsr->iFile].Man->aFile[pCsr->iFile].Man->aFile[pCsr->iFile].Man->aFile[pCsr->iFile].
--- src/fusefs.c
+++ src/fusefs.c
@@ -319,11 +319,10 @@
319319
#ifndef FOSSIL_HAVE_FUSEFS
320320
fossil_fatal("this build of fossil does not support the fuse filesystem");
321321
#else
322322
char *zMountPoint;
323323
char *azNewArgv[5];
324
- int i;
325324
int doDebug = find_option("debug","d",0)!=0;
326325
327326
db_find_and_open_repository(0,0);
328327
verify_all_options();
329328
blob_init(&fusefs.content, 0, 0);
330329
--- src/fusefs.c
+++ src/fusefs.c
@@ -319,11 +319,10 @@
319 #ifndef FOSSIL_HAVE_FUSEFS
320 fossil_fatal("this build of fossil does not support the fuse filesystem");
321 #else
322 char *zMountPoint;
323 char *azNewArgv[5];
324 int i;
325 int doDebug = find_option("debug","d",0)!=0;
326
327 db_find_and_open_repository(0,0);
328 verify_all_options();
329 blob_init(&fusefs.content, 0, 0);
330
--- src/fusefs.c
+++ src/fusefs.c
@@ -319,11 +319,10 @@
319 #ifndef FOSSIL_HAVE_FUSEFS
320 fossil_fatal("this build of fossil does not support the fuse filesystem");
321 #else
322 char *zMountPoint;
323 char *azNewArgv[5];
 
324 int doDebug = find_option("debug","d",0)!=0;
325
326 db_find_and_open_repository(0,0);
327 verify_all_options();
328 blob_init(&fusefs.content, 0, 0);
329
+6 -1
--- src/info.c
+++ src/info.c
@@ -931,10 +931,11 @@
931931
}else{
932932
@ tags: %h(zTagList),
933933
}
934934
@ date:
935935
hyperlink_to_date(zDate, ")");
936
+ tag_private_status(rid);
936937
}
937938
db_finalize(&q);
938939
}
939940
940941
@@ -1203,19 +1204,20 @@
12031204
}else{
12041205
@ <li>File
12051206
}
12061207
objType |= OBJTYPE_CONTENT;
12071208
@ %z(href("%R/finfo?name=%T",zName))%h(zName)</a>
1209
+ tag_private_status(rid);
12081210
if( showDetail ){
12091211
@ <ul>
12101212
}
12111213
prevName = fossil_strdup(zName);
12121214
}
12131215
if( showDetail ){
12141216
@ <li>
12151217
hyperlink_to_date(zDate,"");
1216
- @ &mdash; part of check-in
1218
+ @ &mdash; part of checkin
12171219
hyperlink_to_uuid(zVers);
12181220
}else{
12191221
@ &mdash; part of checkin
12201222
hyperlink_to_uuid(zVers);
12211223
@ at
@@ -1314,10 +1316,11 @@
13141316
hyperlink_to_user(zUser,zDate," on");
13151317
hyperlink_to_date(zDate, ".");
13161318
if( pDownloadName && blob_size(pDownloadName)==0 ){
13171319
blob_appendf(pDownloadName, "%.10s.txt", zUuid);
13181320
}
1321
+ tag_private_status(rid);
13191322
cnt++;
13201323
}
13211324
db_finalize(&q);
13221325
}
13231326
db_prepare(&q,
@@ -1357,17 +1360,19 @@
13571360
hyperlink_to_date(zDate,".");
13581361
cnt++;
13591362
if( pDownloadName && blob_size(pDownloadName)==0 ){
13601363
blob_append(pDownloadName, zFilename, -1);
13611364
}
1365
+ tag_private_status(rid);
13621366
}
13631367
db_finalize(&q);
13641368
if( cnt==0 ){
13651369
@ Control artifact.
13661370
if( pDownloadName && blob_size(pDownloadName)==0 ){
13671371
blob_appendf(pDownloadName, "%.10s.txt", zUuid);
13681372
}
1373
+ tag_private_status(rid);
13691374
}
13701375
return objType;
13711376
}
13721377
13731378
13741379
--- src/info.c
+++ src/info.c
@@ -931,10 +931,11 @@
931 }else{
932 @ tags: %h(zTagList),
933 }
934 @ date:
935 hyperlink_to_date(zDate, ")");
 
936 }
937 db_finalize(&q);
938 }
939
940
@@ -1203,19 +1204,20 @@
1203 }else{
1204 @ <li>File
1205 }
1206 objType |= OBJTYPE_CONTENT;
1207 @ %z(href("%R/finfo?name=%T",zName))%h(zName)</a>
 
1208 if( showDetail ){
1209 @ <ul>
1210 }
1211 prevName = fossil_strdup(zName);
1212 }
1213 if( showDetail ){
1214 @ <li>
1215 hyperlink_to_date(zDate,"");
1216 @ &mdash; part of check-in
1217 hyperlink_to_uuid(zVers);
1218 }else{
1219 @ &mdash; part of checkin
1220 hyperlink_to_uuid(zVers);
1221 @ at
@@ -1314,10 +1316,11 @@
1314 hyperlink_to_user(zUser,zDate," on");
1315 hyperlink_to_date(zDate, ".");
1316 if( pDownloadName && blob_size(pDownloadName)==0 ){
1317 blob_appendf(pDownloadName, "%.10s.txt", zUuid);
1318 }
 
1319 cnt++;
1320 }
1321 db_finalize(&q);
1322 }
1323 db_prepare(&q,
@@ -1357,17 +1360,19 @@
1357 hyperlink_to_date(zDate,".");
1358 cnt++;
1359 if( pDownloadName && blob_size(pDownloadName)==0 ){
1360 blob_append(pDownloadName, zFilename, -1);
1361 }
 
1362 }
1363 db_finalize(&q);
1364 if( cnt==0 ){
1365 @ Control artifact.
1366 if( pDownloadName && blob_size(pDownloadName)==0 ){
1367 blob_appendf(pDownloadName, "%.10s.txt", zUuid);
1368 }
 
1369 }
1370 return objType;
1371 }
1372
1373
1374
--- src/info.c
+++ src/info.c
@@ -931,10 +931,11 @@
931 }else{
932 @ tags: %h(zTagList),
933 }
934 @ date:
935 hyperlink_to_date(zDate, ")");
936 tag_private_status(rid);
937 }
938 db_finalize(&q);
939 }
940
941
@@ -1203,19 +1204,20 @@
1204 }else{
1205 @ <li>File
1206 }
1207 objType |= OBJTYPE_CONTENT;
1208 @ %z(href("%R/finfo?name=%T",zName))%h(zName)</a>
1209 tag_private_status(rid);
1210 if( showDetail ){
1211 @ <ul>
1212 }
1213 prevName = fossil_strdup(zName);
1214 }
1215 if( showDetail ){
1216 @ <li>
1217 hyperlink_to_date(zDate,"");
1218 @ &mdash; part of checkin
1219 hyperlink_to_uuid(zVers);
1220 }else{
1221 @ &mdash; part of checkin
1222 hyperlink_to_uuid(zVers);
1223 @ at
@@ -1314,10 +1316,11 @@
1316 hyperlink_to_user(zUser,zDate," on");
1317 hyperlink_to_date(zDate, ".");
1318 if( pDownloadName && blob_size(pDownloadName)==0 ){
1319 blob_appendf(pDownloadName, "%.10s.txt", zUuid);
1320 }
1321 tag_private_status(rid);
1322 cnt++;
1323 }
1324 db_finalize(&q);
1325 }
1326 db_prepare(&q,
@@ -1357,17 +1360,19 @@
1360 hyperlink_to_date(zDate,".");
1361 cnt++;
1362 if( pDownloadName && blob_size(pDownloadName)==0 ){
1363 blob_append(pDownloadName, zFilename, -1);
1364 }
1365 tag_private_status(rid);
1366 }
1367 db_finalize(&q);
1368 if( cnt==0 ){
1369 @ Control artifact.
1370 if( pDownloadName && blob_size(pDownloadName)==0 ){
1371 blob_appendf(pDownloadName, "%.10s.txt", zUuid);
1372 }
1373 tag_private_status(rid);
1374 }
1375 return objType;
1376 }
1377
1378
1379
+26 -1
--- src/login.c
+++ src/login.c
@@ -475,10 +475,20 @@
475475
char *zSha1Pw;
476476
const char *zIpAddr; /* IP address of requestor */
477477
const char *zReferer;
478478
479479
login_check_credentials();
480
+ if( login_wants_https_redirect() ){
481
+ const char *zQS = P("QUERY_STRING");
482
+ if( zQS==0 ){
483
+ zQS = "";
484
+ }else if( zQS[0]!=0 ){
485
+ zQS = mprintf("?%s", zQS);
486
+ }
487
+ cgi_redirectf("%s%s%s", g.zHttpsURL, P("PATH_INFO"), zQS);
488
+ return;
489
+ }
480490
sqlite3_create_function(g.db, "constant_time_cmp", 2, SQLITE_UTF8, 0,
481491
constant_time_cmp_function, 0, 0);
482492
zUsername = P("u");
483493
zPasswd = P("p");
484494
anonFlag = P("anon")!=0;
@@ -776,10 +786,25 @@
776786
" AND constant_time_cmp(cookie,%Q)=0",
777787
zLogin, zRemoteAddr, zCookie
778788
);
779789
return uid;
780790
}
791
+
792
+/*
793
+** Return true if it is appropriate to redirect login requests to HTTPS.
794
+**
795
+** Redirect to https is appropriate if all of the above are true:
796
+** (1) The redirect-to-https flag is set
797
+** (2) The current connection is http, not https or ssh
798
+** (3) The sslNotAvailable flag is clear
799
+*/
800
+int login_wants_https_redirect(void){
801
+ if( g.sslNotAvailable ) return 0;
802
+ if( db_get_boolean("redirect-to-https",0)==0 ) return 0;
803
+ if( P("HTTPS")!=0 ) return 0;
804
+ return 1;
805
+}
781806
782807
/*
783808
** This routine examines the login cookie to see if it exists and
784809
** is valid. If the login cookie checks out, it then sets global
785810
** variables appropriately.
@@ -812,11 +837,11 @@
812837
** This feature allows the "fossil ui" command to give the user
813838
** full access rights without having to log in.
814839
*/
815840
zRemoteAddr = ipPrefix(zIpAddr = PD("REMOTE_ADDR","nil"));
816841
if( ( fossil_strcmp(zIpAddr, "127.0.0.1")==0 ||
817
- g.fSshClient & CGI_SSH_CLIENT )
842
+ (g.fSshClient & CGI_SSH_CLIENT)!=0 )
818843
&& g.useLocalauth
819844
&& db_get_int("localauth",0)==0
820845
&& P("HTTPS")==0
821846
){
822847
if( g.localOpen ) zLogin = db_lget("default-user",0);
823848
--- src/login.c
+++ src/login.c
@@ -475,10 +475,20 @@
475 char *zSha1Pw;
476 const char *zIpAddr; /* IP address of requestor */
477 const char *zReferer;
478
479 login_check_credentials();
 
 
 
 
 
 
 
 
 
 
480 sqlite3_create_function(g.db, "constant_time_cmp", 2, SQLITE_UTF8, 0,
481 constant_time_cmp_function, 0, 0);
482 zUsername = P("u");
483 zPasswd = P("p");
484 anonFlag = P("anon")!=0;
@@ -776,10 +786,25 @@
776 " AND constant_time_cmp(cookie,%Q)=0",
777 zLogin, zRemoteAddr, zCookie
778 );
779 return uid;
780 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
781
782 /*
783 ** This routine examines the login cookie to see if it exists and
784 ** is valid. If the login cookie checks out, it then sets global
785 ** variables appropriately.
@@ -812,11 +837,11 @@
812 ** This feature allows the "fossil ui" command to give the user
813 ** full access rights without having to log in.
814 */
815 zRemoteAddr = ipPrefix(zIpAddr = PD("REMOTE_ADDR","nil"));
816 if( ( fossil_strcmp(zIpAddr, "127.0.0.1")==0 ||
817 g.fSshClient & CGI_SSH_CLIENT )
818 && g.useLocalauth
819 && db_get_int("localauth",0)==0
820 && P("HTTPS")==0
821 ){
822 if( g.localOpen ) zLogin = db_lget("default-user",0);
823
--- src/login.c
+++ src/login.c
@@ -475,10 +475,20 @@
475 char *zSha1Pw;
476 const char *zIpAddr; /* IP address of requestor */
477 const char *zReferer;
478
479 login_check_credentials();
480 if( login_wants_https_redirect() ){
481 const char *zQS = P("QUERY_STRING");
482 if( zQS==0 ){
483 zQS = "";
484 }else if( zQS[0]!=0 ){
485 zQS = mprintf("?%s", zQS);
486 }
487 cgi_redirectf("%s%s%s", g.zHttpsURL, P("PATH_INFO"), zQS);
488 return;
489 }
490 sqlite3_create_function(g.db, "constant_time_cmp", 2, SQLITE_UTF8, 0,
491 constant_time_cmp_function, 0, 0);
492 zUsername = P("u");
493 zPasswd = P("p");
494 anonFlag = P("anon")!=0;
@@ -776,10 +786,25 @@
786 " AND constant_time_cmp(cookie,%Q)=0",
787 zLogin, zRemoteAddr, zCookie
788 );
789 return uid;
790 }
791
792 /*
793 ** Return true if it is appropriate to redirect login requests to HTTPS.
794 **
795 ** Redirect to https is appropriate if all of the above are true:
796 ** (1) The redirect-to-https flag is set
797 ** (2) The current connection is http, not https or ssh
798 ** (3) The sslNotAvailable flag is clear
799 */
800 int login_wants_https_redirect(void){
801 if( g.sslNotAvailable ) return 0;
802 if( db_get_boolean("redirect-to-https",0)==0 ) return 0;
803 if( P("HTTPS")!=0 ) return 0;
804 return 1;
805 }
806
807 /*
808 ** This routine examines the login cookie to see if it exists and
809 ** is valid. If the login cookie checks out, it then sets global
810 ** variables appropriately.
@@ -812,11 +837,11 @@
837 ** This feature allows the "fossil ui" command to give the user
838 ** full access rights without having to log in.
839 */
840 zRemoteAddr = ipPrefix(zIpAddr = PD("REMOTE_ADDR","nil"));
841 if( ( fossil_strcmp(zIpAddr, "127.0.0.1")==0 ||
842 (g.fSshClient & CGI_SSH_CLIENT)!=0 )
843 && g.useLocalauth
844 && db_get_int("localauth",0)==0
845 && P("HTTPS")==0
846 ){
847 if( g.localOpen ) zLogin = db_lget("default-user",0);
848
+6 -1
--- src/main.c
+++ src/main.c
@@ -125,16 +125,18 @@
125125
const char *zErrlog; /* Log errors to this file, if not NULL */
126126
int isConst; /* True if the output is unchanging & cacheable */
127127
const char *zVfsName; /* The VFS to use for database connections */
128128
sqlite3 *db; /* The connection to the databases */
129129
sqlite3 *dbConfig; /* Separate connection for global_config table */
130
+ char *zAuxSchema; /* Main repository aux-schema */
130131
int useAttach; /* True if global_config is attached to repository */
131132
const char *zConfigDbName;/* Path of the config database. NULL if not open */
132133
sqlite3_int64 now; /* Seconds since 1970 */
133134
int repositoryOpen; /* True if the main repository database is open */
134135
char *zRepositoryOption; /* Most recent cached repository option value */
135136
char *zRepositoryName; /* Name of the repository database */
137
+ char *zLocalDbName; /* Name of the local database */
136138
const char *zMainDbType;/* "configdb", "localdb", or "repository" */
137139
const char *zConfigDbType; /* "configdb", "localdb", or "repository" */
138140
int localOpen; /* True if the local database is open */
139141
char *zLocalRoot; /* The directory holding the local database */
140142
int minPrefix; /* Number of digits needed for a distinct UUID */
@@ -150,10 +152,11 @@
150152
char *zSshCmd; /* SSH command string */
151153
int fNoSync; /* Do not do an autosync ever. --nosync */
152154
char *zPath; /* Name of webpage being served */
153155
char *zExtra; /* Extra path information past the webpage name */
154156
char *zBaseURL; /* Full text of the URL being served */
157
+ char *zHttpsURL; /* zBaseURL translated to https: */
155158
char *zTop; /* Parent directory of zPath */
156159
const char *zContentType; /* The content type of the input HTTP request */
157160
int iErrPriority; /* Priority of current error message */
158161
char *zErrMsg; /* Text of an error message */
159162
int sslNotAvailable; /* SSL is not available. Do not redirect to https: */
@@ -968,11 +971,11 @@
968971
const char *zRc;
969972
#endif
970973
fossil_print("Compiled on %s %s using %s (%d-bit)\n",
971974
__DATE__, __TIME__, COMPILER_NAME, sizeof(void*)*8);
972975
fossil_print("SQLite %s %.30s\n", sqlite3_libversion(), sqlite3_sourceid());
973
- fossil_print("Schema version %s\n", AUX_SCHEMA);
976
+ fossil_print("Schema version %s\n", AUX_SCHEMA_MAX);
974977
#if defined(FOSSIL_ENABLE_MINIZ)
975978
fossil_print("miniz %s, loaded %s\n", MZ_VERSION, mz_version());
976979
#else
977980
fossil_print("zlib %s, loaded %s\n", ZLIB_VERSION, zlibVersion());
978981
#endif
@@ -1289,13 +1292,15 @@
12891292
i = strlen(zCur);
12901293
while( i>0 && zCur[i-1]=='/' ) i--;
12911294
if( fossil_stricmp(zMode,"on")==0 ){
12921295
g.zBaseURL = mprintf("https://%s%.*s", zHost, i, zCur);
12931296
g.zTop = &g.zBaseURL[8+strlen(zHost)];
1297
+ g.zHttpsURL = g.zBaseURL;
12941298
}else{
12951299
g.zBaseURL = mprintf("http://%s%.*s", zHost, i, zCur);
12961300
g.zTop = &g.zBaseURL[7+strlen(zHost)];
1301
+ g.zHttpsURL = mprintf("https://%s%.*s", zHost, i, zCur);
12971302
}
12981303
}
12991304
if( db_is_writeable("repository") ){
13001305
if( !db_exists("SELECT 1 FROM config WHERE name='baseurl:%q'", g.zBaseURL)){
13011306
db_multi_exec("INSERT INTO config(name,value,mtime)"
13021307
--- src/main.c
+++ src/main.c
@@ -125,16 +125,18 @@
125 const char *zErrlog; /* Log errors to this file, if not NULL */
126 int isConst; /* True if the output is unchanging & cacheable */
127 const char *zVfsName; /* The VFS to use for database connections */
128 sqlite3 *db; /* The connection to the databases */
129 sqlite3 *dbConfig; /* Separate connection for global_config table */
 
130 int useAttach; /* True if global_config is attached to repository */
131 const char *zConfigDbName;/* Path of the config database. NULL if not open */
132 sqlite3_int64 now; /* Seconds since 1970 */
133 int repositoryOpen; /* True if the main repository database is open */
134 char *zRepositoryOption; /* Most recent cached repository option value */
135 char *zRepositoryName; /* Name of the repository database */
 
136 const char *zMainDbType;/* "configdb", "localdb", or "repository" */
137 const char *zConfigDbType; /* "configdb", "localdb", or "repository" */
138 int localOpen; /* True if the local database is open */
139 char *zLocalRoot; /* The directory holding the local database */
140 int minPrefix; /* Number of digits needed for a distinct UUID */
@@ -150,10 +152,11 @@
150 char *zSshCmd; /* SSH command string */
151 int fNoSync; /* Do not do an autosync ever. --nosync */
152 char *zPath; /* Name of webpage being served */
153 char *zExtra; /* Extra path information past the webpage name */
154 char *zBaseURL; /* Full text of the URL being served */
 
155 char *zTop; /* Parent directory of zPath */
156 const char *zContentType; /* The content type of the input HTTP request */
157 int iErrPriority; /* Priority of current error message */
158 char *zErrMsg; /* Text of an error message */
159 int sslNotAvailable; /* SSL is not available. Do not redirect to https: */
@@ -968,11 +971,11 @@
968 const char *zRc;
969 #endif
970 fossil_print("Compiled on %s %s using %s (%d-bit)\n",
971 __DATE__, __TIME__, COMPILER_NAME, sizeof(void*)*8);
972 fossil_print("SQLite %s %.30s\n", sqlite3_libversion(), sqlite3_sourceid());
973 fossil_print("Schema version %s\n", AUX_SCHEMA);
974 #if defined(FOSSIL_ENABLE_MINIZ)
975 fossil_print("miniz %s, loaded %s\n", MZ_VERSION, mz_version());
976 #else
977 fossil_print("zlib %s, loaded %s\n", ZLIB_VERSION, zlibVersion());
978 #endif
@@ -1289,13 +1292,15 @@
1289 i = strlen(zCur);
1290 while( i>0 && zCur[i-1]=='/' ) i--;
1291 if( fossil_stricmp(zMode,"on")==0 ){
1292 g.zBaseURL = mprintf("https://%s%.*s", zHost, i, zCur);
1293 g.zTop = &g.zBaseURL[8+strlen(zHost)];
 
1294 }else{
1295 g.zBaseURL = mprintf("http://%s%.*s", zHost, i, zCur);
1296 g.zTop = &g.zBaseURL[7+strlen(zHost)];
 
1297 }
1298 }
1299 if( db_is_writeable("repository") ){
1300 if( !db_exists("SELECT 1 FROM config WHERE name='baseurl:%q'", g.zBaseURL)){
1301 db_multi_exec("INSERT INTO config(name,value,mtime)"
1302
--- src/main.c
+++ src/main.c
@@ -125,16 +125,18 @@
125 const char *zErrlog; /* Log errors to this file, if not NULL */
126 int isConst; /* True if the output is unchanging & cacheable */
127 const char *zVfsName; /* The VFS to use for database connections */
128 sqlite3 *db; /* The connection to the databases */
129 sqlite3 *dbConfig; /* Separate connection for global_config table */
130 char *zAuxSchema; /* Main repository aux-schema */
131 int useAttach; /* True if global_config is attached to repository */
132 const char *zConfigDbName;/* Path of the config database. NULL if not open */
133 sqlite3_int64 now; /* Seconds since 1970 */
134 int repositoryOpen; /* True if the main repository database is open */
135 char *zRepositoryOption; /* Most recent cached repository option value */
136 char *zRepositoryName; /* Name of the repository database */
137 char *zLocalDbName; /* Name of the local database */
138 const char *zMainDbType;/* "configdb", "localdb", or "repository" */
139 const char *zConfigDbType; /* "configdb", "localdb", or "repository" */
140 int localOpen; /* True if the local database is open */
141 char *zLocalRoot; /* The directory holding the local database */
142 int minPrefix; /* Number of digits needed for a distinct UUID */
@@ -150,10 +152,11 @@
152 char *zSshCmd; /* SSH command string */
153 int fNoSync; /* Do not do an autosync ever. --nosync */
154 char *zPath; /* Name of webpage being served */
155 char *zExtra; /* Extra path information past the webpage name */
156 char *zBaseURL; /* Full text of the URL being served */
157 char *zHttpsURL; /* zBaseURL translated to https: */
158 char *zTop; /* Parent directory of zPath */
159 const char *zContentType; /* The content type of the input HTTP request */
160 int iErrPriority; /* Priority of current error message */
161 char *zErrMsg; /* Text of an error message */
162 int sslNotAvailable; /* SSL is not available. Do not redirect to https: */
@@ -968,11 +971,11 @@
971 const char *zRc;
972 #endif
973 fossil_print("Compiled on %s %s using %s (%d-bit)\n",
974 __DATE__, __TIME__, COMPILER_NAME, sizeof(void*)*8);
975 fossil_print("SQLite %s %.30s\n", sqlite3_libversion(), sqlite3_sourceid());
976 fossil_print("Schema version %s\n", AUX_SCHEMA_MAX);
977 #if defined(FOSSIL_ENABLE_MINIZ)
978 fossil_print("miniz %s, loaded %s\n", MZ_VERSION, mz_version());
979 #else
980 fossil_print("zlib %s, loaded %s\n", ZLIB_VERSION, zlibVersion());
981 #endif
@@ -1289,13 +1292,15 @@
1292 i = strlen(zCur);
1293 while( i>0 && zCur[i-1]=='/' ) i--;
1294 if( fossil_stricmp(zMode,"on")==0 ){
1295 g.zBaseURL = mprintf("https://%s%.*s", zHost, i, zCur);
1296 g.zTop = &g.zBaseURL[8+strlen(zHost)];
1297 g.zHttpsURL = g.zBaseURL;
1298 }else{
1299 g.zBaseURL = mprintf("http://%s%.*s", zHost, i, zCur);
1300 g.zTop = &g.zBaseURL[7+strlen(zHost)];
1301 g.zHttpsURL = mprintf("https://%s%.*s", zHost, i, zCur);
1302 }
1303 }
1304 if( db_is_writeable("repository") ){
1305 if( !db_exists("SELECT 1 FROM config WHERE name='baseurl:%q'", g.zBaseURL)){
1306 db_multi_exec("INSERT INTO config(name,value,mtime)"
1307
+280 -120
--- src/main.mk
+++ src/main.mk
@@ -8,11 +8,11 @@
88
# to regenerate this file.
99
#
1010
# This file is included by primary Makefile.
1111
#
1212
13
-XTCC = $(TCC) $(CFLAGS) -I. -I$(SRCDIR) -I$(OBJDIR)
13
+XTCC = $(TCC) -I. -I$(SRCDIR) -I$(OBJDIR) $(TCCFLAGS) $(CFLAGS)
1414
1515
1616
SRC = \
1717
$(SRCDIR)/add.c \
1818
$(SRCDIR)/allrepo.c \
@@ -21,10 +21,11 @@
2121
$(SRCDIR)/bisect.c \
2222
$(SRCDIR)/blob.c \
2323
$(SRCDIR)/branch.c \
2424
$(SRCDIR)/browse.c \
2525
$(SRCDIR)/builtin.c \
26
+ $(SRCDIR)/bundle.c \
2627
$(SRCDIR)/cache.c \
2728
$(SRCDIR)/captcha.c \
2829
$(SRCDIR)/cgi.c \
2930
$(SRCDIR)/checkin.c \
3031
$(SRCDIR)/checkout.c \
@@ -43,10 +44,11 @@
4344
$(SRCDIR)/encode.c \
4445
$(SRCDIR)/event.c \
4546
$(SRCDIR)/export.c \
4647
$(SRCDIR)/file.c \
4748
$(SRCDIR)/finfo.c \
49
+ $(SRCDIR)/foci.c \
4850
$(SRCDIR)/fusefs.c \
4951
$(SRCDIR)/glob.c \
5052
$(SRCDIR)/graph.c \
5153
$(SRCDIR)/gzip.c \
5254
$(SRCDIR)/http.c \
@@ -86,10 +88,12 @@
8688
$(SRCDIR)/path.c \
8789
$(SRCDIR)/pivot.c \
8890
$(SRCDIR)/popen.c \
8991
$(SRCDIR)/pqueue.c \
9092
$(SRCDIR)/printf.c \
93
+ $(SRCDIR)/publish.c \
94
+ $(SRCDIR)/purge.c \
9195
$(SRCDIR)/rebuild.c \
9296
$(SRCDIR)/regexp.c \
9397
$(SRCDIR)/report.c \
9498
$(SRCDIR)/rss.c \
9599
$(SRCDIR)/schema.c \
@@ -138,10 +142,11 @@
138142
$(OBJDIR)/bisect_.c \
139143
$(OBJDIR)/blob_.c \
140144
$(OBJDIR)/branch_.c \
141145
$(OBJDIR)/browse_.c \
142146
$(OBJDIR)/builtin_.c \
147
+ $(OBJDIR)/bundle_.c \
143148
$(OBJDIR)/cache_.c \
144149
$(OBJDIR)/captcha_.c \
145150
$(OBJDIR)/cgi_.c \
146151
$(OBJDIR)/checkin_.c \
147152
$(OBJDIR)/checkout_.c \
@@ -160,10 +165,11 @@
160165
$(OBJDIR)/encode_.c \
161166
$(OBJDIR)/event_.c \
162167
$(OBJDIR)/export_.c \
163168
$(OBJDIR)/file_.c \
164169
$(OBJDIR)/finfo_.c \
170
+ $(OBJDIR)/foci_.c \
165171
$(OBJDIR)/fusefs_.c \
166172
$(OBJDIR)/glob_.c \
167173
$(OBJDIR)/graph_.c \
168174
$(OBJDIR)/gzip_.c \
169175
$(OBJDIR)/http_.c \
@@ -203,10 +209,12 @@
203209
$(OBJDIR)/path_.c \
204210
$(OBJDIR)/pivot_.c \
205211
$(OBJDIR)/popen_.c \
206212
$(OBJDIR)/pqueue_.c \
207213
$(OBJDIR)/printf_.c \
214
+ $(OBJDIR)/publish_.c \
215
+ $(OBJDIR)/purge_.c \
208216
$(OBJDIR)/rebuild_.c \
209217
$(OBJDIR)/regexp_.c \
210218
$(OBJDIR)/report_.c \
211219
$(OBJDIR)/rss_.c \
212220
$(OBJDIR)/schema_.c \
@@ -252,10 +260,11 @@
252260
$(OBJDIR)/bisect.o \
253261
$(OBJDIR)/blob.o \
254262
$(OBJDIR)/branch.o \
255263
$(OBJDIR)/browse.o \
256264
$(OBJDIR)/builtin.o \
265
+ $(OBJDIR)/bundle.o \
257266
$(OBJDIR)/cache.o \
258267
$(OBJDIR)/captcha.o \
259268
$(OBJDIR)/cgi.o \
260269
$(OBJDIR)/checkin.o \
261270
$(OBJDIR)/checkout.o \
@@ -274,10 +283,11 @@
274283
$(OBJDIR)/encode.o \
275284
$(OBJDIR)/event.o \
276285
$(OBJDIR)/export.o \
277286
$(OBJDIR)/file.o \
278287
$(OBJDIR)/finfo.o \
288
+ $(OBJDIR)/foci.o \
279289
$(OBJDIR)/fusefs.o \
280290
$(OBJDIR)/glob.o \
281291
$(OBJDIR)/graph.o \
282292
$(OBJDIR)/gzip.o \
283293
$(OBJDIR)/http.o \
@@ -317,10 +327,12 @@
317327
$(OBJDIR)/path.o \
318328
$(OBJDIR)/pivot.o \
319329
$(OBJDIR)/popen.o \
320330
$(OBJDIR)/pqueue.o \
321331
$(OBJDIR)/printf.o \
332
+ $(OBJDIR)/publish.o \
333
+ $(OBJDIR)/purge.o \
322334
$(OBJDIR)/rebuild.o \
323335
$(OBJDIR)/regexp.o \
324336
$(OBJDIR)/report.o \
325337
$(OBJDIR)/rss.o \
326338
$(OBJDIR)/schema.o \
@@ -475,10 +487,11 @@
475487
$(OBJDIR)/bisect_.c:$(OBJDIR)/bisect.h \
476488
$(OBJDIR)/blob_.c:$(OBJDIR)/blob.h \
477489
$(OBJDIR)/branch_.c:$(OBJDIR)/branch.h \
478490
$(OBJDIR)/browse_.c:$(OBJDIR)/browse.h \
479491
$(OBJDIR)/builtin_.c:$(OBJDIR)/builtin.h \
492
+ $(OBJDIR)/bundle_.c:$(OBJDIR)/bundle.h \
480493
$(OBJDIR)/cache_.c:$(OBJDIR)/cache.h \
481494
$(OBJDIR)/captcha_.c:$(OBJDIR)/captcha.h \
482495
$(OBJDIR)/cgi_.c:$(OBJDIR)/cgi.h \
483496
$(OBJDIR)/checkin_.c:$(OBJDIR)/checkin.h \
484497
$(OBJDIR)/checkout_.c:$(OBJDIR)/checkout.h \
@@ -497,10 +510,11 @@
497510
$(OBJDIR)/encode_.c:$(OBJDIR)/encode.h \
498511
$(OBJDIR)/event_.c:$(OBJDIR)/event.h \
499512
$(OBJDIR)/export_.c:$(OBJDIR)/export.h \
500513
$(OBJDIR)/file_.c:$(OBJDIR)/file.h \
501514
$(OBJDIR)/finfo_.c:$(OBJDIR)/finfo.h \
515
+ $(OBJDIR)/foci_.c:$(OBJDIR)/foci.h \
502516
$(OBJDIR)/fusefs_.c:$(OBJDIR)/fusefs.h \
503517
$(OBJDIR)/glob_.c:$(OBJDIR)/glob.h \
504518
$(OBJDIR)/graph_.c:$(OBJDIR)/graph.h \
505519
$(OBJDIR)/gzip_.c:$(OBJDIR)/gzip.h \
506520
$(OBJDIR)/http_.c:$(OBJDIR)/http.h \
@@ -540,10 +554,12 @@
540554
$(OBJDIR)/path_.c:$(OBJDIR)/path.h \
541555
$(OBJDIR)/pivot_.c:$(OBJDIR)/pivot.h \
542556
$(OBJDIR)/popen_.c:$(OBJDIR)/popen.h \
543557
$(OBJDIR)/pqueue_.c:$(OBJDIR)/pqueue.h \
544558
$(OBJDIR)/printf_.c:$(OBJDIR)/printf.h \
559
+ $(OBJDIR)/publish_.c:$(OBJDIR)/publish.h \
560
+ $(OBJDIR)/purge_.c:$(OBJDIR)/purge.h \
545561
$(OBJDIR)/rebuild_.c:$(OBJDIR)/rebuild.h \
546562
$(OBJDIR)/regexp_.c:$(OBJDIR)/regexp.h \
547563
$(OBJDIR)/report_.c:$(OBJDIR)/report.h \
548564
$(OBJDIR)/rss_.c:$(OBJDIR)/rss.h \
549565
$(OBJDIR)/schema_.c:$(OBJDIR)/schema.h \
@@ -586,817 +602,961 @@
586602
touch $(OBJDIR)/headers
587603
$(OBJDIR)/headers: Makefile
588604
$(OBJDIR)/json.o $(OBJDIR)/json_artifact.o $(OBJDIR)/json_branch.o $(OBJDIR)/json_config.o $(OBJDIR)/json_diff.o $(OBJDIR)/json_dir.o $(OBJDIR)/json_finfo.o $(OBJDIR)/json_login.o $(OBJDIR)/json_query.o $(OBJDIR)/json_report.o $(OBJDIR)/json_status.o $(OBJDIR)/json_tag.o $(OBJDIR)/json_timeline.o $(OBJDIR)/json_user.o $(OBJDIR)/json_wiki.o : $(SRCDIR)/json_detail.h
589605
Makefile:
590606
$(OBJDIR)/add_.c: $(SRCDIR)/add.c $(OBJDIR)/translate
591
- $(OBJDIR)/translate $(SRCDIR)/add.c >$(OBJDIR)/add_.c
607
+ $(OBJDIR)/translate $(SRCDIR)/add.c >$@
592608
593609
$(OBJDIR)/add.o: $(OBJDIR)/add_.c $(OBJDIR)/add.h $(SRCDIR)/config.h
594610
$(XTCC) -o $(OBJDIR)/add.o -c $(OBJDIR)/add_.c
595611
596612
$(OBJDIR)/add.h: $(OBJDIR)/headers
613
+
597614
$(OBJDIR)/allrepo_.c: $(SRCDIR)/allrepo.c $(OBJDIR)/translate
598
- $(OBJDIR)/translate $(SRCDIR)/allrepo.c >$(OBJDIR)/allrepo_.c
615
+ $(OBJDIR)/translate $(SRCDIR)/allrepo.c >$@
599616
600617
$(OBJDIR)/allrepo.o: $(OBJDIR)/allrepo_.c $(OBJDIR)/allrepo.h $(SRCDIR)/config.h
601618
$(XTCC) -o $(OBJDIR)/allrepo.o -c $(OBJDIR)/allrepo_.c
602619
603620
$(OBJDIR)/allrepo.h: $(OBJDIR)/headers
621
+
604622
$(OBJDIR)/attach_.c: $(SRCDIR)/attach.c $(OBJDIR)/translate
605
- $(OBJDIR)/translate $(SRCDIR)/attach.c >$(OBJDIR)/attach_.c
623
+ $(OBJDIR)/translate $(SRCDIR)/attach.c >$@
606624
607625
$(OBJDIR)/attach.o: $(OBJDIR)/attach_.c $(OBJDIR)/attach.h $(SRCDIR)/config.h
608626
$(XTCC) -o $(OBJDIR)/attach.o -c $(OBJDIR)/attach_.c
609627
610628
$(OBJDIR)/attach.h: $(OBJDIR)/headers
629
+
611630
$(OBJDIR)/bag_.c: $(SRCDIR)/bag.c $(OBJDIR)/translate
612
- $(OBJDIR)/translate $(SRCDIR)/bag.c >$(OBJDIR)/bag_.c
631
+ $(OBJDIR)/translate $(SRCDIR)/bag.c >$@
613632
614633
$(OBJDIR)/bag.o: $(OBJDIR)/bag_.c $(OBJDIR)/bag.h $(SRCDIR)/config.h
615634
$(XTCC) -o $(OBJDIR)/bag.o -c $(OBJDIR)/bag_.c
616635
617636
$(OBJDIR)/bag.h: $(OBJDIR)/headers
637
+
618638
$(OBJDIR)/bisect_.c: $(SRCDIR)/bisect.c $(OBJDIR)/translate
619
- $(OBJDIR)/translate $(SRCDIR)/bisect.c >$(OBJDIR)/bisect_.c
639
+ $(OBJDIR)/translate $(SRCDIR)/bisect.c >$@
620640
621641
$(OBJDIR)/bisect.o: $(OBJDIR)/bisect_.c $(OBJDIR)/bisect.h $(SRCDIR)/config.h
622642
$(XTCC) -o $(OBJDIR)/bisect.o -c $(OBJDIR)/bisect_.c
623643
624644
$(OBJDIR)/bisect.h: $(OBJDIR)/headers
645
+
625646
$(OBJDIR)/blob_.c: $(SRCDIR)/blob.c $(OBJDIR)/translate
626
- $(OBJDIR)/translate $(SRCDIR)/blob.c >$(OBJDIR)/blob_.c
647
+ $(OBJDIR)/translate $(SRCDIR)/blob.c >$@
627648
628649
$(OBJDIR)/blob.o: $(OBJDIR)/blob_.c $(OBJDIR)/blob.h $(SRCDIR)/config.h
629650
$(XTCC) -o $(OBJDIR)/blob.o -c $(OBJDIR)/blob_.c
630651
631652
$(OBJDIR)/blob.h: $(OBJDIR)/headers
653
+
632654
$(OBJDIR)/branch_.c: $(SRCDIR)/branch.c $(OBJDIR)/translate
633
- $(OBJDIR)/translate $(SRCDIR)/branch.c >$(OBJDIR)/branch_.c
655
+ $(OBJDIR)/translate $(SRCDIR)/branch.c >$@
634656
635657
$(OBJDIR)/branch.o: $(OBJDIR)/branch_.c $(OBJDIR)/branch.h $(SRCDIR)/config.h
636658
$(XTCC) -o $(OBJDIR)/branch.o -c $(OBJDIR)/branch_.c
637659
638660
$(OBJDIR)/branch.h: $(OBJDIR)/headers
661
+
639662
$(OBJDIR)/browse_.c: $(SRCDIR)/browse.c $(OBJDIR)/translate
640
- $(OBJDIR)/translate $(SRCDIR)/browse.c >$(OBJDIR)/browse_.c
663
+ $(OBJDIR)/translate $(SRCDIR)/browse.c >$@
641664
642665
$(OBJDIR)/browse.o: $(OBJDIR)/browse_.c $(OBJDIR)/browse.h $(SRCDIR)/config.h
643666
$(XTCC) -o $(OBJDIR)/browse.o -c $(OBJDIR)/browse_.c
644667
645668
$(OBJDIR)/browse.h: $(OBJDIR)/headers
669
+
646670
$(OBJDIR)/builtin_.c: $(SRCDIR)/builtin.c $(OBJDIR)/translate
647
- $(OBJDIR)/translate $(SRCDIR)/builtin.c >$(OBJDIR)/builtin_.c
671
+ $(OBJDIR)/translate $(SRCDIR)/builtin.c >$@
648672
649673
$(OBJDIR)/builtin.o: $(OBJDIR)/builtin_.c $(OBJDIR)/builtin.h $(OBJDIR)/builtin_data.h $(SRCDIR)/config.h
650674
$(XTCC) -o $(OBJDIR)/builtin.o -c $(OBJDIR)/builtin_.c
651675
652676
$(OBJDIR)/builtin.h: $(OBJDIR)/headers
677
+
678
+$(OBJDIR)/bundle_.c: $(SRCDIR)/bundle.c $(OBJDIR)/translate
679
+ $(OBJDIR)/translate $(SRCDIR)/bundle.c >$@
680
+
681
+$(OBJDIR)/bundle.o: $(OBJDIR)/bundle_.c $(OBJDIR)/bundle.h $(SRCDIR)/config.h
682
+ $(XTCC) -o $(OBJDIR)/bundle.o -c $(OBJDIR)/bundle_.c
683
+
684
+$(OBJDIR)/bundle.h: $(OBJDIR)/headers
685
+
653686
$(OBJDIR)/cache_.c: $(SRCDIR)/cache.c $(OBJDIR)/translate
654
- $(OBJDIR)/translate $(SRCDIR)/cache.c >$(OBJDIR)/cache_.c
687
+ $(OBJDIR)/translate $(SRCDIR)/cache.c >$@
655688
656689
$(OBJDIR)/cache.o: $(OBJDIR)/cache_.c $(OBJDIR)/cache.h $(SRCDIR)/config.h
657690
$(XTCC) -o $(OBJDIR)/cache.o -c $(OBJDIR)/cache_.c
658691
659692
$(OBJDIR)/cache.h: $(OBJDIR)/headers
693
+
660694
$(OBJDIR)/captcha_.c: $(SRCDIR)/captcha.c $(OBJDIR)/translate
661
- $(OBJDIR)/translate $(SRCDIR)/captcha.c >$(OBJDIR)/captcha_.c
695
+ $(OBJDIR)/translate $(SRCDIR)/captcha.c >$@
662696
663697
$(OBJDIR)/captcha.o: $(OBJDIR)/captcha_.c $(OBJDIR)/captcha.h $(SRCDIR)/config.h
664698
$(XTCC) -o $(OBJDIR)/captcha.o -c $(OBJDIR)/captcha_.c
665699
666700
$(OBJDIR)/captcha.h: $(OBJDIR)/headers
701
+
667702
$(OBJDIR)/cgi_.c: $(SRCDIR)/cgi.c $(OBJDIR)/translate
668
- $(OBJDIR)/translate $(SRCDIR)/cgi.c >$(OBJDIR)/cgi_.c
703
+ $(OBJDIR)/translate $(SRCDIR)/cgi.c >$@
669704
670705
$(OBJDIR)/cgi.o: $(OBJDIR)/cgi_.c $(OBJDIR)/cgi.h $(SRCDIR)/config.h
671706
$(XTCC) -o $(OBJDIR)/cgi.o -c $(OBJDIR)/cgi_.c
672707
673708
$(OBJDIR)/cgi.h: $(OBJDIR)/headers
709
+
674710
$(OBJDIR)/checkin_.c: $(SRCDIR)/checkin.c $(OBJDIR)/translate
675
- $(OBJDIR)/translate $(SRCDIR)/checkin.c >$(OBJDIR)/checkin_.c
711
+ $(OBJDIR)/translate $(SRCDIR)/checkin.c >$@
676712
677713
$(OBJDIR)/checkin.o: $(OBJDIR)/checkin_.c $(OBJDIR)/checkin.h $(SRCDIR)/config.h
678714
$(XTCC) -o $(OBJDIR)/checkin.o -c $(OBJDIR)/checkin_.c
679715
680716
$(OBJDIR)/checkin.h: $(OBJDIR)/headers
717
+
681718
$(OBJDIR)/checkout_.c: $(SRCDIR)/checkout.c $(OBJDIR)/translate
682
- $(OBJDIR)/translate $(SRCDIR)/checkout.c >$(OBJDIR)/checkout_.c
719
+ $(OBJDIR)/translate $(SRCDIR)/checkout.c >$@
683720
684721
$(OBJDIR)/checkout.o: $(OBJDIR)/checkout_.c $(OBJDIR)/checkout.h $(SRCDIR)/config.h
685722
$(XTCC) -o $(OBJDIR)/checkout.o -c $(OBJDIR)/checkout_.c
686723
687724
$(OBJDIR)/checkout.h: $(OBJDIR)/headers
725
+
688726
$(OBJDIR)/clearsign_.c: $(SRCDIR)/clearsign.c $(OBJDIR)/translate
689
- $(OBJDIR)/translate $(SRCDIR)/clearsign.c >$(OBJDIR)/clearsign_.c
727
+ $(OBJDIR)/translate $(SRCDIR)/clearsign.c >$@
690728
691729
$(OBJDIR)/clearsign.o: $(OBJDIR)/clearsign_.c $(OBJDIR)/clearsign.h $(SRCDIR)/config.h
692730
$(XTCC) -o $(OBJDIR)/clearsign.o -c $(OBJDIR)/clearsign_.c
693731
694732
$(OBJDIR)/clearsign.h: $(OBJDIR)/headers
733
+
695734
$(OBJDIR)/clone_.c: $(SRCDIR)/clone.c $(OBJDIR)/translate
696
- $(OBJDIR)/translate $(SRCDIR)/clone.c >$(OBJDIR)/clone_.c
735
+ $(OBJDIR)/translate $(SRCDIR)/clone.c >$@
697736
698737
$(OBJDIR)/clone.o: $(OBJDIR)/clone_.c $(OBJDIR)/clone.h $(SRCDIR)/config.h
699738
$(XTCC) -o $(OBJDIR)/clone.o -c $(OBJDIR)/clone_.c
700739
701740
$(OBJDIR)/clone.h: $(OBJDIR)/headers
741
+
702742
$(OBJDIR)/comformat_.c: $(SRCDIR)/comformat.c $(OBJDIR)/translate
703
- $(OBJDIR)/translate $(SRCDIR)/comformat.c >$(OBJDIR)/comformat_.c
743
+ $(OBJDIR)/translate $(SRCDIR)/comformat.c >$@
704744
705745
$(OBJDIR)/comformat.o: $(OBJDIR)/comformat_.c $(OBJDIR)/comformat.h $(SRCDIR)/config.h
706746
$(XTCC) -o $(OBJDIR)/comformat.o -c $(OBJDIR)/comformat_.c
707747
708748
$(OBJDIR)/comformat.h: $(OBJDIR)/headers
749
+
709750
$(OBJDIR)/configure_.c: $(SRCDIR)/configure.c $(OBJDIR)/translate
710
- $(OBJDIR)/translate $(SRCDIR)/configure.c >$(OBJDIR)/configure_.c
751
+ $(OBJDIR)/translate $(SRCDIR)/configure.c >$@
711752
712753
$(OBJDIR)/configure.o: $(OBJDIR)/configure_.c $(OBJDIR)/configure.h $(SRCDIR)/config.h
713754
$(XTCC) -o $(OBJDIR)/configure.o -c $(OBJDIR)/configure_.c
714755
715756
$(OBJDIR)/configure.h: $(OBJDIR)/headers
757
+
716758
$(OBJDIR)/content_.c: $(SRCDIR)/content.c $(OBJDIR)/translate
717
- $(OBJDIR)/translate $(SRCDIR)/content.c >$(OBJDIR)/content_.c
759
+ $(OBJDIR)/translate $(SRCDIR)/content.c >$@
718760
719761
$(OBJDIR)/content.o: $(OBJDIR)/content_.c $(OBJDIR)/content.h $(SRCDIR)/config.h
720762
$(XTCC) -o $(OBJDIR)/content.o -c $(OBJDIR)/content_.c
721763
722764
$(OBJDIR)/content.h: $(OBJDIR)/headers
765
+
723766
$(OBJDIR)/db_.c: $(SRCDIR)/db.c $(OBJDIR)/translate
724
- $(OBJDIR)/translate $(SRCDIR)/db.c >$(OBJDIR)/db_.c
767
+ $(OBJDIR)/translate $(SRCDIR)/db.c >$@
725768
726769
$(OBJDIR)/db.o: $(OBJDIR)/db_.c $(OBJDIR)/db.h $(SRCDIR)/config.h
727770
$(XTCC) -o $(OBJDIR)/db.o -c $(OBJDIR)/db_.c
728771
729772
$(OBJDIR)/db.h: $(OBJDIR)/headers
773
+
730774
$(OBJDIR)/delta_.c: $(SRCDIR)/delta.c $(OBJDIR)/translate
731
- $(OBJDIR)/translate $(SRCDIR)/delta.c >$(OBJDIR)/delta_.c
775
+ $(OBJDIR)/translate $(SRCDIR)/delta.c >$@
732776
733777
$(OBJDIR)/delta.o: $(OBJDIR)/delta_.c $(OBJDIR)/delta.h $(SRCDIR)/config.h
734778
$(XTCC) -o $(OBJDIR)/delta.o -c $(OBJDIR)/delta_.c
735779
736780
$(OBJDIR)/delta.h: $(OBJDIR)/headers
781
+
737782
$(OBJDIR)/deltacmd_.c: $(SRCDIR)/deltacmd.c $(OBJDIR)/translate
738
- $(OBJDIR)/translate $(SRCDIR)/deltacmd.c >$(OBJDIR)/deltacmd_.c
783
+ $(OBJDIR)/translate $(SRCDIR)/deltacmd.c >$@
739784
740785
$(OBJDIR)/deltacmd.o: $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h $(SRCDIR)/config.h
741786
$(XTCC) -o $(OBJDIR)/deltacmd.o -c $(OBJDIR)/deltacmd_.c
742787
743788
$(OBJDIR)/deltacmd.h: $(OBJDIR)/headers
789
+
744790
$(OBJDIR)/descendants_.c: $(SRCDIR)/descendants.c $(OBJDIR)/translate
745
- $(OBJDIR)/translate $(SRCDIR)/descendants.c >$(OBJDIR)/descendants_.c
791
+ $(OBJDIR)/translate $(SRCDIR)/descendants.c >$@
746792
747793
$(OBJDIR)/descendants.o: $(OBJDIR)/descendants_.c $(OBJDIR)/descendants.h $(SRCDIR)/config.h
748794
$(XTCC) -o $(OBJDIR)/descendants.o -c $(OBJDIR)/descendants_.c
749795
750796
$(OBJDIR)/descendants.h: $(OBJDIR)/headers
797
+
751798
$(OBJDIR)/diff_.c: $(SRCDIR)/diff.c $(OBJDIR)/translate
752
- $(OBJDIR)/translate $(SRCDIR)/diff.c >$(OBJDIR)/diff_.c
799
+ $(OBJDIR)/translate $(SRCDIR)/diff.c >$@
753800
754801
$(OBJDIR)/diff.o: $(OBJDIR)/diff_.c $(OBJDIR)/diff.h $(SRCDIR)/config.h
755802
$(XTCC) -o $(OBJDIR)/diff.o -c $(OBJDIR)/diff_.c
756803
757804
$(OBJDIR)/diff.h: $(OBJDIR)/headers
805
+
758806
$(OBJDIR)/diffcmd_.c: $(SRCDIR)/diffcmd.c $(OBJDIR)/translate
759
- $(OBJDIR)/translate $(SRCDIR)/diffcmd.c >$(OBJDIR)/diffcmd_.c
807
+ $(OBJDIR)/translate $(SRCDIR)/diffcmd.c >$@
760808
761809
$(OBJDIR)/diffcmd.o: $(OBJDIR)/diffcmd_.c $(OBJDIR)/diffcmd.h $(SRCDIR)/config.h
762810
$(XTCC) -o $(OBJDIR)/diffcmd.o -c $(OBJDIR)/diffcmd_.c
763811
764812
$(OBJDIR)/diffcmd.h: $(OBJDIR)/headers
813
+
765814
$(OBJDIR)/doc_.c: $(SRCDIR)/doc.c $(OBJDIR)/translate
766
- $(OBJDIR)/translate $(SRCDIR)/doc.c >$(OBJDIR)/doc_.c
815
+ $(OBJDIR)/translate $(SRCDIR)/doc.c >$@
767816
768817
$(OBJDIR)/doc.o: $(OBJDIR)/doc_.c $(OBJDIR)/doc.h $(SRCDIR)/config.h
769818
$(XTCC) -o $(OBJDIR)/doc.o -c $(OBJDIR)/doc_.c
770819
771820
$(OBJDIR)/doc.h: $(OBJDIR)/headers
821
+
772822
$(OBJDIR)/encode_.c: $(SRCDIR)/encode.c $(OBJDIR)/translate
773
- $(OBJDIR)/translate $(SRCDIR)/encode.c >$(OBJDIR)/encode_.c
823
+ $(OBJDIR)/translate $(SRCDIR)/encode.c >$@
774824
775825
$(OBJDIR)/encode.o: $(OBJDIR)/encode_.c $(OBJDIR)/encode.h $(SRCDIR)/config.h
776826
$(XTCC) -o $(OBJDIR)/encode.o -c $(OBJDIR)/encode_.c
777827
778828
$(OBJDIR)/encode.h: $(OBJDIR)/headers
829
+
779830
$(OBJDIR)/event_.c: $(SRCDIR)/event.c $(OBJDIR)/translate
780
- $(OBJDIR)/translate $(SRCDIR)/event.c >$(OBJDIR)/event_.c
831
+ $(OBJDIR)/translate $(SRCDIR)/event.c >$@
781832
782833
$(OBJDIR)/event.o: $(OBJDIR)/event_.c $(OBJDIR)/event.h $(SRCDIR)/config.h
783834
$(XTCC) -o $(OBJDIR)/event.o -c $(OBJDIR)/event_.c
784835
785836
$(OBJDIR)/event.h: $(OBJDIR)/headers
837
+
786838
$(OBJDIR)/export_.c: $(SRCDIR)/export.c $(OBJDIR)/translate
787
- $(OBJDIR)/translate $(SRCDIR)/export.c >$(OBJDIR)/export_.c
839
+ $(OBJDIR)/translate $(SRCDIR)/export.c >$@
788840
789841
$(OBJDIR)/export.o: $(OBJDIR)/export_.c $(OBJDIR)/export.h $(SRCDIR)/config.h
790842
$(XTCC) -o $(OBJDIR)/export.o -c $(OBJDIR)/export_.c
791843
792844
$(OBJDIR)/export.h: $(OBJDIR)/headers
845
+
793846
$(OBJDIR)/file_.c: $(SRCDIR)/file.c $(OBJDIR)/translate
794
- $(OBJDIR)/translate $(SRCDIR)/file.c >$(OBJDIR)/file_.c
847
+ $(OBJDIR)/translate $(SRCDIR)/file.c >$@
795848
796849
$(OBJDIR)/file.o: $(OBJDIR)/file_.c $(OBJDIR)/file.h $(SRCDIR)/config.h
797850
$(XTCC) -o $(OBJDIR)/file.o -c $(OBJDIR)/file_.c
798851
799852
$(OBJDIR)/file.h: $(OBJDIR)/headers
853
+
800854
$(OBJDIR)/finfo_.c: $(SRCDIR)/finfo.c $(OBJDIR)/translate
801
- $(OBJDIR)/translate $(SRCDIR)/finfo.c >$(OBJDIR)/finfo_.c
855
+ $(OBJDIR)/translate $(SRCDIR)/finfo.c >$@
802856
803857
$(OBJDIR)/finfo.o: $(OBJDIR)/finfo_.c $(OBJDIR)/finfo.h $(SRCDIR)/config.h
804858
$(XTCC) -o $(OBJDIR)/finfo.o -c $(OBJDIR)/finfo_.c
805859
806860
$(OBJDIR)/finfo.h: $(OBJDIR)/headers
861
+
862
+$(OBJDIR)/foci_.c: $(SRCDIR)/foci.c $(OBJDIR)/translate
863
+ $(OBJDIR)/translate $(SRCDIR)/foci.c >$@
864
+
865
+$(OBJDIR)/foci.o: $(OBJDIR)/foci_.c $(OBJDIR)/foci.h $(SRCDIR)/config.h
866
+ $(XTCC) -o $(OBJDIR)/foci.o -c $(OBJDIR)/foci_.c
867
+
868
+$(OBJDIR)/foci.h: $(OBJDIR)/headers
869
+
807870
$(OBJDIR)/fusefs_.c: $(SRCDIR)/fusefs.c $(OBJDIR)/translate
808
- $(OBJDIR)/translate $(SRCDIR)/fusefs.c >$(OBJDIR)/fusefs_.c
871
+ $(OBJDIR)/translate $(SRCDIR)/fusefs.c >$@
809872
810873
$(OBJDIR)/fusefs.o: $(OBJDIR)/fusefs_.c $(OBJDIR)/fusefs.h $(SRCDIR)/config.h
811874
$(XTCC) -o $(OBJDIR)/fusefs.o -c $(OBJDIR)/fusefs_.c
812875
813876
$(OBJDIR)/fusefs.h: $(OBJDIR)/headers
877
+
814878
$(OBJDIR)/glob_.c: $(SRCDIR)/glob.c $(OBJDIR)/translate
815
- $(OBJDIR)/translate $(SRCDIR)/glob.c >$(OBJDIR)/glob_.c
879
+ $(OBJDIR)/translate $(SRCDIR)/glob.c >$@
816880
817881
$(OBJDIR)/glob.o: $(OBJDIR)/glob_.c $(OBJDIR)/glob.h $(SRCDIR)/config.h
818882
$(XTCC) -o $(OBJDIR)/glob.o -c $(OBJDIR)/glob_.c
819883
820884
$(OBJDIR)/glob.h: $(OBJDIR)/headers
885
+
821886
$(OBJDIR)/graph_.c: $(SRCDIR)/graph.c $(OBJDIR)/translate
822
- $(OBJDIR)/translate $(SRCDIR)/graph.c >$(OBJDIR)/graph_.c
887
+ $(OBJDIR)/translate $(SRCDIR)/graph.c >$@
823888
824889
$(OBJDIR)/graph.o: $(OBJDIR)/graph_.c $(OBJDIR)/graph.h $(SRCDIR)/config.h
825890
$(XTCC) -o $(OBJDIR)/graph.o -c $(OBJDIR)/graph_.c
826891
827892
$(OBJDIR)/graph.h: $(OBJDIR)/headers
893
+
828894
$(OBJDIR)/gzip_.c: $(SRCDIR)/gzip.c $(OBJDIR)/translate
829
- $(OBJDIR)/translate $(SRCDIR)/gzip.c >$(OBJDIR)/gzip_.c
895
+ $(OBJDIR)/translate $(SRCDIR)/gzip.c >$@
830896
831897
$(OBJDIR)/gzip.o: $(OBJDIR)/gzip_.c $(OBJDIR)/gzip.h $(SRCDIR)/config.h
832898
$(XTCC) -o $(OBJDIR)/gzip.o -c $(OBJDIR)/gzip_.c
833899
834900
$(OBJDIR)/gzip.h: $(OBJDIR)/headers
901
+
835902
$(OBJDIR)/http_.c: $(SRCDIR)/http.c $(OBJDIR)/translate
836
- $(OBJDIR)/translate $(SRCDIR)/http.c >$(OBJDIR)/http_.c
903
+ $(OBJDIR)/translate $(SRCDIR)/http.c >$@
837904
838905
$(OBJDIR)/http.o: $(OBJDIR)/http_.c $(OBJDIR)/http.h $(SRCDIR)/config.h
839906
$(XTCC) -o $(OBJDIR)/http.o -c $(OBJDIR)/http_.c
840907
841908
$(OBJDIR)/http.h: $(OBJDIR)/headers
909
+
842910
$(OBJDIR)/http_socket_.c: $(SRCDIR)/http_socket.c $(OBJDIR)/translate
843
- $(OBJDIR)/translate $(SRCDIR)/http_socket.c >$(OBJDIR)/http_socket_.c
911
+ $(OBJDIR)/translate $(SRCDIR)/http_socket.c >$@
844912
845913
$(OBJDIR)/http_socket.o: $(OBJDIR)/http_socket_.c $(OBJDIR)/http_socket.h $(SRCDIR)/config.h
846914
$(XTCC) -o $(OBJDIR)/http_socket.o -c $(OBJDIR)/http_socket_.c
847915
848916
$(OBJDIR)/http_socket.h: $(OBJDIR)/headers
917
+
849918
$(OBJDIR)/http_ssl_.c: $(SRCDIR)/http_ssl.c $(OBJDIR)/translate
850
- $(OBJDIR)/translate $(SRCDIR)/http_ssl.c >$(OBJDIR)/http_ssl_.c
919
+ $(OBJDIR)/translate $(SRCDIR)/http_ssl.c >$@
851920
852921
$(OBJDIR)/http_ssl.o: $(OBJDIR)/http_ssl_.c $(OBJDIR)/http_ssl.h $(SRCDIR)/config.h
853922
$(XTCC) -o $(OBJDIR)/http_ssl.o -c $(OBJDIR)/http_ssl_.c
854923
855924
$(OBJDIR)/http_ssl.h: $(OBJDIR)/headers
925
+
856926
$(OBJDIR)/http_transport_.c: $(SRCDIR)/http_transport.c $(OBJDIR)/translate
857
- $(OBJDIR)/translate $(SRCDIR)/http_transport.c >$(OBJDIR)/http_transport_.c
927
+ $(OBJDIR)/translate $(SRCDIR)/http_transport.c >$@
858928
859929
$(OBJDIR)/http_transport.o: $(OBJDIR)/http_transport_.c $(OBJDIR)/http_transport.h $(SRCDIR)/config.h
860930
$(XTCC) -o $(OBJDIR)/http_transport.o -c $(OBJDIR)/http_transport_.c
861931
862932
$(OBJDIR)/http_transport.h: $(OBJDIR)/headers
933
+
863934
$(OBJDIR)/import_.c: $(SRCDIR)/import.c $(OBJDIR)/translate
864
- $(OBJDIR)/translate $(SRCDIR)/import.c >$(OBJDIR)/import_.c
935
+ $(OBJDIR)/translate $(SRCDIR)/import.c >$@
865936
866937
$(OBJDIR)/import.o: $(OBJDIR)/import_.c $(OBJDIR)/import.h $(SRCDIR)/config.h
867938
$(XTCC) -o $(OBJDIR)/import.o -c $(OBJDIR)/import_.c
868939
869940
$(OBJDIR)/import.h: $(OBJDIR)/headers
941
+
870942
$(OBJDIR)/info_.c: $(SRCDIR)/info.c $(OBJDIR)/translate
871
- $(OBJDIR)/translate $(SRCDIR)/info.c >$(OBJDIR)/info_.c
943
+ $(OBJDIR)/translate $(SRCDIR)/info.c >$@
872944
873945
$(OBJDIR)/info.o: $(OBJDIR)/info_.c $(OBJDIR)/info.h $(SRCDIR)/config.h
874946
$(XTCC) -o $(OBJDIR)/info.o -c $(OBJDIR)/info_.c
875947
876948
$(OBJDIR)/info.h: $(OBJDIR)/headers
949
+
877950
$(OBJDIR)/json_.c: $(SRCDIR)/json.c $(OBJDIR)/translate
878
- $(OBJDIR)/translate $(SRCDIR)/json.c >$(OBJDIR)/json_.c
951
+ $(OBJDIR)/translate $(SRCDIR)/json.c >$@
879952
880953
$(OBJDIR)/json.o: $(OBJDIR)/json_.c $(OBJDIR)/json.h $(SRCDIR)/config.h
881954
$(XTCC) -o $(OBJDIR)/json.o -c $(OBJDIR)/json_.c
882955
883956
$(OBJDIR)/json.h: $(OBJDIR)/headers
957
+
884958
$(OBJDIR)/json_artifact_.c: $(SRCDIR)/json_artifact.c $(OBJDIR)/translate
885
- $(OBJDIR)/translate $(SRCDIR)/json_artifact.c >$(OBJDIR)/json_artifact_.c
959
+ $(OBJDIR)/translate $(SRCDIR)/json_artifact.c >$@
886960
887961
$(OBJDIR)/json_artifact.o: $(OBJDIR)/json_artifact_.c $(OBJDIR)/json_artifact.h $(SRCDIR)/config.h
888962
$(XTCC) -o $(OBJDIR)/json_artifact.o -c $(OBJDIR)/json_artifact_.c
889963
890964
$(OBJDIR)/json_artifact.h: $(OBJDIR)/headers
965
+
891966
$(OBJDIR)/json_branch_.c: $(SRCDIR)/json_branch.c $(OBJDIR)/translate
892
- $(OBJDIR)/translate $(SRCDIR)/json_branch.c >$(OBJDIR)/json_branch_.c
967
+ $(OBJDIR)/translate $(SRCDIR)/json_branch.c >$@
893968
894969
$(OBJDIR)/json_branch.o: $(OBJDIR)/json_branch_.c $(OBJDIR)/json_branch.h $(SRCDIR)/config.h
895970
$(XTCC) -o $(OBJDIR)/json_branch.o -c $(OBJDIR)/json_branch_.c
896971
897972
$(OBJDIR)/json_branch.h: $(OBJDIR)/headers
973
+
898974
$(OBJDIR)/json_config_.c: $(SRCDIR)/json_config.c $(OBJDIR)/translate
899
- $(OBJDIR)/translate $(SRCDIR)/json_config.c >$(OBJDIR)/json_config_.c
975
+ $(OBJDIR)/translate $(SRCDIR)/json_config.c >$@
900976
901977
$(OBJDIR)/json_config.o: $(OBJDIR)/json_config_.c $(OBJDIR)/json_config.h $(SRCDIR)/config.h
902978
$(XTCC) -o $(OBJDIR)/json_config.o -c $(OBJDIR)/json_config_.c
903979
904980
$(OBJDIR)/json_config.h: $(OBJDIR)/headers
981
+
905982
$(OBJDIR)/json_diff_.c: $(SRCDIR)/json_diff.c $(OBJDIR)/translate
906
- $(OBJDIR)/translate $(SRCDIR)/json_diff.c >$(OBJDIR)/json_diff_.c
983
+ $(OBJDIR)/translate $(SRCDIR)/json_diff.c >$@
907984
908985
$(OBJDIR)/json_diff.o: $(OBJDIR)/json_diff_.c $(OBJDIR)/json_diff.h $(SRCDIR)/config.h
909986
$(XTCC) -o $(OBJDIR)/json_diff.o -c $(OBJDIR)/json_diff_.c
910987
911988
$(OBJDIR)/json_diff.h: $(OBJDIR)/headers
989
+
912990
$(OBJDIR)/json_dir_.c: $(SRCDIR)/json_dir.c $(OBJDIR)/translate
913
- $(OBJDIR)/translate $(SRCDIR)/json_dir.c >$(OBJDIR)/json_dir_.c
991
+ $(OBJDIR)/translate $(SRCDIR)/json_dir.c >$@
914992
915993
$(OBJDIR)/json_dir.o: $(OBJDIR)/json_dir_.c $(OBJDIR)/json_dir.h $(SRCDIR)/config.h
916994
$(XTCC) -o $(OBJDIR)/json_dir.o -c $(OBJDIR)/json_dir_.c
917995
918996
$(OBJDIR)/json_dir.h: $(OBJDIR)/headers
997
+
919998
$(OBJDIR)/json_finfo_.c: $(SRCDIR)/json_finfo.c $(OBJDIR)/translate
920
- $(OBJDIR)/translate $(SRCDIR)/json_finfo.c >$(OBJDIR)/json_finfo_.c
999
+ $(OBJDIR)/translate $(SRCDIR)/json_finfo.c >$@
9211000
9221001
$(OBJDIR)/json_finfo.o: $(OBJDIR)/json_finfo_.c $(OBJDIR)/json_finfo.h $(SRCDIR)/config.h
9231002
$(XTCC) -o $(OBJDIR)/json_finfo.o -c $(OBJDIR)/json_finfo_.c
9241003
9251004
$(OBJDIR)/json_finfo.h: $(OBJDIR)/headers
1005
+
9261006
$(OBJDIR)/json_login_.c: $(SRCDIR)/json_login.c $(OBJDIR)/translate
927
- $(OBJDIR)/translate $(SRCDIR)/json_login.c >$(OBJDIR)/json_login_.c
1007
+ $(OBJDIR)/translate $(SRCDIR)/json_login.c >$@
9281008
9291009
$(OBJDIR)/json_login.o: $(OBJDIR)/json_login_.c $(OBJDIR)/json_login.h $(SRCDIR)/config.h
9301010
$(XTCC) -o $(OBJDIR)/json_login.o -c $(OBJDIR)/json_login_.c
9311011
9321012
$(OBJDIR)/json_login.h: $(OBJDIR)/headers
1013
+
9331014
$(OBJDIR)/json_query_.c: $(SRCDIR)/json_query.c $(OBJDIR)/translate
934
- $(OBJDIR)/translate $(SRCDIR)/json_query.c >$(OBJDIR)/json_query_.c
1015
+ $(OBJDIR)/translate $(SRCDIR)/json_query.c >$@
9351016
9361017
$(OBJDIR)/json_query.o: $(OBJDIR)/json_query_.c $(OBJDIR)/json_query.h $(SRCDIR)/config.h
9371018
$(XTCC) -o $(OBJDIR)/json_query.o -c $(OBJDIR)/json_query_.c
9381019
9391020
$(OBJDIR)/json_query.h: $(OBJDIR)/headers
1021
+
9401022
$(OBJDIR)/json_report_.c: $(SRCDIR)/json_report.c $(OBJDIR)/translate
941
- $(OBJDIR)/translate $(SRCDIR)/json_report.c >$(OBJDIR)/json_report_.c
1023
+ $(OBJDIR)/translate $(SRCDIR)/json_report.c >$@
9421024
9431025
$(OBJDIR)/json_report.o: $(OBJDIR)/json_report_.c $(OBJDIR)/json_report.h $(SRCDIR)/config.h
9441026
$(XTCC) -o $(OBJDIR)/json_report.o -c $(OBJDIR)/json_report_.c
9451027
9461028
$(OBJDIR)/json_report.h: $(OBJDIR)/headers
1029
+
9471030
$(OBJDIR)/json_status_.c: $(SRCDIR)/json_status.c $(OBJDIR)/translate
948
- $(OBJDIR)/translate $(SRCDIR)/json_status.c >$(OBJDIR)/json_status_.c
1031
+ $(OBJDIR)/translate $(SRCDIR)/json_status.c >$@
9491032
9501033
$(OBJDIR)/json_status.o: $(OBJDIR)/json_status_.c $(OBJDIR)/json_status.h $(SRCDIR)/config.h
9511034
$(XTCC) -o $(OBJDIR)/json_status.o -c $(OBJDIR)/json_status_.c
9521035
9531036
$(OBJDIR)/json_status.h: $(OBJDIR)/headers
1037
+
9541038
$(OBJDIR)/json_tag_.c: $(SRCDIR)/json_tag.c $(OBJDIR)/translate
955
- $(OBJDIR)/translate $(SRCDIR)/json_tag.c >$(OBJDIR)/json_tag_.c
1039
+ $(OBJDIR)/translate $(SRCDIR)/json_tag.c >$@
9561040
9571041
$(OBJDIR)/json_tag.o: $(OBJDIR)/json_tag_.c $(OBJDIR)/json_tag.h $(SRCDIR)/config.h
9581042
$(XTCC) -o $(OBJDIR)/json_tag.o -c $(OBJDIR)/json_tag_.c
9591043
9601044
$(OBJDIR)/json_tag.h: $(OBJDIR)/headers
1045
+
9611046
$(OBJDIR)/json_timeline_.c: $(SRCDIR)/json_timeline.c $(OBJDIR)/translate
962
- $(OBJDIR)/translate $(SRCDIR)/json_timeline.c >$(OBJDIR)/json_timeline_.c
1047
+ $(OBJDIR)/translate $(SRCDIR)/json_timeline.c >$@
9631048
9641049
$(OBJDIR)/json_timeline.o: $(OBJDIR)/json_timeline_.c $(OBJDIR)/json_timeline.h $(SRCDIR)/config.h
9651050
$(XTCC) -o $(OBJDIR)/json_timeline.o -c $(OBJDIR)/json_timeline_.c
9661051
9671052
$(OBJDIR)/json_timeline.h: $(OBJDIR)/headers
1053
+
9681054
$(OBJDIR)/json_user_.c: $(SRCDIR)/json_user.c $(OBJDIR)/translate
969
- $(OBJDIR)/translate $(SRCDIR)/json_user.c >$(OBJDIR)/json_user_.c
1055
+ $(OBJDIR)/translate $(SRCDIR)/json_user.c >$@
9701056
9711057
$(OBJDIR)/json_user.o: $(OBJDIR)/json_user_.c $(OBJDIR)/json_user.h $(SRCDIR)/config.h
9721058
$(XTCC) -o $(OBJDIR)/json_user.o -c $(OBJDIR)/json_user_.c
9731059
9741060
$(OBJDIR)/json_user.h: $(OBJDIR)/headers
1061
+
9751062
$(OBJDIR)/json_wiki_.c: $(SRCDIR)/json_wiki.c $(OBJDIR)/translate
976
- $(OBJDIR)/translate $(SRCDIR)/json_wiki.c >$(OBJDIR)/json_wiki_.c
1063
+ $(OBJDIR)/translate $(SRCDIR)/json_wiki.c >$@
9771064
9781065
$(OBJDIR)/json_wiki.o: $(OBJDIR)/json_wiki_.c $(OBJDIR)/json_wiki.h $(SRCDIR)/config.h
9791066
$(XTCC) -o $(OBJDIR)/json_wiki.o -c $(OBJDIR)/json_wiki_.c
9801067
9811068
$(OBJDIR)/json_wiki.h: $(OBJDIR)/headers
1069
+
9821070
$(OBJDIR)/leaf_.c: $(SRCDIR)/leaf.c $(OBJDIR)/translate
983
- $(OBJDIR)/translate $(SRCDIR)/leaf.c >$(OBJDIR)/leaf_.c
1071
+ $(OBJDIR)/translate $(SRCDIR)/leaf.c >$@
9841072
9851073
$(OBJDIR)/leaf.o: $(OBJDIR)/leaf_.c $(OBJDIR)/leaf.h $(SRCDIR)/config.h
9861074
$(XTCC) -o $(OBJDIR)/leaf.o -c $(OBJDIR)/leaf_.c
9871075
9881076
$(OBJDIR)/leaf.h: $(OBJDIR)/headers
1077
+
9891078
$(OBJDIR)/loadctrl_.c: $(SRCDIR)/loadctrl.c $(OBJDIR)/translate
990
- $(OBJDIR)/translate $(SRCDIR)/loadctrl.c >$(OBJDIR)/loadctrl_.c
1079
+ $(OBJDIR)/translate $(SRCDIR)/loadctrl.c >$@
9911080
9921081
$(OBJDIR)/loadctrl.o: $(OBJDIR)/loadctrl_.c $(OBJDIR)/loadctrl.h $(SRCDIR)/config.h
9931082
$(XTCC) -o $(OBJDIR)/loadctrl.o -c $(OBJDIR)/loadctrl_.c
9941083
9951084
$(OBJDIR)/loadctrl.h: $(OBJDIR)/headers
1085
+
9961086
$(OBJDIR)/login_.c: $(SRCDIR)/login.c $(OBJDIR)/translate
997
- $(OBJDIR)/translate $(SRCDIR)/login.c >$(OBJDIR)/login_.c
1087
+ $(OBJDIR)/translate $(SRCDIR)/login.c >$@
9981088
9991089
$(OBJDIR)/login.o: $(OBJDIR)/login_.c $(OBJDIR)/login.h $(SRCDIR)/config.h
10001090
$(XTCC) -o $(OBJDIR)/login.o -c $(OBJDIR)/login_.c
10011091
10021092
$(OBJDIR)/login.h: $(OBJDIR)/headers
1093
+
10031094
$(OBJDIR)/lookslike_.c: $(SRCDIR)/lookslike.c $(OBJDIR)/translate
1004
- $(OBJDIR)/translate $(SRCDIR)/lookslike.c >$(OBJDIR)/lookslike_.c
1095
+ $(OBJDIR)/translate $(SRCDIR)/lookslike.c >$@
10051096
10061097
$(OBJDIR)/lookslike.o: $(OBJDIR)/lookslike_.c $(OBJDIR)/lookslike.h $(SRCDIR)/config.h
10071098
$(XTCC) -o $(OBJDIR)/lookslike.o -c $(OBJDIR)/lookslike_.c
10081099
10091100
$(OBJDIR)/lookslike.h: $(OBJDIR)/headers
1101
+
10101102
$(OBJDIR)/main_.c: $(SRCDIR)/main.c $(OBJDIR)/translate
1011
- $(OBJDIR)/translate $(SRCDIR)/main.c >$(OBJDIR)/main_.c
1103
+ $(OBJDIR)/translate $(SRCDIR)/main.c >$@
10121104
10131105
$(OBJDIR)/main.o: $(OBJDIR)/main_.c $(OBJDIR)/main.h $(OBJDIR)/page_index.h $(SRCDIR)/config.h
10141106
$(XTCC) -o $(OBJDIR)/main.o -c $(OBJDIR)/main_.c
10151107
10161108
$(OBJDIR)/main.h: $(OBJDIR)/headers
1109
+
10171110
$(OBJDIR)/manifest_.c: $(SRCDIR)/manifest.c $(OBJDIR)/translate
1018
- $(OBJDIR)/translate $(SRCDIR)/manifest.c >$(OBJDIR)/manifest_.c
1111
+ $(OBJDIR)/translate $(SRCDIR)/manifest.c >$@
10191112
10201113
$(OBJDIR)/manifest.o: $(OBJDIR)/manifest_.c $(OBJDIR)/manifest.h $(SRCDIR)/config.h
10211114
$(XTCC) -o $(OBJDIR)/manifest.o -c $(OBJDIR)/manifest_.c
10221115
10231116
$(OBJDIR)/manifest.h: $(OBJDIR)/headers
1117
+
10241118
$(OBJDIR)/markdown_.c: $(SRCDIR)/markdown.c $(OBJDIR)/translate
1025
- $(OBJDIR)/translate $(SRCDIR)/markdown.c >$(OBJDIR)/markdown_.c
1119
+ $(OBJDIR)/translate $(SRCDIR)/markdown.c >$@
10261120
10271121
$(OBJDIR)/markdown.o: $(OBJDIR)/markdown_.c $(OBJDIR)/markdown.h $(SRCDIR)/config.h
10281122
$(XTCC) -o $(OBJDIR)/markdown.o -c $(OBJDIR)/markdown_.c
10291123
10301124
$(OBJDIR)/markdown.h: $(OBJDIR)/headers
1125
+
10311126
$(OBJDIR)/markdown_html_.c: $(SRCDIR)/markdown_html.c $(OBJDIR)/translate
1032
- $(OBJDIR)/translate $(SRCDIR)/markdown_html.c >$(OBJDIR)/markdown_html_.c
1127
+ $(OBJDIR)/translate $(SRCDIR)/markdown_html.c >$@
10331128
10341129
$(OBJDIR)/markdown_html.o: $(OBJDIR)/markdown_html_.c $(OBJDIR)/markdown_html.h $(SRCDIR)/config.h
10351130
$(XTCC) -o $(OBJDIR)/markdown_html.o -c $(OBJDIR)/markdown_html_.c
10361131
10371132
$(OBJDIR)/markdown_html.h: $(OBJDIR)/headers
1133
+
10381134
$(OBJDIR)/md5_.c: $(SRCDIR)/md5.c $(OBJDIR)/translate
1039
- $(OBJDIR)/translate $(SRCDIR)/md5.c >$(OBJDIR)/md5_.c
1135
+ $(OBJDIR)/translate $(SRCDIR)/md5.c >$@
10401136
10411137
$(OBJDIR)/md5.o: $(OBJDIR)/md5_.c $(OBJDIR)/md5.h $(SRCDIR)/config.h
10421138
$(XTCC) -o $(OBJDIR)/md5.o -c $(OBJDIR)/md5_.c
10431139
10441140
$(OBJDIR)/md5.h: $(OBJDIR)/headers
1141
+
10451142
$(OBJDIR)/merge_.c: $(SRCDIR)/merge.c $(OBJDIR)/translate
1046
- $(OBJDIR)/translate $(SRCDIR)/merge.c >$(OBJDIR)/merge_.c
1143
+ $(OBJDIR)/translate $(SRCDIR)/merge.c >$@
10471144
10481145
$(OBJDIR)/merge.o: $(OBJDIR)/merge_.c $(OBJDIR)/merge.h $(SRCDIR)/config.h
10491146
$(XTCC) -o $(OBJDIR)/merge.o -c $(OBJDIR)/merge_.c
10501147
10511148
$(OBJDIR)/merge.h: $(OBJDIR)/headers
1149
+
10521150
$(OBJDIR)/merge3_.c: $(SRCDIR)/merge3.c $(OBJDIR)/translate
1053
- $(OBJDIR)/translate $(SRCDIR)/merge3.c >$(OBJDIR)/merge3_.c
1151
+ $(OBJDIR)/translate $(SRCDIR)/merge3.c >$@
10541152
10551153
$(OBJDIR)/merge3.o: $(OBJDIR)/merge3_.c $(OBJDIR)/merge3.h $(SRCDIR)/config.h
10561154
$(XTCC) -o $(OBJDIR)/merge3.o -c $(OBJDIR)/merge3_.c
10571155
10581156
$(OBJDIR)/merge3.h: $(OBJDIR)/headers
1157
+
10591158
$(OBJDIR)/moderate_.c: $(SRCDIR)/moderate.c $(OBJDIR)/translate
1060
- $(OBJDIR)/translate $(SRCDIR)/moderate.c >$(OBJDIR)/moderate_.c
1159
+ $(OBJDIR)/translate $(SRCDIR)/moderate.c >$@
10611160
10621161
$(OBJDIR)/moderate.o: $(OBJDIR)/moderate_.c $(OBJDIR)/moderate.h $(SRCDIR)/config.h
10631162
$(XTCC) -o $(OBJDIR)/moderate.o -c $(OBJDIR)/moderate_.c
10641163
10651164
$(OBJDIR)/moderate.h: $(OBJDIR)/headers
1165
+
10661166
$(OBJDIR)/name_.c: $(SRCDIR)/name.c $(OBJDIR)/translate
1067
- $(OBJDIR)/translate $(SRCDIR)/name.c >$(OBJDIR)/name_.c
1167
+ $(OBJDIR)/translate $(SRCDIR)/name.c >$@
10681168
10691169
$(OBJDIR)/name.o: $(OBJDIR)/name_.c $(OBJDIR)/name.h $(SRCDIR)/config.h
10701170
$(XTCC) -o $(OBJDIR)/name.o -c $(OBJDIR)/name_.c
10711171
10721172
$(OBJDIR)/name.h: $(OBJDIR)/headers
1173
+
10731174
$(OBJDIR)/path_.c: $(SRCDIR)/path.c $(OBJDIR)/translate
1074
- $(OBJDIR)/translate $(SRCDIR)/path.c >$(OBJDIR)/path_.c
1175
+ $(OBJDIR)/translate $(SRCDIR)/path.c >$@
10751176
10761177
$(OBJDIR)/path.o: $(OBJDIR)/path_.c $(OBJDIR)/path.h $(SRCDIR)/config.h
10771178
$(XTCC) -o $(OBJDIR)/path.o -c $(OBJDIR)/path_.c
10781179
10791180
$(OBJDIR)/path.h: $(OBJDIR)/headers
1181
+
10801182
$(OBJDIR)/pivot_.c: $(SRCDIR)/pivot.c $(OBJDIR)/translate
1081
- $(OBJDIR)/translate $(SRCDIR)/pivot.c >$(OBJDIR)/pivot_.c
1183
+ $(OBJDIR)/translate $(SRCDIR)/pivot.c >$@
10821184
10831185
$(OBJDIR)/pivot.o: $(OBJDIR)/pivot_.c $(OBJDIR)/pivot.h $(SRCDIR)/config.h
10841186
$(XTCC) -o $(OBJDIR)/pivot.o -c $(OBJDIR)/pivot_.c
10851187
10861188
$(OBJDIR)/pivot.h: $(OBJDIR)/headers
1189
+
10871190
$(OBJDIR)/popen_.c: $(SRCDIR)/popen.c $(OBJDIR)/translate
1088
- $(OBJDIR)/translate $(SRCDIR)/popen.c >$(OBJDIR)/popen_.c
1191
+ $(OBJDIR)/translate $(SRCDIR)/popen.c >$@
10891192
10901193
$(OBJDIR)/popen.o: $(OBJDIR)/popen_.c $(OBJDIR)/popen.h $(SRCDIR)/config.h
10911194
$(XTCC) -o $(OBJDIR)/popen.o -c $(OBJDIR)/popen_.c
10921195
10931196
$(OBJDIR)/popen.h: $(OBJDIR)/headers
1197
+
10941198
$(OBJDIR)/pqueue_.c: $(SRCDIR)/pqueue.c $(OBJDIR)/translate
1095
- $(OBJDIR)/translate $(SRCDIR)/pqueue.c >$(OBJDIR)/pqueue_.c
1199
+ $(OBJDIR)/translate $(SRCDIR)/pqueue.c >$@
10961200
10971201
$(OBJDIR)/pqueue.o: $(OBJDIR)/pqueue_.c $(OBJDIR)/pqueue.h $(SRCDIR)/config.h
10981202
$(XTCC) -o $(OBJDIR)/pqueue.o -c $(OBJDIR)/pqueue_.c
10991203
11001204
$(OBJDIR)/pqueue.h: $(OBJDIR)/headers
1205
+
11011206
$(OBJDIR)/printf_.c: $(SRCDIR)/printf.c $(OBJDIR)/translate
1102
- $(OBJDIR)/translate $(SRCDIR)/printf.c >$(OBJDIR)/printf_.c
1207
+ $(OBJDIR)/translate $(SRCDIR)/printf.c >$@
11031208
11041209
$(OBJDIR)/printf.o: $(OBJDIR)/printf_.c $(OBJDIR)/printf.h $(SRCDIR)/config.h
11051210
$(XTCC) -o $(OBJDIR)/printf.o -c $(OBJDIR)/printf_.c
11061211
11071212
$(OBJDIR)/printf.h: $(OBJDIR)/headers
1213
+
1214
+$(OBJDIR)/publish_.c: $(SRCDIR)/publish.c $(OBJDIR)/translate
1215
+ $(OBJDIR)/translate $(SRCDIR)/publish.c >$@
1216
+
1217
+$(OBJDIR)/publish.o: $(OBJDIR)/publish_.c $(OBJDIR)/publish.h $(SRCDIR)/config.h
1218
+ $(XTCC) -o $(OBJDIR)/publish.o -c $(OBJDIR)/publish_.c
1219
+
1220
+$(OBJDIR)/publish.h: $(OBJDIR)/headers
1221
+
1222
+$(OBJDIR)/purge_.c: $(SRCDIR)/purge.c $(OBJDIR)/translate
1223
+ $(OBJDIR)/translate $(SRCDIR)/purge.c >$@
1224
+
1225
+$(OBJDIR)/purge.o: $(OBJDIR)/purge_.c $(OBJDIR)/purge.h $(SRCDIR)/config.h
1226
+ $(XTCC) -o $(OBJDIR)/purge.o -c $(OBJDIR)/purge_.c
1227
+
1228
+$(OBJDIR)/purge.h: $(OBJDIR)/headers
1229
+
11081230
$(OBJDIR)/rebuild_.c: $(SRCDIR)/rebuild.c $(OBJDIR)/translate
1109
- $(OBJDIR)/translate $(SRCDIR)/rebuild.c >$(OBJDIR)/rebuild_.c
1231
+ $(OBJDIR)/translate $(SRCDIR)/rebuild.c >$@
11101232
11111233
$(OBJDIR)/rebuild.o: $(OBJDIR)/rebuild_.c $(OBJDIR)/rebuild.h $(SRCDIR)/config.h
11121234
$(XTCC) -o $(OBJDIR)/rebuild.o -c $(OBJDIR)/rebuild_.c
11131235
11141236
$(OBJDIR)/rebuild.h: $(OBJDIR)/headers
1237
+
11151238
$(OBJDIR)/regexp_.c: $(SRCDIR)/regexp.c $(OBJDIR)/translate
1116
- $(OBJDIR)/translate $(SRCDIR)/regexp.c >$(OBJDIR)/regexp_.c
1239
+ $(OBJDIR)/translate $(SRCDIR)/regexp.c >$@
11171240
11181241
$(OBJDIR)/regexp.o: $(OBJDIR)/regexp_.c $(OBJDIR)/regexp.h $(SRCDIR)/config.h
11191242
$(XTCC) -o $(OBJDIR)/regexp.o -c $(OBJDIR)/regexp_.c
11201243
11211244
$(OBJDIR)/regexp.h: $(OBJDIR)/headers
1245
+
11221246
$(OBJDIR)/report_.c: $(SRCDIR)/report.c $(OBJDIR)/translate
1123
- $(OBJDIR)/translate $(SRCDIR)/report.c >$(OBJDIR)/report_.c
1247
+ $(OBJDIR)/translate $(SRCDIR)/report.c >$@
11241248
11251249
$(OBJDIR)/report.o: $(OBJDIR)/report_.c $(OBJDIR)/report.h $(SRCDIR)/config.h
11261250
$(XTCC) -o $(OBJDIR)/report.o -c $(OBJDIR)/report_.c
11271251
11281252
$(OBJDIR)/report.h: $(OBJDIR)/headers
1253
+
11291254
$(OBJDIR)/rss_.c: $(SRCDIR)/rss.c $(OBJDIR)/translate
1130
- $(OBJDIR)/translate $(SRCDIR)/rss.c >$(OBJDIR)/rss_.c
1255
+ $(OBJDIR)/translate $(SRCDIR)/rss.c >$@
11311256
11321257
$(OBJDIR)/rss.o: $(OBJDIR)/rss_.c $(OBJDIR)/rss.h $(SRCDIR)/config.h
11331258
$(XTCC) -o $(OBJDIR)/rss.o -c $(OBJDIR)/rss_.c
11341259
11351260
$(OBJDIR)/rss.h: $(OBJDIR)/headers
1261
+
11361262
$(OBJDIR)/schema_.c: $(SRCDIR)/schema.c $(OBJDIR)/translate
1137
- $(OBJDIR)/translate $(SRCDIR)/schema.c >$(OBJDIR)/schema_.c
1263
+ $(OBJDIR)/translate $(SRCDIR)/schema.c >$@
11381264
11391265
$(OBJDIR)/schema.o: $(OBJDIR)/schema_.c $(OBJDIR)/schema.h $(SRCDIR)/config.h
11401266
$(XTCC) -o $(OBJDIR)/schema.o -c $(OBJDIR)/schema_.c
11411267
11421268
$(OBJDIR)/schema.h: $(OBJDIR)/headers
1269
+
11431270
$(OBJDIR)/search_.c: $(SRCDIR)/search.c $(OBJDIR)/translate
1144
- $(OBJDIR)/translate $(SRCDIR)/search.c >$(OBJDIR)/search_.c
1271
+ $(OBJDIR)/translate $(SRCDIR)/search.c >$@
11451272
11461273
$(OBJDIR)/search.o: $(OBJDIR)/search_.c $(OBJDIR)/search.h $(SRCDIR)/config.h
11471274
$(XTCC) -o $(OBJDIR)/search.o -c $(OBJDIR)/search_.c
11481275
11491276
$(OBJDIR)/search.h: $(OBJDIR)/headers
1277
+
11501278
$(OBJDIR)/setup_.c: $(SRCDIR)/setup.c $(OBJDIR)/translate
1151
- $(OBJDIR)/translate $(SRCDIR)/setup.c >$(OBJDIR)/setup_.c
1279
+ $(OBJDIR)/translate $(SRCDIR)/setup.c >$@
11521280
11531281
$(OBJDIR)/setup.o: $(OBJDIR)/setup_.c $(OBJDIR)/setup.h $(SRCDIR)/config.h
11541282
$(XTCC) -o $(OBJDIR)/setup.o -c $(OBJDIR)/setup_.c
11551283
11561284
$(OBJDIR)/setup.h: $(OBJDIR)/headers
1285
+
11571286
$(OBJDIR)/sha1_.c: $(SRCDIR)/sha1.c $(OBJDIR)/translate
1158
- $(OBJDIR)/translate $(SRCDIR)/sha1.c >$(OBJDIR)/sha1_.c
1287
+ $(OBJDIR)/translate $(SRCDIR)/sha1.c >$@
11591288
11601289
$(OBJDIR)/sha1.o: $(OBJDIR)/sha1_.c $(OBJDIR)/sha1.h $(SRCDIR)/config.h
11611290
$(XTCC) -o $(OBJDIR)/sha1.o -c $(OBJDIR)/sha1_.c
11621291
11631292
$(OBJDIR)/sha1.h: $(OBJDIR)/headers
1293
+
11641294
$(OBJDIR)/shun_.c: $(SRCDIR)/shun.c $(OBJDIR)/translate
1165
- $(OBJDIR)/translate $(SRCDIR)/shun.c >$(OBJDIR)/shun_.c
1295
+ $(OBJDIR)/translate $(SRCDIR)/shun.c >$@
11661296
11671297
$(OBJDIR)/shun.o: $(OBJDIR)/shun_.c $(OBJDIR)/shun.h $(SRCDIR)/config.h
11681298
$(XTCC) -o $(OBJDIR)/shun.o -c $(OBJDIR)/shun_.c
11691299
11701300
$(OBJDIR)/shun.h: $(OBJDIR)/headers
1301
+
11711302
$(OBJDIR)/skins_.c: $(SRCDIR)/skins.c $(OBJDIR)/translate
1172
- $(OBJDIR)/translate $(SRCDIR)/skins.c >$(OBJDIR)/skins_.c
1303
+ $(OBJDIR)/translate $(SRCDIR)/skins.c >$@
11731304
11741305
$(OBJDIR)/skins.o: $(OBJDIR)/skins_.c $(OBJDIR)/skins.h $(SRCDIR)/config.h
11751306
$(XTCC) -o $(OBJDIR)/skins.o -c $(OBJDIR)/skins_.c
11761307
11771308
$(OBJDIR)/skins.h: $(OBJDIR)/headers
1309
+
11781310
$(OBJDIR)/sqlcmd_.c: $(SRCDIR)/sqlcmd.c $(OBJDIR)/translate
1179
- $(OBJDIR)/translate $(SRCDIR)/sqlcmd.c >$(OBJDIR)/sqlcmd_.c
1311
+ $(OBJDIR)/translate $(SRCDIR)/sqlcmd.c >$@
11801312
11811313
$(OBJDIR)/sqlcmd.o: $(OBJDIR)/sqlcmd_.c $(OBJDIR)/sqlcmd.h $(SRCDIR)/config.h
11821314
$(XTCC) -o $(OBJDIR)/sqlcmd.o -c $(OBJDIR)/sqlcmd_.c
11831315
11841316
$(OBJDIR)/sqlcmd.h: $(OBJDIR)/headers
1317
+
11851318
$(OBJDIR)/stash_.c: $(SRCDIR)/stash.c $(OBJDIR)/translate
1186
- $(OBJDIR)/translate $(SRCDIR)/stash.c >$(OBJDIR)/stash_.c
1319
+ $(OBJDIR)/translate $(SRCDIR)/stash.c >$@
11871320
11881321
$(OBJDIR)/stash.o: $(OBJDIR)/stash_.c $(OBJDIR)/stash.h $(SRCDIR)/config.h
11891322
$(XTCC) -o $(OBJDIR)/stash.o -c $(OBJDIR)/stash_.c
11901323
11911324
$(OBJDIR)/stash.h: $(OBJDIR)/headers
1325
+
11921326
$(OBJDIR)/stat_.c: $(SRCDIR)/stat.c $(OBJDIR)/translate
1193
- $(OBJDIR)/translate $(SRCDIR)/stat.c >$(OBJDIR)/stat_.c
1327
+ $(OBJDIR)/translate $(SRCDIR)/stat.c >$@
11941328
11951329
$(OBJDIR)/stat.o: $(OBJDIR)/stat_.c $(OBJDIR)/stat.h $(SRCDIR)/config.h
11961330
$(XTCC) -o $(OBJDIR)/stat.o -c $(OBJDIR)/stat_.c
11971331
11981332
$(OBJDIR)/stat.h: $(OBJDIR)/headers
1333
+
11991334
$(OBJDIR)/style_.c: $(SRCDIR)/style.c $(OBJDIR)/translate
1200
- $(OBJDIR)/translate $(SRCDIR)/style.c >$(OBJDIR)/style_.c
1335
+ $(OBJDIR)/translate $(SRCDIR)/style.c >$@
12011336
12021337
$(OBJDIR)/style.o: $(OBJDIR)/style_.c $(OBJDIR)/style.h $(SRCDIR)/config.h
12031338
$(XTCC) -o $(OBJDIR)/style.o -c $(OBJDIR)/style_.c
12041339
12051340
$(OBJDIR)/style.h: $(OBJDIR)/headers
1341
+
12061342
$(OBJDIR)/sync_.c: $(SRCDIR)/sync.c $(OBJDIR)/translate
1207
- $(OBJDIR)/translate $(SRCDIR)/sync.c >$(OBJDIR)/sync_.c
1343
+ $(OBJDIR)/translate $(SRCDIR)/sync.c >$@
12081344
12091345
$(OBJDIR)/sync.o: $(OBJDIR)/sync_.c $(OBJDIR)/sync.h $(SRCDIR)/config.h
12101346
$(XTCC) -o $(OBJDIR)/sync.o -c $(OBJDIR)/sync_.c
12111347
12121348
$(OBJDIR)/sync.h: $(OBJDIR)/headers
1349
+
12131350
$(OBJDIR)/tag_.c: $(SRCDIR)/tag.c $(OBJDIR)/translate
1214
- $(OBJDIR)/translate $(SRCDIR)/tag.c >$(OBJDIR)/tag_.c
1351
+ $(OBJDIR)/translate $(SRCDIR)/tag.c >$@
12151352
12161353
$(OBJDIR)/tag.o: $(OBJDIR)/tag_.c $(OBJDIR)/tag.h $(SRCDIR)/config.h
12171354
$(XTCC) -o $(OBJDIR)/tag.o -c $(OBJDIR)/tag_.c
12181355
12191356
$(OBJDIR)/tag.h: $(OBJDIR)/headers
1357
+
12201358
$(OBJDIR)/tar_.c: $(SRCDIR)/tar.c $(OBJDIR)/translate
1221
- $(OBJDIR)/translate $(SRCDIR)/tar.c >$(OBJDIR)/tar_.c
1359
+ $(OBJDIR)/translate $(SRCDIR)/tar.c >$@
12221360
12231361
$(OBJDIR)/tar.o: $(OBJDIR)/tar_.c $(OBJDIR)/tar.h $(SRCDIR)/config.h
12241362
$(XTCC) -o $(OBJDIR)/tar.o -c $(OBJDIR)/tar_.c
12251363
12261364
$(OBJDIR)/tar.h: $(OBJDIR)/headers
1365
+
12271366
$(OBJDIR)/th_main_.c: $(SRCDIR)/th_main.c $(OBJDIR)/translate
1228
- $(OBJDIR)/translate $(SRCDIR)/th_main.c >$(OBJDIR)/th_main_.c
1367
+ $(OBJDIR)/translate $(SRCDIR)/th_main.c >$@
12291368
12301369
$(OBJDIR)/th_main.o: $(OBJDIR)/th_main_.c $(OBJDIR)/th_main.h $(SRCDIR)/config.h
12311370
$(XTCC) -o $(OBJDIR)/th_main.o -c $(OBJDIR)/th_main_.c
12321371
12331372
$(OBJDIR)/th_main.h: $(OBJDIR)/headers
1373
+
12341374
$(OBJDIR)/timeline_.c: $(SRCDIR)/timeline.c $(OBJDIR)/translate
1235
- $(OBJDIR)/translate $(SRCDIR)/timeline.c >$(OBJDIR)/timeline_.c
1375
+ $(OBJDIR)/translate $(SRCDIR)/timeline.c >$@
12361376
12371377
$(OBJDIR)/timeline.o: $(OBJDIR)/timeline_.c $(OBJDIR)/timeline.h $(SRCDIR)/config.h
12381378
$(XTCC) -o $(OBJDIR)/timeline.o -c $(OBJDIR)/timeline_.c
12391379
12401380
$(OBJDIR)/timeline.h: $(OBJDIR)/headers
1381
+
12411382
$(OBJDIR)/tkt_.c: $(SRCDIR)/tkt.c $(OBJDIR)/translate
1242
- $(OBJDIR)/translate $(SRCDIR)/tkt.c >$(OBJDIR)/tkt_.c
1383
+ $(OBJDIR)/translate $(SRCDIR)/tkt.c >$@
12431384
12441385
$(OBJDIR)/tkt.o: $(OBJDIR)/tkt_.c $(OBJDIR)/tkt.h $(SRCDIR)/config.h
12451386
$(XTCC) -o $(OBJDIR)/tkt.o -c $(OBJDIR)/tkt_.c
12461387
12471388
$(OBJDIR)/tkt.h: $(OBJDIR)/headers
1389
+
12481390
$(OBJDIR)/tktsetup_.c: $(SRCDIR)/tktsetup.c $(OBJDIR)/translate
1249
- $(OBJDIR)/translate $(SRCDIR)/tktsetup.c >$(OBJDIR)/tktsetup_.c
1391
+ $(OBJDIR)/translate $(SRCDIR)/tktsetup.c >$@
12501392
12511393
$(OBJDIR)/tktsetup.o: $(OBJDIR)/tktsetup_.c $(OBJDIR)/tktsetup.h $(SRCDIR)/config.h
12521394
$(XTCC) -o $(OBJDIR)/tktsetup.o -c $(OBJDIR)/tktsetup_.c
12531395
12541396
$(OBJDIR)/tktsetup.h: $(OBJDIR)/headers
1397
+
12551398
$(OBJDIR)/undo_.c: $(SRCDIR)/undo.c $(OBJDIR)/translate
1256
- $(OBJDIR)/translate $(SRCDIR)/undo.c >$(OBJDIR)/undo_.c
1399
+ $(OBJDIR)/translate $(SRCDIR)/undo.c >$@
12571400
12581401
$(OBJDIR)/undo.o: $(OBJDIR)/undo_.c $(OBJDIR)/undo.h $(SRCDIR)/config.h
12591402
$(XTCC) -o $(OBJDIR)/undo.o -c $(OBJDIR)/undo_.c
12601403
12611404
$(OBJDIR)/undo.h: $(OBJDIR)/headers
1405
+
12621406
$(OBJDIR)/unicode_.c: $(SRCDIR)/unicode.c $(OBJDIR)/translate
1263
- $(OBJDIR)/translate $(SRCDIR)/unicode.c >$(OBJDIR)/unicode_.c
1407
+ $(OBJDIR)/translate $(SRCDIR)/unicode.c >$@
12641408
12651409
$(OBJDIR)/unicode.o: $(OBJDIR)/unicode_.c $(OBJDIR)/unicode.h $(SRCDIR)/config.h
12661410
$(XTCC) -o $(OBJDIR)/unicode.o -c $(OBJDIR)/unicode_.c
12671411
12681412
$(OBJDIR)/unicode.h: $(OBJDIR)/headers
1413
+
12691414
$(OBJDIR)/update_.c: $(SRCDIR)/update.c $(OBJDIR)/translate
1270
- $(OBJDIR)/translate $(SRCDIR)/update.c >$(OBJDIR)/update_.c
1415
+ $(OBJDIR)/translate $(SRCDIR)/update.c >$@
12711416
12721417
$(OBJDIR)/update.o: $(OBJDIR)/update_.c $(OBJDIR)/update.h $(SRCDIR)/config.h
12731418
$(XTCC) -o $(OBJDIR)/update.o -c $(OBJDIR)/update_.c
12741419
12751420
$(OBJDIR)/update.h: $(OBJDIR)/headers
1421
+
12761422
$(OBJDIR)/url_.c: $(SRCDIR)/url.c $(OBJDIR)/translate
1277
- $(OBJDIR)/translate $(SRCDIR)/url.c >$(OBJDIR)/url_.c
1423
+ $(OBJDIR)/translate $(SRCDIR)/url.c >$@
12781424
12791425
$(OBJDIR)/url.o: $(OBJDIR)/url_.c $(OBJDIR)/url.h $(SRCDIR)/config.h
12801426
$(XTCC) -o $(OBJDIR)/url.o -c $(OBJDIR)/url_.c
12811427
12821428
$(OBJDIR)/url.h: $(OBJDIR)/headers
1429
+
12831430
$(OBJDIR)/user_.c: $(SRCDIR)/user.c $(OBJDIR)/translate
1284
- $(OBJDIR)/translate $(SRCDIR)/user.c >$(OBJDIR)/user_.c
1431
+ $(OBJDIR)/translate $(SRCDIR)/user.c >$@
12851432
12861433
$(OBJDIR)/user.o: $(OBJDIR)/user_.c $(OBJDIR)/user.h $(SRCDIR)/config.h
12871434
$(XTCC) -o $(OBJDIR)/user.o -c $(OBJDIR)/user_.c
12881435
12891436
$(OBJDIR)/user.h: $(OBJDIR)/headers
1437
+
12901438
$(OBJDIR)/utf8_.c: $(SRCDIR)/utf8.c $(OBJDIR)/translate
1291
- $(OBJDIR)/translate $(SRCDIR)/utf8.c >$(OBJDIR)/utf8_.c
1439
+ $(OBJDIR)/translate $(SRCDIR)/utf8.c >$@
12921440
12931441
$(OBJDIR)/utf8.o: $(OBJDIR)/utf8_.c $(OBJDIR)/utf8.h $(SRCDIR)/config.h
12941442
$(XTCC) -o $(OBJDIR)/utf8.o -c $(OBJDIR)/utf8_.c
12951443
12961444
$(OBJDIR)/utf8.h: $(OBJDIR)/headers
1445
+
12971446
$(OBJDIR)/util_.c: $(SRCDIR)/util.c $(OBJDIR)/translate
1298
- $(OBJDIR)/translate $(SRCDIR)/util.c >$(OBJDIR)/util_.c
1447
+ $(OBJDIR)/translate $(SRCDIR)/util.c >$@
12991448
13001449
$(OBJDIR)/util.o: $(OBJDIR)/util_.c $(OBJDIR)/util.h $(SRCDIR)/config.h
13011450
$(XTCC) -o $(OBJDIR)/util.o -c $(OBJDIR)/util_.c
13021451
13031452
$(OBJDIR)/util.h: $(OBJDIR)/headers
1453
+
13041454
$(OBJDIR)/verify_.c: $(SRCDIR)/verify.c $(OBJDIR)/translate
1305
- $(OBJDIR)/translate $(SRCDIR)/verify.c >$(OBJDIR)/verify_.c
1455
+ $(OBJDIR)/translate $(SRCDIR)/verify.c >$@
13061456
13071457
$(OBJDIR)/verify.o: $(OBJDIR)/verify_.c $(OBJDIR)/verify.h $(SRCDIR)/config.h
13081458
$(XTCC) -o $(OBJDIR)/verify.o -c $(OBJDIR)/verify_.c
13091459
13101460
$(OBJDIR)/verify.h: $(OBJDIR)/headers
1461
+
13111462
$(OBJDIR)/vfile_.c: $(SRCDIR)/vfile.c $(OBJDIR)/translate
1312
- $(OBJDIR)/translate $(SRCDIR)/vfile.c >$(OBJDIR)/vfile_.c
1463
+ $(OBJDIR)/translate $(SRCDIR)/vfile.c >$@
13131464
13141465
$(OBJDIR)/vfile.o: $(OBJDIR)/vfile_.c $(OBJDIR)/vfile.h $(SRCDIR)/config.h
13151466
$(XTCC) -o $(OBJDIR)/vfile.o -c $(OBJDIR)/vfile_.c
13161467
13171468
$(OBJDIR)/vfile.h: $(OBJDIR)/headers
1469
+
13181470
$(OBJDIR)/wiki_.c: $(SRCDIR)/wiki.c $(OBJDIR)/translate
1319
- $(OBJDIR)/translate $(SRCDIR)/wiki.c >$(OBJDIR)/wiki_.c
1471
+ $(OBJDIR)/translate $(SRCDIR)/wiki.c >$@
13201472
13211473
$(OBJDIR)/wiki.o: $(OBJDIR)/wiki_.c $(OBJDIR)/wiki.h $(SRCDIR)/config.h
13221474
$(XTCC) -o $(OBJDIR)/wiki.o -c $(OBJDIR)/wiki_.c
13231475
13241476
$(OBJDIR)/wiki.h: $(OBJDIR)/headers
1477
+
13251478
$(OBJDIR)/wikiformat_.c: $(SRCDIR)/wikiformat.c $(OBJDIR)/translate
1326
- $(OBJDIR)/translate $(SRCDIR)/wikiformat.c >$(OBJDIR)/wikiformat_.c
1479
+ $(OBJDIR)/translate $(SRCDIR)/wikiformat.c >$@
13271480
13281481
$(OBJDIR)/wikiformat.o: $(OBJDIR)/wikiformat_.c $(OBJDIR)/wikiformat.h $(SRCDIR)/config.h
13291482
$(XTCC) -o $(OBJDIR)/wikiformat.o -c $(OBJDIR)/wikiformat_.c
13301483
13311484
$(OBJDIR)/wikiformat.h: $(OBJDIR)/headers
1485
+
13321486
$(OBJDIR)/winfile_.c: $(SRCDIR)/winfile.c $(OBJDIR)/translate
1333
- $(OBJDIR)/translate $(SRCDIR)/winfile.c >$(OBJDIR)/winfile_.c
1487
+ $(OBJDIR)/translate $(SRCDIR)/winfile.c >$@
13341488
13351489
$(OBJDIR)/winfile.o: $(OBJDIR)/winfile_.c $(OBJDIR)/winfile.h $(SRCDIR)/config.h
13361490
$(XTCC) -o $(OBJDIR)/winfile.o -c $(OBJDIR)/winfile_.c
13371491
13381492
$(OBJDIR)/winfile.h: $(OBJDIR)/headers
1493
+
13391494
$(OBJDIR)/winhttp_.c: $(SRCDIR)/winhttp.c $(OBJDIR)/translate
1340
- $(OBJDIR)/translate $(SRCDIR)/winhttp.c >$(OBJDIR)/winhttp_.c
1495
+ $(OBJDIR)/translate $(SRCDIR)/winhttp.c >$@
13411496
13421497
$(OBJDIR)/winhttp.o: $(OBJDIR)/winhttp_.c $(OBJDIR)/winhttp.h $(SRCDIR)/config.h
13431498
$(XTCC) -o $(OBJDIR)/winhttp.o -c $(OBJDIR)/winhttp_.c
13441499
13451500
$(OBJDIR)/winhttp.h: $(OBJDIR)/headers
1501
+
13461502
$(OBJDIR)/wysiwyg_.c: $(SRCDIR)/wysiwyg.c $(OBJDIR)/translate
1347
- $(OBJDIR)/translate $(SRCDIR)/wysiwyg.c >$(OBJDIR)/wysiwyg_.c
1503
+ $(OBJDIR)/translate $(SRCDIR)/wysiwyg.c >$@
13481504
13491505
$(OBJDIR)/wysiwyg.o: $(OBJDIR)/wysiwyg_.c $(OBJDIR)/wysiwyg.h $(SRCDIR)/config.h
13501506
$(XTCC) -o $(OBJDIR)/wysiwyg.o -c $(OBJDIR)/wysiwyg_.c
13511507
13521508
$(OBJDIR)/wysiwyg.h: $(OBJDIR)/headers
1509
+
13531510
$(OBJDIR)/xfer_.c: $(SRCDIR)/xfer.c $(OBJDIR)/translate
1354
- $(OBJDIR)/translate $(SRCDIR)/xfer.c >$(OBJDIR)/xfer_.c
1511
+ $(OBJDIR)/translate $(SRCDIR)/xfer.c >$@
13551512
13561513
$(OBJDIR)/xfer.o: $(OBJDIR)/xfer_.c $(OBJDIR)/xfer.h $(SRCDIR)/config.h
13571514
$(XTCC) -o $(OBJDIR)/xfer.o -c $(OBJDIR)/xfer_.c
13581515
13591516
$(OBJDIR)/xfer.h: $(OBJDIR)/headers
1517
+
13601518
$(OBJDIR)/xfersetup_.c: $(SRCDIR)/xfersetup.c $(OBJDIR)/translate
1361
- $(OBJDIR)/translate $(SRCDIR)/xfersetup.c >$(OBJDIR)/xfersetup_.c
1519
+ $(OBJDIR)/translate $(SRCDIR)/xfersetup.c >$@
13621520
13631521
$(OBJDIR)/xfersetup.o: $(OBJDIR)/xfersetup_.c $(OBJDIR)/xfersetup.h $(SRCDIR)/config.h
13641522
$(XTCC) -o $(OBJDIR)/xfersetup.o -c $(OBJDIR)/xfersetup_.c
13651523
13661524
$(OBJDIR)/xfersetup.h: $(OBJDIR)/headers
1525
+
13671526
$(OBJDIR)/zip_.c: $(SRCDIR)/zip.c $(OBJDIR)/translate
1368
- $(OBJDIR)/translate $(SRCDIR)/zip.c >$(OBJDIR)/zip_.c
1527
+ $(OBJDIR)/translate $(SRCDIR)/zip.c >$@
13691528
13701529
$(OBJDIR)/zip.o: $(OBJDIR)/zip_.c $(OBJDIR)/zip.h $(SRCDIR)/config.h
13711530
$(XTCC) -o $(OBJDIR)/zip.o -c $(OBJDIR)/zip_.c
13721531
13731532
$(OBJDIR)/zip.h: $(OBJDIR)/headers
1533
+
13741534
$(OBJDIR)/sqlite3.o: $(SRCDIR)/sqlite3.c
1375
- $(XTCC) $(SQLITE_OPTIONS) $(SQLITE_CFLAGS) -c $(SRCDIR)/sqlite3.c -o $(OBJDIR)/sqlite3.o
1535
+ $(XTCC) $(SQLITE_OPTIONS) $(SQLITE_CFLAGS) -c $(SRCDIR)/sqlite3.c -o $@
13761536
13771537
$(OBJDIR)/shell.o: $(SRCDIR)/shell.c $(SRCDIR)/sqlite3.h
1378
- $(XTCC) $(SHELL_OPTIONS) $(SHELL_CFLAGS) -c $(SRCDIR)/shell.c -o $(OBJDIR)/shell.o
1538
+ $(XTCC) $(SHELL_OPTIONS) $(SHELL_CFLAGS) -c $(SRCDIR)/shell.c -o $@
13791539
13801540
$(OBJDIR)/th.o: $(SRCDIR)/th.c
1381
- $(XTCC) -c $(SRCDIR)/th.c -o $(OBJDIR)/th.o
1541
+ $(XTCC) -c $(SRCDIR)/th.c -o $@
13821542
13831543
$(OBJDIR)/th_lang.o: $(SRCDIR)/th_lang.c
1384
- $(XTCC) -c $(SRCDIR)/th_lang.c -o $(OBJDIR)/th_lang.o
1544
+ $(XTCC) -c $(SRCDIR)/th_lang.c -o $@
13851545
13861546
$(OBJDIR)/th_tcl.o: $(SRCDIR)/th_tcl.c
1387
- $(XTCC) -c $(SRCDIR)/th_tcl.c -o $(OBJDIR)/th_tcl.o
1547
+ $(XTCC) -c $(SRCDIR)/th_tcl.c -o $@
13881548
13891549
13901550
$(OBJDIR)/miniz.o: $(SRCDIR)/miniz.c
1391
- $(XTCC) $(MINIZ_OPTIONS) -c $(SRCDIR)/miniz.c -o $(OBJDIR)/miniz.o
1551
+ $(XTCC) $(MINIZ_OPTIONS) -c $(SRCDIR)/miniz.c -o $@
13921552
13931553
$(OBJDIR)/cson_amalgamation.o: $(SRCDIR)/cson_amalgamation.c
1394
- $(XTCC) -c $(SRCDIR)/cson_amalgamation.c -o $(OBJDIR)/cson_amalgamation.o
1554
+ $(XTCC) -c $(SRCDIR)/cson_amalgamation.c -o $@
13951555
13961556
#
13971557
# The list of all the targets that do not correspond to real files. This stops
13981558
# 'make' from getting confused when someone makes an error in a rule.
13991559
#
14001560
14011561
.PHONY: all install test clean
14021562
14031563
--- src/main.mk
+++ src/main.mk
@@ -8,11 +8,11 @@
8 # to regenerate this file.
9 #
10 # This file is included by primary Makefile.
11 #
12
13 XTCC = $(TCC) $(CFLAGS) -I. -I$(SRCDIR) -I$(OBJDIR)
14
15
16 SRC = \
17 $(SRCDIR)/add.c \
18 $(SRCDIR)/allrepo.c \
@@ -21,10 +21,11 @@
21 $(SRCDIR)/bisect.c \
22 $(SRCDIR)/blob.c \
23 $(SRCDIR)/branch.c \
24 $(SRCDIR)/browse.c \
25 $(SRCDIR)/builtin.c \
 
26 $(SRCDIR)/cache.c \
27 $(SRCDIR)/captcha.c \
28 $(SRCDIR)/cgi.c \
29 $(SRCDIR)/checkin.c \
30 $(SRCDIR)/checkout.c \
@@ -43,10 +44,11 @@
43 $(SRCDIR)/encode.c \
44 $(SRCDIR)/event.c \
45 $(SRCDIR)/export.c \
46 $(SRCDIR)/file.c \
47 $(SRCDIR)/finfo.c \
 
48 $(SRCDIR)/fusefs.c \
49 $(SRCDIR)/glob.c \
50 $(SRCDIR)/graph.c \
51 $(SRCDIR)/gzip.c \
52 $(SRCDIR)/http.c \
@@ -86,10 +88,12 @@
86 $(SRCDIR)/path.c \
87 $(SRCDIR)/pivot.c \
88 $(SRCDIR)/popen.c \
89 $(SRCDIR)/pqueue.c \
90 $(SRCDIR)/printf.c \
 
 
91 $(SRCDIR)/rebuild.c \
92 $(SRCDIR)/regexp.c \
93 $(SRCDIR)/report.c \
94 $(SRCDIR)/rss.c \
95 $(SRCDIR)/schema.c \
@@ -138,10 +142,11 @@
138 $(OBJDIR)/bisect_.c \
139 $(OBJDIR)/blob_.c \
140 $(OBJDIR)/branch_.c \
141 $(OBJDIR)/browse_.c \
142 $(OBJDIR)/builtin_.c \
 
143 $(OBJDIR)/cache_.c \
144 $(OBJDIR)/captcha_.c \
145 $(OBJDIR)/cgi_.c \
146 $(OBJDIR)/checkin_.c \
147 $(OBJDIR)/checkout_.c \
@@ -160,10 +165,11 @@
160 $(OBJDIR)/encode_.c \
161 $(OBJDIR)/event_.c \
162 $(OBJDIR)/export_.c \
163 $(OBJDIR)/file_.c \
164 $(OBJDIR)/finfo_.c \
 
165 $(OBJDIR)/fusefs_.c \
166 $(OBJDIR)/glob_.c \
167 $(OBJDIR)/graph_.c \
168 $(OBJDIR)/gzip_.c \
169 $(OBJDIR)/http_.c \
@@ -203,10 +209,12 @@
203 $(OBJDIR)/path_.c \
204 $(OBJDIR)/pivot_.c \
205 $(OBJDIR)/popen_.c \
206 $(OBJDIR)/pqueue_.c \
207 $(OBJDIR)/printf_.c \
 
 
208 $(OBJDIR)/rebuild_.c \
209 $(OBJDIR)/regexp_.c \
210 $(OBJDIR)/report_.c \
211 $(OBJDIR)/rss_.c \
212 $(OBJDIR)/schema_.c \
@@ -252,10 +260,11 @@
252 $(OBJDIR)/bisect.o \
253 $(OBJDIR)/blob.o \
254 $(OBJDIR)/branch.o \
255 $(OBJDIR)/browse.o \
256 $(OBJDIR)/builtin.o \
 
257 $(OBJDIR)/cache.o \
258 $(OBJDIR)/captcha.o \
259 $(OBJDIR)/cgi.o \
260 $(OBJDIR)/checkin.o \
261 $(OBJDIR)/checkout.o \
@@ -274,10 +283,11 @@
274 $(OBJDIR)/encode.o \
275 $(OBJDIR)/event.o \
276 $(OBJDIR)/export.o \
277 $(OBJDIR)/file.o \
278 $(OBJDIR)/finfo.o \
 
279 $(OBJDIR)/fusefs.o \
280 $(OBJDIR)/glob.o \
281 $(OBJDIR)/graph.o \
282 $(OBJDIR)/gzip.o \
283 $(OBJDIR)/http.o \
@@ -317,10 +327,12 @@
317 $(OBJDIR)/path.o \
318 $(OBJDIR)/pivot.o \
319 $(OBJDIR)/popen.o \
320 $(OBJDIR)/pqueue.o \
321 $(OBJDIR)/printf.o \
 
 
322 $(OBJDIR)/rebuild.o \
323 $(OBJDIR)/regexp.o \
324 $(OBJDIR)/report.o \
325 $(OBJDIR)/rss.o \
326 $(OBJDIR)/schema.o \
@@ -475,10 +487,11 @@
475 $(OBJDIR)/bisect_.c:$(OBJDIR)/bisect.h \
476 $(OBJDIR)/blob_.c:$(OBJDIR)/blob.h \
477 $(OBJDIR)/branch_.c:$(OBJDIR)/branch.h \
478 $(OBJDIR)/browse_.c:$(OBJDIR)/browse.h \
479 $(OBJDIR)/builtin_.c:$(OBJDIR)/builtin.h \
 
480 $(OBJDIR)/cache_.c:$(OBJDIR)/cache.h \
481 $(OBJDIR)/captcha_.c:$(OBJDIR)/captcha.h \
482 $(OBJDIR)/cgi_.c:$(OBJDIR)/cgi.h \
483 $(OBJDIR)/checkin_.c:$(OBJDIR)/checkin.h \
484 $(OBJDIR)/checkout_.c:$(OBJDIR)/checkout.h \
@@ -497,10 +510,11 @@
497 $(OBJDIR)/encode_.c:$(OBJDIR)/encode.h \
498 $(OBJDIR)/event_.c:$(OBJDIR)/event.h \
499 $(OBJDIR)/export_.c:$(OBJDIR)/export.h \
500 $(OBJDIR)/file_.c:$(OBJDIR)/file.h \
501 $(OBJDIR)/finfo_.c:$(OBJDIR)/finfo.h \
 
502 $(OBJDIR)/fusefs_.c:$(OBJDIR)/fusefs.h \
503 $(OBJDIR)/glob_.c:$(OBJDIR)/glob.h \
504 $(OBJDIR)/graph_.c:$(OBJDIR)/graph.h \
505 $(OBJDIR)/gzip_.c:$(OBJDIR)/gzip.h \
506 $(OBJDIR)/http_.c:$(OBJDIR)/http.h \
@@ -540,10 +554,12 @@
540 $(OBJDIR)/path_.c:$(OBJDIR)/path.h \
541 $(OBJDIR)/pivot_.c:$(OBJDIR)/pivot.h \
542 $(OBJDIR)/popen_.c:$(OBJDIR)/popen.h \
543 $(OBJDIR)/pqueue_.c:$(OBJDIR)/pqueue.h \
544 $(OBJDIR)/printf_.c:$(OBJDIR)/printf.h \
 
 
545 $(OBJDIR)/rebuild_.c:$(OBJDIR)/rebuild.h \
546 $(OBJDIR)/regexp_.c:$(OBJDIR)/regexp.h \
547 $(OBJDIR)/report_.c:$(OBJDIR)/report.h \
548 $(OBJDIR)/rss_.c:$(OBJDIR)/rss.h \
549 $(OBJDIR)/schema_.c:$(OBJDIR)/schema.h \
@@ -586,817 +602,961 @@
586 touch $(OBJDIR)/headers
587 $(OBJDIR)/headers: Makefile
588 $(OBJDIR)/json.o $(OBJDIR)/json_artifact.o $(OBJDIR)/json_branch.o $(OBJDIR)/json_config.o $(OBJDIR)/json_diff.o $(OBJDIR)/json_dir.o $(OBJDIR)/json_finfo.o $(OBJDIR)/json_login.o $(OBJDIR)/json_query.o $(OBJDIR)/json_report.o $(OBJDIR)/json_status.o $(OBJDIR)/json_tag.o $(OBJDIR)/json_timeline.o $(OBJDIR)/json_user.o $(OBJDIR)/json_wiki.o : $(SRCDIR)/json_detail.h
589 Makefile:
590 $(OBJDIR)/add_.c: $(SRCDIR)/add.c $(OBJDIR)/translate
591 $(OBJDIR)/translate $(SRCDIR)/add.c >$(OBJDIR)/add_.c
592
593 $(OBJDIR)/add.o: $(OBJDIR)/add_.c $(OBJDIR)/add.h $(SRCDIR)/config.h
594 $(XTCC) -o $(OBJDIR)/add.o -c $(OBJDIR)/add_.c
595
596 $(OBJDIR)/add.h: $(OBJDIR)/headers
 
597 $(OBJDIR)/allrepo_.c: $(SRCDIR)/allrepo.c $(OBJDIR)/translate
598 $(OBJDIR)/translate $(SRCDIR)/allrepo.c >$(OBJDIR)/allrepo_.c
599
600 $(OBJDIR)/allrepo.o: $(OBJDIR)/allrepo_.c $(OBJDIR)/allrepo.h $(SRCDIR)/config.h
601 $(XTCC) -o $(OBJDIR)/allrepo.o -c $(OBJDIR)/allrepo_.c
602
603 $(OBJDIR)/allrepo.h: $(OBJDIR)/headers
 
604 $(OBJDIR)/attach_.c: $(SRCDIR)/attach.c $(OBJDIR)/translate
605 $(OBJDIR)/translate $(SRCDIR)/attach.c >$(OBJDIR)/attach_.c
606
607 $(OBJDIR)/attach.o: $(OBJDIR)/attach_.c $(OBJDIR)/attach.h $(SRCDIR)/config.h
608 $(XTCC) -o $(OBJDIR)/attach.o -c $(OBJDIR)/attach_.c
609
610 $(OBJDIR)/attach.h: $(OBJDIR)/headers
 
611 $(OBJDIR)/bag_.c: $(SRCDIR)/bag.c $(OBJDIR)/translate
612 $(OBJDIR)/translate $(SRCDIR)/bag.c >$(OBJDIR)/bag_.c
613
614 $(OBJDIR)/bag.o: $(OBJDIR)/bag_.c $(OBJDIR)/bag.h $(SRCDIR)/config.h
615 $(XTCC) -o $(OBJDIR)/bag.o -c $(OBJDIR)/bag_.c
616
617 $(OBJDIR)/bag.h: $(OBJDIR)/headers
 
618 $(OBJDIR)/bisect_.c: $(SRCDIR)/bisect.c $(OBJDIR)/translate
619 $(OBJDIR)/translate $(SRCDIR)/bisect.c >$(OBJDIR)/bisect_.c
620
621 $(OBJDIR)/bisect.o: $(OBJDIR)/bisect_.c $(OBJDIR)/bisect.h $(SRCDIR)/config.h
622 $(XTCC) -o $(OBJDIR)/bisect.o -c $(OBJDIR)/bisect_.c
623
624 $(OBJDIR)/bisect.h: $(OBJDIR)/headers
 
625 $(OBJDIR)/blob_.c: $(SRCDIR)/blob.c $(OBJDIR)/translate
626 $(OBJDIR)/translate $(SRCDIR)/blob.c >$(OBJDIR)/blob_.c
627
628 $(OBJDIR)/blob.o: $(OBJDIR)/blob_.c $(OBJDIR)/blob.h $(SRCDIR)/config.h
629 $(XTCC) -o $(OBJDIR)/blob.o -c $(OBJDIR)/blob_.c
630
631 $(OBJDIR)/blob.h: $(OBJDIR)/headers
 
632 $(OBJDIR)/branch_.c: $(SRCDIR)/branch.c $(OBJDIR)/translate
633 $(OBJDIR)/translate $(SRCDIR)/branch.c >$(OBJDIR)/branch_.c
634
635 $(OBJDIR)/branch.o: $(OBJDIR)/branch_.c $(OBJDIR)/branch.h $(SRCDIR)/config.h
636 $(XTCC) -o $(OBJDIR)/branch.o -c $(OBJDIR)/branch_.c
637
638 $(OBJDIR)/branch.h: $(OBJDIR)/headers
 
639 $(OBJDIR)/browse_.c: $(SRCDIR)/browse.c $(OBJDIR)/translate
640 $(OBJDIR)/translate $(SRCDIR)/browse.c >$(OBJDIR)/browse_.c
641
642 $(OBJDIR)/browse.o: $(OBJDIR)/browse_.c $(OBJDIR)/browse.h $(SRCDIR)/config.h
643 $(XTCC) -o $(OBJDIR)/browse.o -c $(OBJDIR)/browse_.c
644
645 $(OBJDIR)/browse.h: $(OBJDIR)/headers
 
646 $(OBJDIR)/builtin_.c: $(SRCDIR)/builtin.c $(OBJDIR)/translate
647 $(OBJDIR)/translate $(SRCDIR)/builtin.c >$(OBJDIR)/builtin_.c
648
649 $(OBJDIR)/builtin.o: $(OBJDIR)/builtin_.c $(OBJDIR)/builtin.h $(OBJDIR)/builtin_data.h $(SRCDIR)/config.h
650 $(XTCC) -o $(OBJDIR)/builtin.o -c $(OBJDIR)/builtin_.c
651
652 $(OBJDIR)/builtin.h: $(OBJDIR)/headers
 
 
 
 
 
 
 
 
 
653 $(OBJDIR)/cache_.c: $(SRCDIR)/cache.c $(OBJDIR)/translate
654 $(OBJDIR)/translate $(SRCDIR)/cache.c >$(OBJDIR)/cache_.c
655
656 $(OBJDIR)/cache.o: $(OBJDIR)/cache_.c $(OBJDIR)/cache.h $(SRCDIR)/config.h
657 $(XTCC) -o $(OBJDIR)/cache.o -c $(OBJDIR)/cache_.c
658
659 $(OBJDIR)/cache.h: $(OBJDIR)/headers
 
660 $(OBJDIR)/captcha_.c: $(SRCDIR)/captcha.c $(OBJDIR)/translate
661 $(OBJDIR)/translate $(SRCDIR)/captcha.c >$(OBJDIR)/captcha_.c
662
663 $(OBJDIR)/captcha.o: $(OBJDIR)/captcha_.c $(OBJDIR)/captcha.h $(SRCDIR)/config.h
664 $(XTCC) -o $(OBJDIR)/captcha.o -c $(OBJDIR)/captcha_.c
665
666 $(OBJDIR)/captcha.h: $(OBJDIR)/headers
 
667 $(OBJDIR)/cgi_.c: $(SRCDIR)/cgi.c $(OBJDIR)/translate
668 $(OBJDIR)/translate $(SRCDIR)/cgi.c >$(OBJDIR)/cgi_.c
669
670 $(OBJDIR)/cgi.o: $(OBJDIR)/cgi_.c $(OBJDIR)/cgi.h $(SRCDIR)/config.h
671 $(XTCC) -o $(OBJDIR)/cgi.o -c $(OBJDIR)/cgi_.c
672
673 $(OBJDIR)/cgi.h: $(OBJDIR)/headers
 
674 $(OBJDIR)/checkin_.c: $(SRCDIR)/checkin.c $(OBJDIR)/translate
675 $(OBJDIR)/translate $(SRCDIR)/checkin.c >$(OBJDIR)/checkin_.c
676
677 $(OBJDIR)/checkin.o: $(OBJDIR)/checkin_.c $(OBJDIR)/checkin.h $(SRCDIR)/config.h
678 $(XTCC) -o $(OBJDIR)/checkin.o -c $(OBJDIR)/checkin_.c
679
680 $(OBJDIR)/checkin.h: $(OBJDIR)/headers
 
681 $(OBJDIR)/checkout_.c: $(SRCDIR)/checkout.c $(OBJDIR)/translate
682 $(OBJDIR)/translate $(SRCDIR)/checkout.c >$(OBJDIR)/checkout_.c
683
684 $(OBJDIR)/checkout.o: $(OBJDIR)/checkout_.c $(OBJDIR)/checkout.h $(SRCDIR)/config.h
685 $(XTCC) -o $(OBJDIR)/checkout.o -c $(OBJDIR)/checkout_.c
686
687 $(OBJDIR)/checkout.h: $(OBJDIR)/headers
 
688 $(OBJDIR)/clearsign_.c: $(SRCDIR)/clearsign.c $(OBJDIR)/translate
689 $(OBJDIR)/translate $(SRCDIR)/clearsign.c >$(OBJDIR)/clearsign_.c
690
691 $(OBJDIR)/clearsign.o: $(OBJDIR)/clearsign_.c $(OBJDIR)/clearsign.h $(SRCDIR)/config.h
692 $(XTCC) -o $(OBJDIR)/clearsign.o -c $(OBJDIR)/clearsign_.c
693
694 $(OBJDIR)/clearsign.h: $(OBJDIR)/headers
 
695 $(OBJDIR)/clone_.c: $(SRCDIR)/clone.c $(OBJDIR)/translate
696 $(OBJDIR)/translate $(SRCDIR)/clone.c >$(OBJDIR)/clone_.c
697
698 $(OBJDIR)/clone.o: $(OBJDIR)/clone_.c $(OBJDIR)/clone.h $(SRCDIR)/config.h
699 $(XTCC) -o $(OBJDIR)/clone.o -c $(OBJDIR)/clone_.c
700
701 $(OBJDIR)/clone.h: $(OBJDIR)/headers
 
702 $(OBJDIR)/comformat_.c: $(SRCDIR)/comformat.c $(OBJDIR)/translate
703 $(OBJDIR)/translate $(SRCDIR)/comformat.c >$(OBJDIR)/comformat_.c
704
705 $(OBJDIR)/comformat.o: $(OBJDIR)/comformat_.c $(OBJDIR)/comformat.h $(SRCDIR)/config.h
706 $(XTCC) -o $(OBJDIR)/comformat.o -c $(OBJDIR)/comformat_.c
707
708 $(OBJDIR)/comformat.h: $(OBJDIR)/headers
 
709 $(OBJDIR)/configure_.c: $(SRCDIR)/configure.c $(OBJDIR)/translate
710 $(OBJDIR)/translate $(SRCDIR)/configure.c >$(OBJDIR)/configure_.c
711
712 $(OBJDIR)/configure.o: $(OBJDIR)/configure_.c $(OBJDIR)/configure.h $(SRCDIR)/config.h
713 $(XTCC) -o $(OBJDIR)/configure.o -c $(OBJDIR)/configure_.c
714
715 $(OBJDIR)/configure.h: $(OBJDIR)/headers
 
716 $(OBJDIR)/content_.c: $(SRCDIR)/content.c $(OBJDIR)/translate
717 $(OBJDIR)/translate $(SRCDIR)/content.c >$(OBJDIR)/content_.c
718
719 $(OBJDIR)/content.o: $(OBJDIR)/content_.c $(OBJDIR)/content.h $(SRCDIR)/config.h
720 $(XTCC) -o $(OBJDIR)/content.o -c $(OBJDIR)/content_.c
721
722 $(OBJDIR)/content.h: $(OBJDIR)/headers
 
723 $(OBJDIR)/db_.c: $(SRCDIR)/db.c $(OBJDIR)/translate
724 $(OBJDIR)/translate $(SRCDIR)/db.c >$(OBJDIR)/db_.c
725
726 $(OBJDIR)/db.o: $(OBJDIR)/db_.c $(OBJDIR)/db.h $(SRCDIR)/config.h
727 $(XTCC) -o $(OBJDIR)/db.o -c $(OBJDIR)/db_.c
728
729 $(OBJDIR)/db.h: $(OBJDIR)/headers
 
730 $(OBJDIR)/delta_.c: $(SRCDIR)/delta.c $(OBJDIR)/translate
731 $(OBJDIR)/translate $(SRCDIR)/delta.c >$(OBJDIR)/delta_.c
732
733 $(OBJDIR)/delta.o: $(OBJDIR)/delta_.c $(OBJDIR)/delta.h $(SRCDIR)/config.h
734 $(XTCC) -o $(OBJDIR)/delta.o -c $(OBJDIR)/delta_.c
735
736 $(OBJDIR)/delta.h: $(OBJDIR)/headers
 
737 $(OBJDIR)/deltacmd_.c: $(SRCDIR)/deltacmd.c $(OBJDIR)/translate
738 $(OBJDIR)/translate $(SRCDIR)/deltacmd.c >$(OBJDIR)/deltacmd_.c
739
740 $(OBJDIR)/deltacmd.o: $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h $(SRCDIR)/config.h
741 $(XTCC) -o $(OBJDIR)/deltacmd.o -c $(OBJDIR)/deltacmd_.c
742
743 $(OBJDIR)/deltacmd.h: $(OBJDIR)/headers
 
744 $(OBJDIR)/descendants_.c: $(SRCDIR)/descendants.c $(OBJDIR)/translate
745 $(OBJDIR)/translate $(SRCDIR)/descendants.c >$(OBJDIR)/descendants_.c
746
747 $(OBJDIR)/descendants.o: $(OBJDIR)/descendants_.c $(OBJDIR)/descendants.h $(SRCDIR)/config.h
748 $(XTCC) -o $(OBJDIR)/descendants.o -c $(OBJDIR)/descendants_.c
749
750 $(OBJDIR)/descendants.h: $(OBJDIR)/headers
 
751 $(OBJDIR)/diff_.c: $(SRCDIR)/diff.c $(OBJDIR)/translate
752 $(OBJDIR)/translate $(SRCDIR)/diff.c >$(OBJDIR)/diff_.c
753
754 $(OBJDIR)/diff.o: $(OBJDIR)/diff_.c $(OBJDIR)/diff.h $(SRCDIR)/config.h
755 $(XTCC) -o $(OBJDIR)/diff.o -c $(OBJDIR)/diff_.c
756
757 $(OBJDIR)/diff.h: $(OBJDIR)/headers
 
758 $(OBJDIR)/diffcmd_.c: $(SRCDIR)/diffcmd.c $(OBJDIR)/translate
759 $(OBJDIR)/translate $(SRCDIR)/diffcmd.c >$(OBJDIR)/diffcmd_.c
760
761 $(OBJDIR)/diffcmd.o: $(OBJDIR)/diffcmd_.c $(OBJDIR)/diffcmd.h $(SRCDIR)/config.h
762 $(XTCC) -o $(OBJDIR)/diffcmd.o -c $(OBJDIR)/diffcmd_.c
763
764 $(OBJDIR)/diffcmd.h: $(OBJDIR)/headers
 
765 $(OBJDIR)/doc_.c: $(SRCDIR)/doc.c $(OBJDIR)/translate
766 $(OBJDIR)/translate $(SRCDIR)/doc.c >$(OBJDIR)/doc_.c
767
768 $(OBJDIR)/doc.o: $(OBJDIR)/doc_.c $(OBJDIR)/doc.h $(SRCDIR)/config.h
769 $(XTCC) -o $(OBJDIR)/doc.o -c $(OBJDIR)/doc_.c
770
771 $(OBJDIR)/doc.h: $(OBJDIR)/headers
 
772 $(OBJDIR)/encode_.c: $(SRCDIR)/encode.c $(OBJDIR)/translate
773 $(OBJDIR)/translate $(SRCDIR)/encode.c >$(OBJDIR)/encode_.c
774
775 $(OBJDIR)/encode.o: $(OBJDIR)/encode_.c $(OBJDIR)/encode.h $(SRCDIR)/config.h
776 $(XTCC) -o $(OBJDIR)/encode.o -c $(OBJDIR)/encode_.c
777
778 $(OBJDIR)/encode.h: $(OBJDIR)/headers
 
779 $(OBJDIR)/event_.c: $(SRCDIR)/event.c $(OBJDIR)/translate
780 $(OBJDIR)/translate $(SRCDIR)/event.c >$(OBJDIR)/event_.c
781
782 $(OBJDIR)/event.o: $(OBJDIR)/event_.c $(OBJDIR)/event.h $(SRCDIR)/config.h
783 $(XTCC) -o $(OBJDIR)/event.o -c $(OBJDIR)/event_.c
784
785 $(OBJDIR)/event.h: $(OBJDIR)/headers
 
786 $(OBJDIR)/export_.c: $(SRCDIR)/export.c $(OBJDIR)/translate
787 $(OBJDIR)/translate $(SRCDIR)/export.c >$(OBJDIR)/export_.c
788
789 $(OBJDIR)/export.o: $(OBJDIR)/export_.c $(OBJDIR)/export.h $(SRCDIR)/config.h
790 $(XTCC) -o $(OBJDIR)/export.o -c $(OBJDIR)/export_.c
791
792 $(OBJDIR)/export.h: $(OBJDIR)/headers
 
793 $(OBJDIR)/file_.c: $(SRCDIR)/file.c $(OBJDIR)/translate
794 $(OBJDIR)/translate $(SRCDIR)/file.c >$(OBJDIR)/file_.c
795
796 $(OBJDIR)/file.o: $(OBJDIR)/file_.c $(OBJDIR)/file.h $(SRCDIR)/config.h
797 $(XTCC) -o $(OBJDIR)/file.o -c $(OBJDIR)/file_.c
798
799 $(OBJDIR)/file.h: $(OBJDIR)/headers
 
800 $(OBJDIR)/finfo_.c: $(SRCDIR)/finfo.c $(OBJDIR)/translate
801 $(OBJDIR)/translate $(SRCDIR)/finfo.c >$(OBJDIR)/finfo_.c
802
803 $(OBJDIR)/finfo.o: $(OBJDIR)/finfo_.c $(OBJDIR)/finfo.h $(SRCDIR)/config.h
804 $(XTCC) -o $(OBJDIR)/finfo.o -c $(OBJDIR)/finfo_.c
805
806 $(OBJDIR)/finfo.h: $(OBJDIR)/headers
 
 
 
 
 
 
 
 
 
807 $(OBJDIR)/fusefs_.c: $(SRCDIR)/fusefs.c $(OBJDIR)/translate
808 $(OBJDIR)/translate $(SRCDIR)/fusefs.c >$(OBJDIR)/fusefs_.c
809
810 $(OBJDIR)/fusefs.o: $(OBJDIR)/fusefs_.c $(OBJDIR)/fusefs.h $(SRCDIR)/config.h
811 $(XTCC) -o $(OBJDIR)/fusefs.o -c $(OBJDIR)/fusefs_.c
812
813 $(OBJDIR)/fusefs.h: $(OBJDIR)/headers
 
814 $(OBJDIR)/glob_.c: $(SRCDIR)/glob.c $(OBJDIR)/translate
815 $(OBJDIR)/translate $(SRCDIR)/glob.c >$(OBJDIR)/glob_.c
816
817 $(OBJDIR)/glob.o: $(OBJDIR)/glob_.c $(OBJDIR)/glob.h $(SRCDIR)/config.h
818 $(XTCC) -o $(OBJDIR)/glob.o -c $(OBJDIR)/glob_.c
819
820 $(OBJDIR)/glob.h: $(OBJDIR)/headers
 
821 $(OBJDIR)/graph_.c: $(SRCDIR)/graph.c $(OBJDIR)/translate
822 $(OBJDIR)/translate $(SRCDIR)/graph.c >$(OBJDIR)/graph_.c
823
824 $(OBJDIR)/graph.o: $(OBJDIR)/graph_.c $(OBJDIR)/graph.h $(SRCDIR)/config.h
825 $(XTCC) -o $(OBJDIR)/graph.o -c $(OBJDIR)/graph_.c
826
827 $(OBJDIR)/graph.h: $(OBJDIR)/headers
 
828 $(OBJDIR)/gzip_.c: $(SRCDIR)/gzip.c $(OBJDIR)/translate
829 $(OBJDIR)/translate $(SRCDIR)/gzip.c >$(OBJDIR)/gzip_.c
830
831 $(OBJDIR)/gzip.o: $(OBJDIR)/gzip_.c $(OBJDIR)/gzip.h $(SRCDIR)/config.h
832 $(XTCC) -o $(OBJDIR)/gzip.o -c $(OBJDIR)/gzip_.c
833
834 $(OBJDIR)/gzip.h: $(OBJDIR)/headers
 
835 $(OBJDIR)/http_.c: $(SRCDIR)/http.c $(OBJDIR)/translate
836 $(OBJDIR)/translate $(SRCDIR)/http.c >$(OBJDIR)/http_.c
837
838 $(OBJDIR)/http.o: $(OBJDIR)/http_.c $(OBJDIR)/http.h $(SRCDIR)/config.h
839 $(XTCC) -o $(OBJDIR)/http.o -c $(OBJDIR)/http_.c
840
841 $(OBJDIR)/http.h: $(OBJDIR)/headers
 
842 $(OBJDIR)/http_socket_.c: $(SRCDIR)/http_socket.c $(OBJDIR)/translate
843 $(OBJDIR)/translate $(SRCDIR)/http_socket.c >$(OBJDIR)/http_socket_.c
844
845 $(OBJDIR)/http_socket.o: $(OBJDIR)/http_socket_.c $(OBJDIR)/http_socket.h $(SRCDIR)/config.h
846 $(XTCC) -o $(OBJDIR)/http_socket.o -c $(OBJDIR)/http_socket_.c
847
848 $(OBJDIR)/http_socket.h: $(OBJDIR)/headers
 
849 $(OBJDIR)/http_ssl_.c: $(SRCDIR)/http_ssl.c $(OBJDIR)/translate
850 $(OBJDIR)/translate $(SRCDIR)/http_ssl.c >$(OBJDIR)/http_ssl_.c
851
852 $(OBJDIR)/http_ssl.o: $(OBJDIR)/http_ssl_.c $(OBJDIR)/http_ssl.h $(SRCDIR)/config.h
853 $(XTCC) -o $(OBJDIR)/http_ssl.o -c $(OBJDIR)/http_ssl_.c
854
855 $(OBJDIR)/http_ssl.h: $(OBJDIR)/headers
 
856 $(OBJDIR)/http_transport_.c: $(SRCDIR)/http_transport.c $(OBJDIR)/translate
857 $(OBJDIR)/translate $(SRCDIR)/http_transport.c >$(OBJDIR)/http_transport_.c
858
859 $(OBJDIR)/http_transport.o: $(OBJDIR)/http_transport_.c $(OBJDIR)/http_transport.h $(SRCDIR)/config.h
860 $(XTCC) -o $(OBJDIR)/http_transport.o -c $(OBJDIR)/http_transport_.c
861
862 $(OBJDIR)/http_transport.h: $(OBJDIR)/headers
 
863 $(OBJDIR)/import_.c: $(SRCDIR)/import.c $(OBJDIR)/translate
864 $(OBJDIR)/translate $(SRCDIR)/import.c >$(OBJDIR)/import_.c
865
866 $(OBJDIR)/import.o: $(OBJDIR)/import_.c $(OBJDIR)/import.h $(SRCDIR)/config.h
867 $(XTCC) -o $(OBJDIR)/import.o -c $(OBJDIR)/import_.c
868
869 $(OBJDIR)/import.h: $(OBJDIR)/headers
 
870 $(OBJDIR)/info_.c: $(SRCDIR)/info.c $(OBJDIR)/translate
871 $(OBJDIR)/translate $(SRCDIR)/info.c >$(OBJDIR)/info_.c
872
873 $(OBJDIR)/info.o: $(OBJDIR)/info_.c $(OBJDIR)/info.h $(SRCDIR)/config.h
874 $(XTCC) -o $(OBJDIR)/info.o -c $(OBJDIR)/info_.c
875
876 $(OBJDIR)/info.h: $(OBJDIR)/headers
 
877 $(OBJDIR)/json_.c: $(SRCDIR)/json.c $(OBJDIR)/translate
878 $(OBJDIR)/translate $(SRCDIR)/json.c >$(OBJDIR)/json_.c
879
880 $(OBJDIR)/json.o: $(OBJDIR)/json_.c $(OBJDIR)/json.h $(SRCDIR)/config.h
881 $(XTCC) -o $(OBJDIR)/json.o -c $(OBJDIR)/json_.c
882
883 $(OBJDIR)/json.h: $(OBJDIR)/headers
 
884 $(OBJDIR)/json_artifact_.c: $(SRCDIR)/json_artifact.c $(OBJDIR)/translate
885 $(OBJDIR)/translate $(SRCDIR)/json_artifact.c >$(OBJDIR)/json_artifact_.c
886
887 $(OBJDIR)/json_artifact.o: $(OBJDIR)/json_artifact_.c $(OBJDIR)/json_artifact.h $(SRCDIR)/config.h
888 $(XTCC) -o $(OBJDIR)/json_artifact.o -c $(OBJDIR)/json_artifact_.c
889
890 $(OBJDIR)/json_artifact.h: $(OBJDIR)/headers
 
891 $(OBJDIR)/json_branch_.c: $(SRCDIR)/json_branch.c $(OBJDIR)/translate
892 $(OBJDIR)/translate $(SRCDIR)/json_branch.c >$(OBJDIR)/json_branch_.c
893
894 $(OBJDIR)/json_branch.o: $(OBJDIR)/json_branch_.c $(OBJDIR)/json_branch.h $(SRCDIR)/config.h
895 $(XTCC) -o $(OBJDIR)/json_branch.o -c $(OBJDIR)/json_branch_.c
896
897 $(OBJDIR)/json_branch.h: $(OBJDIR)/headers
 
898 $(OBJDIR)/json_config_.c: $(SRCDIR)/json_config.c $(OBJDIR)/translate
899 $(OBJDIR)/translate $(SRCDIR)/json_config.c >$(OBJDIR)/json_config_.c
900
901 $(OBJDIR)/json_config.o: $(OBJDIR)/json_config_.c $(OBJDIR)/json_config.h $(SRCDIR)/config.h
902 $(XTCC) -o $(OBJDIR)/json_config.o -c $(OBJDIR)/json_config_.c
903
904 $(OBJDIR)/json_config.h: $(OBJDIR)/headers
 
905 $(OBJDIR)/json_diff_.c: $(SRCDIR)/json_diff.c $(OBJDIR)/translate
906 $(OBJDIR)/translate $(SRCDIR)/json_diff.c >$(OBJDIR)/json_diff_.c
907
908 $(OBJDIR)/json_diff.o: $(OBJDIR)/json_diff_.c $(OBJDIR)/json_diff.h $(SRCDIR)/config.h
909 $(XTCC) -o $(OBJDIR)/json_diff.o -c $(OBJDIR)/json_diff_.c
910
911 $(OBJDIR)/json_diff.h: $(OBJDIR)/headers
 
912 $(OBJDIR)/json_dir_.c: $(SRCDIR)/json_dir.c $(OBJDIR)/translate
913 $(OBJDIR)/translate $(SRCDIR)/json_dir.c >$(OBJDIR)/json_dir_.c
914
915 $(OBJDIR)/json_dir.o: $(OBJDIR)/json_dir_.c $(OBJDIR)/json_dir.h $(SRCDIR)/config.h
916 $(XTCC) -o $(OBJDIR)/json_dir.o -c $(OBJDIR)/json_dir_.c
917
918 $(OBJDIR)/json_dir.h: $(OBJDIR)/headers
 
919 $(OBJDIR)/json_finfo_.c: $(SRCDIR)/json_finfo.c $(OBJDIR)/translate
920 $(OBJDIR)/translate $(SRCDIR)/json_finfo.c >$(OBJDIR)/json_finfo_.c
921
922 $(OBJDIR)/json_finfo.o: $(OBJDIR)/json_finfo_.c $(OBJDIR)/json_finfo.h $(SRCDIR)/config.h
923 $(XTCC) -o $(OBJDIR)/json_finfo.o -c $(OBJDIR)/json_finfo_.c
924
925 $(OBJDIR)/json_finfo.h: $(OBJDIR)/headers
 
926 $(OBJDIR)/json_login_.c: $(SRCDIR)/json_login.c $(OBJDIR)/translate
927 $(OBJDIR)/translate $(SRCDIR)/json_login.c >$(OBJDIR)/json_login_.c
928
929 $(OBJDIR)/json_login.o: $(OBJDIR)/json_login_.c $(OBJDIR)/json_login.h $(SRCDIR)/config.h
930 $(XTCC) -o $(OBJDIR)/json_login.o -c $(OBJDIR)/json_login_.c
931
932 $(OBJDIR)/json_login.h: $(OBJDIR)/headers
 
933 $(OBJDIR)/json_query_.c: $(SRCDIR)/json_query.c $(OBJDIR)/translate
934 $(OBJDIR)/translate $(SRCDIR)/json_query.c >$(OBJDIR)/json_query_.c
935
936 $(OBJDIR)/json_query.o: $(OBJDIR)/json_query_.c $(OBJDIR)/json_query.h $(SRCDIR)/config.h
937 $(XTCC) -o $(OBJDIR)/json_query.o -c $(OBJDIR)/json_query_.c
938
939 $(OBJDIR)/json_query.h: $(OBJDIR)/headers
 
940 $(OBJDIR)/json_report_.c: $(SRCDIR)/json_report.c $(OBJDIR)/translate
941 $(OBJDIR)/translate $(SRCDIR)/json_report.c >$(OBJDIR)/json_report_.c
942
943 $(OBJDIR)/json_report.o: $(OBJDIR)/json_report_.c $(OBJDIR)/json_report.h $(SRCDIR)/config.h
944 $(XTCC) -o $(OBJDIR)/json_report.o -c $(OBJDIR)/json_report_.c
945
946 $(OBJDIR)/json_report.h: $(OBJDIR)/headers
 
947 $(OBJDIR)/json_status_.c: $(SRCDIR)/json_status.c $(OBJDIR)/translate
948 $(OBJDIR)/translate $(SRCDIR)/json_status.c >$(OBJDIR)/json_status_.c
949
950 $(OBJDIR)/json_status.o: $(OBJDIR)/json_status_.c $(OBJDIR)/json_status.h $(SRCDIR)/config.h
951 $(XTCC) -o $(OBJDIR)/json_status.o -c $(OBJDIR)/json_status_.c
952
953 $(OBJDIR)/json_status.h: $(OBJDIR)/headers
 
954 $(OBJDIR)/json_tag_.c: $(SRCDIR)/json_tag.c $(OBJDIR)/translate
955 $(OBJDIR)/translate $(SRCDIR)/json_tag.c >$(OBJDIR)/json_tag_.c
956
957 $(OBJDIR)/json_tag.o: $(OBJDIR)/json_tag_.c $(OBJDIR)/json_tag.h $(SRCDIR)/config.h
958 $(XTCC) -o $(OBJDIR)/json_tag.o -c $(OBJDIR)/json_tag_.c
959
960 $(OBJDIR)/json_tag.h: $(OBJDIR)/headers
 
961 $(OBJDIR)/json_timeline_.c: $(SRCDIR)/json_timeline.c $(OBJDIR)/translate
962 $(OBJDIR)/translate $(SRCDIR)/json_timeline.c >$(OBJDIR)/json_timeline_.c
963
964 $(OBJDIR)/json_timeline.o: $(OBJDIR)/json_timeline_.c $(OBJDIR)/json_timeline.h $(SRCDIR)/config.h
965 $(XTCC) -o $(OBJDIR)/json_timeline.o -c $(OBJDIR)/json_timeline_.c
966
967 $(OBJDIR)/json_timeline.h: $(OBJDIR)/headers
 
968 $(OBJDIR)/json_user_.c: $(SRCDIR)/json_user.c $(OBJDIR)/translate
969 $(OBJDIR)/translate $(SRCDIR)/json_user.c >$(OBJDIR)/json_user_.c
970
971 $(OBJDIR)/json_user.o: $(OBJDIR)/json_user_.c $(OBJDIR)/json_user.h $(SRCDIR)/config.h
972 $(XTCC) -o $(OBJDIR)/json_user.o -c $(OBJDIR)/json_user_.c
973
974 $(OBJDIR)/json_user.h: $(OBJDIR)/headers
 
975 $(OBJDIR)/json_wiki_.c: $(SRCDIR)/json_wiki.c $(OBJDIR)/translate
976 $(OBJDIR)/translate $(SRCDIR)/json_wiki.c >$(OBJDIR)/json_wiki_.c
977
978 $(OBJDIR)/json_wiki.o: $(OBJDIR)/json_wiki_.c $(OBJDIR)/json_wiki.h $(SRCDIR)/config.h
979 $(XTCC) -o $(OBJDIR)/json_wiki.o -c $(OBJDIR)/json_wiki_.c
980
981 $(OBJDIR)/json_wiki.h: $(OBJDIR)/headers
 
982 $(OBJDIR)/leaf_.c: $(SRCDIR)/leaf.c $(OBJDIR)/translate
983 $(OBJDIR)/translate $(SRCDIR)/leaf.c >$(OBJDIR)/leaf_.c
984
985 $(OBJDIR)/leaf.o: $(OBJDIR)/leaf_.c $(OBJDIR)/leaf.h $(SRCDIR)/config.h
986 $(XTCC) -o $(OBJDIR)/leaf.o -c $(OBJDIR)/leaf_.c
987
988 $(OBJDIR)/leaf.h: $(OBJDIR)/headers
 
989 $(OBJDIR)/loadctrl_.c: $(SRCDIR)/loadctrl.c $(OBJDIR)/translate
990 $(OBJDIR)/translate $(SRCDIR)/loadctrl.c >$(OBJDIR)/loadctrl_.c
991
992 $(OBJDIR)/loadctrl.o: $(OBJDIR)/loadctrl_.c $(OBJDIR)/loadctrl.h $(SRCDIR)/config.h
993 $(XTCC) -o $(OBJDIR)/loadctrl.o -c $(OBJDIR)/loadctrl_.c
994
995 $(OBJDIR)/loadctrl.h: $(OBJDIR)/headers
 
996 $(OBJDIR)/login_.c: $(SRCDIR)/login.c $(OBJDIR)/translate
997 $(OBJDIR)/translate $(SRCDIR)/login.c >$(OBJDIR)/login_.c
998
999 $(OBJDIR)/login.o: $(OBJDIR)/login_.c $(OBJDIR)/login.h $(SRCDIR)/config.h
1000 $(XTCC) -o $(OBJDIR)/login.o -c $(OBJDIR)/login_.c
1001
1002 $(OBJDIR)/login.h: $(OBJDIR)/headers
 
1003 $(OBJDIR)/lookslike_.c: $(SRCDIR)/lookslike.c $(OBJDIR)/translate
1004 $(OBJDIR)/translate $(SRCDIR)/lookslike.c >$(OBJDIR)/lookslike_.c
1005
1006 $(OBJDIR)/lookslike.o: $(OBJDIR)/lookslike_.c $(OBJDIR)/lookslike.h $(SRCDIR)/config.h
1007 $(XTCC) -o $(OBJDIR)/lookslike.o -c $(OBJDIR)/lookslike_.c
1008
1009 $(OBJDIR)/lookslike.h: $(OBJDIR)/headers
 
1010 $(OBJDIR)/main_.c: $(SRCDIR)/main.c $(OBJDIR)/translate
1011 $(OBJDIR)/translate $(SRCDIR)/main.c >$(OBJDIR)/main_.c
1012
1013 $(OBJDIR)/main.o: $(OBJDIR)/main_.c $(OBJDIR)/main.h $(OBJDIR)/page_index.h $(SRCDIR)/config.h
1014 $(XTCC) -o $(OBJDIR)/main.o -c $(OBJDIR)/main_.c
1015
1016 $(OBJDIR)/main.h: $(OBJDIR)/headers
 
1017 $(OBJDIR)/manifest_.c: $(SRCDIR)/manifest.c $(OBJDIR)/translate
1018 $(OBJDIR)/translate $(SRCDIR)/manifest.c >$(OBJDIR)/manifest_.c
1019
1020 $(OBJDIR)/manifest.o: $(OBJDIR)/manifest_.c $(OBJDIR)/manifest.h $(SRCDIR)/config.h
1021 $(XTCC) -o $(OBJDIR)/manifest.o -c $(OBJDIR)/manifest_.c
1022
1023 $(OBJDIR)/manifest.h: $(OBJDIR)/headers
 
1024 $(OBJDIR)/markdown_.c: $(SRCDIR)/markdown.c $(OBJDIR)/translate
1025 $(OBJDIR)/translate $(SRCDIR)/markdown.c >$(OBJDIR)/markdown_.c
1026
1027 $(OBJDIR)/markdown.o: $(OBJDIR)/markdown_.c $(OBJDIR)/markdown.h $(SRCDIR)/config.h
1028 $(XTCC) -o $(OBJDIR)/markdown.o -c $(OBJDIR)/markdown_.c
1029
1030 $(OBJDIR)/markdown.h: $(OBJDIR)/headers
 
1031 $(OBJDIR)/markdown_html_.c: $(SRCDIR)/markdown_html.c $(OBJDIR)/translate
1032 $(OBJDIR)/translate $(SRCDIR)/markdown_html.c >$(OBJDIR)/markdown_html_.c
1033
1034 $(OBJDIR)/markdown_html.o: $(OBJDIR)/markdown_html_.c $(OBJDIR)/markdown_html.h $(SRCDIR)/config.h
1035 $(XTCC) -o $(OBJDIR)/markdown_html.o -c $(OBJDIR)/markdown_html_.c
1036
1037 $(OBJDIR)/markdown_html.h: $(OBJDIR)/headers
 
1038 $(OBJDIR)/md5_.c: $(SRCDIR)/md5.c $(OBJDIR)/translate
1039 $(OBJDIR)/translate $(SRCDIR)/md5.c >$(OBJDIR)/md5_.c
1040
1041 $(OBJDIR)/md5.o: $(OBJDIR)/md5_.c $(OBJDIR)/md5.h $(SRCDIR)/config.h
1042 $(XTCC) -o $(OBJDIR)/md5.o -c $(OBJDIR)/md5_.c
1043
1044 $(OBJDIR)/md5.h: $(OBJDIR)/headers
 
1045 $(OBJDIR)/merge_.c: $(SRCDIR)/merge.c $(OBJDIR)/translate
1046 $(OBJDIR)/translate $(SRCDIR)/merge.c >$(OBJDIR)/merge_.c
1047
1048 $(OBJDIR)/merge.o: $(OBJDIR)/merge_.c $(OBJDIR)/merge.h $(SRCDIR)/config.h
1049 $(XTCC) -o $(OBJDIR)/merge.o -c $(OBJDIR)/merge_.c
1050
1051 $(OBJDIR)/merge.h: $(OBJDIR)/headers
 
1052 $(OBJDIR)/merge3_.c: $(SRCDIR)/merge3.c $(OBJDIR)/translate
1053 $(OBJDIR)/translate $(SRCDIR)/merge3.c >$(OBJDIR)/merge3_.c
1054
1055 $(OBJDIR)/merge3.o: $(OBJDIR)/merge3_.c $(OBJDIR)/merge3.h $(SRCDIR)/config.h
1056 $(XTCC) -o $(OBJDIR)/merge3.o -c $(OBJDIR)/merge3_.c
1057
1058 $(OBJDIR)/merge3.h: $(OBJDIR)/headers
 
1059 $(OBJDIR)/moderate_.c: $(SRCDIR)/moderate.c $(OBJDIR)/translate
1060 $(OBJDIR)/translate $(SRCDIR)/moderate.c >$(OBJDIR)/moderate_.c
1061
1062 $(OBJDIR)/moderate.o: $(OBJDIR)/moderate_.c $(OBJDIR)/moderate.h $(SRCDIR)/config.h
1063 $(XTCC) -o $(OBJDIR)/moderate.o -c $(OBJDIR)/moderate_.c
1064
1065 $(OBJDIR)/moderate.h: $(OBJDIR)/headers
 
1066 $(OBJDIR)/name_.c: $(SRCDIR)/name.c $(OBJDIR)/translate
1067 $(OBJDIR)/translate $(SRCDIR)/name.c >$(OBJDIR)/name_.c
1068
1069 $(OBJDIR)/name.o: $(OBJDIR)/name_.c $(OBJDIR)/name.h $(SRCDIR)/config.h
1070 $(XTCC) -o $(OBJDIR)/name.o -c $(OBJDIR)/name_.c
1071
1072 $(OBJDIR)/name.h: $(OBJDIR)/headers
 
1073 $(OBJDIR)/path_.c: $(SRCDIR)/path.c $(OBJDIR)/translate
1074 $(OBJDIR)/translate $(SRCDIR)/path.c >$(OBJDIR)/path_.c
1075
1076 $(OBJDIR)/path.o: $(OBJDIR)/path_.c $(OBJDIR)/path.h $(SRCDIR)/config.h
1077 $(XTCC) -o $(OBJDIR)/path.o -c $(OBJDIR)/path_.c
1078
1079 $(OBJDIR)/path.h: $(OBJDIR)/headers
 
1080 $(OBJDIR)/pivot_.c: $(SRCDIR)/pivot.c $(OBJDIR)/translate
1081 $(OBJDIR)/translate $(SRCDIR)/pivot.c >$(OBJDIR)/pivot_.c
1082
1083 $(OBJDIR)/pivot.o: $(OBJDIR)/pivot_.c $(OBJDIR)/pivot.h $(SRCDIR)/config.h
1084 $(XTCC) -o $(OBJDIR)/pivot.o -c $(OBJDIR)/pivot_.c
1085
1086 $(OBJDIR)/pivot.h: $(OBJDIR)/headers
 
1087 $(OBJDIR)/popen_.c: $(SRCDIR)/popen.c $(OBJDIR)/translate
1088 $(OBJDIR)/translate $(SRCDIR)/popen.c >$(OBJDIR)/popen_.c
1089
1090 $(OBJDIR)/popen.o: $(OBJDIR)/popen_.c $(OBJDIR)/popen.h $(SRCDIR)/config.h
1091 $(XTCC) -o $(OBJDIR)/popen.o -c $(OBJDIR)/popen_.c
1092
1093 $(OBJDIR)/popen.h: $(OBJDIR)/headers
 
1094 $(OBJDIR)/pqueue_.c: $(SRCDIR)/pqueue.c $(OBJDIR)/translate
1095 $(OBJDIR)/translate $(SRCDIR)/pqueue.c >$(OBJDIR)/pqueue_.c
1096
1097 $(OBJDIR)/pqueue.o: $(OBJDIR)/pqueue_.c $(OBJDIR)/pqueue.h $(SRCDIR)/config.h
1098 $(XTCC) -o $(OBJDIR)/pqueue.o -c $(OBJDIR)/pqueue_.c
1099
1100 $(OBJDIR)/pqueue.h: $(OBJDIR)/headers
 
1101 $(OBJDIR)/printf_.c: $(SRCDIR)/printf.c $(OBJDIR)/translate
1102 $(OBJDIR)/translate $(SRCDIR)/printf.c >$(OBJDIR)/printf_.c
1103
1104 $(OBJDIR)/printf.o: $(OBJDIR)/printf_.c $(OBJDIR)/printf.h $(SRCDIR)/config.h
1105 $(XTCC) -o $(OBJDIR)/printf.o -c $(OBJDIR)/printf_.c
1106
1107 $(OBJDIR)/printf.h: $(OBJDIR)/headers
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1108 $(OBJDIR)/rebuild_.c: $(SRCDIR)/rebuild.c $(OBJDIR)/translate
1109 $(OBJDIR)/translate $(SRCDIR)/rebuild.c >$(OBJDIR)/rebuild_.c
1110
1111 $(OBJDIR)/rebuild.o: $(OBJDIR)/rebuild_.c $(OBJDIR)/rebuild.h $(SRCDIR)/config.h
1112 $(XTCC) -o $(OBJDIR)/rebuild.o -c $(OBJDIR)/rebuild_.c
1113
1114 $(OBJDIR)/rebuild.h: $(OBJDIR)/headers
 
1115 $(OBJDIR)/regexp_.c: $(SRCDIR)/regexp.c $(OBJDIR)/translate
1116 $(OBJDIR)/translate $(SRCDIR)/regexp.c >$(OBJDIR)/regexp_.c
1117
1118 $(OBJDIR)/regexp.o: $(OBJDIR)/regexp_.c $(OBJDIR)/regexp.h $(SRCDIR)/config.h
1119 $(XTCC) -o $(OBJDIR)/regexp.o -c $(OBJDIR)/regexp_.c
1120
1121 $(OBJDIR)/regexp.h: $(OBJDIR)/headers
 
1122 $(OBJDIR)/report_.c: $(SRCDIR)/report.c $(OBJDIR)/translate
1123 $(OBJDIR)/translate $(SRCDIR)/report.c >$(OBJDIR)/report_.c
1124
1125 $(OBJDIR)/report.o: $(OBJDIR)/report_.c $(OBJDIR)/report.h $(SRCDIR)/config.h
1126 $(XTCC) -o $(OBJDIR)/report.o -c $(OBJDIR)/report_.c
1127
1128 $(OBJDIR)/report.h: $(OBJDIR)/headers
 
1129 $(OBJDIR)/rss_.c: $(SRCDIR)/rss.c $(OBJDIR)/translate
1130 $(OBJDIR)/translate $(SRCDIR)/rss.c >$(OBJDIR)/rss_.c
1131
1132 $(OBJDIR)/rss.o: $(OBJDIR)/rss_.c $(OBJDIR)/rss.h $(SRCDIR)/config.h
1133 $(XTCC) -o $(OBJDIR)/rss.o -c $(OBJDIR)/rss_.c
1134
1135 $(OBJDIR)/rss.h: $(OBJDIR)/headers
 
1136 $(OBJDIR)/schema_.c: $(SRCDIR)/schema.c $(OBJDIR)/translate
1137 $(OBJDIR)/translate $(SRCDIR)/schema.c >$(OBJDIR)/schema_.c
1138
1139 $(OBJDIR)/schema.o: $(OBJDIR)/schema_.c $(OBJDIR)/schema.h $(SRCDIR)/config.h
1140 $(XTCC) -o $(OBJDIR)/schema.o -c $(OBJDIR)/schema_.c
1141
1142 $(OBJDIR)/schema.h: $(OBJDIR)/headers
 
1143 $(OBJDIR)/search_.c: $(SRCDIR)/search.c $(OBJDIR)/translate
1144 $(OBJDIR)/translate $(SRCDIR)/search.c >$(OBJDIR)/search_.c
1145
1146 $(OBJDIR)/search.o: $(OBJDIR)/search_.c $(OBJDIR)/search.h $(SRCDIR)/config.h
1147 $(XTCC) -o $(OBJDIR)/search.o -c $(OBJDIR)/search_.c
1148
1149 $(OBJDIR)/search.h: $(OBJDIR)/headers
 
1150 $(OBJDIR)/setup_.c: $(SRCDIR)/setup.c $(OBJDIR)/translate
1151 $(OBJDIR)/translate $(SRCDIR)/setup.c >$(OBJDIR)/setup_.c
1152
1153 $(OBJDIR)/setup.o: $(OBJDIR)/setup_.c $(OBJDIR)/setup.h $(SRCDIR)/config.h
1154 $(XTCC) -o $(OBJDIR)/setup.o -c $(OBJDIR)/setup_.c
1155
1156 $(OBJDIR)/setup.h: $(OBJDIR)/headers
 
1157 $(OBJDIR)/sha1_.c: $(SRCDIR)/sha1.c $(OBJDIR)/translate
1158 $(OBJDIR)/translate $(SRCDIR)/sha1.c >$(OBJDIR)/sha1_.c
1159
1160 $(OBJDIR)/sha1.o: $(OBJDIR)/sha1_.c $(OBJDIR)/sha1.h $(SRCDIR)/config.h
1161 $(XTCC) -o $(OBJDIR)/sha1.o -c $(OBJDIR)/sha1_.c
1162
1163 $(OBJDIR)/sha1.h: $(OBJDIR)/headers
 
1164 $(OBJDIR)/shun_.c: $(SRCDIR)/shun.c $(OBJDIR)/translate
1165 $(OBJDIR)/translate $(SRCDIR)/shun.c >$(OBJDIR)/shun_.c
1166
1167 $(OBJDIR)/shun.o: $(OBJDIR)/shun_.c $(OBJDIR)/shun.h $(SRCDIR)/config.h
1168 $(XTCC) -o $(OBJDIR)/shun.o -c $(OBJDIR)/shun_.c
1169
1170 $(OBJDIR)/shun.h: $(OBJDIR)/headers
 
1171 $(OBJDIR)/skins_.c: $(SRCDIR)/skins.c $(OBJDIR)/translate
1172 $(OBJDIR)/translate $(SRCDIR)/skins.c >$(OBJDIR)/skins_.c
1173
1174 $(OBJDIR)/skins.o: $(OBJDIR)/skins_.c $(OBJDIR)/skins.h $(SRCDIR)/config.h
1175 $(XTCC) -o $(OBJDIR)/skins.o -c $(OBJDIR)/skins_.c
1176
1177 $(OBJDIR)/skins.h: $(OBJDIR)/headers
 
1178 $(OBJDIR)/sqlcmd_.c: $(SRCDIR)/sqlcmd.c $(OBJDIR)/translate
1179 $(OBJDIR)/translate $(SRCDIR)/sqlcmd.c >$(OBJDIR)/sqlcmd_.c
1180
1181 $(OBJDIR)/sqlcmd.o: $(OBJDIR)/sqlcmd_.c $(OBJDIR)/sqlcmd.h $(SRCDIR)/config.h
1182 $(XTCC) -o $(OBJDIR)/sqlcmd.o -c $(OBJDIR)/sqlcmd_.c
1183
1184 $(OBJDIR)/sqlcmd.h: $(OBJDIR)/headers
 
1185 $(OBJDIR)/stash_.c: $(SRCDIR)/stash.c $(OBJDIR)/translate
1186 $(OBJDIR)/translate $(SRCDIR)/stash.c >$(OBJDIR)/stash_.c
1187
1188 $(OBJDIR)/stash.o: $(OBJDIR)/stash_.c $(OBJDIR)/stash.h $(SRCDIR)/config.h
1189 $(XTCC) -o $(OBJDIR)/stash.o -c $(OBJDIR)/stash_.c
1190
1191 $(OBJDIR)/stash.h: $(OBJDIR)/headers
 
1192 $(OBJDIR)/stat_.c: $(SRCDIR)/stat.c $(OBJDIR)/translate
1193 $(OBJDIR)/translate $(SRCDIR)/stat.c >$(OBJDIR)/stat_.c
1194
1195 $(OBJDIR)/stat.o: $(OBJDIR)/stat_.c $(OBJDIR)/stat.h $(SRCDIR)/config.h
1196 $(XTCC) -o $(OBJDIR)/stat.o -c $(OBJDIR)/stat_.c
1197
1198 $(OBJDIR)/stat.h: $(OBJDIR)/headers
 
1199 $(OBJDIR)/style_.c: $(SRCDIR)/style.c $(OBJDIR)/translate
1200 $(OBJDIR)/translate $(SRCDIR)/style.c >$(OBJDIR)/style_.c
1201
1202 $(OBJDIR)/style.o: $(OBJDIR)/style_.c $(OBJDIR)/style.h $(SRCDIR)/config.h
1203 $(XTCC) -o $(OBJDIR)/style.o -c $(OBJDIR)/style_.c
1204
1205 $(OBJDIR)/style.h: $(OBJDIR)/headers
 
1206 $(OBJDIR)/sync_.c: $(SRCDIR)/sync.c $(OBJDIR)/translate
1207 $(OBJDIR)/translate $(SRCDIR)/sync.c >$(OBJDIR)/sync_.c
1208
1209 $(OBJDIR)/sync.o: $(OBJDIR)/sync_.c $(OBJDIR)/sync.h $(SRCDIR)/config.h
1210 $(XTCC) -o $(OBJDIR)/sync.o -c $(OBJDIR)/sync_.c
1211
1212 $(OBJDIR)/sync.h: $(OBJDIR)/headers
 
1213 $(OBJDIR)/tag_.c: $(SRCDIR)/tag.c $(OBJDIR)/translate
1214 $(OBJDIR)/translate $(SRCDIR)/tag.c >$(OBJDIR)/tag_.c
1215
1216 $(OBJDIR)/tag.o: $(OBJDIR)/tag_.c $(OBJDIR)/tag.h $(SRCDIR)/config.h
1217 $(XTCC) -o $(OBJDIR)/tag.o -c $(OBJDIR)/tag_.c
1218
1219 $(OBJDIR)/tag.h: $(OBJDIR)/headers
 
1220 $(OBJDIR)/tar_.c: $(SRCDIR)/tar.c $(OBJDIR)/translate
1221 $(OBJDIR)/translate $(SRCDIR)/tar.c >$(OBJDIR)/tar_.c
1222
1223 $(OBJDIR)/tar.o: $(OBJDIR)/tar_.c $(OBJDIR)/tar.h $(SRCDIR)/config.h
1224 $(XTCC) -o $(OBJDIR)/tar.o -c $(OBJDIR)/tar_.c
1225
1226 $(OBJDIR)/tar.h: $(OBJDIR)/headers
 
1227 $(OBJDIR)/th_main_.c: $(SRCDIR)/th_main.c $(OBJDIR)/translate
1228 $(OBJDIR)/translate $(SRCDIR)/th_main.c >$(OBJDIR)/th_main_.c
1229
1230 $(OBJDIR)/th_main.o: $(OBJDIR)/th_main_.c $(OBJDIR)/th_main.h $(SRCDIR)/config.h
1231 $(XTCC) -o $(OBJDIR)/th_main.o -c $(OBJDIR)/th_main_.c
1232
1233 $(OBJDIR)/th_main.h: $(OBJDIR)/headers
 
1234 $(OBJDIR)/timeline_.c: $(SRCDIR)/timeline.c $(OBJDIR)/translate
1235 $(OBJDIR)/translate $(SRCDIR)/timeline.c >$(OBJDIR)/timeline_.c
1236
1237 $(OBJDIR)/timeline.o: $(OBJDIR)/timeline_.c $(OBJDIR)/timeline.h $(SRCDIR)/config.h
1238 $(XTCC) -o $(OBJDIR)/timeline.o -c $(OBJDIR)/timeline_.c
1239
1240 $(OBJDIR)/timeline.h: $(OBJDIR)/headers
 
1241 $(OBJDIR)/tkt_.c: $(SRCDIR)/tkt.c $(OBJDIR)/translate
1242 $(OBJDIR)/translate $(SRCDIR)/tkt.c >$(OBJDIR)/tkt_.c
1243
1244 $(OBJDIR)/tkt.o: $(OBJDIR)/tkt_.c $(OBJDIR)/tkt.h $(SRCDIR)/config.h
1245 $(XTCC) -o $(OBJDIR)/tkt.o -c $(OBJDIR)/tkt_.c
1246
1247 $(OBJDIR)/tkt.h: $(OBJDIR)/headers
 
1248 $(OBJDIR)/tktsetup_.c: $(SRCDIR)/tktsetup.c $(OBJDIR)/translate
1249 $(OBJDIR)/translate $(SRCDIR)/tktsetup.c >$(OBJDIR)/tktsetup_.c
1250
1251 $(OBJDIR)/tktsetup.o: $(OBJDIR)/tktsetup_.c $(OBJDIR)/tktsetup.h $(SRCDIR)/config.h
1252 $(XTCC) -o $(OBJDIR)/tktsetup.o -c $(OBJDIR)/tktsetup_.c
1253
1254 $(OBJDIR)/tktsetup.h: $(OBJDIR)/headers
 
1255 $(OBJDIR)/undo_.c: $(SRCDIR)/undo.c $(OBJDIR)/translate
1256 $(OBJDIR)/translate $(SRCDIR)/undo.c >$(OBJDIR)/undo_.c
1257
1258 $(OBJDIR)/undo.o: $(OBJDIR)/undo_.c $(OBJDIR)/undo.h $(SRCDIR)/config.h
1259 $(XTCC) -o $(OBJDIR)/undo.o -c $(OBJDIR)/undo_.c
1260
1261 $(OBJDIR)/undo.h: $(OBJDIR)/headers
 
1262 $(OBJDIR)/unicode_.c: $(SRCDIR)/unicode.c $(OBJDIR)/translate
1263 $(OBJDIR)/translate $(SRCDIR)/unicode.c >$(OBJDIR)/unicode_.c
1264
1265 $(OBJDIR)/unicode.o: $(OBJDIR)/unicode_.c $(OBJDIR)/unicode.h $(SRCDIR)/config.h
1266 $(XTCC) -o $(OBJDIR)/unicode.o -c $(OBJDIR)/unicode_.c
1267
1268 $(OBJDIR)/unicode.h: $(OBJDIR)/headers
 
1269 $(OBJDIR)/update_.c: $(SRCDIR)/update.c $(OBJDIR)/translate
1270 $(OBJDIR)/translate $(SRCDIR)/update.c >$(OBJDIR)/update_.c
1271
1272 $(OBJDIR)/update.o: $(OBJDIR)/update_.c $(OBJDIR)/update.h $(SRCDIR)/config.h
1273 $(XTCC) -o $(OBJDIR)/update.o -c $(OBJDIR)/update_.c
1274
1275 $(OBJDIR)/update.h: $(OBJDIR)/headers
 
1276 $(OBJDIR)/url_.c: $(SRCDIR)/url.c $(OBJDIR)/translate
1277 $(OBJDIR)/translate $(SRCDIR)/url.c >$(OBJDIR)/url_.c
1278
1279 $(OBJDIR)/url.o: $(OBJDIR)/url_.c $(OBJDIR)/url.h $(SRCDIR)/config.h
1280 $(XTCC) -o $(OBJDIR)/url.o -c $(OBJDIR)/url_.c
1281
1282 $(OBJDIR)/url.h: $(OBJDIR)/headers
 
1283 $(OBJDIR)/user_.c: $(SRCDIR)/user.c $(OBJDIR)/translate
1284 $(OBJDIR)/translate $(SRCDIR)/user.c >$(OBJDIR)/user_.c
1285
1286 $(OBJDIR)/user.o: $(OBJDIR)/user_.c $(OBJDIR)/user.h $(SRCDIR)/config.h
1287 $(XTCC) -o $(OBJDIR)/user.o -c $(OBJDIR)/user_.c
1288
1289 $(OBJDIR)/user.h: $(OBJDIR)/headers
 
1290 $(OBJDIR)/utf8_.c: $(SRCDIR)/utf8.c $(OBJDIR)/translate
1291 $(OBJDIR)/translate $(SRCDIR)/utf8.c >$(OBJDIR)/utf8_.c
1292
1293 $(OBJDIR)/utf8.o: $(OBJDIR)/utf8_.c $(OBJDIR)/utf8.h $(SRCDIR)/config.h
1294 $(XTCC) -o $(OBJDIR)/utf8.o -c $(OBJDIR)/utf8_.c
1295
1296 $(OBJDIR)/utf8.h: $(OBJDIR)/headers
 
1297 $(OBJDIR)/util_.c: $(SRCDIR)/util.c $(OBJDIR)/translate
1298 $(OBJDIR)/translate $(SRCDIR)/util.c >$(OBJDIR)/util_.c
1299
1300 $(OBJDIR)/util.o: $(OBJDIR)/util_.c $(OBJDIR)/util.h $(SRCDIR)/config.h
1301 $(XTCC) -o $(OBJDIR)/util.o -c $(OBJDIR)/util_.c
1302
1303 $(OBJDIR)/util.h: $(OBJDIR)/headers
 
1304 $(OBJDIR)/verify_.c: $(SRCDIR)/verify.c $(OBJDIR)/translate
1305 $(OBJDIR)/translate $(SRCDIR)/verify.c >$(OBJDIR)/verify_.c
1306
1307 $(OBJDIR)/verify.o: $(OBJDIR)/verify_.c $(OBJDIR)/verify.h $(SRCDIR)/config.h
1308 $(XTCC) -o $(OBJDIR)/verify.o -c $(OBJDIR)/verify_.c
1309
1310 $(OBJDIR)/verify.h: $(OBJDIR)/headers
 
1311 $(OBJDIR)/vfile_.c: $(SRCDIR)/vfile.c $(OBJDIR)/translate
1312 $(OBJDIR)/translate $(SRCDIR)/vfile.c >$(OBJDIR)/vfile_.c
1313
1314 $(OBJDIR)/vfile.o: $(OBJDIR)/vfile_.c $(OBJDIR)/vfile.h $(SRCDIR)/config.h
1315 $(XTCC) -o $(OBJDIR)/vfile.o -c $(OBJDIR)/vfile_.c
1316
1317 $(OBJDIR)/vfile.h: $(OBJDIR)/headers
 
1318 $(OBJDIR)/wiki_.c: $(SRCDIR)/wiki.c $(OBJDIR)/translate
1319 $(OBJDIR)/translate $(SRCDIR)/wiki.c >$(OBJDIR)/wiki_.c
1320
1321 $(OBJDIR)/wiki.o: $(OBJDIR)/wiki_.c $(OBJDIR)/wiki.h $(SRCDIR)/config.h
1322 $(XTCC) -o $(OBJDIR)/wiki.o -c $(OBJDIR)/wiki_.c
1323
1324 $(OBJDIR)/wiki.h: $(OBJDIR)/headers
 
1325 $(OBJDIR)/wikiformat_.c: $(SRCDIR)/wikiformat.c $(OBJDIR)/translate
1326 $(OBJDIR)/translate $(SRCDIR)/wikiformat.c >$(OBJDIR)/wikiformat_.c
1327
1328 $(OBJDIR)/wikiformat.o: $(OBJDIR)/wikiformat_.c $(OBJDIR)/wikiformat.h $(SRCDIR)/config.h
1329 $(XTCC) -o $(OBJDIR)/wikiformat.o -c $(OBJDIR)/wikiformat_.c
1330
1331 $(OBJDIR)/wikiformat.h: $(OBJDIR)/headers
 
1332 $(OBJDIR)/winfile_.c: $(SRCDIR)/winfile.c $(OBJDIR)/translate
1333 $(OBJDIR)/translate $(SRCDIR)/winfile.c >$(OBJDIR)/winfile_.c
1334
1335 $(OBJDIR)/winfile.o: $(OBJDIR)/winfile_.c $(OBJDIR)/winfile.h $(SRCDIR)/config.h
1336 $(XTCC) -o $(OBJDIR)/winfile.o -c $(OBJDIR)/winfile_.c
1337
1338 $(OBJDIR)/winfile.h: $(OBJDIR)/headers
 
1339 $(OBJDIR)/winhttp_.c: $(SRCDIR)/winhttp.c $(OBJDIR)/translate
1340 $(OBJDIR)/translate $(SRCDIR)/winhttp.c >$(OBJDIR)/winhttp_.c
1341
1342 $(OBJDIR)/winhttp.o: $(OBJDIR)/winhttp_.c $(OBJDIR)/winhttp.h $(SRCDIR)/config.h
1343 $(XTCC) -o $(OBJDIR)/winhttp.o -c $(OBJDIR)/winhttp_.c
1344
1345 $(OBJDIR)/winhttp.h: $(OBJDIR)/headers
 
1346 $(OBJDIR)/wysiwyg_.c: $(SRCDIR)/wysiwyg.c $(OBJDIR)/translate
1347 $(OBJDIR)/translate $(SRCDIR)/wysiwyg.c >$(OBJDIR)/wysiwyg_.c
1348
1349 $(OBJDIR)/wysiwyg.o: $(OBJDIR)/wysiwyg_.c $(OBJDIR)/wysiwyg.h $(SRCDIR)/config.h
1350 $(XTCC) -o $(OBJDIR)/wysiwyg.o -c $(OBJDIR)/wysiwyg_.c
1351
1352 $(OBJDIR)/wysiwyg.h: $(OBJDIR)/headers
 
1353 $(OBJDIR)/xfer_.c: $(SRCDIR)/xfer.c $(OBJDIR)/translate
1354 $(OBJDIR)/translate $(SRCDIR)/xfer.c >$(OBJDIR)/xfer_.c
1355
1356 $(OBJDIR)/xfer.o: $(OBJDIR)/xfer_.c $(OBJDIR)/xfer.h $(SRCDIR)/config.h
1357 $(XTCC) -o $(OBJDIR)/xfer.o -c $(OBJDIR)/xfer_.c
1358
1359 $(OBJDIR)/xfer.h: $(OBJDIR)/headers
 
1360 $(OBJDIR)/xfersetup_.c: $(SRCDIR)/xfersetup.c $(OBJDIR)/translate
1361 $(OBJDIR)/translate $(SRCDIR)/xfersetup.c >$(OBJDIR)/xfersetup_.c
1362
1363 $(OBJDIR)/xfersetup.o: $(OBJDIR)/xfersetup_.c $(OBJDIR)/xfersetup.h $(SRCDIR)/config.h
1364 $(XTCC) -o $(OBJDIR)/xfersetup.o -c $(OBJDIR)/xfersetup_.c
1365
1366 $(OBJDIR)/xfersetup.h: $(OBJDIR)/headers
 
1367 $(OBJDIR)/zip_.c: $(SRCDIR)/zip.c $(OBJDIR)/translate
1368 $(OBJDIR)/translate $(SRCDIR)/zip.c >$(OBJDIR)/zip_.c
1369
1370 $(OBJDIR)/zip.o: $(OBJDIR)/zip_.c $(OBJDIR)/zip.h $(SRCDIR)/config.h
1371 $(XTCC) -o $(OBJDIR)/zip.o -c $(OBJDIR)/zip_.c
1372
1373 $(OBJDIR)/zip.h: $(OBJDIR)/headers
 
1374 $(OBJDIR)/sqlite3.o: $(SRCDIR)/sqlite3.c
1375 $(XTCC) $(SQLITE_OPTIONS) $(SQLITE_CFLAGS) -c $(SRCDIR)/sqlite3.c -o $(OBJDIR)/sqlite3.o
1376
1377 $(OBJDIR)/shell.o: $(SRCDIR)/shell.c $(SRCDIR)/sqlite3.h
1378 $(XTCC) $(SHELL_OPTIONS) $(SHELL_CFLAGS) -c $(SRCDIR)/shell.c -o $(OBJDIR)/shell.o
1379
1380 $(OBJDIR)/th.o: $(SRCDIR)/th.c
1381 $(XTCC) -c $(SRCDIR)/th.c -o $(OBJDIR)/th.o
1382
1383 $(OBJDIR)/th_lang.o: $(SRCDIR)/th_lang.c
1384 $(XTCC) -c $(SRCDIR)/th_lang.c -o $(OBJDIR)/th_lang.o
1385
1386 $(OBJDIR)/th_tcl.o: $(SRCDIR)/th_tcl.c
1387 $(XTCC) -c $(SRCDIR)/th_tcl.c -o $(OBJDIR)/th_tcl.o
1388
1389
1390 $(OBJDIR)/miniz.o: $(SRCDIR)/miniz.c
1391 $(XTCC) $(MINIZ_OPTIONS) -c $(SRCDIR)/miniz.c -o $(OBJDIR)/miniz.o
1392
1393 $(OBJDIR)/cson_amalgamation.o: $(SRCDIR)/cson_amalgamation.c
1394 $(XTCC) -c $(SRCDIR)/cson_amalgamation.c -o $(OBJDIR)/cson_amalgamation.o
1395
1396 #
1397 # The list of all the targets that do not correspond to real files. This stops
1398 # 'make' from getting confused when someone makes an error in a rule.
1399 #
1400
1401 .PHONY: all install test clean
1402
1403
--- src/main.mk
+++ src/main.mk
@@ -8,11 +8,11 @@
8 # to regenerate this file.
9 #
10 # This file is included by primary Makefile.
11 #
12
13 XTCC = $(TCC) -I. -I$(SRCDIR) -I$(OBJDIR) $(TCCFLAGS) $(CFLAGS)
14
15
16 SRC = \
17 $(SRCDIR)/add.c \
18 $(SRCDIR)/allrepo.c \
@@ -21,10 +21,11 @@
21 $(SRCDIR)/bisect.c \
22 $(SRCDIR)/blob.c \
23 $(SRCDIR)/branch.c \
24 $(SRCDIR)/browse.c \
25 $(SRCDIR)/builtin.c \
26 $(SRCDIR)/bundle.c \
27 $(SRCDIR)/cache.c \
28 $(SRCDIR)/captcha.c \
29 $(SRCDIR)/cgi.c \
30 $(SRCDIR)/checkin.c \
31 $(SRCDIR)/checkout.c \
@@ -43,10 +44,11 @@
44 $(SRCDIR)/encode.c \
45 $(SRCDIR)/event.c \
46 $(SRCDIR)/export.c \
47 $(SRCDIR)/file.c \
48 $(SRCDIR)/finfo.c \
49 $(SRCDIR)/foci.c \
50 $(SRCDIR)/fusefs.c \
51 $(SRCDIR)/glob.c \
52 $(SRCDIR)/graph.c \
53 $(SRCDIR)/gzip.c \
54 $(SRCDIR)/http.c \
@@ -86,10 +88,12 @@
88 $(SRCDIR)/path.c \
89 $(SRCDIR)/pivot.c \
90 $(SRCDIR)/popen.c \
91 $(SRCDIR)/pqueue.c \
92 $(SRCDIR)/printf.c \
93 $(SRCDIR)/publish.c \
94 $(SRCDIR)/purge.c \
95 $(SRCDIR)/rebuild.c \
96 $(SRCDIR)/regexp.c \
97 $(SRCDIR)/report.c \
98 $(SRCDIR)/rss.c \
99 $(SRCDIR)/schema.c \
@@ -138,10 +142,11 @@
142 $(OBJDIR)/bisect_.c \
143 $(OBJDIR)/blob_.c \
144 $(OBJDIR)/branch_.c \
145 $(OBJDIR)/browse_.c \
146 $(OBJDIR)/builtin_.c \
147 $(OBJDIR)/bundle_.c \
148 $(OBJDIR)/cache_.c \
149 $(OBJDIR)/captcha_.c \
150 $(OBJDIR)/cgi_.c \
151 $(OBJDIR)/checkin_.c \
152 $(OBJDIR)/checkout_.c \
@@ -160,10 +165,11 @@
165 $(OBJDIR)/encode_.c \
166 $(OBJDIR)/event_.c \
167 $(OBJDIR)/export_.c \
168 $(OBJDIR)/file_.c \
169 $(OBJDIR)/finfo_.c \
170 $(OBJDIR)/foci_.c \
171 $(OBJDIR)/fusefs_.c \
172 $(OBJDIR)/glob_.c \
173 $(OBJDIR)/graph_.c \
174 $(OBJDIR)/gzip_.c \
175 $(OBJDIR)/http_.c \
@@ -203,10 +209,12 @@
209 $(OBJDIR)/path_.c \
210 $(OBJDIR)/pivot_.c \
211 $(OBJDIR)/popen_.c \
212 $(OBJDIR)/pqueue_.c \
213 $(OBJDIR)/printf_.c \
214 $(OBJDIR)/publish_.c \
215 $(OBJDIR)/purge_.c \
216 $(OBJDIR)/rebuild_.c \
217 $(OBJDIR)/regexp_.c \
218 $(OBJDIR)/report_.c \
219 $(OBJDIR)/rss_.c \
220 $(OBJDIR)/schema_.c \
@@ -252,10 +260,11 @@
260 $(OBJDIR)/bisect.o \
261 $(OBJDIR)/blob.o \
262 $(OBJDIR)/branch.o \
263 $(OBJDIR)/browse.o \
264 $(OBJDIR)/builtin.o \
265 $(OBJDIR)/bundle.o \
266 $(OBJDIR)/cache.o \
267 $(OBJDIR)/captcha.o \
268 $(OBJDIR)/cgi.o \
269 $(OBJDIR)/checkin.o \
270 $(OBJDIR)/checkout.o \
@@ -274,10 +283,11 @@
283 $(OBJDIR)/encode.o \
284 $(OBJDIR)/event.o \
285 $(OBJDIR)/export.o \
286 $(OBJDIR)/file.o \
287 $(OBJDIR)/finfo.o \
288 $(OBJDIR)/foci.o \
289 $(OBJDIR)/fusefs.o \
290 $(OBJDIR)/glob.o \
291 $(OBJDIR)/graph.o \
292 $(OBJDIR)/gzip.o \
293 $(OBJDIR)/http.o \
@@ -317,10 +327,12 @@
327 $(OBJDIR)/path.o \
328 $(OBJDIR)/pivot.o \
329 $(OBJDIR)/popen.o \
330 $(OBJDIR)/pqueue.o \
331 $(OBJDIR)/printf.o \
332 $(OBJDIR)/publish.o \
333 $(OBJDIR)/purge.o \
334 $(OBJDIR)/rebuild.o \
335 $(OBJDIR)/regexp.o \
336 $(OBJDIR)/report.o \
337 $(OBJDIR)/rss.o \
338 $(OBJDIR)/schema.o \
@@ -475,10 +487,11 @@
487 $(OBJDIR)/bisect_.c:$(OBJDIR)/bisect.h \
488 $(OBJDIR)/blob_.c:$(OBJDIR)/blob.h \
489 $(OBJDIR)/branch_.c:$(OBJDIR)/branch.h \
490 $(OBJDIR)/browse_.c:$(OBJDIR)/browse.h \
491 $(OBJDIR)/builtin_.c:$(OBJDIR)/builtin.h \
492 $(OBJDIR)/bundle_.c:$(OBJDIR)/bundle.h \
493 $(OBJDIR)/cache_.c:$(OBJDIR)/cache.h \
494 $(OBJDIR)/captcha_.c:$(OBJDIR)/captcha.h \
495 $(OBJDIR)/cgi_.c:$(OBJDIR)/cgi.h \
496 $(OBJDIR)/checkin_.c:$(OBJDIR)/checkin.h \
497 $(OBJDIR)/checkout_.c:$(OBJDIR)/checkout.h \
@@ -497,10 +510,11 @@
510 $(OBJDIR)/encode_.c:$(OBJDIR)/encode.h \
511 $(OBJDIR)/event_.c:$(OBJDIR)/event.h \
512 $(OBJDIR)/export_.c:$(OBJDIR)/export.h \
513 $(OBJDIR)/file_.c:$(OBJDIR)/file.h \
514 $(OBJDIR)/finfo_.c:$(OBJDIR)/finfo.h \
515 $(OBJDIR)/foci_.c:$(OBJDIR)/foci.h \
516 $(OBJDIR)/fusefs_.c:$(OBJDIR)/fusefs.h \
517 $(OBJDIR)/glob_.c:$(OBJDIR)/glob.h \
518 $(OBJDIR)/graph_.c:$(OBJDIR)/graph.h \
519 $(OBJDIR)/gzip_.c:$(OBJDIR)/gzip.h \
520 $(OBJDIR)/http_.c:$(OBJDIR)/http.h \
@@ -540,10 +554,12 @@
554 $(OBJDIR)/path_.c:$(OBJDIR)/path.h \
555 $(OBJDIR)/pivot_.c:$(OBJDIR)/pivot.h \
556 $(OBJDIR)/popen_.c:$(OBJDIR)/popen.h \
557 $(OBJDIR)/pqueue_.c:$(OBJDIR)/pqueue.h \
558 $(OBJDIR)/printf_.c:$(OBJDIR)/printf.h \
559 $(OBJDIR)/publish_.c:$(OBJDIR)/publish.h \
560 $(OBJDIR)/purge_.c:$(OBJDIR)/purge.h \
561 $(OBJDIR)/rebuild_.c:$(OBJDIR)/rebuild.h \
562 $(OBJDIR)/regexp_.c:$(OBJDIR)/regexp.h \
563 $(OBJDIR)/report_.c:$(OBJDIR)/report.h \
564 $(OBJDIR)/rss_.c:$(OBJDIR)/rss.h \
565 $(OBJDIR)/schema_.c:$(OBJDIR)/schema.h \
@@ -586,817 +602,961 @@
602 touch $(OBJDIR)/headers
603 $(OBJDIR)/headers: Makefile
604 $(OBJDIR)/json.o $(OBJDIR)/json_artifact.o $(OBJDIR)/json_branch.o $(OBJDIR)/json_config.o $(OBJDIR)/json_diff.o $(OBJDIR)/json_dir.o $(OBJDIR)/json_finfo.o $(OBJDIR)/json_login.o $(OBJDIR)/json_query.o $(OBJDIR)/json_report.o $(OBJDIR)/json_status.o $(OBJDIR)/json_tag.o $(OBJDIR)/json_timeline.o $(OBJDIR)/json_user.o $(OBJDIR)/json_wiki.o : $(SRCDIR)/json_detail.h
605 Makefile:
606 $(OBJDIR)/add_.c: $(SRCDIR)/add.c $(OBJDIR)/translate
607 $(OBJDIR)/translate $(SRCDIR)/add.c >$@
608
609 $(OBJDIR)/add.o: $(OBJDIR)/add_.c $(OBJDIR)/add.h $(SRCDIR)/config.h
610 $(XTCC) -o $(OBJDIR)/add.o -c $(OBJDIR)/add_.c
611
612 $(OBJDIR)/add.h: $(OBJDIR)/headers
613
614 $(OBJDIR)/allrepo_.c: $(SRCDIR)/allrepo.c $(OBJDIR)/translate
615 $(OBJDIR)/translate $(SRCDIR)/allrepo.c >$@
616
617 $(OBJDIR)/allrepo.o: $(OBJDIR)/allrepo_.c $(OBJDIR)/allrepo.h $(SRCDIR)/config.h
618 $(XTCC) -o $(OBJDIR)/allrepo.o -c $(OBJDIR)/allrepo_.c
619
620 $(OBJDIR)/allrepo.h: $(OBJDIR)/headers
621
622 $(OBJDIR)/attach_.c: $(SRCDIR)/attach.c $(OBJDIR)/translate
623 $(OBJDIR)/translate $(SRCDIR)/attach.c >$@
624
625 $(OBJDIR)/attach.o: $(OBJDIR)/attach_.c $(OBJDIR)/attach.h $(SRCDIR)/config.h
626 $(XTCC) -o $(OBJDIR)/attach.o -c $(OBJDIR)/attach_.c
627
628 $(OBJDIR)/attach.h: $(OBJDIR)/headers
629
630 $(OBJDIR)/bag_.c: $(SRCDIR)/bag.c $(OBJDIR)/translate
631 $(OBJDIR)/translate $(SRCDIR)/bag.c >$@
632
633 $(OBJDIR)/bag.o: $(OBJDIR)/bag_.c $(OBJDIR)/bag.h $(SRCDIR)/config.h
634 $(XTCC) -o $(OBJDIR)/bag.o -c $(OBJDIR)/bag_.c
635
636 $(OBJDIR)/bag.h: $(OBJDIR)/headers
637
638 $(OBJDIR)/bisect_.c: $(SRCDIR)/bisect.c $(OBJDIR)/translate
639 $(OBJDIR)/translate $(SRCDIR)/bisect.c >$@
640
641 $(OBJDIR)/bisect.o: $(OBJDIR)/bisect_.c $(OBJDIR)/bisect.h $(SRCDIR)/config.h
642 $(XTCC) -o $(OBJDIR)/bisect.o -c $(OBJDIR)/bisect_.c
643
644 $(OBJDIR)/bisect.h: $(OBJDIR)/headers
645
646 $(OBJDIR)/blob_.c: $(SRCDIR)/blob.c $(OBJDIR)/translate
647 $(OBJDIR)/translate $(SRCDIR)/blob.c >$@
648
649 $(OBJDIR)/blob.o: $(OBJDIR)/blob_.c $(OBJDIR)/blob.h $(SRCDIR)/config.h
650 $(XTCC) -o $(OBJDIR)/blob.o -c $(OBJDIR)/blob_.c
651
652 $(OBJDIR)/blob.h: $(OBJDIR)/headers
653
654 $(OBJDIR)/branch_.c: $(SRCDIR)/branch.c $(OBJDIR)/translate
655 $(OBJDIR)/translate $(SRCDIR)/branch.c >$@
656
657 $(OBJDIR)/branch.o: $(OBJDIR)/branch_.c $(OBJDIR)/branch.h $(SRCDIR)/config.h
658 $(XTCC) -o $(OBJDIR)/branch.o -c $(OBJDIR)/branch_.c
659
660 $(OBJDIR)/branch.h: $(OBJDIR)/headers
661
662 $(OBJDIR)/browse_.c: $(SRCDIR)/browse.c $(OBJDIR)/translate
663 $(OBJDIR)/translate $(SRCDIR)/browse.c >$@
664
665 $(OBJDIR)/browse.o: $(OBJDIR)/browse_.c $(OBJDIR)/browse.h $(SRCDIR)/config.h
666 $(XTCC) -o $(OBJDIR)/browse.o -c $(OBJDIR)/browse_.c
667
668 $(OBJDIR)/browse.h: $(OBJDIR)/headers
669
670 $(OBJDIR)/builtin_.c: $(SRCDIR)/builtin.c $(OBJDIR)/translate
671 $(OBJDIR)/translate $(SRCDIR)/builtin.c >$@
672
673 $(OBJDIR)/builtin.o: $(OBJDIR)/builtin_.c $(OBJDIR)/builtin.h $(OBJDIR)/builtin_data.h $(SRCDIR)/config.h
674 $(XTCC) -o $(OBJDIR)/builtin.o -c $(OBJDIR)/builtin_.c
675
676 $(OBJDIR)/builtin.h: $(OBJDIR)/headers
677
678 $(OBJDIR)/bundle_.c: $(SRCDIR)/bundle.c $(OBJDIR)/translate
679 $(OBJDIR)/translate $(SRCDIR)/bundle.c >$@
680
681 $(OBJDIR)/bundle.o: $(OBJDIR)/bundle_.c $(OBJDIR)/bundle.h $(SRCDIR)/config.h
682 $(XTCC) -o $(OBJDIR)/bundle.o -c $(OBJDIR)/bundle_.c
683
684 $(OBJDIR)/bundle.h: $(OBJDIR)/headers
685
686 $(OBJDIR)/cache_.c: $(SRCDIR)/cache.c $(OBJDIR)/translate
687 $(OBJDIR)/translate $(SRCDIR)/cache.c >$@
688
689 $(OBJDIR)/cache.o: $(OBJDIR)/cache_.c $(OBJDIR)/cache.h $(SRCDIR)/config.h
690 $(XTCC) -o $(OBJDIR)/cache.o -c $(OBJDIR)/cache_.c
691
692 $(OBJDIR)/cache.h: $(OBJDIR)/headers
693
694 $(OBJDIR)/captcha_.c: $(SRCDIR)/captcha.c $(OBJDIR)/translate
695 $(OBJDIR)/translate $(SRCDIR)/captcha.c >$@
696
697 $(OBJDIR)/captcha.o: $(OBJDIR)/captcha_.c $(OBJDIR)/captcha.h $(SRCDIR)/config.h
698 $(XTCC) -o $(OBJDIR)/captcha.o -c $(OBJDIR)/captcha_.c
699
700 $(OBJDIR)/captcha.h: $(OBJDIR)/headers
701
702 $(OBJDIR)/cgi_.c: $(SRCDIR)/cgi.c $(OBJDIR)/translate
703 $(OBJDIR)/translate $(SRCDIR)/cgi.c >$@
704
705 $(OBJDIR)/cgi.o: $(OBJDIR)/cgi_.c $(OBJDIR)/cgi.h $(SRCDIR)/config.h
706 $(XTCC) -o $(OBJDIR)/cgi.o -c $(OBJDIR)/cgi_.c
707
708 $(OBJDIR)/cgi.h: $(OBJDIR)/headers
709
710 $(OBJDIR)/checkin_.c: $(SRCDIR)/checkin.c $(OBJDIR)/translate
711 $(OBJDIR)/translate $(SRCDIR)/checkin.c >$@
712
713 $(OBJDIR)/checkin.o: $(OBJDIR)/checkin_.c $(OBJDIR)/checkin.h $(SRCDIR)/config.h
714 $(XTCC) -o $(OBJDIR)/checkin.o -c $(OBJDIR)/checkin_.c
715
716 $(OBJDIR)/checkin.h: $(OBJDIR)/headers
717
718 $(OBJDIR)/checkout_.c: $(SRCDIR)/checkout.c $(OBJDIR)/translate
719 $(OBJDIR)/translate $(SRCDIR)/checkout.c >$@
720
721 $(OBJDIR)/checkout.o: $(OBJDIR)/checkout_.c $(OBJDIR)/checkout.h $(SRCDIR)/config.h
722 $(XTCC) -o $(OBJDIR)/checkout.o -c $(OBJDIR)/checkout_.c
723
724 $(OBJDIR)/checkout.h: $(OBJDIR)/headers
725
726 $(OBJDIR)/clearsign_.c: $(SRCDIR)/clearsign.c $(OBJDIR)/translate
727 $(OBJDIR)/translate $(SRCDIR)/clearsign.c >$@
728
729 $(OBJDIR)/clearsign.o: $(OBJDIR)/clearsign_.c $(OBJDIR)/clearsign.h $(SRCDIR)/config.h
730 $(XTCC) -o $(OBJDIR)/clearsign.o -c $(OBJDIR)/clearsign_.c
731
732 $(OBJDIR)/clearsign.h: $(OBJDIR)/headers
733
734 $(OBJDIR)/clone_.c: $(SRCDIR)/clone.c $(OBJDIR)/translate
735 $(OBJDIR)/translate $(SRCDIR)/clone.c >$@
736
737 $(OBJDIR)/clone.o: $(OBJDIR)/clone_.c $(OBJDIR)/clone.h $(SRCDIR)/config.h
738 $(XTCC) -o $(OBJDIR)/clone.o -c $(OBJDIR)/clone_.c
739
740 $(OBJDIR)/clone.h: $(OBJDIR)/headers
741
742 $(OBJDIR)/comformat_.c: $(SRCDIR)/comformat.c $(OBJDIR)/translate
743 $(OBJDIR)/translate $(SRCDIR)/comformat.c >$@
744
745 $(OBJDIR)/comformat.o: $(OBJDIR)/comformat_.c $(OBJDIR)/comformat.h $(SRCDIR)/config.h
746 $(XTCC) -o $(OBJDIR)/comformat.o -c $(OBJDIR)/comformat_.c
747
748 $(OBJDIR)/comformat.h: $(OBJDIR)/headers
749
750 $(OBJDIR)/configure_.c: $(SRCDIR)/configure.c $(OBJDIR)/translate
751 $(OBJDIR)/translate $(SRCDIR)/configure.c >$@
752
753 $(OBJDIR)/configure.o: $(OBJDIR)/configure_.c $(OBJDIR)/configure.h $(SRCDIR)/config.h
754 $(XTCC) -o $(OBJDIR)/configure.o -c $(OBJDIR)/configure_.c
755
756 $(OBJDIR)/configure.h: $(OBJDIR)/headers
757
758 $(OBJDIR)/content_.c: $(SRCDIR)/content.c $(OBJDIR)/translate
759 $(OBJDIR)/translate $(SRCDIR)/content.c >$@
760
761 $(OBJDIR)/content.o: $(OBJDIR)/content_.c $(OBJDIR)/content.h $(SRCDIR)/config.h
762 $(XTCC) -o $(OBJDIR)/content.o -c $(OBJDIR)/content_.c
763
764 $(OBJDIR)/content.h: $(OBJDIR)/headers
765
766 $(OBJDIR)/db_.c: $(SRCDIR)/db.c $(OBJDIR)/translate
767 $(OBJDIR)/translate $(SRCDIR)/db.c >$@
768
769 $(OBJDIR)/db.o: $(OBJDIR)/db_.c $(OBJDIR)/db.h $(SRCDIR)/config.h
770 $(XTCC) -o $(OBJDIR)/db.o -c $(OBJDIR)/db_.c
771
772 $(OBJDIR)/db.h: $(OBJDIR)/headers
773
774 $(OBJDIR)/delta_.c: $(SRCDIR)/delta.c $(OBJDIR)/translate
775 $(OBJDIR)/translate $(SRCDIR)/delta.c >$@
776
777 $(OBJDIR)/delta.o: $(OBJDIR)/delta_.c $(OBJDIR)/delta.h $(SRCDIR)/config.h
778 $(XTCC) -o $(OBJDIR)/delta.o -c $(OBJDIR)/delta_.c
779
780 $(OBJDIR)/delta.h: $(OBJDIR)/headers
781
782 $(OBJDIR)/deltacmd_.c: $(SRCDIR)/deltacmd.c $(OBJDIR)/translate
783 $(OBJDIR)/translate $(SRCDIR)/deltacmd.c >$@
784
785 $(OBJDIR)/deltacmd.o: $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h $(SRCDIR)/config.h
786 $(XTCC) -o $(OBJDIR)/deltacmd.o -c $(OBJDIR)/deltacmd_.c
787
788 $(OBJDIR)/deltacmd.h: $(OBJDIR)/headers
789
790 $(OBJDIR)/descendants_.c: $(SRCDIR)/descendants.c $(OBJDIR)/translate
791 $(OBJDIR)/translate $(SRCDIR)/descendants.c >$@
792
793 $(OBJDIR)/descendants.o: $(OBJDIR)/descendants_.c $(OBJDIR)/descendants.h $(SRCDIR)/config.h
794 $(XTCC) -o $(OBJDIR)/descendants.o -c $(OBJDIR)/descendants_.c
795
796 $(OBJDIR)/descendants.h: $(OBJDIR)/headers
797
798 $(OBJDIR)/diff_.c: $(SRCDIR)/diff.c $(OBJDIR)/translate
799 $(OBJDIR)/translate $(SRCDIR)/diff.c >$@
800
801 $(OBJDIR)/diff.o: $(OBJDIR)/diff_.c $(OBJDIR)/diff.h $(SRCDIR)/config.h
802 $(XTCC) -o $(OBJDIR)/diff.o -c $(OBJDIR)/diff_.c
803
804 $(OBJDIR)/diff.h: $(OBJDIR)/headers
805
806 $(OBJDIR)/diffcmd_.c: $(SRCDIR)/diffcmd.c $(OBJDIR)/translate
807 $(OBJDIR)/translate $(SRCDIR)/diffcmd.c >$@
808
809 $(OBJDIR)/diffcmd.o: $(OBJDIR)/diffcmd_.c $(OBJDIR)/diffcmd.h $(SRCDIR)/config.h
810 $(XTCC) -o $(OBJDIR)/diffcmd.o -c $(OBJDIR)/diffcmd_.c
811
812 $(OBJDIR)/diffcmd.h: $(OBJDIR)/headers
813
814 $(OBJDIR)/doc_.c: $(SRCDIR)/doc.c $(OBJDIR)/translate
815 $(OBJDIR)/translate $(SRCDIR)/doc.c >$@
816
817 $(OBJDIR)/doc.o: $(OBJDIR)/doc_.c $(OBJDIR)/doc.h $(SRCDIR)/config.h
818 $(XTCC) -o $(OBJDIR)/doc.o -c $(OBJDIR)/doc_.c
819
820 $(OBJDIR)/doc.h: $(OBJDIR)/headers
821
822 $(OBJDIR)/encode_.c: $(SRCDIR)/encode.c $(OBJDIR)/translate
823 $(OBJDIR)/translate $(SRCDIR)/encode.c >$@
824
825 $(OBJDIR)/encode.o: $(OBJDIR)/encode_.c $(OBJDIR)/encode.h $(SRCDIR)/config.h
826 $(XTCC) -o $(OBJDIR)/encode.o -c $(OBJDIR)/encode_.c
827
828 $(OBJDIR)/encode.h: $(OBJDIR)/headers
829
830 $(OBJDIR)/event_.c: $(SRCDIR)/event.c $(OBJDIR)/translate
831 $(OBJDIR)/translate $(SRCDIR)/event.c >$@
832
833 $(OBJDIR)/event.o: $(OBJDIR)/event_.c $(OBJDIR)/event.h $(SRCDIR)/config.h
834 $(XTCC) -o $(OBJDIR)/event.o -c $(OBJDIR)/event_.c
835
836 $(OBJDIR)/event.h: $(OBJDIR)/headers
837
838 $(OBJDIR)/export_.c: $(SRCDIR)/export.c $(OBJDIR)/translate
839 $(OBJDIR)/translate $(SRCDIR)/export.c >$@
840
841 $(OBJDIR)/export.o: $(OBJDIR)/export_.c $(OBJDIR)/export.h $(SRCDIR)/config.h
842 $(XTCC) -o $(OBJDIR)/export.o -c $(OBJDIR)/export_.c
843
844 $(OBJDIR)/export.h: $(OBJDIR)/headers
845
846 $(OBJDIR)/file_.c: $(SRCDIR)/file.c $(OBJDIR)/translate
847 $(OBJDIR)/translate $(SRCDIR)/file.c >$@
848
849 $(OBJDIR)/file.o: $(OBJDIR)/file_.c $(OBJDIR)/file.h $(SRCDIR)/config.h
850 $(XTCC) -o $(OBJDIR)/file.o -c $(OBJDIR)/file_.c
851
852 $(OBJDIR)/file.h: $(OBJDIR)/headers
853
854 $(OBJDIR)/finfo_.c: $(SRCDIR)/finfo.c $(OBJDIR)/translate
855 $(OBJDIR)/translate $(SRCDIR)/finfo.c >$@
856
857 $(OBJDIR)/finfo.o: $(OBJDIR)/finfo_.c $(OBJDIR)/finfo.h $(SRCDIR)/config.h
858 $(XTCC) -o $(OBJDIR)/finfo.o -c $(OBJDIR)/finfo_.c
859
860 $(OBJDIR)/finfo.h: $(OBJDIR)/headers
861
862 $(OBJDIR)/foci_.c: $(SRCDIR)/foci.c $(OBJDIR)/translate
863 $(OBJDIR)/translate $(SRCDIR)/foci.c >$@
864
865 $(OBJDIR)/foci.o: $(OBJDIR)/foci_.c $(OBJDIR)/foci.h $(SRCDIR)/config.h
866 $(XTCC) -o $(OBJDIR)/foci.o -c $(OBJDIR)/foci_.c
867
868 $(OBJDIR)/foci.h: $(OBJDIR)/headers
869
870 $(OBJDIR)/fusefs_.c: $(SRCDIR)/fusefs.c $(OBJDIR)/translate
871 $(OBJDIR)/translate $(SRCDIR)/fusefs.c >$@
872
873 $(OBJDIR)/fusefs.o: $(OBJDIR)/fusefs_.c $(OBJDIR)/fusefs.h $(SRCDIR)/config.h
874 $(XTCC) -o $(OBJDIR)/fusefs.o -c $(OBJDIR)/fusefs_.c
875
876 $(OBJDIR)/fusefs.h: $(OBJDIR)/headers
877
878 $(OBJDIR)/glob_.c: $(SRCDIR)/glob.c $(OBJDIR)/translate
879 $(OBJDIR)/translate $(SRCDIR)/glob.c >$@
880
881 $(OBJDIR)/glob.o: $(OBJDIR)/glob_.c $(OBJDIR)/glob.h $(SRCDIR)/config.h
882 $(XTCC) -o $(OBJDIR)/glob.o -c $(OBJDIR)/glob_.c
883
884 $(OBJDIR)/glob.h: $(OBJDIR)/headers
885
886 $(OBJDIR)/graph_.c: $(SRCDIR)/graph.c $(OBJDIR)/translate
887 $(OBJDIR)/translate $(SRCDIR)/graph.c >$@
888
889 $(OBJDIR)/graph.o: $(OBJDIR)/graph_.c $(OBJDIR)/graph.h $(SRCDIR)/config.h
890 $(XTCC) -o $(OBJDIR)/graph.o -c $(OBJDIR)/graph_.c
891
892 $(OBJDIR)/graph.h: $(OBJDIR)/headers
893
894 $(OBJDIR)/gzip_.c: $(SRCDIR)/gzip.c $(OBJDIR)/translate
895 $(OBJDIR)/translate $(SRCDIR)/gzip.c >$@
896
897 $(OBJDIR)/gzip.o: $(OBJDIR)/gzip_.c $(OBJDIR)/gzip.h $(SRCDIR)/config.h
898 $(XTCC) -o $(OBJDIR)/gzip.o -c $(OBJDIR)/gzip_.c
899
900 $(OBJDIR)/gzip.h: $(OBJDIR)/headers
901
902 $(OBJDIR)/http_.c: $(SRCDIR)/http.c $(OBJDIR)/translate
903 $(OBJDIR)/translate $(SRCDIR)/http.c >$@
904
905 $(OBJDIR)/http.o: $(OBJDIR)/http_.c $(OBJDIR)/http.h $(SRCDIR)/config.h
906 $(XTCC) -o $(OBJDIR)/http.o -c $(OBJDIR)/http_.c
907
908 $(OBJDIR)/http.h: $(OBJDIR)/headers
909
910 $(OBJDIR)/http_socket_.c: $(SRCDIR)/http_socket.c $(OBJDIR)/translate
911 $(OBJDIR)/translate $(SRCDIR)/http_socket.c >$@
912
913 $(OBJDIR)/http_socket.o: $(OBJDIR)/http_socket_.c $(OBJDIR)/http_socket.h $(SRCDIR)/config.h
914 $(XTCC) -o $(OBJDIR)/http_socket.o -c $(OBJDIR)/http_socket_.c
915
916 $(OBJDIR)/http_socket.h: $(OBJDIR)/headers
917
918 $(OBJDIR)/http_ssl_.c: $(SRCDIR)/http_ssl.c $(OBJDIR)/translate
919 $(OBJDIR)/translate $(SRCDIR)/http_ssl.c >$@
920
921 $(OBJDIR)/http_ssl.o: $(OBJDIR)/http_ssl_.c $(OBJDIR)/http_ssl.h $(SRCDIR)/config.h
922 $(XTCC) -o $(OBJDIR)/http_ssl.o -c $(OBJDIR)/http_ssl_.c
923
924 $(OBJDIR)/http_ssl.h: $(OBJDIR)/headers
925
926 $(OBJDIR)/http_transport_.c: $(SRCDIR)/http_transport.c $(OBJDIR)/translate
927 $(OBJDIR)/translate $(SRCDIR)/http_transport.c >$@
928
929 $(OBJDIR)/http_transport.o: $(OBJDIR)/http_transport_.c $(OBJDIR)/http_transport.h $(SRCDIR)/config.h
930 $(XTCC) -o $(OBJDIR)/http_transport.o -c $(OBJDIR)/http_transport_.c
931
932 $(OBJDIR)/http_transport.h: $(OBJDIR)/headers
933
934 $(OBJDIR)/import_.c: $(SRCDIR)/import.c $(OBJDIR)/translate
935 $(OBJDIR)/translate $(SRCDIR)/import.c >$@
936
937 $(OBJDIR)/import.o: $(OBJDIR)/import_.c $(OBJDIR)/import.h $(SRCDIR)/config.h
938 $(XTCC) -o $(OBJDIR)/import.o -c $(OBJDIR)/import_.c
939
940 $(OBJDIR)/import.h: $(OBJDIR)/headers
941
942 $(OBJDIR)/info_.c: $(SRCDIR)/info.c $(OBJDIR)/translate
943 $(OBJDIR)/translate $(SRCDIR)/info.c >$@
944
945 $(OBJDIR)/info.o: $(OBJDIR)/info_.c $(OBJDIR)/info.h $(SRCDIR)/config.h
946 $(XTCC) -o $(OBJDIR)/info.o -c $(OBJDIR)/info_.c
947
948 $(OBJDIR)/info.h: $(OBJDIR)/headers
949
950 $(OBJDIR)/json_.c: $(SRCDIR)/json.c $(OBJDIR)/translate
951 $(OBJDIR)/translate $(SRCDIR)/json.c >$@
952
953 $(OBJDIR)/json.o: $(OBJDIR)/json_.c $(OBJDIR)/json.h $(SRCDIR)/config.h
954 $(XTCC) -o $(OBJDIR)/json.o -c $(OBJDIR)/json_.c
955
956 $(OBJDIR)/json.h: $(OBJDIR)/headers
957
958 $(OBJDIR)/json_artifact_.c: $(SRCDIR)/json_artifact.c $(OBJDIR)/translate
959 $(OBJDIR)/translate $(SRCDIR)/json_artifact.c >$@
960
961 $(OBJDIR)/json_artifact.o: $(OBJDIR)/json_artifact_.c $(OBJDIR)/json_artifact.h $(SRCDIR)/config.h
962 $(XTCC) -o $(OBJDIR)/json_artifact.o -c $(OBJDIR)/json_artifact_.c
963
964 $(OBJDIR)/json_artifact.h: $(OBJDIR)/headers
965
966 $(OBJDIR)/json_branch_.c: $(SRCDIR)/json_branch.c $(OBJDIR)/translate
967 $(OBJDIR)/translate $(SRCDIR)/json_branch.c >$@
968
969 $(OBJDIR)/json_branch.o: $(OBJDIR)/json_branch_.c $(OBJDIR)/json_branch.h $(SRCDIR)/config.h
970 $(XTCC) -o $(OBJDIR)/json_branch.o -c $(OBJDIR)/json_branch_.c
971
972 $(OBJDIR)/json_branch.h: $(OBJDIR)/headers
973
974 $(OBJDIR)/json_config_.c: $(SRCDIR)/json_config.c $(OBJDIR)/translate
975 $(OBJDIR)/translate $(SRCDIR)/json_config.c >$@
976
977 $(OBJDIR)/json_config.o: $(OBJDIR)/json_config_.c $(OBJDIR)/json_config.h $(SRCDIR)/config.h
978 $(XTCC) -o $(OBJDIR)/json_config.o -c $(OBJDIR)/json_config_.c
979
980 $(OBJDIR)/json_config.h: $(OBJDIR)/headers
981
982 $(OBJDIR)/json_diff_.c: $(SRCDIR)/json_diff.c $(OBJDIR)/translate
983 $(OBJDIR)/translate $(SRCDIR)/json_diff.c >$@
984
985 $(OBJDIR)/json_diff.o: $(OBJDIR)/json_diff_.c $(OBJDIR)/json_diff.h $(SRCDIR)/config.h
986 $(XTCC) -o $(OBJDIR)/json_diff.o -c $(OBJDIR)/json_diff_.c
987
988 $(OBJDIR)/json_diff.h: $(OBJDIR)/headers
989
990 $(OBJDIR)/json_dir_.c: $(SRCDIR)/json_dir.c $(OBJDIR)/translate
991 $(OBJDIR)/translate $(SRCDIR)/json_dir.c >$@
992
993 $(OBJDIR)/json_dir.o: $(OBJDIR)/json_dir_.c $(OBJDIR)/json_dir.h $(SRCDIR)/config.h
994 $(XTCC) -o $(OBJDIR)/json_dir.o -c $(OBJDIR)/json_dir_.c
995
996 $(OBJDIR)/json_dir.h: $(OBJDIR)/headers
997
998 $(OBJDIR)/json_finfo_.c: $(SRCDIR)/json_finfo.c $(OBJDIR)/translate
999 $(OBJDIR)/translate $(SRCDIR)/json_finfo.c >$@
1000
1001 $(OBJDIR)/json_finfo.o: $(OBJDIR)/json_finfo_.c $(OBJDIR)/json_finfo.h $(SRCDIR)/config.h
1002 $(XTCC) -o $(OBJDIR)/json_finfo.o -c $(OBJDIR)/json_finfo_.c
1003
1004 $(OBJDIR)/json_finfo.h: $(OBJDIR)/headers
1005
1006 $(OBJDIR)/json_login_.c: $(SRCDIR)/json_login.c $(OBJDIR)/translate
1007 $(OBJDIR)/translate $(SRCDIR)/json_login.c >$@
1008
1009 $(OBJDIR)/json_login.o: $(OBJDIR)/json_login_.c $(OBJDIR)/json_login.h $(SRCDIR)/config.h
1010 $(XTCC) -o $(OBJDIR)/json_login.o -c $(OBJDIR)/json_login_.c
1011
1012 $(OBJDIR)/json_login.h: $(OBJDIR)/headers
1013
1014 $(OBJDIR)/json_query_.c: $(SRCDIR)/json_query.c $(OBJDIR)/translate
1015 $(OBJDIR)/translate $(SRCDIR)/json_query.c >$@
1016
1017 $(OBJDIR)/json_query.o: $(OBJDIR)/json_query_.c $(OBJDIR)/json_query.h $(SRCDIR)/config.h
1018 $(XTCC) -o $(OBJDIR)/json_query.o -c $(OBJDIR)/json_query_.c
1019
1020 $(OBJDIR)/json_query.h: $(OBJDIR)/headers
1021
1022 $(OBJDIR)/json_report_.c: $(SRCDIR)/json_report.c $(OBJDIR)/translate
1023 $(OBJDIR)/translate $(SRCDIR)/json_report.c >$@
1024
1025 $(OBJDIR)/json_report.o: $(OBJDIR)/json_report_.c $(OBJDIR)/json_report.h $(SRCDIR)/config.h
1026 $(XTCC) -o $(OBJDIR)/json_report.o -c $(OBJDIR)/json_report_.c
1027
1028 $(OBJDIR)/json_report.h: $(OBJDIR)/headers
1029
1030 $(OBJDIR)/json_status_.c: $(SRCDIR)/json_status.c $(OBJDIR)/translate
1031 $(OBJDIR)/translate $(SRCDIR)/json_status.c >$@
1032
1033 $(OBJDIR)/json_status.o: $(OBJDIR)/json_status_.c $(OBJDIR)/json_status.h $(SRCDIR)/config.h
1034 $(XTCC) -o $(OBJDIR)/json_status.o -c $(OBJDIR)/json_status_.c
1035
1036 $(OBJDIR)/json_status.h: $(OBJDIR)/headers
1037
1038 $(OBJDIR)/json_tag_.c: $(SRCDIR)/json_tag.c $(OBJDIR)/translate
1039 $(OBJDIR)/translate $(SRCDIR)/json_tag.c >$@
1040
1041 $(OBJDIR)/json_tag.o: $(OBJDIR)/json_tag_.c $(OBJDIR)/json_tag.h $(SRCDIR)/config.h
1042 $(XTCC) -o $(OBJDIR)/json_tag.o -c $(OBJDIR)/json_tag_.c
1043
1044 $(OBJDIR)/json_tag.h: $(OBJDIR)/headers
1045
1046 $(OBJDIR)/json_timeline_.c: $(SRCDIR)/json_timeline.c $(OBJDIR)/translate
1047 $(OBJDIR)/translate $(SRCDIR)/json_timeline.c >$@
1048
1049 $(OBJDIR)/json_timeline.o: $(OBJDIR)/json_timeline_.c $(OBJDIR)/json_timeline.h $(SRCDIR)/config.h
1050 $(XTCC) -o $(OBJDIR)/json_timeline.o -c $(OBJDIR)/json_timeline_.c
1051
1052 $(OBJDIR)/json_timeline.h: $(OBJDIR)/headers
1053
1054 $(OBJDIR)/json_user_.c: $(SRCDIR)/json_user.c $(OBJDIR)/translate
1055 $(OBJDIR)/translate $(SRCDIR)/json_user.c >$@
1056
1057 $(OBJDIR)/json_user.o: $(OBJDIR)/json_user_.c $(OBJDIR)/json_user.h $(SRCDIR)/config.h
1058 $(XTCC) -o $(OBJDIR)/json_user.o -c $(OBJDIR)/json_user_.c
1059
1060 $(OBJDIR)/json_user.h: $(OBJDIR)/headers
1061
1062 $(OBJDIR)/json_wiki_.c: $(SRCDIR)/json_wiki.c $(OBJDIR)/translate
1063 $(OBJDIR)/translate $(SRCDIR)/json_wiki.c >$@
1064
1065 $(OBJDIR)/json_wiki.o: $(OBJDIR)/json_wiki_.c $(OBJDIR)/json_wiki.h $(SRCDIR)/config.h
1066 $(XTCC) -o $(OBJDIR)/json_wiki.o -c $(OBJDIR)/json_wiki_.c
1067
1068 $(OBJDIR)/json_wiki.h: $(OBJDIR)/headers
1069
1070 $(OBJDIR)/leaf_.c: $(SRCDIR)/leaf.c $(OBJDIR)/translate
1071 $(OBJDIR)/translate $(SRCDIR)/leaf.c >$@
1072
1073 $(OBJDIR)/leaf.o: $(OBJDIR)/leaf_.c $(OBJDIR)/leaf.h $(SRCDIR)/config.h
1074 $(XTCC) -o $(OBJDIR)/leaf.o -c $(OBJDIR)/leaf_.c
1075
1076 $(OBJDIR)/leaf.h: $(OBJDIR)/headers
1077
1078 $(OBJDIR)/loadctrl_.c: $(SRCDIR)/loadctrl.c $(OBJDIR)/translate
1079 $(OBJDIR)/translate $(SRCDIR)/loadctrl.c >$@
1080
1081 $(OBJDIR)/loadctrl.o: $(OBJDIR)/loadctrl_.c $(OBJDIR)/loadctrl.h $(SRCDIR)/config.h
1082 $(XTCC) -o $(OBJDIR)/loadctrl.o -c $(OBJDIR)/loadctrl_.c
1083
1084 $(OBJDIR)/loadctrl.h: $(OBJDIR)/headers
1085
1086 $(OBJDIR)/login_.c: $(SRCDIR)/login.c $(OBJDIR)/translate
1087 $(OBJDIR)/translate $(SRCDIR)/login.c >$@
1088
1089 $(OBJDIR)/login.o: $(OBJDIR)/login_.c $(OBJDIR)/login.h $(SRCDIR)/config.h
1090 $(XTCC) -o $(OBJDIR)/login.o -c $(OBJDIR)/login_.c
1091
1092 $(OBJDIR)/login.h: $(OBJDIR)/headers
1093
1094 $(OBJDIR)/lookslike_.c: $(SRCDIR)/lookslike.c $(OBJDIR)/translate
1095 $(OBJDIR)/translate $(SRCDIR)/lookslike.c >$@
1096
1097 $(OBJDIR)/lookslike.o: $(OBJDIR)/lookslike_.c $(OBJDIR)/lookslike.h $(SRCDIR)/config.h
1098 $(XTCC) -o $(OBJDIR)/lookslike.o -c $(OBJDIR)/lookslike_.c
1099
1100 $(OBJDIR)/lookslike.h: $(OBJDIR)/headers
1101
1102 $(OBJDIR)/main_.c: $(SRCDIR)/main.c $(OBJDIR)/translate
1103 $(OBJDIR)/translate $(SRCDIR)/main.c >$@
1104
1105 $(OBJDIR)/main.o: $(OBJDIR)/main_.c $(OBJDIR)/main.h $(OBJDIR)/page_index.h $(SRCDIR)/config.h
1106 $(XTCC) -o $(OBJDIR)/main.o -c $(OBJDIR)/main_.c
1107
1108 $(OBJDIR)/main.h: $(OBJDIR)/headers
1109
1110 $(OBJDIR)/manifest_.c: $(SRCDIR)/manifest.c $(OBJDIR)/translate
1111 $(OBJDIR)/translate $(SRCDIR)/manifest.c >$@
1112
1113 $(OBJDIR)/manifest.o: $(OBJDIR)/manifest_.c $(OBJDIR)/manifest.h $(SRCDIR)/config.h
1114 $(XTCC) -o $(OBJDIR)/manifest.o -c $(OBJDIR)/manifest_.c
1115
1116 $(OBJDIR)/manifest.h: $(OBJDIR)/headers
1117
1118 $(OBJDIR)/markdown_.c: $(SRCDIR)/markdown.c $(OBJDIR)/translate
1119 $(OBJDIR)/translate $(SRCDIR)/markdown.c >$@
1120
1121 $(OBJDIR)/markdown.o: $(OBJDIR)/markdown_.c $(OBJDIR)/markdown.h $(SRCDIR)/config.h
1122 $(XTCC) -o $(OBJDIR)/markdown.o -c $(OBJDIR)/markdown_.c
1123
1124 $(OBJDIR)/markdown.h: $(OBJDIR)/headers
1125
1126 $(OBJDIR)/markdown_html_.c: $(SRCDIR)/markdown_html.c $(OBJDIR)/translate
1127 $(OBJDIR)/translate $(SRCDIR)/markdown_html.c >$@
1128
1129 $(OBJDIR)/markdown_html.o: $(OBJDIR)/markdown_html_.c $(OBJDIR)/markdown_html.h $(SRCDIR)/config.h
1130 $(XTCC) -o $(OBJDIR)/markdown_html.o -c $(OBJDIR)/markdown_html_.c
1131
1132 $(OBJDIR)/markdown_html.h: $(OBJDIR)/headers
1133
1134 $(OBJDIR)/md5_.c: $(SRCDIR)/md5.c $(OBJDIR)/translate
1135 $(OBJDIR)/translate $(SRCDIR)/md5.c >$@
1136
1137 $(OBJDIR)/md5.o: $(OBJDIR)/md5_.c $(OBJDIR)/md5.h $(SRCDIR)/config.h
1138 $(XTCC) -o $(OBJDIR)/md5.o -c $(OBJDIR)/md5_.c
1139
1140 $(OBJDIR)/md5.h: $(OBJDIR)/headers
1141
1142 $(OBJDIR)/merge_.c: $(SRCDIR)/merge.c $(OBJDIR)/translate
1143 $(OBJDIR)/translate $(SRCDIR)/merge.c >$@
1144
1145 $(OBJDIR)/merge.o: $(OBJDIR)/merge_.c $(OBJDIR)/merge.h $(SRCDIR)/config.h
1146 $(XTCC) -o $(OBJDIR)/merge.o -c $(OBJDIR)/merge_.c
1147
1148 $(OBJDIR)/merge.h: $(OBJDIR)/headers
1149
1150 $(OBJDIR)/merge3_.c: $(SRCDIR)/merge3.c $(OBJDIR)/translate
1151 $(OBJDIR)/translate $(SRCDIR)/merge3.c >$@
1152
1153 $(OBJDIR)/merge3.o: $(OBJDIR)/merge3_.c $(OBJDIR)/merge3.h $(SRCDIR)/config.h
1154 $(XTCC) -o $(OBJDIR)/merge3.o -c $(OBJDIR)/merge3_.c
1155
1156 $(OBJDIR)/merge3.h: $(OBJDIR)/headers
1157
1158 $(OBJDIR)/moderate_.c: $(SRCDIR)/moderate.c $(OBJDIR)/translate
1159 $(OBJDIR)/translate $(SRCDIR)/moderate.c >$@
1160
1161 $(OBJDIR)/moderate.o: $(OBJDIR)/moderate_.c $(OBJDIR)/moderate.h $(SRCDIR)/config.h
1162 $(XTCC) -o $(OBJDIR)/moderate.o -c $(OBJDIR)/moderate_.c
1163
1164 $(OBJDIR)/moderate.h: $(OBJDIR)/headers
1165
1166 $(OBJDIR)/name_.c: $(SRCDIR)/name.c $(OBJDIR)/translate
1167 $(OBJDIR)/translate $(SRCDIR)/name.c >$@
1168
1169 $(OBJDIR)/name.o: $(OBJDIR)/name_.c $(OBJDIR)/name.h $(SRCDIR)/config.h
1170 $(XTCC) -o $(OBJDIR)/name.o -c $(OBJDIR)/name_.c
1171
1172 $(OBJDIR)/name.h: $(OBJDIR)/headers
1173
1174 $(OBJDIR)/path_.c: $(SRCDIR)/path.c $(OBJDIR)/translate
1175 $(OBJDIR)/translate $(SRCDIR)/path.c >$@
1176
1177 $(OBJDIR)/path.o: $(OBJDIR)/path_.c $(OBJDIR)/path.h $(SRCDIR)/config.h
1178 $(XTCC) -o $(OBJDIR)/path.o -c $(OBJDIR)/path_.c
1179
1180 $(OBJDIR)/path.h: $(OBJDIR)/headers
1181
1182 $(OBJDIR)/pivot_.c: $(SRCDIR)/pivot.c $(OBJDIR)/translate
1183 $(OBJDIR)/translate $(SRCDIR)/pivot.c >$@
1184
1185 $(OBJDIR)/pivot.o: $(OBJDIR)/pivot_.c $(OBJDIR)/pivot.h $(SRCDIR)/config.h
1186 $(XTCC) -o $(OBJDIR)/pivot.o -c $(OBJDIR)/pivot_.c
1187
1188 $(OBJDIR)/pivot.h: $(OBJDIR)/headers
1189
1190 $(OBJDIR)/popen_.c: $(SRCDIR)/popen.c $(OBJDIR)/translate
1191 $(OBJDIR)/translate $(SRCDIR)/popen.c >$@
1192
1193 $(OBJDIR)/popen.o: $(OBJDIR)/popen_.c $(OBJDIR)/popen.h $(SRCDIR)/config.h
1194 $(XTCC) -o $(OBJDIR)/popen.o -c $(OBJDIR)/popen_.c
1195
1196 $(OBJDIR)/popen.h: $(OBJDIR)/headers
1197
1198 $(OBJDIR)/pqueue_.c: $(SRCDIR)/pqueue.c $(OBJDIR)/translate
1199 $(OBJDIR)/translate $(SRCDIR)/pqueue.c >$@
1200
1201 $(OBJDIR)/pqueue.o: $(OBJDIR)/pqueue_.c $(OBJDIR)/pqueue.h $(SRCDIR)/config.h
1202 $(XTCC) -o $(OBJDIR)/pqueue.o -c $(OBJDIR)/pqueue_.c
1203
1204 $(OBJDIR)/pqueue.h: $(OBJDIR)/headers
1205
1206 $(OBJDIR)/printf_.c: $(SRCDIR)/printf.c $(OBJDIR)/translate
1207 $(OBJDIR)/translate $(SRCDIR)/printf.c >$@
1208
1209 $(OBJDIR)/printf.o: $(OBJDIR)/printf_.c $(OBJDIR)/printf.h $(SRCDIR)/config.h
1210 $(XTCC) -o $(OBJDIR)/printf.o -c $(OBJDIR)/printf_.c
1211
1212 $(OBJDIR)/printf.h: $(OBJDIR)/headers
1213
1214 $(OBJDIR)/publish_.c: $(SRCDIR)/publish.c $(OBJDIR)/translate
1215 $(OBJDIR)/translate $(SRCDIR)/publish.c >$@
1216
1217 $(OBJDIR)/publish.o: $(OBJDIR)/publish_.c $(OBJDIR)/publish.h $(SRCDIR)/config.h
1218 $(XTCC) -o $(OBJDIR)/publish.o -c $(OBJDIR)/publish_.c
1219
1220 $(OBJDIR)/publish.h: $(OBJDIR)/headers
1221
1222 $(OBJDIR)/purge_.c: $(SRCDIR)/purge.c $(OBJDIR)/translate
1223 $(OBJDIR)/translate $(SRCDIR)/purge.c >$@
1224
1225 $(OBJDIR)/purge.o: $(OBJDIR)/purge_.c $(OBJDIR)/purge.h $(SRCDIR)/config.h
1226 $(XTCC) -o $(OBJDIR)/purge.o -c $(OBJDIR)/purge_.c
1227
1228 $(OBJDIR)/purge.h: $(OBJDIR)/headers
1229
1230 $(OBJDIR)/rebuild_.c: $(SRCDIR)/rebuild.c $(OBJDIR)/translate
1231 $(OBJDIR)/translate $(SRCDIR)/rebuild.c >$@
1232
1233 $(OBJDIR)/rebuild.o: $(OBJDIR)/rebuild_.c $(OBJDIR)/rebuild.h $(SRCDIR)/config.h
1234 $(XTCC) -o $(OBJDIR)/rebuild.o -c $(OBJDIR)/rebuild_.c
1235
1236 $(OBJDIR)/rebuild.h: $(OBJDIR)/headers
1237
1238 $(OBJDIR)/regexp_.c: $(SRCDIR)/regexp.c $(OBJDIR)/translate
1239 $(OBJDIR)/translate $(SRCDIR)/regexp.c >$@
1240
1241 $(OBJDIR)/regexp.o: $(OBJDIR)/regexp_.c $(OBJDIR)/regexp.h $(SRCDIR)/config.h
1242 $(XTCC) -o $(OBJDIR)/regexp.o -c $(OBJDIR)/regexp_.c
1243
1244 $(OBJDIR)/regexp.h: $(OBJDIR)/headers
1245
1246 $(OBJDIR)/report_.c: $(SRCDIR)/report.c $(OBJDIR)/translate
1247 $(OBJDIR)/translate $(SRCDIR)/report.c >$@
1248
1249 $(OBJDIR)/report.o: $(OBJDIR)/report_.c $(OBJDIR)/report.h $(SRCDIR)/config.h
1250 $(XTCC) -o $(OBJDIR)/report.o -c $(OBJDIR)/report_.c
1251
1252 $(OBJDIR)/report.h: $(OBJDIR)/headers
1253
1254 $(OBJDIR)/rss_.c: $(SRCDIR)/rss.c $(OBJDIR)/translate
1255 $(OBJDIR)/translate $(SRCDIR)/rss.c >$@
1256
1257 $(OBJDIR)/rss.o: $(OBJDIR)/rss_.c $(OBJDIR)/rss.h $(SRCDIR)/config.h
1258 $(XTCC) -o $(OBJDIR)/rss.o -c $(OBJDIR)/rss_.c
1259
1260 $(OBJDIR)/rss.h: $(OBJDIR)/headers
1261
1262 $(OBJDIR)/schema_.c: $(SRCDIR)/schema.c $(OBJDIR)/translate
1263 $(OBJDIR)/translate $(SRCDIR)/schema.c >$@
1264
1265 $(OBJDIR)/schema.o: $(OBJDIR)/schema_.c $(OBJDIR)/schema.h $(SRCDIR)/config.h
1266 $(XTCC) -o $(OBJDIR)/schema.o -c $(OBJDIR)/schema_.c
1267
1268 $(OBJDIR)/schema.h: $(OBJDIR)/headers
1269
1270 $(OBJDIR)/search_.c: $(SRCDIR)/search.c $(OBJDIR)/translate
1271 $(OBJDIR)/translate $(SRCDIR)/search.c >$@
1272
1273 $(OBJDIR)/search.o: $(OBJDIR)/search_.c $(OBJDIR)/search.h $(SRCDIR)/config.h
1274 $(XTCC) -o $(OBJDIR)/search.o -c $(OBJDIR)/search_.c
1275
1276 $(OBJDIR)/search.h: $(OBJDIR)/headers
1277
1278 $(OBJDIR)/setup_.c: $(SRCDIR)/setup.c $(OBJDIR)/translate
1279 $(OBJDIR)/translate $(SRCDIR)/setup.c >$@
1280
1281 $(OBJDIR)/setup.o: $(OBJDIR)/setup_.c $(OBJDIR)/setup.h $(SRCDIR)/config.h
1282 $(XTCC) -o $(OBJDIR)/setup.o -c $(OBJDIR)/setup_.c
1283
1284 $(OBJDIR)/setup.h: $(OBJDIR)/headers
1285
1286 $(OBJDIR)/sha1_.c: $(SRCDIR)/sha1.c $(OBJDIR)/translate
1287 $(OBJDIR)/translate $(SRCDIR)/sha1.c >$@
1288
1289 $(OBJDIR)/sha1.o: $(OBJDIR)/sha1_.c $(OBJDIR)/sha1.h $(SRCDIR)/config.h
1290 $(XTCC) -o $(OBJDIR)/sha1.o -c $(OBJDIR)/sha1_.c
1291
1292 $(OBJDIR)/sha1.h: $(OBJDIR)/headers
1293
1294 $(OBJDIR)/shun_.c: $(SRCDIR)/shun.c $(OBJDIR)/translate
1295 $(OBJDIR)/translate $(SRCDIR)/shun.c >$@
1296
1297 $(OBJDIR)/shun.o: $(OBJDIR)/shun_.c $(OBJDIR)/shun.h $(SRCDIR)/config.h
1298 $(XTCC) -o $(OBJDIR)/shun.o -c $(OBJDIR)/shun_.c
1299
1300 $(OBJDIR)/shun.h: $(OBJDIR)/headers
1301
1302 $(OBJDIR)/skins_.c: $(SRCDIR)/skins.c $(OBJDIR)/translate
1303 $(OBJDIR)/translate $(SRCDIR)/skins.c >$@
1304
1305 $(OBJDIR)/skins.o: $(OBJDIR)/skins_.c $(OBJDIR)/skins.h $(SRCDIR)/config.h
1306 $(XTCC) -o $(OBJDIR)/skins.o -c $(OBJDIR)/skins_.c
1307
1308 $(OBJDIR)/skins.h: $(OBJDIR)/headers
1309
1310 $(OBJDIR)/sqlcmd_.c: $(SRCDIR)/sqlcmd.c $(OBJDIR)/translate
1311 $(OBJDIR)/translate $(SRCDIR)/sqlcmd.c >$@
1312
1313 $(OBJDIR)/sqlcmd.o: $(OBJDIR)/sqlcmd_.c $(OBJDIR)/sqlcmd.h $(SRCDIR)/config.h
1314 $(XTCC) -o $(OBJDIR)/sqlcmd.o -c $(OBJDIR)/sqlcmd_.c
1315
1316 $(OBJDIR)/sqlcmd.h: $(OBJDIR)/headers
1317
1318 $(OBJDIR)/stash_.c: $(SRCDIR)/stash.c $(OBJDIR)/translate
1319 $(OBJDIR)/translate $(SRCDIR)/stash.c >$@
1320
1321 $(OBJDIR)/stash.o: $(OBJDIR)/stash_.c $(OBJDIR)/stash.h $(SRCDIR)/config.h
1322 $(XTCC) -o $(OBJDIR)/stash.o -c $(OBJDIR)/stash_.c
1323
1324 $(OBJDIR)/stash.h: $(OBJDIR)/headers
1325
1326 $(OBJDIR)/stat_.c: $(SRCDIR)/stat.c $(OBJDIR)/translate
1327 $(OBJDIR)/translate $(SRCDIR)/stat.c >$@
1328
1329 $(OBJDIR)/stat.o: $(OBJDIR)/stat_.c $(OBJDIR)/stat.h $(SRCDIR)/config.h
1330 $(XTCC) -o $(OBJDIR)/stat.o -c $(OBJDIR)/stat_.c
1331
1332 $(OBJDIR)/stat.h: $(OBJDIR)/headers
1333
1334 $(OBJDIR)/style_.c: $(SRCDIR)/style.c $(OBJDIR)/translate
1335 $(OBJDIR)/translate $(SRCDIR)/style.c >$@
1336
1337 $(OBJDIR)/style.o: $(OBJDIR)/style_.c $(OBJDIR)/style.h $(SRCDIR)/config.h
1338 $(XTCC) -o $(OBJDIR)/style.o -c $(OBJDIR)/style_.c
1339
1340 $(OBJDIR)/style.h: $(OBJDIR)/headers
1341
1342 $(OBJDIR)/sync_.c: $(SRCDIR)/sync.c $(OBJDIR)/translate
1343 $(OBJDIR)/translate $(SRCDIR)/sync.c >$@
1344
1345 $(OBJDIR)/sync.o: $(OBJDIR)/sync_.c $(OBJDIR)/sync.h $(SRCDIR)/config.h
1346 $(XTCC) -o $(OBJDIR)/sync.o -c $(OBJDIR)/sync_.c
1347
1348 $(OBJDIR)/sync.h: $(OBJDIR)/headers
1349
1350 $(OBJDIR)/tag_.c: $(SRCDIR)/tag.c $(OBJDIR)/translate
1351 $(OBJDIR)/translate $(SRCDIR)/tag.c >$@
1352
1353 $(OBJDIR)/tag.o: $(OBJDIR)/tag_.c $(OBJDIR)/tag.h $(SRCDIR)/config.h
1354 $(XTCC) -o $(OBJDIR)/tag.o -c $(OBJDIR)/tag_.c
1355
1356 $(OBJDIR)/tag.h: $(OBJDIR)/headers
1357
1358 $(OBJDIR)/tar_.c: $(SRCDIR)/tar.c $(OBJDIR)/translate
1359 $(OBJDIR)/translate $(SRCDIR)/tar.c >$@
1360
1361 $(OBJDIR)/tar.o: $(OBJDIR)/tar_.c $(OBJDIR)/tar.h $(SRCDIR)/config.h
1362 $(XTCC) -o $(OBJDIR)/tar.o -c $(OBJDIR)/tar_.c
1363
1364 $(OBJDIR)/tar.h: $(OBJDIR)/headers
1365
1366 $(OBJDIR)/th_main_.c: $(SRCDIR)/th_main.c $(OBJDIR)/translate
1367 $(OBJDIR)/translate $(SRCDIR)/th_main.c >$@
1368
1369 $(OBJDIR)/th_main.o: $(OBJDIR)/th_main_.c $(OBJDIR)/th_main.h $(SRCDIR)/config.h
1370 $(XTCC) -o $(OBJDIR)/th_main.o -c $(OBJDIR)/th_main_.c
1371
1372 $(OBJDIR)/th_main.h: $(OBJDIR)/headers
1373
1374 $(OBJDIR)/timeline_.c: $(SRCDIR)/timeline.c $(OBJDIR)/translate
1375 $(OBJDIR)/translate $(SRCDIR)/timeline.c >$@
1376
1377 $(OBJDIR)/timeline.o: $(OBJDIR)/timeline_.c $(OBJDIR)/timeline.h $(SRCDIR)/config.h
1378 $(XTCC) -o $(OBJDIR)/timeline.o -c $(OBJDIR)/timeline_.c
1379
1380 $(OBJDIR)/timeline.h: $(OBJDIR)/headers
1381
1382 $(OBJDIR)/tkt_.c: $(SRCDIR)/tkt.c $(OBJDIR)/translate
1383 $(OBJDIR)/translate $(SRCDIR)/tkt.c >$@
1384
1385 $(OBJDIR)/tkt.o: $(OBJDIR)/tkt_.c $(OBJDIR)/tkt.h $(SRCDIR)/config.h
1386 $(XTCC) -o $(OBJDIR)/tkt.o -c $(OBJDIR)/tkt_.c
1387
1388 $(OBJDIR)/tkt.h: $(OBJDIR)/headers
1389
1390 $(OBJDIR)/tktsetup_.c: $(SRCDIR)/tktsetup.c $(OBJDIR)/translate
1391 $(OBJDIR)/translate $(SRCDIR)/tktsetup.c >$@
1392
1393 $(OBJDIR)/tktsetup.o: $(OBJDIR)/tktsetup_.c $(OBJDIR)/tktsetup.h $(SRCDIR)/config.h
1394 $(XTCC) -o $(OBJDIR)/tktsetup.o -c $(OBJDIR)/tktsetup_.c
1395
1396 $(OBJDIR)/tktsetup.h: $(OBJDIR)/headers
1397
1398 $(OBJDIR)/undo_.c: $(SRCDIR)/undo.c $(OBJDIR)/translate
1399 $(OBJDIR)/translate $(SRCDIR)/undo.c >$@
1400
1401 $(OBJDIR)/undo.o: $(OBJDIR)/undo_.c $(OBJDIR)/undo.h $(SRCDIR)/config.h
1402 $(XTCC) -o $(OBJDIR)/undo.o -c $(OBJDIR)/undo_.c
1403
1404 $(OBJDIR)/undo.h: $(OBJDIR)/headers
1405
1406 $(OBJDIR)/unicode_.c: $(SRCDIR)/unicode.c $(OBJDIR)/translate
1407 $(OBJDIR)/translate $(SRCDIR)/unicode.c >$@
1408
1409 $(OBJDIR)/unicode.o: $(OBJDIR)/unicode_.c $(OBJDIR)/unicode.h $(SRCDIR)/config.h
1410 $(XTCC) -o $(OBJDIR)/unicode.o -c $(OBJDIR)/unicode_.c
1411
1412 $(OBJDIR)/unicode.h: $(OBJDIR)/headers
1413
1414 $(OBJDIR)/update_.c: $(SRCDIR)/update.c $(OBJDIR)/translate
1415 $(OBJDIR)/translate $(SRCDIR)/update.c >$@
1416
1417 $(OBJDIR)/update.o: $(OBJDIR)/update_.c $(OBJDIR)/update.h $(SRCDIR)/config.h
1418 $(XTCC) -o $(OBJDIR)/update.o -c $(OBJDIR)/update_.c
1419
1420 $(OBJDIR)/update.h: $(OBJDIR)/headers
1421
1422 $(OBJDIR)/url_.c: $(SRCDIR)/url.c $(OBJDIR)/translate
1423 $(OBJDIR)/translate $(SRCDIR)/url.c >$@
1424
1425 $(OBJDIR)/url.o: $(OBJDIR)/url_.c $(OBJDIR)/url.h $(SRCDIR)/config.h
1426 $(XTCC) -o $(OBJDIR)/url.o -c $(OBJDIR)/url_.c
1427
1428 $(OBJDIR)/url.h: $(OBJDIR)/headers
1429
1430 $(OBJDIR)/user_.c: $(SRCDIR)/user.c $(OBJDIR)/translate
1431 $(OBJDIR)/translate $(SRCDIR)/user.c >$@
1432
1433 $(OBJDIR)/user.o: $(OBJDIR)/user_.c $(OBJDIR)/user.h $(SRCDIR)/config.h
1434 $(XTCC) -o $(OBJDIR)/user.o -c $(OBJDIR)/user_.c
1435
1436 $(OBJDIR)/user.h: $(OBJDIR)/headers
1437
1438 $(OBJDIR)/utf8_.c: $(SRCDIR)/utf8.c $(OBJDIR)/translate
1439 $(OBJDIR)/translate $(SRCDIR)/utf8.c >$@
1440
1441 $(OBJDIR)/utf8.o: $(OBJDIR)/utf8_.c $(OBJDIR)/utf8.h $(SRCDIR)/config.h
1442 $(XTCC) -o $(OBJDIR)/utf8.o -c $(OBJDIR)/utf8_.c
1443
1444 $(OBJDIR)/utf8.h: $(OBJDIR)/headers
1445
1446 $(OBJDIR)/util_.c: $(SRCDIR)/util.c $(OBJDIR)/translate
1447 $(OBJDIR)/translate $(SRCDIR)/util.c >$@
1448
1449 $(OBJDIR)/util.o: $(OBJDIR)/util_.c $(OBJDIR)/util.h $(SRCDIR)/config.h
1450 $(XTCC) -o $(OBJDIR)/util.o -c $(OBJDIR)/util_.c
1451
1452 $(OBJDIR)/util.h: $(OBJDIR)/headers
1453
1454 $(OBJDIR)/verify_.c: $(SRCDIR)/verify.c $(OBJDIR)/translate
1455 $(OBJDIR)/translate $(SRCDIR)/verify.c >$@
1456
1457 $(OBJDIR)/verify.o: $(OBJDIR)/verify_.c $(OBJDIR)/verify.h $(SRCDIR)/config.h
1458 $(XTCC) -o $(OBJDIR)/verify.o -c $(OBJDIR)/verify_.c
1459
1460 $(OBJDIR)/verify.h: $(OBJDIR)/headers
1461
1462 $(OBJDIR)/vfile_.c: $(SRCDIR)/vfile.c $(OBJDIR)/translate
1463 $(OBJDIR)/translate $(SRCDIR)/vfile.c >$@
1464
1465 $(OBJDIR)/vfile.o: $(OBJDIR)/vfile_.c $(OBJDIR)/vfile.h $(SRCDIR)/config.h
1466 $(XTCC) -o $(OBJDIR)/vfile.o -c $(OBJDIR)/vfile_.c
1467
1468 $(OBJDIR)/vfile.h: $(OBJDIR)/headers
1469
1470 $(OBJDIR)/wiki_.c: $(SRCDIR)/wiki.c $(OBJDIR)/translate
1471 $(OBJDIR)/translate $(SRCDIR)/wiki.c >$@
1472
1473 $(OBJDIR)/wiki.o: $(OBJDIR)/wiki_.c $(OBJDIR)/wiki.h $(SRCDIR)/config.h
1474 $(XTCC) -o $(OBJDIR)/wiki.o -c $(OBJDIR)/wiki_.c
1475
1476 $(OBJDIR)/wiki.h: $(OBJDIR)/headers
1477
1478 $(OBJDIR)/wikiformat_.c: $(SRCDIR)/wikiformat.c $(OBJDIR)/translate
1479 $(OBJDIR)/translate $(SRCDIR)/wikiformat.c >$@
1480
1481 $(OBJDIR)/wikiformat.o: $(OBJDIR)/wikiformat_.c $(OBJDIR)/wikiformat.h $(SRCDIR)/config.h
1482 $(XTCC) -o $(OBJDIR)/wikiformat.o -c $(OBJDIR)/wikiformat_.c
1483
1484 $(OBJDIR)/wikiformat.h: $(OBJDIR)/headers
1485
1486 $(OBJDIR)/winfile_.c: $(SRCDIR)/winfile.c $(OBJDIR)/translate
1487 $(OBJDIR)/translate $(SRCDIR)/winfile.c >$@
1488
1489 $(OBJDIR)/winfile.o: $(OBJDIR)/winfile_.c $(OBJDIR)/winfile.h $(SRCDIR)/config.h
1490 $(XTCC) -o $(OBJDIR)/winfile.o -c $(OBJDIR)/winfile_.c
1491
1492 $(OBJDIR)/winfile.h: $(OBJDIR)/headers
1493
1494 $(OBJDIR)/winhttp_.c: $(SRCDIR)/winhttp.c $(OBJDIR)/translate
1495 $(OBJDIR)/translate $(SRCDIR)/winhttp.c >$@
1496
1497 $(OBJDIR)/winhttp.o: $(OBJDIR)/winhttp_.c $(OBJDIR)/winhttp.h $(SRCDIR)/config.h
1498 $(XTCC) -o $(OBJDIR)/winhttp.o -c $(OBJDIR)/winhttp_.c
1499
1500 $(OBJDIR)/winhttp.h: $(OBJDIR)/headers
1501
1502 $(OBJDIR)/wysiwyg_.c: $(SRCDIR)/wysiwyg.c $(OBJDIR)/translate
1503 $(OBJDIR)/translate $(SRCDIR)/wysiwyg.c >$@
1504
1505 $(OBJDIR)/wysiwyg.o: $(OBJDIR)/wysiwyg_.c $(OBJDIR)/wysiwyg.h $(SRCDIR)/config.h
1506 $(XTCC) -o $(OBJDIR)/wysiwyg.o -c $(OBJDIR)/wysiwyg_.c
1507
1508 $(OBJDIR)/wysiwyg.h: $(OBJDIR)/headers
1509
1510 $(OBJDIR)/xfer_.c: $(SRCDIR)/xfer.c $(OBJDIR)/translate
1511 $(OBJDIR)/translate $(SRCDIR)/xfer.c >$@
1512
1513 $(OBJDIR)/xfer.o: $(OBJDIR)/xfer_.c $(OBJDIR)/xfer.h $(SRCDIR)/config.h
1514 $(XTCC) -o $(OBJDIR)/xfer.o -c $(OBJDIR)/xfer_.c
1515
1516 $(OBJDIR)/xfer.h: $(OBJDIR)/headers
1517
1518 $(OBJDIR)/xfersetup_.c: $(SRCDIR)/xfersetup.c $(OBJDIR)/translate
1519 $(OBJDIR)/translate $(SRCDIR)/xfersetup.c >$@
1520
1521 $(OBJDIR)/xfersetup.o: $(OBJDIR)/xfersetup_.c $(OBJDIR)/xfersetup.h $(SRCDIR)/config.h
1522 $(XTCC) -o $(OBJDIR)/xfersetup.o -c $(OBJDIR)/xfersetup_.c
1523
1524 $(OBJDIR)/xfersetup.h: $(OBJDIR)/headers
1525
1526 $(OBJDIR)/zip_.c: $(SRCDIR)/zip.c $(OBJDIR)/translate
1527 $(OBJDIR)/translate $(SRCDIR)/zip.c >$@
1528
1529 $(OBJDIR)/zip.o: $(OBJDIR)/zip_.c $(OBJDIR)/zip.h $(SRCDIR)/config.h
1530 $(XTCC) -o $(OBJDIR)/zip.o -c $(OBJDIR)/zip_.c
1531
1532 $(OBJDIR)/zip.h: $(OBJDIR)/headers
1533
1534 $(OBJDIR)/sqlite3.o: $(SRCDIR)/sqlite3.c
1535 $(XTCC) $(SQLITE_OPTIONS) $(SQLITE_CFLAGS) -c $(SRCDIR)/sqlite3.c -o $@
1536
1537 $(OBJDIR)/shell.o: $(SRCDIR)/shell.c $(SRCDIR)/sqlite3.h
1538 $(XTCC) $(SHELL_OPTIONS) $(SHELL_CFLAGS) -c $(SRCDIR)/shell.c -o $@
1539
1540 $(OBJDIR)/th.o: $(SRCDIR)/th.c
1541 $(XTCC) -c $(SRCDIR)/th.c -o $@
1542
1543 $(OBJDIR)/th_lang.o: $(SRCDIR)/th_lang.c
1544 $(XTCC) -c $(SRCDIR)/th_lang.c -o $@
1545
1546 $(OBJDIR)/th_tcl.o: $(SRCDIR)/th_tcl.c
1547 $(XTCC) -c $(SRCDIR)/th_tcl.c -o $@
1548
1549
1550 $(OBJDIR)/miniz.o: $(SRCDIR)/miniz.c
1551 $(XTCC) $(MINIZ_OPTIONS) -c $(SRCDIR)/miniz.c -o $@
1552
1553 $(OBJDIR)/cson_amalgamation.o: $(SRCDIR)/cson_amalgamation.c
1554 $(XTCC) -c $(SRCDIR)/cson_amalgamation.c -o $@
1555
1556 #
1557 # The list of all the targets that do not correspond to real files. This stops
1558 # 'make' from getting confused when someone makes an error in a rule.
1559 #
1560
1561 .PHONY: all install test clean
1562
1563
+63 -41
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -28,10 +28,11 @@
2828
bisect
2929
blob
3030
branch
3131
browse
3232
builtin
33
+ bundle
3334
cache
3435
captcha
3536
cgi
3637
checkin
3738
checkout
@@ -50,10 +51,11 @@
5051
encode
5152
event
5253
export
5354
file
5455
finfo
56
+ foci
5557
fusefs
5658
glob
5759
graph
5860
gzip
5961
http
@@ -92,10 +94,12 @@
9294
path
9395
pivot
9496
popen
9597
pqueue
9698
printf
99
+ publish
100
+ purge
97101
rebuild
98102
regexp
99103
report
100104
rss
101105
schema
@@ -220,11 +224,11 @@
220224
# to regenerate this file.
221225
#
222226
# This file is included by primary Makefile.
223227
#
224228
225
-XTCC = $(TCC) $(CFLAGS) -I. -I$(SRCDIR) -I$(OBJDIR)
229
+XTCC = $(TCC) -I. -I$(SRCDIR) -I$(OBJDIR) $(TCCFLAGS) $(CFLAGS)
226230
227231
}
228232
writeln -nonewline "SRC ="
229233
foreach s [lsort $src] {
230234
writeln -nonewline " \\\n \$(SRCDIR)/$s.c"
@@ -354,14 +358,14 @@
354358
append mhargs "\$(SRCDIR)/th.h <<<NEXT_LINE>>>"
355359
#append mhargs "\$(SRCDIR)/cson_amalgamation.h <<<NEXT_LINE>>>"
356360
append mhargs "\$(OBJDIR)/VERSION.h"
357361
set mhargs [string map [list <<<NEXT_LINE>>> \\\n\t] $mhargs]
358362
writeln "\$(OBJDIR)/page_index.h: \$(TRANS_SRC) \$(OBJDIR)/mkindex"
359
-writeln "\t\$(OBJDIR)/mkindex \$(TRANS_SRC) >$@\n"
363
+writeln "\t\$(OBJDIR)/mkindex \$(TRANS_SRC) >\$@\n"
360364
361365
writeln "\$(OBJDIR)/builtin_data.h: \$(OBJDIR)/mkbuiltin \$(EXTRA_FILES)"
362
-writeln "\t\$(OBJDIR)/mkbuiltin \$(EXTRA_FILES) >$@\n"
366
+writeln "\t\$(OBJDIR)/mkbuiltin \$(EXTRA_FILES) >\$@\n"
363367
364368
writeln "\$(OBJDIR)/headers:\t\$(OBJDIR)/page_index.h \$(OBJDIR)/builtin_data.h \$(OBJDIR)/makeheaders \$(OBJDIR)/VERSION.h"
365369
writeln "\t\$(OBJDIR)/makeheaders $mhargs"
366370
writeln "\ttouch \$(OBJDIR)/headers"
367371
writeln "\$(OBJDIR)/headers: Makefile"
@@ -370,37 +374,37 @@
370374
set extra_h(main) " \$(OBJDIR)/page_index.h "
371375
set extra_h(builtin) " \$(OBJDIR)/builtin_data.h "
372376
373377
foreach s [lsort $src] {
374378
writeln "\$(OBJDIR)/${s}_.c:\t\$(SRCDIR)/$s.c \$(OBJDIR)/translate"
375
- writeln "\t\$(OBJDIR)/translate \$(SRCDIR)/$s.c >\$(OBJDIR)/${s}_.c\n"
379
+ writeln "\t\$(OBJDIR)/translate \$(SRCDIR)/$s.c >\$@\n"
376380
writeln "\$(OBJDIR)/$s.o:\t\$(OBJDIR)/${s}_.c \$(OBJDIR)/$s.h$extra_h($s)\$(SRCDIR)/config.h"
377381
writeln "\t\$(XTCC) -o \$(OBJDIR)/$s.o -c \$(OBJDIR)/${s}_.c\n"
378
- writeln "\$(OBJDIR)/$s.h:\t\$(OBJDIR)/headers"
382
+ writeln "\$(OBJDIR)/$s.h:\t\$(OBJDIR)/headers\n"
379383
}
380384
381385
writeln "\$(OBJDIR)/sqlite3.o:\t\$(SRCDIR)/sqlite3.c"
382
-writeln "\t\$(XTCC) \$(SQLITE_OPTIONS) \$(SQLITE_CFLAGS) -c \$(SRCDIR)/sqlite3.c -o \$(OBJDIR)/sqlite3.o\n"
386
+writeln "\t\$(XTCC) \$(SQLITE_OPTIONS) \$(SQLITE_CFLAGS) -c \$(SRCDIR)/sqlite3.c -o \$@\n"
383387
384388
writeln "\$(OBJDIR)/shell.o:\t\$(SRCDIR)/shell.c \$(SRCDIR)/sqlite3.h"
385
-writeln "\t\$(XTCC) \$(SHELL_OPTIONS) \$(SHELL_CFLAGS) -c \$(SRCDIR)/shell.c -o \$(OBJDIR)/shell.o\n"
389
+writeln "\t\$(XTCC) \$(SHELL_OPTIONS) \$(SHELL_CFLAGS) -c \$(SRCDIR)/shell.c -o \$@\n"
386390
387391
writeln "\$(OBJDIR)/th.o:\t\$(SRCDIR)/th.c"
388
-writeln "\t\$(XTCC) -c \$(SRCDIR)/th.c -o \$(OBJDIR)/th.o\n"
392
+writeln "\t\$(XTCC) -c \$(SRCDIR)/th.c -o \$@\n"
389393
390394
writeln "\$(OBJDIR)/th_lang.o:\t\$(SRCDIR)/th_lang.c"
391
-writeln "\t\$(XTCC) -c \$(SRCDIR)/th_lang.c -o \$(OBJDIR)/th_lang.o\n"
395
+writeln "\t\$(XTCC) -c \$(SRCDIR)/th_lang.c -o \$@\n"
392396
393397
writeln "\$(OBJDIR)/th_tcl.o:\t\$(SRCDIR)/th_tcl.c"
394
-writeln "\t\$(XTCC) -c \$(SRCDIR)/th_tcl.c -o \$(OBJDIR)/th_tcl.o\n"
398
+writeln "\t\$(XTCC) -c \$(SRCDIR)/th_tcl.c -o \$@\n"
395399
396400
writeln {
397401
$(OBJDIR)/miniz.o: $(SRCDIR)/miniz.c
398
- $(XTCC) $(MINIZ_OPTIONS) -c $(SRCDIR)/miniz.c -o $(OBJDIR)/miniz.o
402
+ $(XTCC) $(MINIZ_OPTIONS) -c $(SRCDIR)/miniz.c -o $@
399403
400404
$(OBJDIR)/cson_amalgamation.o: $(SRCDIR)/cson_amalgamation.c
401
- $(XTCC) -c $(SRCDIR)/cson_amalgamation.c -o $(OBJDIR)/cson_amalgamation.o
405
+ $(XTCC) -c $(SRCDIR)/cson_amalgamation.c -o $@
402406
403407
#
404408
# The list of all the targets that do not correspond to real files. This stops
405409
# 'make' from getting confused when someone makes an error in a rule.
406410
#
@@ -516,23 +520,35 @@
516520
ifndef MINGW_IS_32BIT_ONLY
517521
ifeq (,$(findstring w64-mingw32,$(PREFIX)))
518522
MINGW_IS_32BIT_ONLY = 1
519523
endif
520524
endif
521
-ifeq (,$(findstring x86_64-w64-mingw32,$(PREFIX)))
522
-SSLCONFIG = mingw
523
-else
524
-SSLCONFIG = mingw64
525
-endif
526
-ifndef FOSSIL_ENABLE_MINIZ
527
-SSLCONFIG += --with-zlib-lib=$(PWD)/$(ZLIBDIR) --with-zlib-include=$(PWD)/$(ZLIBDIR) zlib
528
-endif
529525
530526
#### The directories where the zlib include and library files are located.
531527
#
532528
ZINCDIR = $(SRCDIR)/../compat/zlib
533529
ZLIBDIR = $(SRCDIR)/../compat/zlib
530
+
531
+ifndef X64
532
+ifneq (,$(findstring x86_64-w64-mingw32,$(PREFIX)))
533
+X64 = 1
534
+endif
535
+endif
536
+
537
+ifndef X64
538
+SSLCONFIG = mingw
539
+ZLIBCONFIG = LOC="-DASMV -DASMINF" OBJA="inffas86.o match.o"
540
+LIBTARGETS = $(ZLIBDIR)/inffas86.o $(ZLIBDIR)/match.o
541
+else
542
+SSLCONFIG = mingw64
543
+ZLIBCONFIG =
544
+LIBTARGETS =
545
+endif
546
+
547
+ifndef FOSSIL_ENABLE_MINIZ
548
+SSLCONFIG += --with-zlib-lib=$(PWD)/$(ZLIBDIR) --with-zlib-include=$(PWD)/$(ZLIBDIR) zlib
549
+endif
534550
535551
#### The directories where the OpenSSL include and library files are located.
536552
# The recommended usage here is to use the Sysinternals junction tool
537553
# to create a hard link between an "openssl-1.x" sub-directory of the
538554
# Fossil source code directory and the target OpenSSL source directory.
@@ -774,11 +790,10 @@
774790
writeln -nonewline " \\\n \$(OBJDIR)/$s.o"
775791
}
776792
writeln "\n"
777793
writeln "APPNAME = ${name}.exe"
778794
writeln "APPTARGETS ="
779
-writeln "LIBTARGETS ="
780795
writeln {
781796
#### If the USE_WINDOWS variable exists, it is assumed that we are building
782797
# inside of a Windows-style shell; otherwise, it is assumed that we are
783798
# building inside of a Unix-style shell. Note that the "move" command is
784799
# broken when attempting to use it from the Windows shell via MinGW make
@@ -847,35 +862,35 @@
847862
else
848863
$(MKDIR) $(OBJDIR)
849864
endif
850865
851866
$(TRANSLATE): $(SRCDIR)/translate.c
852
- $(BCC) -o $(TRANSLATE) $(SRCDIR)/translate.c
867
+ $(BCC) -o $@ $(SRCDIR)/translate.c
853868
854869
$(MAKEHEADERS): $(SRCDIR)/makeheaders.c
855
- $(BCC) -o $(MAKEHEADERS) $(SRCDIR)/makeheaders.c
870
+ $(BCC) -o $@ $(SRCDIR)/makeheaders.c
856871
857872
$(MKINDEX): $(SRCDIR)/mkindex.c
858
- $(BCC) -o $(MKINDEX) $(SRCDIR)/mkindex.c
873
+ $(BCC) -o $@ $(SRCDIR)/mkindex.c
859874
860875
$(MKBUILTIN): $(SRCDIR)/mkbuiltin.c
861
- $(BCC) -o $(MKBUILTIN) $(SRCDIR)/mkbuiltin.c
876
+ $(BCC) -o $@ $(SRCDIR)/mkbuiltin.c
862877
863878
$(MKVERSION): $(SRCDIR)/mkversion.c
864
- $(BCC) -o $(MKVERSION) $(SRCDIR)/mkversion.c
879
+ $(BCC) -o $@ $(SRCDIR)/mkversion.c
865880
866881
$(CODECHECK1): $(SRCDIR)/codecheck1.c
867
- $(BCC) -o $(CODECHECK1) $(SRCDIR)/codecheck1.c
882
+ $(BCC) -o $@ $(SRCDIR)/codecheck1.c
868883
869884
# WARNING. DANGER. Running the test suite modifies the repository the
870885
# build is done from, i.e. the checkout belongs to. Do not sync/push
871886
# the repository after running the tests.
872887
test: $(OBJDIR) $(APPNAME)
873888
$(TCLSH) $(SRCDIR)/../test/tester.tcl $(APPNAME)
874889
875890
$(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(MKVERSION)
876
- $(MKVERSION) $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION >$(OBJDIR)/VERSION.h
891
+ $(MKVERSION) $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION >$@
877892
878893
# The USE_SYSTEM_SQLITE variable may be undefined, set to 0, or set
879894
# to 1. If it is set to 1, then there is no need to build or link
880895
# the sqlite3.o object. Instead, the system SQLite will be linked
881896
# using -lsqlite3.
@@ -902,14 +917,21 @@
902917
$(OBJDIR)/cson_amalgamation.o
903918
}]
904919
905920
writeln {
906921
zlib:
907
- $(MAKE) -C $(ZLIBDIR) PREFIX=$(PREFIX) -f win32/Makefile.gcc libz.a
922
+ $(MAKE) -C $(ZLIBDIR) PREFIX=$(PREFIX) $(ZLIBCONFIG) -f win32/Makefile.gcc libz.a
908923
909924
clean-zlib:
910925
$(MAKE) -C $(ZLIBDIR) PREFIX=$(PREFIX) -f win32/Makefile.gcc clean
926
+
927
+$(ZLIBDIR)/inffas86.o:
928
+ $(TCC) -c -o $@ -DASMINF -I$(ZLIBDIR) -O3 $(ZLIBDIR)/contrib/inflate86/inffas86.c
929
+
930
+$(ZLIBDIR)/match.o:
931
+ $(TCC) -c -o $@ -DASMV $(ZLIBDIR)/contrib/asm686/match.S
932
+
911933
912934
ifndef FOSSIL_ENABLE_MINIZ
913935
LIBTARGETS += zlib
914936
endif
915937
@@ -933,11 +955,11 @@
933955
APPTARGETS += openssl
934956
endif
935957
936958
$(APPNAME): $(OBJDIR)/headers $(CODECHECK1) $(OBJ) $(EXTRAOBJ) $(OBJDIR)/fossil.o $(APPTARGETS)
937959
$(CODECHECK1) $(TRANS_SRC)
938
- $(TCC) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB) $(OBJDIR)/fossil.o
960
+ $(TCC) -o $@ $(OBJ) $(EXTRAOBJ) $(LIB) $(OBJDIR)/fossil.o
939961
940962
# This rule prevents make from using its default rules to try build
941963
# an executable named "manifest" out of the file named "manifest.c"
942964
#
943965
$(SRCDIR)/../manifest:
@@ -967,14 +989,14 @@
967989
}
968990
append mhargs " \\\n\t\t\$(SRCDIR)/sqlite3.h"
969991
append mhargs " \\\n\t\t\$(SRCDIR)/th.h"
970992
append mhargs " \\\n\t\t\$(OBJDIR)/VERSION.h"
971993
writeln "\$(OBJDIR)/page_index.h: \$(TRANS_SRC) \$(MKINDEX)"
972
-writeln "\t\$(MKINDEX) \$(TRANS_SRC) >$@\n"
994
+writeln "\t\$(MKINDEX) \$(TRANS_SRC) >\$@\n"
973995
974996
writeln "\$(OBJDIR)/builtin_data.h:\t\$(MKBUILTIN) \$(EXTRA_FILES)"
975
-writeln "\t\$(MKBUILTIN) \$(EXTRA_FILES) >$@\n"
997
+writeln "\t\$(MKBUILTIN) \$(EXTRA_FILES) >\$@\n"
976998
977999
writeln "\$(OBJDIR)/headers:\t\$(OBJDIR)/page_index.h \$(OBJDIR)/builtin_data.h \$(MAKEHEADERS) \$(OBJDIR)/VERSION.h"
9781000
writeln "\t\$(MAKEHEADERS) $mhargs"
9791001
writeln "\techo Done >\$(OBJDIR)/headers\n"
9801002
writeln "\$(OBJDIR)/headers: Makefile\n"
@@ -982,11 +1004,11 @@
9821004
set extra_h(main) " \$(OBJDIR)/page_index.h "
9831005
set extra_h(builtin) " \$(OBJDIR)/builtin_data.h "
9841006
9851007
foreach s [lsort $src] {
9861008
writeln "\$(OBJDIR)/${s}_.c:\t\$(SRCDIR)/$s.c \$(TRANSLATE)"
987
- writeln "\t\$(TRANSLATE) \$(SRCDIR)/$s.c >\$(OBJDIR)/${s}_.c\n"
1009
+ writeln "\t\$(TRANSLATE) \$(SRCDIR)/$s.c >\$@\n"
9881010
writeln "\$(OBJDIR)/$s.o:\t\$(OBJDIR)/${s}_.c \$(OBJDIR)/$s.h$extra_h($s)\$(SRCDIR)/config.h"
9891011
writeln "\t\$(XTCC) -o \$(OBJDIR)/$s.o -c \$(OBJDIR)/${s}_.c\n"
9901012
writeln "\$(OBJDIR)/${s}.h:\t\$(OBJDIR)/headers\n"
9911013
}
9921014
@@ -1006,30 +1028,30 @@
10061028
writeln "SHELL_OPTIONS = [join $SHELL_WIN32_OPTIONS $j]\n"
10071029
set j " \\\n "
10081030
writeln "MINIZ_OPTIONS = [join $MINIZ_WIN32_OPTIONS $j]\n"
10091031
10101032
writeln "\$(OBJDIR)/sqlite3.o:\t\$(SRCDIR)/sqlite3.c \$(SRCDIR)/../win/Makefile.mingw"
1011
-writeln "\t\$(XTCC) \$(SQLITE_OPTIONS) \$(SQLITE_CFLAGS) -c \$(SRCDIR)/sqlite3.c -o \$(OBJDIR)/sqlite3.o\n"
1033
+writeln "\t\$(XTCC) \$(SQLITE_OPTIONS) \$(SQLITE_CFLAGS) -c \$(SRCDIR)/sqlite3.c -o \$@\n"
10121034
10131035
writeln "\$(OBJDIR)/cson_amalgamation.o:\t\$(SRCDIR)/cson_amalgamation.c"
1014
-writeln "\t\$(XTCC) -c \$(SRCDIR)/cson_amalgamation.c -o \$(OBJDIR)/cson_amalgamation.o\n"
1036
+writeln "\t\$(XTCC) -c \$(SRCDIR)/cson_amalgamation.c -o \$@\n"
10151037
writeln "\$(OBJDIR)/json.o \$(OBJDIR)/json_artifact.o \$(OBJDIR)/json_branch.o \$(OBJDIR)/json_config.o \$(OBJDIR)/json_diff.o \$(OBJDIR)/json_dir.o \$(OBJDIR)/jsos_finfo.o \$(OBJDIR)/json_login.o \$(OBJDIR)/json_query.o \$(OBJDIR)/json_report.o \$(OBJDIR)/json_status.o \$(OBJDIR)/json_tag.o \$(OBJDIR)/json_timeline.o \$(OBJDIR)/json_user.o \$(OBJDIR)/json_wiki.o : \$(SRCDIR)/json_detail.h\n"
10161038
10171039
writeln "\$(OBJDIR)/shell.o:\t\$(SRCDIR)/shell.c \$(SRCDIR)/sqlite3.h \$(SRCDIR)/../win/Makefile.mingw"
1018
-writeln "\t\$(XTCC) \$(SHELL_OPTIONS) \$(SHELL_CFLAGS) -c \$(SRCDIR)/shell.c -o \$(OBJDIR)/shell.o\n"
1040
+writeln "\t\$(XTCC) \$(SHELL_OPTIONS) \$(SHELL_CFLAGS) -c \$(SRCDIR)/shell.c -o \$@\n"
10191041
10201042
writeln "\$(OBJDIR)/th.o:\t\$(SRCDIR)/th.c"
1021
-writeln "\t\$(XTCC) -c \$(SRCDIR)/th.c -o \$(OBJDIR)/th.o\n"
1043
+writeln "\t\$(XTCC) -c \$(SRCDIR)/th.c -o \$@\n"
10221044
10231045
writeln "\$(OBJDIR)/th_lang.o:\t\$(SRCDIR)/th_lang.c"
1024
-writeln "\t\$(XTCC) -c \$(SRCDIR)/th_lang.c -o \$(OBJDIR)/th_lang.o\n"
1046
+writeln "\t\$(XTCC) -c \$(SRCDIR)/th_lang.c -o \$@\n"
10251047
10261048
writeln "\$(OBJDIR)/th_tcl.o:\t\$(SRCDIR)/th_tcl.c"
1027
-writeln "\t\$(XTCC) -c \$(SRCDIR)/th_tcl.c -o \$(OBJDIR)/th_tcl.o\n"
1049
+writeln "\t\$(XTCC) -c \$(SRCDIR)/th_tcl.c -o \$@\n"
10281050
10291051
writeln "\$(OBJDIR)/miniz.o:\t\$(SRCDIR)/miniz.c"
1030
-writeln "\t\$(XTCC) \$(MINIZ_OPTIONS) -c \$(SRCDIR)/miniz.c -o \$(OBJDIR)/miniz.o\n"
1052
+writeln "\t\$(XTCC) \$(MINIZ_OPTIONS) -c \$(SRCDIR)/miniz.c -o \$@\n"
10311053
10321054
close $output_file
10331055
#
10341056
# End of the win/Makefile.mingw output
10351057
##############################################################################
@@ -1770,11 +1792,11 @@
17701792
builtin_data.h: $(EXTRA_FILES) mkbuiltin.exe
17711793
mkbuiltin.exe $(EXTRA_FILES) >$@
17721794
17731795
# extracting version info from manifest
17741796
VERSION.h: version.exe ..\manifest.uuid ..\manifest ..\VERSION
1775
- version.exe ..\manifest.uuid ..\manifest ..\VERSION > $@
1797
+ version.exe ..\manifest.uuid ..\manifest ..\VERSION >$@
17761798
17771799
# generate the simplified headers
17781800
headers: makeheaders.exe page_index.h builtin_data.h VERSION.h ../src/sqlite3.h ../src/th.h VERSION.h
17791801
makeheaders.exe $(foreach ts,$(TRANSLATEDSRC),$(ts):$(ts:_.c=.h)) ../src/sqlite3.h ../src/th.h VERSION.h
17801802
echo Done >$@
17811803
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -28,10 +28,11 @@
28 bisect
29 blob
30 branch
31 browse
32 builtin
 
33 cache
34 captcha
35 cgi
36 checkin
37 checkout
@@ -50,10 +51,11 @@
50 encode
51 event
52 export
53 file
54 finfo
 
55 fusefs
56 glob
57 graph
58 gzip
59 http
@@ -92,10 +94,12 @@
92 path
93 pivot
94 popen
95 pqueue
96 printf
 
 
97 rebuild
98 regexp
99 report
100 rss
101 schema
@@ -220,11 +224,11 @@
220 # to regenerate this file.
221 #
222 # This file is included by primary Makefile.
223 #
224
225 XTCC = $(TCC) $(CFLAGS) -I. -I$(SRCDIR) -I$(OBJDIR)
226
227 }
228 writeln -nonewline "SRC ="
229 foreach s [lsort $src] {
230 writeln -nonewline " \\\n \$(SRCDIR)/$s.c"
@@ -354,14 +358,14 @@
354 append mhargs "\$(SRCDIR)/th.h <<<NEXT_LINE>>>"
355 #append mhargs "\$(SRCDIR)/cson_amalgamation.h <<<NEXT_LINE>>>"
356 append mhargs "\$(OBJDIR)/VERSION.h"
357 set mhargs [string map [list <<<NEXT_LINE>>> \\\n\t] $mhargs]
358 writeln "\$(OBJDIR)/page_index.h: \$(TRANS_SRC) \$(OBJDIR)/mkindex"
359 writeln "\t\$(OBJDIR)/mkindex \$(TRANS_SRC) >$@\n"
360
361 writeln "\$(OBJDIR)/builtin_data.h: \$(OBJDIR)/mkbuiltin \$(EXTRA_FILES)"
362 writeln "\t\$(OBJDIR)/mkbuiltin \$(EXTRA_FILES) >$@\n"
363
364 writeln "\$(OBJDIR)/headers:\t\$(OBJDIR)/page_index.h \$(OBJDIR)/builtin_data.h \$(OBJDIR)/makeheaders \$(OBJDIR)/VERSION.h"
365 writeln "\t\$(OBJDIR)/makeheaders $mhargs"
366 writeln "\ttouch \$(OBJDIR)/headers"
367 writeln "\$(OBJDIR)/headers: Makefile"
@@ -370,37 +374,37 @@
370 set extra_h(main) " \$(OBJDIR)/page_index.h "
371 set extra_h(builtin) " \$(OBJDIR)/builtin_data.h "
372
373 foreach s [lsort $src] {
374 writeln "\$(OBJDIR)/${s}_.c:\t\$(SRCDIR)/$s.c \$(OBJDIR)/translate"
375 writeln "\t\$(OBJDIR)/translate \$(SRCDIR)/$s.c >\$(OBJDIR)/${s}_.c\n"
376 writeln "\$(OBJDIR)/$s.o:\t\$(OBJDIR)/${s}_.c \$(OBJDIR)/$s.h$extra_h($s)\$(SRCDIR)/config.h"
377 writeln "\t\$(XTCC) -o \$(OBJDIR)/$s.o -c \$(OBJDIR)/${s}_.c\n"
378 writeln "\$(OBJDIR)/$s.h:\t\$(OBJDIR)/headers"
379 }
380
381 writeln "\$(OBJDIR)/sqlite3.o:\t\$(SRCDIR)/sqlite3.c"
382 writeln "\t\$(XTCC) \$(SQLITE_OPTIONS) \$(SQLITE_CFLAGS) -c \$(SRCDIR)/sqlite3.c -o \$(OBJDIR)/sqlite3.o\n"
383
384 writeln "\$(OBJDIR)/shell.o:\t\$(SRCDIR)/shell.c \$(SRCDIR)/sqlite3.h"
385 writeln "\t\$(XTCC) \$(SHELL_OPTIONS) \$(SHELL_CFLAGS) -c \$(SRCDIR)/shell.c -o \$(OBJDIR)/shell.o\n"
386
387 writeln "\$(OBJDIR)/th.o:\t\$(SRCDIR)/th.c"
388 writeln "\t\$(XTCC) -c \$(SRCDIR)/th.c -o \$(OBJDIR)/th.o\n"
389
390 writeln "\$(OBJDIR)/th_lang.o:\t\$(SRCDIR)/th_lang.c"
391 writeln "\t\$(XTCC) -c \$(SRCDIR)/th_lang.c -o \$(OBJDIR)/th_lang.o\n"
392
393 writeln "\$(OBJDIR)/th_tcl.o:\t\$(SRCDIR)/th_tcl.c"
394 writeln "\t\$(XTCC) -c \$(SRCDIR)/th_tcl.c -o \$(OBJDIR)/th_tcl.o\n"
395
396 writeln {
397 $(OBJDIR)/miniz.o: $(SRCDIR)/miniz.c
398 $(XTCC) $(MINIZ_OPTIONS) -c $(SRCDIR)/miniz.c -o $(OBJDIR)/miniz.o
399
400 $(OBJDIR)/cson_amalgamation.o: $(SRCDIR)/cson_amalgamation.c
401 $(XTCC) -c $(SRCDIR)/cson_amalgamation.c -o $(OBJDIR)/cson_amalgamation.o
402
403 #
404 # The list of all the targets that do not correspond to real files. This stops
405 # 'make' from getting confused when someone makes an error in a rule.
406 #
@@ -516,23 +520,35 @@
516 ifndef MINGW_IS_32BIT_ONLY
517 ifeq (,$(findstring w64-mingw32,$(PREFIX)))
518 MINGW_IS_32BIT_ONLY = 1
519 endif
520 endif
521 ifeq (,$(findstring x86_64-w64-mingw32,$(PREFIX)))
522 SSLCONFIG = mingw
523 else
524 SSLCONFIG = mingw64
525 endif
526 ifndef FOSSIL_ENABLE_MINIZ
527 SSLCONFIG += --with-zlib-lib=$(PWD)/$(ZLIBDIR) --with-zlib-include=$(PWD)/$(ZLIBDIR) zlib
528 endif
529
530 #### The directories where the zlib include and library files are located.
531 #
532 ZINCDIR = $(SRCDIR)/../compat/zlib
533 ZLIBDIR = $(SRCDIR)/../compat/zlib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
534
535 #### The directories where the OpenSSL include and library files are located.
536 # The recommended usage here is to use the Sysinternals junction tool
537 # to create a hard link between an "openssl-1.x" sub-directory of the
538 # Fossil source code directory and the target OpenSSL source directory.
@@ -774,11 +790,10 @@
774 writeln -nonewline " \\\n \$(OBJDIR)/$s.o"
775 }
776 writeln "\n"
777 writeln "APPNAME = ${name}.exe"
778 writeln "APPTARGETS ="
779 writeln "LIBTARGETS ="
780 writeln {
781 #### If the USE_WINDOWS variable exists, it is assumed that we are building
782 # inside of a Windows-style shell; otherwise, it is assumed that we are
783 # building inside of a Unix-style shell. Note that the "move" command is
784 # broken when attempting to use it from the Windows shell via MinGW make
@@ -847,35 +862,35 @@
847 else
848 $(MKDIR) $(OBJDIR)
849 endif
850
851 $(TRANSLATE): $(SRCDIR)/translate.c
852 $(BCC) -o $(TRANSLATE) $(SRCDIR)/translate.c
853
854 $(MAKEHEADERS): $(SRCDIR)/makeheaders.c
855 $(BCC) -o $(MAKEHEADERS) $(SRCDIR)/makeheaders.c
856
857 $(MKINDEX): $(SRCDIR)/mkindex.c
858 $(BCC) -o $(MKINDEX) $(SRCDIR)/mkindex.c
859
860 $(MKBUILTIN): $(SRCDIR)/mkbuiltin.c
861 $(BCC) -o $(MKBUILTIN) $(SRCDIR)/mkbuiltin.c
862
863 $(MKVERSION): $(SRCDIR)/mkversion.c
864 $(BCC) -o $(MKVERSION) $(SRCDIR)/mkversion.c
865
866 $(CODECHECK1): $(SRCDIR)/codecheck1.c
867 $(BCC) -o $(CODECHECK1) $(SRCDIR)/codecheck1.c
868
869 # WARNING. DANGER. Running the test suite modifies the repository the
870 # build is done from, i.e. the checkout belongs to. Do not sync/push
871 # the repository after running the tests.
872 test: $(OBJDIR) $(APPNAME)
873 $(TCLSH) $(SRCDIR)/../test/tester.tcl $(APPNAME)
874
875 $(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(MKVERSION)
876 $(MKVERSION) $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION >$(OBJDIR)/VERSION.h
877
878 # The USE_SYSTEM_SQLITE variable may be undefined, set to 0, or set
879 # to 1. If it is set to 1, then there is no need to build or link
880 # the sqlite3.o object. Instead, the system SQLite will be linked
881 # using -lsqlite3.
@@ -902,14 +917,21 @@
902 $(OBJDIR)/cson_amalgamation.o
903 }]
904
905 writeln {
906 zlib:
907 $(MAKE) -C $(ZLIBDIR) PREFIX=$(PREFIX) -f win32/Makefile.gcc libz.a
908
909 clean-zlib:
910 $(MAKE) -C $(ZLIBDIR) PREFIX=$(PREFIX) -f win32/Makefile.gcc clean
 
 
 
 
 
 
 
911
912 ifndef FOSSIL_ENABLE_MINIZ
913 LIBTARGETS += zlib
914 endif
915
@@ -933,11 +955,11 @@
933 APPTARGETS += openssl
934 endif
935
936 $(APPNAME): $(OBJDIR)/headers $(CODECHECK1) $(OBJ) $(EXTRAOBJ) $(OBJDIR)/fossil.o $(APPTARGETS)
937 $(CODECHECK1) $(TRANS_SRC)
938 $(TCC) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB) $(OBJDIR)/fossil.o
939
940 # This rule prevents make from using its default rules to try build
941 # an executable named "manifest" out of the file named "manifest.c"
942 #
943 $(SRCDIR)/../manifest:
@@ -967,14 +989,14 @@
967 }
968 append mhargs " \\\n\t\t\$(SRCDIR)/sqlite3.h"
969 append mhargs " \\\n\t\t\$(SRCDIR)/th.h"
970 append mhargs " \\\n\t\t\$(OBJDIR)/VERSION.h"
971 writeln "\$(OBJDIR)/page_index.h: \$(TRANS_SRC) \$(MKINDEX)"
972 writeln "\t\$(MKINDEX) \$(TRANS_SRC) >$@\n"
973
974 writeln "\$(OBJDIR)/builtin_data.h:\t\$(MKBUILTIN) \$(EXTRA_FILES)"
975 writeln "\t\$(MKBUILTIN) \$(EXTRA_FILES) >$@\n"
976
977 writeln "\$(OBJDIR)/headers:\t\$(OBJDIR)/page_index.h \$(OBJDIR)/builtin_data.h \$(MAKEHEADERS) \$(OBJDIR)/VERSION.h"
978 writeln "\t\$(MAKEHEADERS) $mhargs"
979 writeln "\techo Done >\$(OBJDIR)/headers\n"
980 writeln "\$(OBJDIR)/headers: Makefile\n"
@@ -982,11 +1004,11 @@
982 set extra_h(main) " \$(OBJDIR)/page_index.h "
983 set extra_h(builtin) " \$(OBJDIR)/builtin_data.h "
984
985 foreach s [lsort $src] {
986 writeln "\$(OBJDIR)/${s}_.c:\t\$(SRCDIR)/$s.c \$(TRANSLATE)"
987 writeln "\t\$(TRANSLATE) \$(SRCDIR)/$s.c >\$(OBJDIR)/${s}_.c\n"
988 writeln "\$(OBJDIR)/$s.o:\t\$(OBJDIR)/${s}_.c \$(OBJDIR)/$s.h$extra_h($s)\$(SRCDIR)/config.h"
989 writeln "\t\$(XTCC) -o \$(OBJDIR)/$s.o -c \$(OBJDIR)/${s}_.c\n"
990 writeln "\$(OBJDIR)/${s}.h:\t\$(OBJDIR)/headers\n"
991 }
992
@@ -1006,30 +1028,30 @@
1006 writeln "SHELL_OPTIONS = [join $SHELL_WIN32_OPTIONS $j]\n"
1007 set j " \\\n "
1008 writeln "MINIZ_OPTIONS = [join $MINIZ_WIN32_OPTIONS $j]\n"
1009
1010 writeln "\$(OBJDIR)/sqlite3.o:\t\$(SRCDIR)/sqlite3.c \$(SRCDIR)/../win/Makefile.mingw"
1011 writeln "\t\$(XTCC) \$(SQLITE_OPTIONS) \$(SQLITE_CFLAGS) -c \$(SRCDIR)/sqlite3.c -o \$(OBJDIR)/sqlite3.o\n"
1012
1013 writeln "\$(OBJDIR)/cson_amalgamation.o:\t\$(SRCDIR)/cson_amalgamation.c"
1014 writeln "\t\$(XTCC) -c \$(SRCDIR)/cson_amalgamation.c -o \$(OBJDIR)/cson_amalgamation.o\n"
1015 writeln "\$(OBJDIR)/json.o \$(OBJDIR)/json_artifact.o \$(OBJDIR)/json_branch.o \$(OBJDIR)/json_config.o \$(OBJDIR)/json_diff.o \$(OBJDIR)/json_dir.o \$(OBJDIR)/jsos_finfo.o \$(OBJDIR)/json_login.o \$(OBJDIR)/json_query.o \$(OBJDIR)/json_report.o \$(OBJDIR)/json_status.o \$(OBJDIR)/json_tag.o \$(OBJDIR)/json_timeline.o \$(OBJDIR)/json_user.o \$(OBJDIR)/json_wiki.o : \$(SRCDIR)/json_detail.h\n"
1016
1017 writeln "\$(OBJDIR)/shell.o:\t\$(SRCDIR)/shell.c \$(SRCDIR)/sqlite3.h \$(SRCDIR)/../win/Makefile.mingw"
1018 writeln "\t\$(XTCC) \$(SHELL_OPTIONS) \$(SHELL_CFLAGS) -c \$(SRCDIR)/shell.c -o \$(OBJDIR)/shell.o\n"
1019
1020 writeln "\$(OBJDIR)/th.o:\t\$(SRCDIR)/th.c"
1021 writeln "\t\$(XTCC) -c \$(SRCDIR)/th.c -o \$(OBJDIR)/th.o\n"
1022
1023 writeln "\$(OBJDIR)/th_lang.o:\t\$(SRCDIR)/th_lang.c"
1024 writeln "\t\$(XTCC) -c \$(SRCDIR)/th_lang.c -o \$(OBJDIR)/th_lang.o\n"
1025
1026 writeln "\$(OBJDIR)/th_tcl.o:\t\$(SRCDIR)/th_tcl.c"
1027 writeln "\t\$(XTCC) -c \$(SRCDIR)/th_tcl.c -o \$(OBJDIR)/th_tcl.o\n"
1028
1029 writeln "\$(OBJDIR)/miniz.o:\t\$(SRCDIR)/miniz.c"
1030 writeln "\t\$(XTCC) \$(MINIZ_OPTIONS) -c \$(SRCDIR)/miniz.c -o \$(OBJDIR)/miniz.o\n"
1031
1032 close $output_file
1033 #
1034 # End of the win/Makefile.mingw output
1035 ##############################################################################
@@ -1770,11 +1792,11 @@
1770 builtin_data.h: $(EXTRA_FILES) mkbuiltin.exe
1771 mkbuiltin.exe $(EXTRA_FILES) >$@
1772
1773 # extracting version info from manifest
1774 VERSION.h: version.exe ..\manifest.uuid ..\manifest ..\VERSION
1775 version.exe ..\manifest.uuid ..\manifest ..\VERSION > $@
1776
1777 # generate the simplified headers
1778 headers: makeheaders.exe page_index.h builtin_data.h VERSION.h ../src/sqlite3.h ../src/th.h VERSION.h
1779 makeheaders.exe $(foreach ts,$(TRANSLATEDSRC),$(ts):$(ts:_.c=.h)) ../src/sqlite3.h ../src/th.h VERSION.h
1780 echo Done >$@
1781
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -28,10 +28,11 @@
28 bisect
29 blob
30 branch
31 browse
32 builtin
33 bundle
34 cache
35 captcha
36 cgi
37 checkin
38 checkout
@@ -50,10 +51,11 @@
51 encode
52 event
53 export
54 file
55 finfo
56 foci
57 fusefs
58 glob
59 graph
60 gzip
61 http
@@ -92,10 +94,12 @@
94 path
95 pivot
96 popen
97 pqueue
98 printf
99 publish
100 purge
101 rebuild
102 regexp
103 report
104 rss
105 schema
@@ -220,11 +224,11 @@
224 # to regenerate this file.
225 #
226 # This file is included by primary Makefile.
227 #
228
229 XTCC = $(TCC) -I. -I$(SRCDIR) -I$(OBJDIR) $(TCCFLAGS) $(CFLAGS)
230
231 }
232 writeln -nonewline "SRC ="
233 foreach s [lsort $src] {
234 writeln -nonewline " \\\n \$(SRCDIR)/$s.c"
@@ -354,14 +358,14 @@
358 append mhargs "\$(SRCDIR)/th.h <<<NEXT_LINE>>>"
359 #append mhargs "\$(SRCDIR)/cson_amalgamation.h <<<NEXT_LINE>>>"
360 append mhargs "\$(OBJDIR)/VERSION.h"
361 set mhargs [string map [list <<<NEXT_LINE>>> \\\n\t] $mhargs]
362 writeln "\$(OBJDIR)/page_index.h: \$(TRANS_SRC) \$(OBJDIR)/mkindex"
363 writeln "\t\$(OBJDIR)/mkindex \$(TRANS_SRC) >\$@\n"
364
365 writeln "\$(OBJDIR)/builtin_data.h: \$(OBJDIR)/mkbuiltin \$(EXTRA_FILES)"
366 writeln "\t\$(OBJDIR)/mkbuiltin \$(EXTRA_FILES) >\$@\n"
367
368 writeln "\$(OBJDIR)/headers:\t\$(OBJDIR)/page_index.h \$(OBJDIR)/builtin_data.h \$(OBJDIR)/makeheaders \$(OBJDIR)/VERSION.h"
369 writeln "\t\$(OBJDIR)/makeheaders $mhargs"
370 writeln "\ttouch \$(OBJDIR)/headers"
371 writeln "\$(OBJDIR)/headers: Makefile"
@@ -370,37 +374,37 @@
374 set extra_h(main) " \$(OBJDIR)/page_index.h "
375 set extra_h(builtin) " \$(OBJDIR)/builtin_data.h "
376
377 foreach s [lsort $src] {
378 writeln "\$(OBJDIR)/${s}_.c:\t\$(SRCDIR)/$s.c \$(OBJDIR)/translate"
379 writeln "\t\$(OBJDIR)/translate \$(SRCDIR)/$s.c >\$@\n"
380 writeln "\$(OBJDIR)/$s.o:\t\$(OBJDIR)/${s}_.c \$(OBJDIR)/$s.h$extra_h($s)\$(SRCDIR)/config.h"
381 writeln "\t\$(XTCC) -o \$(OBJDIR)/$s.o -c \$(OBJDIR)/${s}_.c\n"
382 writeln "\$(OBJDIR)/$s.h:\t\$(OBJDIR)/headers\n"
383 }
384
385 writeln "\$(OBJDIR)/sqlite3.o:\t\$(SRCDIR)/sqlite3.c"
386 writeln "\t\$(XTCC) \$(SQLITE_OPTIONS) \$(SQLITE_CFLAGS) -c \$(SRCDIR)/sqlite3.c -o \$@\n"
387
388 writeln "\$(OBJDIR)/shell.o:\t\$(SRCDIR)/shell.c \$(SRCDIR)/sqlite3.h"
389 writeln "\t\$(XTCC) \$(SHELL_OPTIONS) \$(SHELL_CFLAGS) -c \$(SRCDIR)/shell.c -o \$@\n"
390
391 writeln "\$(OBJDIR)/th.o:\t\$(SRCDIR)/th.c"
392 writeln "\t\$(XTCC) -c \$(SRCDIR)/th.c -o \$@\n"
393
394 writeln "\$(OBJDIR)/th_lang.o:\t\$(SRCDIR)/th_lang.c"
395 writeln "\t\$(XTCC) -c \$(SRCDIR)/th_lang.c -o \$@\n"
396
397 writeln "\$(OBJDIR)/th_tcl.o:\t\$(SRCDIR)/th_tcl.c"
398 writeln "\t\$(XTCC) -c \$(SRCDIR)/th_tcl.c -o \$@\n"
399
400 writeln {
401 $(OBJDIR)/miniz.o: $(SRCDIR)/miniz.c
402 $(XTCC) $(MINIZ_OPTIONS) -c $(SRCDIR)/miniz.c -o $@
403
404 $(OBJDIR)/cson_amalgamation.o: $(SRCDIR)/cson_amalgamation.c
405 $(XTCC) -c $(SRCDIR)/cson_amalgamation.c -o $@
406
407 #
408 # The list of all the targets that do not correspond to real files. This stops
409 # 'make' from getting confused when someone makes an error in a rule.
410 #
@@ -516,23 +520,35 @@
520 ifndef MINGW_IS_32BIT_ONLY
521 ifeq (,$(findstring w64-mingw32,$(PREFIX)))
522 MINGW_IS_32BIT_ONLY = 1
523 endif
524 endif
 
 
 
 
 
 
 
 
525
526 #### The directories where the zlib include and library files are located.
527 #
528 ZINCDIR = $(SRCDIR)/../compat/zlib
529 ZLIBDIR = $(SRCDIR)/../compat/zlib
530
531 ifndef X64
532 ifneq (,$(findstring x86_64-w64-mingw32,$(PREFIX)))
533 X64 = 1
534 endif
535 endif
536
537 ifndef X64
538 SSLCONFIG = mingw
539 ZLIBCONFIG = LOC="-DASMV -DASMINF" OBJA="inffas86.o match.o"
540 LIBTARGETS = $(ZLIBDIR)/inffas86.o $(ZLIBDIR)/match.o
541 else
542 SSLCONFIG = mingw64
543 ZLIBCONFIG =
544 LIBTARGETS =
545 endif
546
547 ifndef FOSSIL_ENABLE_MINIZ
548 SSLCONFIG += --with-zlib-lib=$(PWD)/$(ZLIBDIR) --with-zlib-include=$(PWD)/$(ZLIBDIR) zlib
549 endif
550
551 #### The directories where the OpenSSL include and library files are located.
552 # The recommended usage here is to use the Sysinternals junction tool
553 # to create a hard link between an "openssl-1.x" sub-directory of the
554 # Fossil source code directory and the target OpenSSL source directory.
@@ -774,11 +790,10 @@
790 writeln -nonewline " \\\n \$(OBJDIR)/$s.o"
791 }
792 writeln "\n"
793 writeln "APPNAME = ${name}.exe"
794 writeln "APPTARGETS ="
 
795 writeln {
796 #### If the USE_WINDOWS variable exists, it is assumed that we are building
797 # inside of a Windows-style shell; otherwise, it is assumed that we are
798 # building inside of a Unix-style shell. Note that the "move" command is
799 # broken when attempting to use it from the Windows shell via MinGW make
@@ -847,35 +862,35 @@
862 else
863 $(MKDIR) $(OBJDIR)
864 endif
865
866 $(TRANSLATE): $(SRCDIR)/translate.c
867 $(BCC) -o $@ $(SRCDIR)/translate.c
868
869 $(MAKEHEADERS): $(SRCDIR)/makeheaders.c
870 $(BCC) -o $@ $(SRCDIR)/makeheaders.c
871
872 $(MKINDEX): $(SRCDIR)/mkindex.c
873 $(BCC) -o $@ $(SRCDIR)/mkindex.c
874
875 $(MKBUILTIN): $(SRCDIR)/mkbuiltin.c
876 $(BCC) -o $@ $(SRCDIR)/mkbuiltin.c
877
878 $(MKVERSION): $(SRCDIR)/mkversion.c
879 $(BCC) -o $@ $(SRCDIR)/mkversion.c
880
881 $(CODECHECK1): $(SRCDIR)/codecheck1.c
882 $(BCC) -o $@ $(SRCDIR)/codecheck1.c
883
884 # WARNING. DANGER. Running the test suite modifies the repository the
885 # build is done from, i.e. the checkout belongs to. Do not sync/push
886 # the repository after running the tests.
887 test: $(OBJDIR) $(APPNAME)
888 $(TCLSH) $(SRCDIR)/../test/tester.tcl $(APPNAME)
889
890 $(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(MKVERSION)
891 $(MKVERSION) $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION >$@
892
893 # The USE_SYSTEM_SQLITE variable may be undefined, set to 0, or set
894 # to 1. If it is set to 1, then there is no need to build or link
895 # the sqlite3.o object. Instead, the system SQLite will be linked
896 # using -lsqlite3.
@@ -902,14 +917,21 @@
917 $(OBJDIR)/cson_amalgamation.o
918 }]
919
920 writeln {
921 zlib:
922 $(MAKE) -C $(ZLIBDIR) PREFIX=$(PREFIX) $(ZLIBCONFIG) -f win32/Makefile.gcc libz.a
923
924 clean-zlib:
925 $(MAKE) -C $(ZLIBDIR) PREFIX=$(PREFIX) -f win32/Makefile.gcc clean
926
927 $(ZLIBDIR)/inffas86.o:
928 $(TCC) -c -o $@ -DASMINF -I$(ZLIBDIR) -O3 $(ZLIBDIR)/contrib/inflate86/inffas86.c
929
930 $(ZLIBDIR)/match.o:
931 $(TCC) -c -o $@ -DASMV $(ZLIBDIR)/contrib/asm686/match.S
932
933
934 ifndef FOSSIL_ENABLE_MINIZ
935 LIBTARGETS += zlib
936 endif
937
@@ -933,11 +955,11 @@
955 APPTARGETS += openssl
956 endif
957
958 $(APPNAME): $(OBJDIR)/headers $(CODECHECK1) $(OBJ) $(EXTRAOBJ) $(OBJDIR)/fossil.o $(APPTARGETS)
959 $(CODECHECK1) $(TRANS_SRC)
960 $(TCC) -o $@ $(OBJ) $(EXTRAOBJ) $(LIB) $(OBJDIR)/fossil.o
961
962 # This rule prevents make from using its default rules to try build
963 # an executable named "manifest" out of the file named "manifest.c"
964 #
965 $(SRCDIR)/../manifest:
@@ -967,14 +989,14 @@
989 }
990 append mhargs " \\\n\t\t\$(SRCDIR)/sqlite3.h"
991 append mhargs " \\\n\t\t\$(SRCDIR)/th.h"
992 append mhargs " \\\n\t\t\$(OBJDIR)/VERSION.h"
993 writeln "\$(OBJDIR)/page_index.h: \$(TRANS_SRC) \$(MKINDEX)"
994 writeln "\t\$(MKINDEX) \$(TRANS_SRC) >\$@\n"
995
996 writeln "\$(OBJDIR)/builtin_data.h:\t\$(MKBUILTIN) \$(EXTRA_FILES)"
997 writeln "\t\$(MKBUILTIN) \$(EXTRA_FILES) >\$@\n"
998
999 writeln "\$(OBJDIR)/headers:\t\$(OBJDIR)/page_index.h \$(OBJDIR)/builtin_data.h \$(MAKEHEADERS) \$(OBJDIR)/VERSION.h"
1000 writeln "\t\$(MAKEHEADERS) $mhargs"
1001 writeln "\techo Done >\$(OBJDIR)/headers\n"
1002 writeln "\$(OBJDIR)/headers: Makefile\n"
@@ -982,11 +1004,11 @@
1004 set extra_h(main) " \$(OBJDIR)/page_index.h "
1005 set extra_h(builtin) " \$(OBJDIR)/builtin_data.h "
1006
1007 foreach s [lsort $src] {
1008 writeln "\$(OBJDIR)/${s}_.c:\t\$(SRCDIR)/$s.c \$(TRANSLATE)"
1009 writeln "\t\$(TRANSLATE) \$(SRCDIR)/$s.c >\$@\n"
1010 writeln "\$(OBJDIR)/$s.o:\t\$(OBJDIR)/${s}_.c \$(OBJDIR)/$s.h$extra_h($s)\$(SRCDIR)/config.h"
1011 writeln "\t\$(XTCC) -o \$(OBJDIR)/$s.o -c \$(OBJDIR)/${s}_.c\n"
1012 writeln "\$(OBJDIR)/${s}.h:\t\$(OBJDIR)/headers\n"
1013 }
1014
@@ -1006,30 +1028,30 @@
1028 writeln "SHELL_OPTIONS = [join $SHELL_WIN32_OPTIONS $j]\n"
1029 set j " \\\n "
1030 writeln "MINIZ_OPTIONS = [join $MINIZ_WIN32_OPTIONS $j]\n"
1031
1032 writeln "\$(OBJDIR)/sqlite3.o:\t\$(SRCDIR)/sqlite3.c \$(SRCDIR)/../win/Makefile.mingw"
1033 writeln "\t\$(XTCC) \$(SQLITE_OPTIONS) \$(SQLITE_CFLAGS) -c \$(SRCDIR)/sqlite3.c -o \$@\n"
1034
1035 writeln "\$(OBJDIR)/cson_amalgamation.o:\t\$(SRCDIR)/cson_amalgamation.c"
1036 writeln "\t\$(XTCC) -c \$(SRCDIR)/cson_amalgamation.c -o \$@\n"
1037 writeln "\$(OBJDIR)/json.o \$(OBJDIR)/json_artifact.o \$(OBJDIR)/json_branch.o \$(OBJDIR)/json_config.o \$(OBJDIR)/json_diff.o \$(OBJDIR)/json_dir.o \$(OBJDIR)/jsos_finfo.o \$(OBJDIR)/json_login.o \$(OBJDIR)/json_query.o \$(OBJDIR)/json_report.o \$(OBJDIR)/json_status.o \$(OBJDIR)/json_tag.o \$(OBJDIR)/json_timeline.o \$(OBJDIR)/json_user.o \$(OBJDIR)/json_wiki.o : \$(SRCDIR)/json_detail.h\n"
1038
1039 writeln "\$(OBJDIR)/shell.o:\t\$(SRCDIR)/shell.c \$(SRCDIR)/sqlite3.h \$(SRCDIR)/../win/Makefile.mingw"
1040 writeln "\t\$(XTCC) \$(SHELL_OPTIONS) \$(SHELL_CFLAGS) -c \$(SRCDIR)/shell.c -o \$@\n"
1041
1042 writeln "\$(OBJDIR)/th.o:\t\$(SRCDIR)/th.c"
1043 writeln "\t\$(XTCC) -c \$(SRCDIR)/th.c -o \$@\n"
1044
1045 writeln "\$(OBJDIR)/th_lang.o:\t\$(SRCDIR)/th_lang.c"
1046 writeln "\t\$(XTCC) -c \$(SRCDIR)/th_lang.c -o \$@\n"
1047
1048 writeln "\$(OBJDIR)/th_tcl.o:\t\$(SRCDIR)/th_tcl.c"
1049 writeln "\t\$(XTCC) -c \$(SRCDIR)/th_tcl.c -o \$@\n"
1050
1051 writeln "\$(OBJDIR)/miniz.o:\t\$(SRCDIR)/miniz.c"
1052 writeln "\t\$(XTCC) \$(MINIZ_OPTIONS) -c \$(SRCDIR)/miniz.c -o \$@\n"
1053
1054 close $output_file
1055 #
1056 # End of the win/Makefile.mingw output
1057 ##############################################################################
@@ -1770,11 +1792,11 @@
1792 builtin_data.h: $(EXTRA_FILES) mkbuiltin.exe
1793 mkbuiltin.exe $(EXTRA_FILES) >$@
1794
1795 # extracting version info from manifest
1796 VERSION.h: version.exe ..\manifest.uuid ..\manifest ..\VERSION
1797 version.exe ..\manifest.uuid ..\manifest ..\VERSION >$@
1798
1799 # generate the simplified headers
1800 headers: makeheaders.exe page_index.h builtin_data.h VERSION.h ../src/sqlite3.h ../src/th.h VERSION.h
1801 makeheaders.exe $(foreach ts,$(TRANSLATEDSRC),$(ts):$(ts:_.c=.h)) ../src/sqlite3.h ../src/th.h VERSION.h
1802 echo Done >$@
1803
+22 -2
--- src/manifest.c
+++ src/manifest.c
@@ -1772,14 +1772,34 @@
17721772
zScript = xfer_commit_code();
17731773
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
17741774
}
17751775
if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){
17761776
char *zCom;
1777
+ char zBaseId[30];
1778
+ if( p->zBaseline ){
1779
+ sqlite3_snprintf(sizeof(zBaseId), zBaseId, "%d",
1780
+ uuid_to_rid(p->zBaseline,1));
1781
+ }else{
1782
+ sqlite3_snprintf(sizeof(zBaseId), zBaseId, "NULL");
1783
+ }
1784
+ (void)db_schema_is_outofdate(); /* Make sure g.zAuxSchema is initialized */
17771785
for(i=0; i<p->nParent; i++){
17781786
int pid = uuid_to_rid(p->azParent[i], 1);
1779
- db_multi_exec("INSERT OR IGNORE INTO plink(pid, cid, isprim, mtime)"
1780
- "VALUES(%d, %d, %d, %.17g)", pid, rid, i==0, p->rDate);
1787
+ if( strcmp(g.zAuxSchema,"2014-11-24 20:35")>=0 ){
1788
+ /* Support for PLINK.BASEID added on 2014-11-24 */
1789
+ db_multi_exec(
1790
+ "INSERT OR IGNORE INTO plink(pid, cid, isprim, mtime, baseid)"
1791
+ "VALUES(%d, %d, %d, %.17g, %s)",
1792
+ pid, rid, i==0, p->rDate, zBaseId/*safe-for-%s*/);
1793
+ }else{
1794
+ /* Continue to work with older schema to avoid an unnecessary
1795
+ ** rebuild */
1796
+ db_multi_exec(
1797
+ "INSERT OR IGNORE INTO plink(pid, cid, isprim, mtime)"
1798
+ "VALUES(%d, %d, %d, %.17g)",
1799
+ pid, rid, i==0, p->rDate);
1800
+ }
17811801
if( i==0 ){
17821802
add_mlink(pid, 0, rid, p);
17831803
parentid = pid;
17841804
}
17851805
}
17861806
--- src/manifest.c
+++ src/manifest.c
@@ -1772,14 +1772,34 @@
1772 zScript = xfer_commit_code();
1773 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
1774 }
1775 if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){
1776 char *zCom;
 
 
 
 
 
 
 
 
1777 for(i=0; i<p->nParent; i++){
1778 int pid = uuid_to_rid(p->azParent[i], 1);
1779 db_multi_exec("INSERT OR IGNORE INTO plink(pid, cid, isprim, mtime)"
1780 "VALUES(%d, %d, %d, %.17g)", pid, rid, i==0, p->rDate);
 
 
 
 
 
 
 
 
 
 
 
 
1781 if( i==0 ){
1782 add_mlink(pid, 0, rid, p);
1783 parentid = pid;
1784 }
1785 }
1786
--- src/manifest.c
+++ src/manifest.c
@@ -1772,14 +1772,34 @@
1772 zScript = xfer_commit_code();
1773 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
1774 }
1775 if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){
1776 char *zCom;
1777 char zBaseId[30];
1778 if( p->zBaseline ){
1779 sqlite3_snprintf(sizeof(zBaseId), zBaseId, "%d",
1780 uuid_to_rid(p->zBaseline,1));
1781 }else{
1782 sqlite3_snprintf(sizeof(zBaseId), zBaseId, "NULL");
1783 }
1784 (void)db_schema_is_outofdate(); /* Make sure g.zAuxSchema is initialized */
1785 for(i=0; i<p->nParent; i++){
1786 int pid = uuid_to_rid(p->azParent[i], 1);
1787 if( strcmp(g.zAuxSchema,"2014-11-24 20:35")>=0 ){
1788 /* Support for PLINK.BASEID added on 2014-11-24 */
1789 db_multi_exec(
1790 "INSERT OR IGNORE INTO plink(pid, cid, isprim, mtime, baseid)"
1791 "VALUES(%d, %d, %d, %.17g, %s)",
1792 pid, rid, i==0, p->rDate, zBaseId/*safe-for-%s*/);
1793 }else{
1794 /* Continue to work with older schema to avoid an unnecessary
1795 ** rebuild */
1796 db_multi_exec(
1797 "INSERT OR IGNORE INTO plink(pid, cid, isprim, mtime)"
1798 "VALUES(%d, %d, %d, %.17g)",
1799 pid, rid, i==0, p->rDate);
1800 }
1801 if( i==0 ){
1802 add_mlink(pid, 0, rid, p);
1803 parentid = pid;
1804 }
1805 }
1806
+22 -2
--- src/manifest.c
+++ src/manifest.c
@@ -1772,14 +1772,34 @@
17721772
zScript = xfer_commit_code();
17731773
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
17741774
}
17751775
if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){
17761776
char *zCom;
1777
+ char zBaseId[30];
1778
+ if( p->zBaseline ){
1779
+ sqlite3_snprintf(sizeof(zBaseId), zBaseId, "%d",
1780
+ uuid_to_rid(p->zBaseline,1));
1781
+ }else{
1782
+ sqlite3_snprintf(sizeof(zBaseId), zBaseId, "NULL");
1783
+ }
1784
+ (void)db_schema_is_outofdate(); /* Make sure g.zAuxSchema is initialized */
17771785
for(i=0; i<p->nParent; i++){
17781786
int pid = uuid_to_rid(p->azParent[i], 1);
1779
- db_multi_exec("INSERT OR IGNORE INTO plink(pid, cid, isprim, mtime)"
1780
- "VALUES(%d, %d, %d, %.17g)", pid, rid, i==0, p->rDate);
1787
+ if( strcmp(g.zAuxSchema,"2014-11-24 20:35")>=0 ){
1788
+ /* Support for PLINK.BASEID added on 2014-11-24 */
1789
+ db_multi_exec(
1790
+ "INSERT OR IGNORE INTO plink(pid, cid, isprim, mtime, baseid)"
1791
+ "VALUES(%d, %d, %d, %.17g, %s)",
1792
+ pid, rid, i==0, p->rDate, zBaseId/*safe-for-%s*/);
1793
+ }else{
1794
+ /* Continue to work with older schema to avoid an unnecessary
1795
+ ** rebuild */
1796
+ db_multi_exec(
1797
+ "INSERT OR IGNORE INTO plink(pid, cid, isprim, mtime)"
1798
+ "VALUES(%d, %d, %d, %.17g)",
1799
+ pid, rid, i==0, p->rDate);
1800
+ }
17811801
if( i==0 ){
17821802
add_mlink(pid, 0, rid, p);
17831803
parentid = pid;
17841804
}
17851805
}
17861806
--- src/manifest.c
+++ src/manifest.c
@@ -1772,14 +1772,34 @@
1772 zScript = xfer_commit_code();
1773 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
1774 }
1775 if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){
1776 char *zCom;
 
 
 
 
 
 
 
 
1777 for(i=0; i<p->nParent; i++){
1778 int pid = uuid_to_rid(p->azParent[i], 1);
1779 db_multi_exec("INSERT OR IGNORE INTO plink(pid, cid, isprim, mtime)"
1780 "VALUES(%d, %d, %d, %.17g)", pid, rid, i==0, p->rDate);
 
 
 
 
 
 
 
 
 
 
 
 
1781 if( i==0 ){
1782 add_mlink(pid, 0, rid, p);
1783 parentid = pid;
1784 }
1785 }
1786
--- src/manifest.c
+++ src/manifest.c
@@ -1772,14 +1772,34 @@
1772 zScript = xfer_commit_code();
1773 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
1774 }
1775 if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){
1776 char *zCom;
1777 char zBaseId[30];
1778 if( p->zBaseline ){
1779 sqlite3_snprintf(sizeof(zBaseId), zBaseId, "%d",
1780 uuid_to_rid(p->zBaseline,1));
1781 }else{
1782 sqlite3_snprintf(sizeof(zBaseId), zBaseId, "NULL");
1783 }
1784 (void)db_schema_is_outofdate(); /* Make sure g.zAuxSchema is initialized */
1785 for(i=0; i<p->nParent; i++){
1786 int pid = uuid_to_rid(p->azParent[i], 1);
1787 if( strcmp(g.zAuxSchema,"2014-11-24 20:35")>=0 ){
1788 /* Support for PLINK.BASEID added on 2014-11-24 */
1789 db_multi_exec(
1790 "INSERT OR IGNORE INTO plink(pid, cid, isprim, mtime, baseid)"
1791 "VALUES(%d, %d, %d, %.17g, %s)",
1792 pid, rid, i==0, p->rDate, zBaseId/*safe-for-%s*/);
1793 }else{
1794 /* Continue to work with older schema to avoid an unnecessary
1795 ** rebuild */
1796 db_multi_exec(
1797 "INSERT OR IGNORE INTO plink(pid, cid, isprim, mtime)"
1798 "VALUES(%d, %d, %d, %.17g)",
1799 pid, rid, i==0, p->rDate);
1800 }
1801 if( i==0 ){
1802 add_mlink(pid, 0, rid, p);
1803 parentid = pid;
1804 }
1805 }
1806
+9 -2
--- src/mkversion.c
+++ src/mkversion.c
@@ -7,10 +7,11 @@
77
**
88
** Note that the manifest.uuid and manifest files are generated by Fossil.
99
*/
1010
#include <stdio.h>
1111
#include <string.h>
12
+#include <stdlib.h>
1213
1314
int main(int argc, char *argv[]){
1415
FILE *m,*u,*v;
1516
char *z;
1617
int i, x, d;
@@ -17,11 +18,14 @@
1718
char b[1000];
1819
char vx[1000];
1920
memset(b,0,sizeof(b));
2021
memset(vx,0,sizeof(vx));
2122
u = fopen(argv[1],"r");
22
- fgets(b, sizeof(b)-1,u);
23
+ if( fgets(b, sizeof(b)-1,u)==0 ){
24
+ fprintf(stderr, "malformed manifest.uuid file: %s\n", argv[1]);
25
+ exit(1);
26
+ }
2327
fclose(u);
2428
for(z=b; z[0] && z[0]!='\r' && z[0]!='\n'; z++){}
2529
*z = 0;
2630
printf("#define MANIFEST_UUID \"%s\"\n",b);
2731
printf("#define MANIFEST_VERSION \"[%10.10s]\"\n",b);
@@ -32,11 +36,14 @@
3236
printf("#define MANIFEST_YEAR \"%.4s\"\n",b+2);
3337
}
3438
}
3539
fclose(m);
3640
v = fopen(argv[3],"r");
37
- fgets(b, sizeof(b)-1,v);
41
+ if( fgets(b, sizeof(b)-1,v)==0 ){
42
+ fprintf(stderr, "malformed VERSION file: %s\n", argv[3]);
43
+ exit(1);
44
+ }
3845
fclose(v);
3946
for(z=b; z[0] && z[0]!='\r' && z[0]!='\n'; z++){}
4047
*z = 0;
4148
printf("#define RELEASE_VERSION \"%s\"\n", b);
4249
x=0;
4350
--- src/mkversion.c
+++ src/mkversion.c
@@ -7,10 +7,11 @@
7 **
8 ** Note that the manifest.uuid and manifest files are generated by Fossil.
9 */
10 #include <stdio.h>
11 #include <string.h>
 
12
13 int main(int argc, char *argv[]){
14 FILE *m,*u,*v;
15 char *z;
16 int i, x, d;
@@ -17,11 +18,14 @@
17 char b[1000];
18 char vx[1000];
19 memset(b,0,sizeof(b));
20 memset(vx,0,sizeof(vx));
21 u = fopen(argv[1],"r");
22 fgets(b, sizeof(b)-1,u);
 
 
 
23 fclose(u);
24 for(z=b; z[0] && z[0]!='\r' && z[0]!='\n'; z++){}
25 *z = 0;
26 printf("#define MANIFEST_UUID \"%s\"\n",b);
27 printf("#define MANIFEST_VERSION \"[%10.10s]\"\n",b);
@@ -32,11 +36,14 @@
32 printf("#define MANIFEST_YEAR \"%.4s\"\n",b+2);
33 }
34 }
35 fclose(m);
36 v = fopen(argv[3],"r");
37 fgets(b, sizeof(b)-1,v);
 
 
 
38 fclose(v);
39 for(z=b; z[0] && z[0]!='\r' && z[0]!='\n'; z++){}
40 *z = 0;
41 printf("#define RELEASE_VERSION \"%s\"\n", b);
42 x=0;
43
--- src/mkversion.c
+++ src/mkversion.c
@@ -7,10 +7,11 @@
7 **
8 ** Note that the manifest.uuid and manifest files are generated by Fossil.
9 */
10 #include <stdio.h>
11 #include <string.h>
12 #include <stdlib.h>
13
14 int main(int argc, char *argv[]){
15 FILE *m,*u,*v;
16 char *z;
17 int i, x, d;
@@ -17,11 +18,14 @@
18 char b[1000];
19 char vx[1000];
20 memset(b,0,sizeof(b));
21 memset(vx,0,sizeof(vx));
22 u = fopen(argv[1],"r");
23 if( fgets(b, sizeof(b)-1,u)==0 ){
24 fprintf(stderr, "malformed manifest.uuid file: %s\n", argv[1]);
25 exit(1);
26 }
27 fclose(u);
28 for(z=b; z[0] && z[0]!='\r' && z[0]!='\n'; z++){}
29 *z = 0;
30 printf("#define MANIFEST_UUID \"%s\"\n",b);
31 printf("#define MANIFEST_VERSION \"[%10.10s]\"\n",b);
@@ -32,11 +36,14 @@
36 printf("#define MANIFEST_YEAR \"%.4s\"\n",b+2);
37 }
38 }
39 fclose(m);
40 v = fopen(argv[3],"r");
41 if( fgets(b, sizeof(b)-1,v)==0 ){
42 fprintf(stderr, "malformed VERSION file: %s\n", argv[3]);
43 exit(1);
44 }
45 fclose(v);
46 for(z=b; z[0] && z[0]!='\r' && z[0]!='\n'; z++){}
47 *z = 0;
48 printf("#define RELEASE_VERSION \"%s\"\n", b);
49 x=0;
50
--- src/moderate.c
+++ src/moderate.c
@@ -116,10 +116,11 @@
116116
attachRid = db_int(0, "SELECT attachRid FROM modreq WHERE objid=%d", rid);
117117
if( rid==objid ){
118118
db_multi_exec("DELETE FROM modreq WHERE objid=%d", rid);
119119
}
120120
if( attachRid && object_used(attachRid) ) attachRid = 0;
121
+ admin_log("Disapproved moderation of rid %d.", rid);
121122
rid = attachRid;
122123
}
123124
db_end_transaction(0);
124125
}
125126
@@ -134,10 +135,11 @@
134135
"INSERT OR IGNORE INTO unclustered VALUES(%d);"
135136
"INSERT OR IGNORE INTO unsent VALUES(%d);",
136137
rid, rid, rid
137138
);
138139
db_multi_exec("DELETE FROM modreq WHERE objid=%d", rid);
140
+ admin_log("Approved moderation of rid %d.", rid);
139141
db_end_transaction(0);
140142
}
141143
142144
/*
143145
** WEBPAGE: modreq
144146
--- src/moderate.c
+++ src/moderate.c
@@ -116,10 +116,11 @@
116 attachRid = db_int(0, "SELECT attachRid FROM modreq WHERE objid=%d", rid);
117 if( rid==objid ){
118 db_multi_exec("DELETE FROM modreq WHERE objid=%d", rid);
119 }
120 if( attachRid && object_used(attachRid) ) attachRid = 0;
 
121 rid = attachRid;
122 }
123 db_end_transaction(0);
124 }
125
@@ -134,10 +135,11 @@
134 "INSERT OR IGNORE INTO unclustered VALUES(%d);"
135 "INSERT OR IGNORE INTO unsent VALUES(%d);",
136 rid, rid, rid
137 );
138 db_multi_exec("DELETE FROM modreq WHERE objid=%d", rid);
 
139 db_end_transaction(0);
140 }
141
142 /*
143 ** WEBPAGE: modreq
144
--- src/moderate.c
+++ src/moderate.c
@@ -116,10 +116,11 @@
116 attachRid = db_int(0, "SELECT attachRid FROM modreq WHERE objid=%d", rid);
117 if( rid==objid ){
118 db_multi_exec("DELETE FROM modreq WHERE objid=%d", rid);
119 }
120 if( attachRid && object_used(attachRid) ) attachRid = 0;
121 admin_log("Disapproved moderation of rid %d.", rid);
122 rid = attachRid;
123 }
124 db_end_transaction(0);
125 }
126
@@ -134,10 +135,11 @@
135 "INSERT OR IGNORE INTO unclustered VALUES(%d);"
136 "INSERT OR IGNORE INTO unsent VALUES(%d);",
137 rid, rid, rid
138 );
139 db_multi_exec("DELETE FROM modreq WHERE objid=%d", rid);
140 admin_log("Approved moderation of rid %d.", rid);
141 db_end_transaction(0);
142 }
143
144 /*
145 ** WEBPAGE: modreq
146
+265 -35
--- src/name.c
+++ src/name.c
@@ -42,10 +42,44 @@
4242
if( z[7]!='-') return 0;
4343
if( !fossil_isdigit(z[8]) ) return 0;
4444
if( !fossil_isdigit(z[9]) ) return 0;
4545
return 1;
4646
}
47
+
48
+/*
49
+** Return the RID that is the "root" of the branch that contains
50
+** check-in "rid" if inBranch==0 or the first check-in in the branch
51
+** if inBranch==1.
52
+*/
53
+int start_of_branch(int rid, int inBranch){
54
+ Stmt q;
55
+ int rc;
56
+ char *zBr;
57
+ zBr = db_text("trunk","SELECT value FROM tagxref"
58
+ " WHERE rid=%d AND tagid=%d"
59
+ " AND tagtype>0",
60
+ rid, TAG_BRANCH);
61
+ db_prepare(&q,
62
+ "SELECT pid, EXISTS(SELECT 1 FROM tagxref"
63
+ " WHERE tagid=%d AND tagtype>0"
64
+ " AND value=%Q AND rid=plink.pid)"
65
+ " FROM plink"
66
+ " WHERE cid=:cid AND isprim",
67
+ TAG_BRANCH, zBr
68
+ );
69
+ fossil_free(zBr);
70
+ do{
71
+ db_reset(&q);
72
+ db_bind_int(&q, ":cid", rid);
73
+ rc = db_step(&q);
74
+ if( rc!=SQLITE_ROW ) break;
75
+ if( inBranch && db_column_int(&q,1)==0 ) break;
76
+ rid = db_column_int(&q, 0);
77
+ }while( db_column_int(&q, 1)==1 && rid>0 );
78
+ db_finalize(&q);
79
+ return rid;
80
+}
4781
4882
/*
4983
** Convert a symbolic name into a RID. Acceptable forms:
5084
**
5185
** * SHA1 hash
@@ -66,20 +100,28 @@
66100
** Return the RID of the matching artifact. Or return 0 if the name does not
67101
** match any known object. Or return -1 if the name is ambiguous.
68102
**
69103
** The zType parameter specifies the type of artifact: ci, t, w, e, g.
70104
** If zType is NULL or "" or "*" then any type of artifact will serve.
105
+** If zType is "br" then find the first check-in of the named branch
106
+** rather than the last.
71107
** zType is "ci" in most use cases since we are usually searching for
72108
** a check-in.
73109
*/
74110
int symbolic_name_to_rid(const char *zTag, const char *zType){
75111
int vid;
76112
int rid = 0;
77113
int nTag;
78114
int i;
115
+ int startOfBranch = 0;
79116
80
- if( zType==0 || zType[0]==0 ) zType = "*";
117
+ if( zType==0 || zType[0]==0 ){
118
+ zType = "*";
119
+ }else if( zType[0]=='b' ){
120
+ zType = "ci";
121
+ startOfBranch = 1;
122
+ }
81123
if( zTag==0 || zTag[0]==0 ) return 0;
82124
83125
/* special keyword: "tip" */
84126
if( fossil_strcmp(zTag, "tip")==0 && (zType[0]=='*' || zType[0]=='c') ){
85127
rid = db_int(0,
@@ -151,41 +193,18 @@
151193
" AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 "
152194
" AND event.objid=tagxref.rid "
153195
" AND event.type GLOB '%q'",
154196
&zTag[4], zType
155197
);
198
+ if( startOfBranch ) rid = start_of_branch(rid,1);
156199
return rid;
157200
}
158201
159202
/* root:TAG -> The origin of the branch */
160203
if( memcmp(zTag, "root:", 5)==0 ){
161
- Stmt q;
162
- int rc;
163
- char *zBr;
164204
rid = symbolic_name_to_rid(zTag+5, zType);
165
- zBr = db_text("trunk","SELECT value FROM tagxref"
166
- " WHERE rid=%d AND tagid=%d"
167
- " AND tagtype>0",
168
- rid, TAG_BRANCH);
169
- db_prepare(&q,
170
- "SELECT pid, EXISTS(SELECT 1 FROM tagxref"
171
- " WHERE tagid=%d AND tagtype>0"
172
- " AND value=%Q AND rid=plink.pid)"
173
- " FROM plink"
174
- " WHERE cid=:cid AND isprim",
175
- TAG_BRANCH, zBr
176
- );
177
- fossil_free(zBr);
178
- do{
179
- db_reset(&q);
180
- db_bind_int(&q, ":cid", rid);
181
- rc = db_step(&q);
182
- if( rc!=SQLITE_ROW ) break;
183
- rid = db_column_int(&q, 0);
184
- }while( db_column_int(&q, 1)==1 && rid>0 );
185
- db_finalize(&q);
186
- return rid;
205
+ return start_of_branch(rid, 0);
187206
}
188207
189208
/* symbolic-name ":" date-time */
190209
nTag = strlen(zTag);
191210
for(i=0; i<nTag-10 && zTag[i]!=':'; i++){}
@@ -245,11 +264,14 @@
245264
" AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 "
246265
" AND event.objid=tagxref.rid "
247266
" AND event.type GLOB '%q'",
248267
zTag, zType
249268
);
250
- if( rid>0 ) return rid;
269
+ if( rid>0 ){
270
+ if( startOfBranch ) rid = start_of_branch(rid,1);
271
+ return rid;
272
+ }
251273
252274
/* Undocumented: numeric tags get translated directly into the RID */
253275
if( memcmp(zTag, "rid:", 4)==0 ){
254276
zTag += 4;
255277
for(i=0; fossil_isdigit(zTag[i]); i++){}
@@ -391,18 +413,15 @@
391413
int rid;
392414
393415
if( zName==0 || zName[0]==0 ) return 0;
394416
rid = symbolic_name_to_rid(zName, zType);
395417
if( rid<0 ){
396
- fossil_error(1, "ambiguous name: %s", zName);
397
- return 0;
418
+ fossil_fatal("ambiguous name: %s", zName);
398419
}else if( rid==0 ){
399
- fossil_error(1, "not found: %s", zName);
400
- return 0;
401
- }else{
402
- return rid;
420
+ fossil_fatal("not found: %s", zName);
403421
}
422
+ return rid;
404423
}
405424
int name_to_rid(const char *zName){
406425
return name_to_typed_rid(zName, "*");
407426
}
408427
@@ -505,11 +524,11 @@
505524
}
506525
507526
/*
508527
** Generate a description of artifact "rid"
509528
*/
510
-static void whatis_rid(int rid, int verboseFlag){
529
+void whatis_rid(int rid, int verboseFlag){
511530
Stmt q;
512531
int cnt;
513532
514533
/* Basic information about the object. */
515534
db_prepare(&q,
@@ -657,21 +676,23 @@
657676
void whatis_cmd(void){
658677
int rid;
659678
const char *zName;
660679
int verboseFlag;
661680
int i;
681
+ const char *zType = 0;
662682
db_find_and_open_repository(0,0);
663683
verboseFlag = find_option("verbose","v",0)!=0;
684
+ zType = find_option("type",0,1);
664685
665686
/* We should be done with options.. */
666687
verify_all_options();
667688
668689
if( g.argc<3 ) usage("whatis NAME ...");
669690
for(i=2; i<g.argc; i++){
670691
zName = g.argv[i];
671692
if( i>2 ) fossil_print("%.79c\n",'-');
672
- rid = symbolic_name_to_rid(zName, 0);
693
+ rid = symbolic_name_to_rid(zName, zType);
673694
if( rid<0 ){
674695
Stmt q;
675696
int cnt = 0;
676697
fossil_print("name: %s (ambiguous)\n", zName);
677698
db_prepare(&q,
@@ -757,5 +778,214 @@
757778
while( db_step(&q)==SQLITE_ROW ){
758779
fossil_print("%s\n", db_column_text(&q, 0));
759780
}
760781
db_finalize(&q);
761782
}
783
+
784
+/*
785
+** Schema for the description table
786
+*/
787
+static const char zDescTab[] =
788
+@ CREATE TEMP TABLE IF NOT EXISTS description(
789
+@ rid INTEGER PRIMARY KEY, -- RID of the object
790
+@ uuid TEXT, -- SHA1 hash of the object
791
+@ ctime DATETIME, -- Time of creation
792
+@ isPrivate BOOLEAN DEFAULT 0, -- True for unpublished artifacts
793
+@ type TEXT, -- file, checkin, wiki, ticket, etc.
794
+@ summary TEXT, -- Summary comment for the object
795
+@ detail TEXT -- filename, checkin comment, etc
796
+@ );
797
+;
798
+
799
+/*
800
+** Create the description table if it does not already exists.
801
+** Populate fields of this table with descriptions for all artifacts
802
+** whose RID matches the SQL expression in zWhere.
803
+*/
804
+void describe_artifacts(const char *zWhere){
805
+ db_multi_exec("%s", zDescTab/*safe-for-%s*/);
806
+
807
+ /* Describe checkins */
808
+ db_multi_exec(
809
+ "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,summary)\n"
810
+ "SELECT blob.rid, blob.uuid, event.mtime, 'checkin',\n"
811
+ " 'checkin on ' || strftime('%%Y-%%m-%%d %%H:%%M',event.mtime)\n"
812
+ " FROM event, blob\n"
813
+ " WHERE event.objid %s AND event.type='ci'\n"
814
+ " AND event.objid=blob.rid;",
815
+ zWhere /*safe-for-%s*/
816
+ );
817
+
818
+ /* Describe files */
819
+ db_multi_exec(
820
+ "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,summary)\n"
821
+ "SELECT blob.rid, blob.uuid, event.mtime, 'file', 'file '||filename.name\n"
822
+ " FROM mlink, blob, event, filename\n"
823
+ " WHERE mlink.fid %s\n"
824
+ " AND mlink.mid=event.objid\n"
825
+ " AND filename.fnid=mlink.fnid\n"
826
+ " AND mlink.fid=blob.rid;",
827
+ zWhere /*safe-for-%s*/
828
+ );
829
+
830
+ /* Describe tags */
831
+ db_multi_exec(
832
+ "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,summary)\n"
833
+ "SELECT blob.rid, blob.uuid, tagxref.mtime, 'tag',\n"
834
+ " 'tag '||substr((SELECT uuid FROM blob WHERE rid=tagxref.rid),1,16)\n"
835
+ " FROM tagxref, blob\n"
836
+ " WHERE tagxref.srcid %s AND tagxref.srcid!=tagxref.rid\n"
837
+ " AND tagxref.srcid=blob.rid;",
838
+ zWhere /*safe-for-%s*/
839
+ );
840
+
841
+ /* Cluster artifacts */
842
+ db_multi_exec(
843
+ "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,summary)\n"
844
+ "SELECT blob.rid, blob.uuid, tagxref.mtime, 'cluster', 'cluster'\n"
845
+ " FROM tagxref, blob\n"
846
+ " WHERE tagxref.rid %s\n"
847
+ " AND tagxref.tagid=(SELECT tagid FROM tag WHERE tagname='cluster')\n"
848
+ " AND blob.rid=tagxref.rid;",
849
+ zWhere /*safe-for-%s*/
850
+ );
851
+
852
+ /* Ticket change artifacts */
853
+ db_multi_exec(
854
+ "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,summary)\n"
855
+ "SELECT blob.rid, blob.uuid, tagxref.mtime, 'ticket',\n"
856
+ " 'ticket '||substr(tag.tagname,5,21)\n"
857
+ " FROM tagxref, tag, blob\n"
858
+ " WHERE tagxref.rid %s\n"
859
+ " AND tag.tagid=tagxref.tagid\n"
860
+ " AND tag.tagname GLOB 'tkt-*'"
861
+ " AND blob.rid=tagxref.rid;",
862
+ zWhere /*safe-for-%s*/
863
+ );
864
+
865
+ /* Wiki edit artifacts */
866
+ db_multi_exec(
867
+ "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,summary)\n"
868
+ "SELECT blob.rid, blob.uuid, tagxref.mtime, 'wiki',\n"
869
+ " printf('wiki \"%%s\"',substr(tag.tagname,6))\n"
870
+ " FROM tagxref, tag, blob\n"
871
+ " WHERE tagxref.rid %s\n"
872
+ " AND tag.tagid=tagxref.tagid\n"
873
+ " AND tag.tagname GLOB 'wiki-*'"
874
+ " AND blob.rid=tagxref.rid;",
875
+ zWhere /*safe-for-%s*/
876
+ );
877
+
878
+ /* Event edit artifacts */
879
+ db_multi_exec(
880
+ "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,summary)\n"
881
+ "SELECT blob.rid, blob.uuid, tagxref.mtime, 'event',\n"
882
+ " 'event '||substr(tag.tagname,7)\n"
883
+ " FROM tagxref, tag, blob\n"
884
+ " WHERE tagxref.rid %s\n"
885
+ " AND tag.tagid=tagxref.tagid\n"
886
+ " AND tag.tagname GLOB 'event-*'"
887
+ " AND blob.rid=tagxref.rid;",
888
+ zWhere /*safe-for-%s*/
889
+ );
890
+
891
+ /* Attachments */
892
+ db_multi_exec(
893
+ "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,detail)\n"
894
+ "SELECT blob.rid, blob.uuid, attachment.mtime, 'attachment',\n"
895
+ " 'attachment '||attachment.filename\n"
896
+ " FROM attachment, blob\n"
897
+ " WHERE attachment.src %s\n"
898
+ " AND blob.rid=attachment.src;",
899
+ zWhere /*safe-for-%s*/
900
+ );
901
+
902
+ /* Everything else */
903
+ db_multi_exec(
904
+ "INSERT OR IGNORE INTO description(rid,uuid,type,summary)\n"
905
+ "SELECT blob.rid, blob.uuid,"
906
+ " CASE WHEN blob.size<0 THEN 'phantom' ELSE '' END,\n"
907
+ " 'unknown'\n"
908
+ " FROM blob WHERE blob.rid %s;",
909
+ zWhere /*safe-for-%s*/
910
+ );
911
+
912
+ /* Mark private elements */
913
+ db_multi_exec(
914
+ "UPDATE description SET isPrivate=1 WHERE rid IN private"
915
+ );
916
+}
917
+
918
+/*
919
+** Print the content of the description table on stdout
920
+*/
921
+int describe_artifacts_to_stdout(const char *zWhere, const char *zLabel){
922
+ Stmt q;
923
+ int cnt = 0;
924
+ describe_artifacts(zWhere);
925
+ db_prepare(&q,
926
+ "SELECT uuid, summary, isPrivate\n"
927
+ " FROM description\n"
928
+ " ORDER BY ctime, type;"
929
+ );
930
+ while( db_step(&q)==SQLITE_ROW ){
931
+ if( zLabel ){
932
+ fossil_print("%s\n", zLabel);
933
+ zLabel = 0;
934
+ }
935
+ fossil_print(" %.16s %s", db_column_text(&q,0), db_column_text(&q,1));
936
+ if( db_column_int(&q,2) ) fossil_print(" (unpublished)");
937
+ fossil_print("\n");
938
+ cnt++;
939
+ }
940
+ db_finalize(&q);
941
+ db_multi_exec("DELETE FROM description;");
942
+ return cnt;
943
+}
944
+
945
+/*
946
+** COMMAND: test-describe-artifacts
947
+**
948
+** Usage: %fossil test-describe-artifacts
949
+**
950
+** Display a one-line description of every artifact.
951
+*/
952
+void test_describe_artifacts_cmd(void){
953
+ db_find_and_open_repository(0,0);
954
+ describe_artifacts_to_stdout("IN (SELECT rid FROM blob)", 0);
955
+}
956
+
957
+/*
958
+** COMMAND: test-unsent
959
+**
960
+** Usage: %fossil test-unsent
961
+**
962
+** Show all artifacts in the unsent table
963
+*/
964
+void test_unsent_cmd(void){
965
+ db_find_and_open_repository(0,0);
966
+ describe_artifacts_to_stdout("IN unsent", 0);
967
+}
968
+
969
+/*
970
+** COMMAND: test-unclustered
971
+**
972
+** Usage: %fossil test-unclustered
973
+**
974
+** Show all artifacts in the unclustered table
975
+*/
976
+void test_unclusterd_cmd(void){
977
+ db_find_and_open_repository(0,0);
978
+ describe_artifacts_to_stdout("IN unclustered", 0);
979
+}
980
+
981
+/*
982
+** COMMAND: test-phantoms
983
+**
984
+** Usage: %fossil test-phantoms
985
+**
986
+** Show all phantom artifacts
987
+*/
988
+void test_phatoms_cmd(void){
989
+ db_find_and_open_repository(0,0);
990
+ describe_artifacts_to_stdout("IN (SELECT rid FROM blob WHERE size<0)", 0);
991
+}
762992
763993
ADDED src/publish.c
764994
ADDED src/purge.c
--- src/name.c
+++ src/name.c
@@ -42,10 +42,44 @@
42 if( z[7]!='-') return 0;
43 if( !fossil_isdigit(z[8]) ) return 0;
44 if( !fossil_isdigit(z[9]) ) return 0;
45 return 1;
46 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
48 /*
49 ** Convert a symbolic name into a RID. Acceptable forms:
50 **
51 ** * SHA1 hash
@@ -66,20 +100,28 @@
66 ** Return the RID of the matching artifact. Or return 0 if the name does not
67 ** match any known object. Or return -1 if the name is ambiguous.
68 **
69 ** The zType parameter specifies the type of artifact: ci, t, w, e, g.
70 ** If zType is NULL or "" or "*" then any type of artifact will serve.
 
 
71 ** zType is "ci" in most use cases since we are usually searching for
72 ** a check-in.
73 */
74 int symbolic_name_to_rid(const char *zTag, const char *zType){
75 int vid;
76 int rid = 0;
77 int nTag;
78 int i;
 
79
80 if( zType==0 || zType[0]==0 ) zType = "*";
 
 
 
 
 
81 if( zTag==0 || zTag[0]==0 ) return 0;
82
83 /* special keyword: "tip" */
84 if( fossil_strcmp(zTag, "tip")==0 && (zType[0]=='*' || zType[0]=='c') ){
85 rid = db_int(0,
@@ -151,41 +193,18 @@
151 " AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 "
152 " AND event.objid=tagxref.rid "
153 " AND event.type GLOB '%q'",
154 &zTag[4], zType
155 );
 
156 return rid;
157 }
158
159 /* root:TAG -> The origin of the branch */
160 if( memcmp(zTag, "root:", 5)==0 ){
161 Stmt q;
162 int rc;
163 char *zBr;
164 rid = symbolic_name_to_rid(zTag+5, zType);
165 zBr = db_text("trunk","SELECT value FROM tagxref"
166 " WHERE rid=%d AND tagid=%d"
167 " AND tagtype>0",
168 rid, TAG_BRANCH);
169 db_prepare(&q,
170 "SELECT pid, EXISTS(SELECT 1 FROM tagxref"
171 " WHERE tagid=%d AND tagtype>0"
172 " AND value=%Q AND rid=plink.pid)"
173 " FROM plink"
174 " WHERE cid=:cid AND isprim",
175 TAG_BRANCH, zBr
176 );
177 fossil_free(zBr);
178 do{
179 db_reset(&q);
180 db_bind_int(&q, ":cid", rid);
181 rc = db_step(&q);
182 if( rc!=SQLITE_ROW ) break;
183 rid = db_column_int(&q, 0);
184 }while( db_column_int(&q, 1)==1 && rid>0 );
185 db_finalize(&q);
186 return rid;
187 }
188
189 /* symbolic-name ":" date-time */
190 nTag = strlen(zTag);
191 for(i=0; i<nTag-10 && zTag[i]!=':'; i++){}
@@ -245,11 +264,14 @@
245 " AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 "
246 " AND event.objid=tagxref.rid "
247 " AND event.type GLOB '%q'",
248 zTag, zType
249 );
250 if( rid>0 ) return rid;
 
 
 
251
252 /* Undocumented: numeric tags get translated directly into the RID */
253 if( memcmp(zTag, "rid:", 4)==0 ){
254 zTag += 4;
255 for(i=0; fossil_isdigit(zTag[i]); i++){}
@@ -391,18 +413,15 @@
391 int rid;
392
393 if( zName==0 || zName[0]==0 ) return 0;
394 rid = symbolic_name_to_rid(zName, zType);
395 if( rid<0 ){
396 fossil_error(1, "ambiguous name: %s", zName);
397 return 0;
398 }else if( rid==0 ){
399 fossil_error(1, "not found: %s", zName);
400 return 0;
401 }else{
402 return rid;
403 }
 
404 }
405 int name_to_rid(const char *zName){
406 return name_to_typed_rid(zName, "*");
407 }
408
@@ -505,11 +524,11 @@
505 }
506
507 /*
508 ** Generate a description of artifact "rid"
509 */
510 static void whatis_rid(int rid, int verboseFlag){
511 Stmt q;
512 int cnt;
513
514 /* Basic information about the object. */
515 db_prepare(&q,
@@ -657,21 +676,23 @@
657 void whatis_cmd(void){
658 int rid;
659 const char *zName;
660 int verboseFlag;
661 int i;
 
662 db_find_and_open_repository(0,0);
663 verboseFlag = find_option("verbose","v",0)!=0;
 
664
665 /* We should be done with options.. */
666 verify_all_options();
667
668 if( g.argc<3 ) usage("whatis NAME ...");
669 for(i=2; i<g.argc; i++){
670 zName = g.argv[i];
671 if( i>2 ) fossil_print("%.79c\n",'-');
672 rid = symbolic_name_to_rid(zName, 0);
673 if( rid<0 ){
674 Stmt q;
675 int cnt = 0;
676 fossil_print("name: %s (ambiguous)\n", zName);
677 db_prepare(&q,
@@ -757,5 +778,214 @@
757 while( db_step(&q)==SQLITE_ROW ){
758 fossil_print("%s\n", db_column_text(&q, 0));
759 }
760 db_finalize(&q);
761 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
762
763 DDED src/publish.c
764 DDED src/purge.c
--- src/name.c
+++ src/name.c
@@ -42,10 +42,44 @@
42 if( z[7]!='-') return 0;
43 if( !fossil_isdigit(z[8]) ) return 0;
44 if( !fossil_isdigit(z[9]) ) return 0;
45 return 1;
46 }
47
48 /*
49 ** Return the RID that is the "root" of the branch that contains
50 ** check-in "rid" if inBranch==0 or the first check-in in the branch
51 ** if inBranch==1.
52 */
53 int start_of_branch(int rid, int inBranch){
54 Stmt q;
55 int rc;
56 char *zBr;
57 zBr = db_text("trunk","SELECT value FROM tagxref"
58 " WHERE rid=%d AND tagid=%d"
59 " AND tagtype>0",
60 rid, TAG_BRANCH);
61 db_prepare(&q,
62 "SELECT pid, EXISTS(SELECT 1 FROM tagxref"
63 " WHERE tagid=%d AND tagtype>0"
64 " AND value=%Q AND rid=plink.pid)"
65 " FROM plink"
66 " WHERE cid=:cid AND isprim",
67 TAG_BRANCH, zBr
68 );
69 fossil_free(zBr);
70 do{
71 db_reset(&q);
72 db_bind_int(&q, ":cid", rid);
73 rc = db_step(&q);
74 if( rc!=SQLITE_ROW ) break;
75 if( inBranch && db_column_int(&q,1)==0 ) break;
76 rid = db_column_int(&q, 0);
77 }while( db_column_int(&q, 1)==1 && rid>0 );
78 db_finalize(&q);
79 return rid;
80 }
81
82 /*
83 ** Convert a symbolic name into a RID. Acceptable forms:
84 **
85 ** * SHA1 hash
@@ -66,20 +100,28 @@
100 ** Return the RID of the matching artifact. Or return 0 if the name does not
101 ** match any known object. Or return -1 if the name is ambiguous.
102 **
103 ** The zType parameter specifies the type of artifact: ci, t, w, e, g.
104 ** If zType is NULL or "" or "*" then any type of artifact will serve.
105 ** If zType is "br" then find the first check-in of the named branch
106 ** rather than the last.
107 ** zType is "ci" in most use cases since we are usually searching for
108 ** a check-in.
109 */
110 int symbolic_name_to_rid(const char *zTag, const char *zType){
111 int vid;
112 int rid = 0;
113 int nTag;
114 int i;
115 int startOfBranch = 0;
116
117 if( zType==0 || zType[0]==0 ){
118 zType = "*";
119 }else if( zType[0]=='b' ){
120 zType = "ci";
121 startOfBranch = 1;
122 }
123 if( zTag==0 || zTag[0]==0 ) return 0;
124
125 /* special keyword: "tip" */
126 if( fossil_strcmp(zTag, "tip")==0 && (zType[0]=='*' || zType[0]=='c') ){
127 rid = db_int(0,
@@ -151,41 +193,18 @@
193 " AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 "
194 " AND event.objid=tagxref.rid "
195 " AND event.type GLOB '%q'",
196 &zTag[4], zType
197 );
198 if( startOfBranch ) rid = start_of_branch(rid,1);
199 return rid;
200 }
201
202 /* root:TAG -> The origin of the branch */
203 if( memcmp(zTag, "root:", 5)==0 ){
 
 
 
204 rid = symbolic_name_to_rid(zTag+5, zType);
205 return start_of_branch(rid, 0);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
206 }
207
208 /* symbolic-name ":" date-time */
209 nTag = strlen(zTag);
210 for(i=0; i<nTag-10 && zTag[i]!=':'; i++){}
@@ -245,11 +264,14 @@
264 " AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 "
265 " AND event.objid=tagxref.rid "
266 " AND event.type GLOB '%q'",
267 zTag, zType
268 );
269 if( rid>0 ){
270 if( startOfBranch ) rid = start_of_branch(rid,1);
271 return rid;
272 }
273
274 /* Undocumented: numeric tags get translated directly into the RID */
275 if( memcmp(zTag, "rid:", 4)==0 ){
276 zTag += 4;
277 for(i=0; fossil_isdigit(zTag[i]); i++){}
@@ -391,18 +413,15 @@
413 int rid;
414
415 if( zName==0 || zName[0]==0 ) return 0;
416 rid = symbolic_name_to_rid(zName, zType);
417 if( rid<0 ){
418 fossil_fatal("ambiguous name: %s", zName);
 
419 }else if( rid==0 ){
420 fossil_fatal("not found: %s", zName);
 
 
 
421 }
422 return rid;
423 }
424 int name_to_rid(const char *zName){
425 return name_to_typed_rid(zName, "*");
426 }
427
@@ -505,11 +524,11 @@
524 }
525
526 /*
527 ** Generate a description of artifact "rid"
528 */
529 void whatis_rid(int rid, int verboseFlag){
530 Stmt q;
531 int cnt;
532
533 /* Basic information about the object. */
534 db_prepare(&q,
@@ -657,21 +676,23 @@
676 void whatis_cmd(void){
677 int rid;
678 const char *zName;
679 int verboseFlag;
680 int i;
681 const char *zType = 0;
682 db_find_and_open_repository(0,0);
683 verboseFlag = find_option("verbose","v",0)!=0;
684 zType = find_option("type",0,1);
685
686 /* We should be done with options.. */
687 verify_all_options();
688
689 if( g.argc<3 ) usage("whatis NAME ...");
690 for(i=2; i<g.argc; i++){
691 zName = g.argv[i];
692 if( i>2 ) fossil_print("%.79c\n",'-');
693 rid = symbolic_name_to_rid(zName, zType);
694 if( rid<0 ){
695 Stmt q;
696 int cnt = 0;
697 fossil_print("name: %s (ambiguous)\n", zName);
698 db_prepare(&q,
@@ -757,5 +778,214 @@
778 while( db_step(&q)==SQLITE_ROW ){
779 fossil_print("%s\n", db_column_text(&q, 0));
780 }
781 db_finalize(&q);
782 }
783
784 /*
785 ** Schema for the description table
786 */
787 static const char zDescTab[] =
788 @ CREATE TEMP TABLE IF NOT EXISTS description(
789 @ rid INTEGER PRIMARY KEY, -- RID of the object
790 @ uuid TEXT, -- SHA1 hash of the object
791 @ ctime DATETIME, -- Time of creation
792 @ isPrivate BOOLEAN DEFAULT 0, -- True for unpublished artifacts
793 @ type TEXT, -- file, checkin, wiki, ticket, etc.
794 @ summary TEXT, -- Summary comment for the object
795 @ detail TEXT -- filename, checkin comment, etc
796 @ );
797 ;
798
799 /*
800 ** Create the description table if it does not already exists.
801 ** Populate fields of this table with descriptions for all artifacts
802 ** whose RID matches the SQL expression in zWhere.
803 */
804 void describe_artifacts(const char *zWhere){
805 db_multi_exec("%s", zDescTab/*safe-for-%s*/);
806
807 /* Describe checkins */
808 db_multi_exec(
809 "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,summary)\n"
810 "SELECT blob.rid, blob.uuid, event.mtime, 'checkin',\n"
811 " 'checkin on ' || strftime('%%Y-%%m-%%d %%H:%%M',event.mtime)\n"
812 " FROM event, blob\n"
813 " WHERE event.objid %s AND event.type='ci'\n"
814 " AND event.objid=blob.rid;",
815 zWhere /*safe-for-%s*/
816 );
817
818 /* Describe files */
819 db_multi_exec(
820 "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,summary)\n"
821 "SELECT blob.rid, blob.uuid, event.mtime, 'file', 'file '||filename.name\n"
822 " FROM mlink, blob, event, filename\n"
823 " WHERE mlink.fid %s\n"
824 " AND mlink.mid=event.objid\n"
825 " AND filename.fnid=mlink.fnid\n"
826 " AND mlink.fid=blob.rid;",
827 zWhere /*safe-for-%s*/
828 );
829
830 /* Describe tags */
831 db_multi_exec(
832 "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,summary)\n"
833 "SELECT blob.rid, blob.uuid, tagxref.mtime, 'tag',\n"
834 " 'tag '||substr((SELECT uuid FROM blob WHERE rid=tagxref.rid),1,16)\n"
835 " FROM tagxref, blob\n"
836 " WHERE tagxref.srcid %s AND tagxref.srcid!=tagxref.rid\n"
837 " AND tagxref.srcid=blob.rid;",
838 zWhere /*safe-for-%s*/
839 );
840
841 /* Cluster artifacts */
842 db_multi_exec(
843 "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,summary)\n"
844 "SELECT blob.rid, blob.uuid, tagxref.mtime, 'cluster', 'cluster'\n"
845 " FROM tagxref, blob\n"
846 " WHERE tagxref.rid %s\n"
847 " AND tagxref.tagid=(SELECT tagid FROM tag WHERE tagname='cluster')\n"
848 " AND blob.rid=tagxref.rid;",
849 zWhere /*safe-for-%s*/
850 );
851
852 /* Ticket change artifacts */
853 db_multi_exec(
854 "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,summary)\n"
855 "SELECT blob.rid, blob.uuid, tagxref.mtime, 'ticket',\n"
856 " 'ticket '||substr(tag.tagname,5,21)\n"
857 " FROM tagxref, tag, blob\n"
858 " WHERE tagxref.rid %s\n"
859 " AND tag.tagid=tagxref.tagid\n"
860 " AND tag.tagname GLOB 'tkt-*'"
861 " AND blob.rid=tagxref.rid;",
862 zWhere /*safe-for-%s*/
863 );
864
865 /* Wiki edit artifacts */
866 db_multi_exec(
867 "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,summary)\n"
868 "SELECT blob.rid, blob.uuid, tagxref.mtime, 'wiki',\n"
869 " printf('wiki \"%%s\"',substr(tag.tagname,6))\n"
870 " FROM tagxref, tag, blob\n"
871 " WHERE tagxref.rid %s\n"
872 " AND tag.tagid=tagxref.tagid\n"
873 " AND tag.tagname GLOB 'wiki-*'"
874 " AND blob.rid=tagxref.rid;",
875 zWhere /*safe-for-%s*/
876 );
877
878 /* Event edit artifacts */
879 db_multi_exec(
880 "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,summary)\n"
881 "SELECT blob.rid, blob.uuid, tagxref.mtime, 'event',\n"
882 " 'event '||substr(tag.tagname,7)\n"
883 " FROM tagxref, tag, blob\n"
884 " WHERE tagxref.rid %s\n"
885 " AND tag.tagid=tagxref.tagid\n"
886 " AND tag.tagname GLOB 'event-*'"
887 " AND blob.rid=tagxref.rid;",
888 zWhere /*safe-for-%s*/
889 );
890
891 /* Attachments */
892 db_multi_exec(
893 "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,detail)\n"
894 "SELECT blob.rid, blob.uuid, attachment.mtime, 'attachment',\n"
895 " 'attachment '||attachment.filename\n"
896 " FROM attachment, blob\n"
897 " WHERE attachment.src %s\n"
898 " AND blob.rid=attachment.src;",
899 zWhere /*safe-for-%s*/
900 );
901
902 /* Everything else */
903 db_multi_exec(
904 "INSERT OR IGNORE INTO description(rid,uuid,type,summary)\n"
905 "SELECT blob.rid, blob.uuid,"
906 " CASE WHEN blob.size<0 THEN 'phantom' ELSE '' END,\n"
907 " 'unknown'\n"
908 " FROM blob WHERE blob.rid %s;",
909 zWhere /*safe-for-%s*/
910 );
911
912 /* Mark private elements */
913 db_multi_exec(
914 "UPDATE description SET isPrivate=1 WHERE rid IN private"
915 );
916 }
917
918 /*
919 ** Print the content of the description table on stdout
920 */
921 int describe_artifacts_to_stdout(const char *zWhere, const char *zLabel){
922 Stmt q;
923 int cnt = 0;
924 describe_artifacts(zWhere);
925 db_prepare(&q,
926 "SELECT uuid, summary, isPrivate\n"
927 " FROM description\n"
928 " ORDER BY ctime, type;"
929 );
930 while( db_step(&q)==SQLITE_ROW ){
931 if( zLabel ){
932 fossil_print("%s\n", zLabel);
933 zLabel = 0;
934 }
935 fossil_print(" %.16s %s", db_column_text(&q,0), db_column_text(&q,1));
936 if( db_column_int(&q,2) ) fossil_print(" (unpublished)");
937 fossil_print("\n");
938 cnt++;
939 }
940 db_finalize(&q);
941 db_multi_exec("DELETE FROM description;");
942 return cnt;
943 }
944
945 /*
946 ** COMMAND: test-describe-artifacts
947 **
948 ** Usage: %fossil test-describe-artifacts
949 **
950 ** Display a one-line description of every artifact.
951 */
952 void test_describe_artifacts_cmd(void){
953 db_find_and_open_repository(0,0);
954 describe_artifacts_to_stdout("IN (SELECT rid FROM blob)", 0);
955 }
956
957 /*
958 ** COMMAND: test-unsent
959 **
960 ** Usage: %fossil test-unsent
961 **
962 ** Show all artifacts in the unsent table
963 */
964 void test_unsent_cmd(void){
965 db_find_and_open_repository(0,0);
966 describe_artifacts_to_stdout("IN unsent", 0);
967 }
968
969 /*
970 ** COMMAND: test-unclustered
971 **
972 ** Usage: %fossil test-unclustered
973 **
974 ** Show all artifacts in the unclustered table
975 */
976 void test_unclusterd_cmd(void){
977 db_find_and_open_repository(0,0);
978 describe_artifacts_to_stdout("IN unclustered", 0);
979 }
980
981 /*
982 ** COMMAND: test-phantoms
983 **
984 ** Usage: %fossil test-phantoms
985 **
986 ** Show all phantom artifacts
987 */
988 void test_phatoms_cmd(void){
989 db_find_and_open_repository(0,0);
990 describe_artifacts_to_stdout("IN (SELECT rid FROM blob WHERE size<0)", 0);
991 }
992
993 DDED src/publish.c
994 DDED src/purge.c
--- a/src/publish.c
+++ b/src/publish.c
@@ -0,0 +1,2 @@
1
+/*
2
+** Copyright (c) 2014 D. Richardat
--- a/src/publish.c
+++ b/src/publish.c
@@ -0,0 +1,2 @@
 
 
--- a/src/publish.c
+++ b/src/publish.c
@@ -0,0 +1,2 @@
1 /*
2 ** Copyright (c) 2014 D. Richardat
--- a/src/purge.c
+++ b/src/purge.c
@@ -0,0 +1 @@
1
+db_n%s.sqlite_master WHERE name='plink'" AND sql GLOB '* baseiddb_int(-1,"PRAGMA t
--- a/src/purge.c
+++ b/src/purge.c
@@ -0,0 +1 @@
 
--- a/src/purge.c
+++ b/src/purge.c
@@ -0,0 +1 @@
1 db_n%s.sqlite_master WHERE name='plink'" AND sql GLOB '* baseiddb_int(-1,"PRAGMA t
+12 -7
--- src/rebuild.c
+++ src/rebuild.c
@@ -346,13 +346,14 @@
346346
rebuild_update_schema();
347347
for(;;){
348348
zTable = db_text(0,
349349
"SELECT name FROM sqlite_master /*scan*/"
350350
" WHERE type='table'"
351
- " AND name NOT IN ('blob','delta','rcvfrom','user',"
351
+ " AND name NOT IN ('admin_log', 'blob','delta','rcvfrom','user',"
352352
"'config','shun','private','reportfmt',"
353
- "'concealed','accesslog','modreq')"
353
+ "'concealed','accesslog','modreq',"
354
+ "'purgeevent','purgeitem')"
354355
" AND name NOT GLOB 'sqlite_*'"
355356
" AND name NOT GLOB 'fx_*'"
356357
);
357358
if( zTable==0 ) break;
358359
db_multi_exec("DROP TABLE %Q", zTable);
@@ -591,11 +592,11 @@
591592
reconstruct_private_table();
592593
db_multi_exec(
593594
"REPLACE INTO config(name,value,mtime) VALUES('content-schema',%Q,now());"
594595
"REPLACE INTO config(name,value,mtime) VALUES('aux-schema',%Q,now());"
595596
"REPLACE INTO config(name,value,mtime) VALUES('rebuilt',%Q,now());",
596
- CONTENT_SCHEMA, AUX_SCHEMA, get_version()
597
+ CONTENT_SCHEMA, AUX_SCHEMA_MAX, get_version()
597598
);
598599
if( errCnt && !forceFlag ){
599600
fossil_print(
600601
"%d errors. Rolling back changes. Use --force to force a commit.\n",
601602
errCnt
@@ -829,14 +830,18 @@
829830
"DELETE FROM config WHERE name GLOB 'skin:*';"
830831
"DELETE FROM config WHERE name GLOB 'subrepo:*';"
831832
);
832833
if( bVerily ){
833834
db_multi_exec(
834
- "DELETE FROM concealed;"
835
- "UPDATE rcvfrom SET ipaddr='unknown';"
836
- "DROP TABLE IF EXISTS accesslog;"
837
- "UPDATE user SET photo=NULL, info='';"
835
+ "DELETE FROM concealed;\n"
836
+ "UPDATE rcvfrom SET ipaddr='unknown';\n"
837
+ "DROP TABLE IF EXISTS accesslog;\n"
838
+ "UPDATE user SET photo=NULL, info='';\n"
839
+ "DROP TABLE IF EXISTS purgeevent;\n"
840
+ "DROP TABLE IF EXISTS purgeitem;\n"
841
+ "DROP TABLE IF EXISTS admin_log;\n"
842
+ "DROP TABLE IF EXISTS vcache;\n"
838843
);
839844
}
840845
}
841846
if( !bNeedRebuild ){
842847
db_end_transaction(0);
843848
--- src/rebuild.c
+++ src/rebuild.c
@@ -346,13 +346,14 @@
346 rebuild_update_schema();
347 for(;;){
348 zTable = db_text(0,
349 "SELECT name FROM sqlite_master /*scan*/"
350 " WHERE type='table'"
351 " AND name NOT IN ('blob','delta','rcvfrom','user',"
352 "'config','shun','private','reportfmt',"
353 "'concealed','accesslog','modreq')"
 
354 " AND name NOT GLOB 'sqlite_*'"
355 " AND name NOT GLOB 'fx_*'"
356 );
357 if( zTable==0 ) break;
358 db_multi_exec("DROP TABLE %Q", zTable);
@@ -591,11 +592,11 @@
591 reconstruct_private_table();
592 db_multi_exec(
593 "REPLACE INTO config(name,value,mtime) VALUES('content-schema',%Q,now());"
594 "REPLACE INTO config(name,value,mtime) VALUES('aux-schema',%Q,now());"
595 "REPLACE INTO config(name,value,mtime) VALUES('rebuilt',%Q,now());",
596 CONTENT_SCHEMA, AUX_SCHEMA, get_version()
597 );
598 if( errCnt && !forceFlag ){
599 fossil_print(
600 "%d errors. Rolling back changes. Use --force to force a commit.\n",
601 errCnt
@@ -829,14 +830,18 @@
829 "DELETE FROM config WHERE name GLOB 'skin:*';"
830 "DELETE FROM config WHERE name GLOB 'subrepo:*';"
831 );
832 if( bVerily ){
833 db_multi_exec(
834 "DELETE FROM concealed;"
835 "UPDATE rcvfrom SET ipaddr='unknown';"
836 "DROP TABLE IF EXISTS accesslog;"
837 "UPDATE user SET photo=NULL, info='';"
 
 
 
 
838 );
839 }
840 }
841 if( !bNeedRebuild ){
842 db_end_transaction(0);
843
--- src/rebuild.c
+++ src/rebuild.c
@@ -346,13 +346,14 @@
346 rebuild_update_schema();
347 for(;;){
348 zTable = db_text(0,
349 "SELECT name FROM sqlite_master /*scan*/"
350 " WHERE type='table'"
351 " AND name NOT IN ('admin_log', 'blob','delta','rcvfrom','user',"
352 "'config','shun','private','reportfmt',"
353 "'concealed','accesslog','modreq',"
354 "'purgeevent','purgeitem')"
355 " AND name NOT GLOB 'sqlite_*'"
356 " AND name NOT GLOB 'fx_*'"
357 );
358 if( zTable==0 ) break;
359 db_multi_exec("DROP TABLE %Q", zTable);
@@ -591,11 +592,11 @@
592 reconstruct_private_table();
593 db_multi_exec(
594 "REPLACE INTO config(name,value,mtime) VALUES('content-schema',%Q,now());"
595 "REPLACE INTO config(name,value,mtime) VALUES('aux-schema',%Q,now());"
596 "REPLACE INTO config(name,value,mtime) VALUES('rebuilt',%Q,now());",
597 CONTENT_SCHEMA, AUX_SCHEMA_MAX, get_version()
598 );
599 if( errCnt && !forceFlag ){
600 fossil_print(
601 "%d errors. Rolling back changes. Use --force to force a commit.\n",
602 errCnt
@@ -829,14 +830,18 @@
830 "DELETE FROM config WHERE name GLOB 'skin:*';"
831 "DELETE FROM config WHERE name GLOB 'subrepo:*';"
832 );
833 if( bVerily ){
834 db_multi_exec(
835 "DELETE FROM concealed;\n"
836 "UPDATE rcvfrom SET ipaddr='unknown';\n"
837 "DROP TABLE IF EXISTS accesslog;\n"
838 "UPDATE user SET photo=NULL, info='';\n"
839 "DROP TABLE IF EXISTS purgeevent;\n"
840 "DROP TABLE IF EXISTS purgeitem;\n"
841 "DROP TABLE IF EXISTS admin_log;\n"
842 "DROP TABLE IF EXISTS vcache;\n"
843 );
844 }
845 }
846 if( !bNeedRebuild ){
847 db_end_transaction(0);
848
+5 -3
--- src/schema.c
+++ src/schema.c
@@ -44,11 +44,12 @@
4444
** a date) which can change frequently. When the content schema changes,
4545
** we have to execute special procedures to update the schema. When
4646
** the aux schema changes, all we need to do is rebuild the database.
4747
*/
4848
#define CONTENT_SCHEMA "2"
49
-#define AUX_SCHEMA "2011-04-25 19:50"
49
+#define AUX_SCHEMA_MIN "2011-04-25 19:50"
50
+#define AUX_SCHEMA_MAX "2014-11-24 20:35"
5051
5152
#endif /* INTERFACE */
5253
5354
5455
/*
@@ -80,12 +81,12 @@
8081
@ uuid TEXT UNIQUE NOT NULL, -- SHA1 hash of the content
8182
@ content BLOB, -- Compressed content of this record
8283
@ CHECK( length(uuid)==40 AND rid>0 )
8384
@ );
8485
@ CREATE TABLE delta(
85
-@ rid INTEGER PRIMARY KEY, -- Record ID
86
-@ srcid INTEGER NOT NULL REFERENCES blob -- Record holding source document
86
+@ rid INTEGER PRIMARY KEY, -- BLOB that is delta-compressed
87
+@ srcid INTEGER NOT NULL REFERENCES blob -- Baseline for delta-compression
8788
@ );
8889
@ CREATE INDEX delta_i1 ON delta(srcid);
8990
@
9091
@ -------------------------------------------------------------------------
9192
@ -- The BLOB and DELTA tables above hold the "global state" of a Fossil
@@ -250,10 +251,11 @@
250251
@ CREATE TABLE plink(
251252
@ pid INTEGER REFERENCES blob, -- Parent manifest
252253
@ cid INTEGER REFERENCES blob, -- Child manifest
253254
@ isprim BOOLEAN, -- pid is the primary parent of cid
254255
@ mtime DATETIME, -- the date/time stamp on cid. Julian day.
256
+@ baseid INTEGER REFERENCES blob, -- Baseline if child is a delta manifest
255257
@ UNIQUE(pid, cid)
256258
@ );
257259
@ CREATE INDEX plink_i2 ON plink(cid,pid);
258260
@
259261
@ -- A "leaf" checkin is a checkin that has no children in the same
260262
--- src/schema.c
+++ src/schema.c
@@ -44,11 +44,12 @@
44 ** a date) which can change frequently. When the content schema changes,
45 ** we have to execute special procedures to update the schema. When
46 ** the aux schema changes, all we need to do is rebuild the database.
47 */
48 #define CONTENT_SCHEMA "2"
49 #define AUX_SCHEMA "2011-04-25 19:50"
 
50
51 #endif /* INTERFACE */
52
53
54 /*
@@ -80,12 +81,12 @@
80 @ uuid TEXT UNIQUE NOT NULL, -- SHA1 hash of the content
81 @ content BLOB, -- Compressed content of this record
82 @ CHECK( length(uuid)==40 AND rid>0 )
83 @ );
84 @ CREATE TABLE delta(
85 @ rid INTEGER PRIMARY KEY, -- Record ID
86 @ srcid INTEGER NOT NULL REFERENCES blob -- Record holding source document
87 @ );
88 @ CREATE INDEX delta_i1 ON delta(srcid);
89 @
90 @ -------------------------------------------------------------------------
91 @ -- The BLOB and DELTA tables above hold the "global state" of a Fossil
@@ -250,10 +251,11 @@
250 @ CREATE TABLE plink(
251 @ pid INTEGER REFERENCES blob, -- Parent manifest
252 @ cid INTEGER REFERENCES blob, -- Child manifest
253 @ isprim BOOLEAN, -- pid is the primary parent of cid
254 @ mtime DATETIME, -- the date/time stamp on cid. Julian day.
 
255 @ UNIQUE(pid, cid)
256 @ );
257 @ CREATE INDEX plink_i2 ON plink(cid,pid);
258 @
259 @ -- A "leaf" checkin is a checkin that has no children in the same
260
--- src/schema.c
+++ src/schema.c
@@ -44,11 +44,12 @@
44 ** a date) which can change frequently. When the content schema changes,
45 ** we have to execute special procedures to update the schema. When
46 ** the aux schema changes, all we need to do is rebuild the database.
47 */
48 #define CONTENT_SCHEMA "2"
49 #define AUX_SCHEMA_MIN "2011-04-25 19:50"
50 #define AUX_SCHEMA_MAX "2014-11-24 20:35"
51
52 #endif /* INTERFACE */
53
54
55 /*
@@ -80,12 +81,12 @@
81 @ uuid TEXT UNIQUE NOT NULL, -- SHA1 hash of the content
82 @ content BLOB, -- Compressed content of this record
83 @ CHECK( length(uuid)==40 AND rid>0 )
84 @ );
85 @ CREATE TABLE delta(
86 @ rid INTEGER PRIMARY KEY, -- BLOB that is delta-compressed
87 @ srcid INTEGER NOT NULL REFERENCES blob -- Baseline for delta-compression
88 @ );
89 @ CREATE INDEX delta_i1 ON delta(srcid);
90 @
91 @ -------------------------------------------------------------------------
92 @ -- The BLOB and DELTA tables above hold the "global state" of a Fossil
@@ -250,10 +251,11 @@
251 @ CREATE TABLE plink(
252 @ pid INTEGER REFERENCES blob, -- Parent manifest
253 @ cid INTEGER REFERENCES blob, -- Child manifest
254 @ isprim BOOLEAN, -- pid is the primary parent of cid
255 @ mtime DATETIME, -- the date/time stamp on cid. Julian day.
256 @ baseid INTEGER REFERENCES blob, -- Baseline if child is a delta manifest
257 @ UNIQUE(pid, cid)
258 @ );
259 @ CREATE INDEX plink_i2 ON plink(cid,pid);
260 @
261 @ -- A "leaf" checkin is a checkin that has no children in the same
262
+5 -3
--- src/schema.c
+++ src/schema.c
@@ -44,11 +44,12 @@
4444
** a date) which can change frequently. When the content schema changes,
4545
** we have to execute special procedures to update the schema. When
4646
** the aux schema changes, all we need to do is rebuild the database.
4747
*/
4848
#define CONTENT_SCHEMA "2"
49
-#define AUX_SCHEMA "2011-04-25 19:50"
49
+#define AUX_SCHEMA_MIN "2011-04-25 19:50"
50
+#define AUX_SCHEMA_MAX "2014-11-24 20:35"
5051
5152
#endif /* INTERFACE */
5253
5354
5455
/*
@@ -80,12 +81,12 @@
8081
@ uuid TEXT UNIQUE NOT NULL, -- SHA1 hash of the content
8182
@ content BLOB, -- Compressed content of this record
8283
@ CHECK( length(uuid)==40 AND rid>0 )
8384
@ );
8485
@ CREATE TABLE delta(
85
-@ rid INTEGER PRIMARY KEY, -- Record ID
86
-@ srcid INTEGER NOT NULL REFERENCES blob -- Record holding source document
86
+@ rid INTEGER PRIMARY KEY, -- BLOB that is delta-compressed
87
+@ srcid INTEGER NOT NULL REFERENCES blob -- Baseline for delta-compression
8788
@ );
8889
@ CREATE INDEX delta_i1 ON delta(srcid);
8990
@
9091
@ -------------------------------------------------------------------------
9192
@ -- The BLOB and DELTA tables above hold the "global state" of a Fossil
@@ -250,10 +251,11 @@
250251
@ CREATE TABLE plink(
251252
@ pid INTEGER REFERENCES blob, -- Parent manifest
252253
@ cid INTEGER REFERENCES blob, -- Child manifest
253254
@ isprim BOOLEAN, -- pid is the primary parent of cid
254255
@ mtime DATETIME, -- the date/time stamp on cid. Julian day.
256
+@ baseid INTEGER REFERENCES blob, -- Baseline if child is a delta manifest
255257
@ UNIQUE(pid, cid)
256258
@ );
257259
@ CREATE INDEX plink_i2 ON plink(cid,pid);
258260
@
259261
@ -- A "leaf" checkin is a checkin that has no children in the same
260262
--- src/schema.c
+++ src/schema.c
@@ -44,11 +44,12 @@
44 ** a date) which can change frequently. When the content schema changes,
45 ** we have to execute special procedures to update the schema. When
46 ** the aux schema changes, all we need to do is rebuild the database.
47 */
48 #define CONTENT_SCHEMA "2"
49 #define AUX_SCHEMA "2011-04-25 19:50"
 
50
51 #endif /* INTERFACE */
52
53
54 /*
@@ -80,12 +81,12 @@
80 @ uuid TEXT UNIQUE NOT NULL, -- SHA1 hash of the content
81 @ content BLOB, -- Compressed content of this record
82 @ CHECK( length(uuid)==40 AND rid>0 )
83 @ );
84 @ CREATE TABLE delta(
85 @ rid INTEGER PRIMARY KEY, -- Record ID
86 @ srcid INTEGER NOT NULL REFERENCES blob -- Record holding source document
87 @ );
88 @ CREATE INDEX delta_i1 ON delta(srcid);
89 @
90 @ -------------------------------------------------------------------------
91 @ -- The BLOB and DELTA tables above hold the "global state" of a Fossil
@@ -250,10 +251,11 @@
250 @ CREATE TABLE plink(
251 @ pid INTEGER REFERENCES blob, -- Parent manifest
252 @ cid INTEGER REFERENCES blob, -- Child manifest
253 @ isprim BOOLEAN, -- pid is the primary parent of cid
254 @ mtime DATETIME, -- the date/time stamp on cid. Julian day.
 
255 @ UNIQUE(pid, cid)
256 @ );
257 @ CREATE INDEX plink_i2 ON plink(cid,pid);
258 @
259 @ -- A "leaf" checkin is a checkin that has no children in the same
260
--- src/schema.c
+++ src/schema.c
@@ -44,11 +44,12 @@
44 ** a date) which can change frequently. When the content schema changes,
45 ** we have to execute special procedures to update the schema. When
46 ** the aux schema changes, all we need to do is rebuild the database.
47 */
48 #define CONTENT_SCHEMA "2"
49 #define AUX_SCHEMA_MIN "2011-04-25 19:50"
50 #define AUX_SCHEMA_MAX "2014-11-24 20:35"
51
52 #endif /* INTERFACE */
53
54
55 /*
@@ -80,12 +81,12 @@
81 @ uuid TEXT UNIQUE NOT NULL, -- SHA1 hash of the content
82 @ content BLOB, -- Compressed content of this record
83 @ CHECK( length(uuid)==40 AND rid>0 )
84 @ );
85 @ CREATE TABLE delta(
86 @ rid INTEGER PRIMARY KEY, -- BLOB that is delta-compressed
87 @ srcid INTEGER NOT NULL REFERENCES blob -- Baseline for delta-compression
88 @ );
89 @ CREATE INDEX delta_i1 ON delta(srcid);
90 @
91 @ -------------------------------------------------------------------------
92 @ -- The BLOB and DELTA tables above hold the "global state" of a Fossil
@@ -250,10 +251,11 @@
251 @ CREATE TABLE plink(
252 @ pid INTEGER REFERENCES blob, -- Parent manifest
253 @ cid INTEGER REFERENCES blob, -- Child manifest
254 @ isprim BOOLEAN, -- pid is the primary parent of cid
255 @ mtime DATETIME, -- the date/time stamp on cid. Julian day.
256 @ baseid INTEGER REFERENCES blob, -- Baseline if child is a delta manifest
257 @ UNIQUE(pid, cid)
258 @ );
259 @ CREATE INDEX plink_i2 ON plink(cid,pid);
260 @
261 @ -- A "leaf" checkin is a checkin that has no children in the same
262
+119 -9
--- src/setup.c
+++ src/setup.c
@@ -19,10 +19,14 @@
1919
*/
2020
#include "config.h"
2121
#include <assert.h>
2222
#include "setup.h"
2323
24
+#if INTERFACE
25
+#define ArraySize(x) (sizeof(x)/sizeof(x[0]))
26
+#endif
27
+
2428
/*
2529
** The table of web pages supported by this application is generated
2630
** automatically by the "mkindex" program and written into a file
2731
** named "page_index.h". We include that file here to get access
2832
** to the table.
@@ -62,11 +66,11 @@
6266
6367
/* Make sure the header contains <base href="...">. Issue a warning
6468
** if it does not. */
6569
if( !cgi_header_contains("<base href=") ){
6670
@ <p class="generalError"><b>Configuration Error:</b> Please add
67
- @ <tt>&lt;base href="$baseurl/$current_page"&gt;</tt> after
71
+ @ <tt>&lt;base href="$secureurl/$current_page"&gt;</tt> after
6872
@ <tt>&lt;head&gt;</tt> in the <a href="setup_header">HTML header</a>!</p>
6973
}
7074
7175
@ <table border="0" cellspacing="7">
7276
setup_menu_entry("Users", "setup_ulist",
@@ -101,14 +105,16 @@
101105
"Edit HTML text for an ad unit inserted after the menu bar");
102106
setup_menu_entry("Logo", "setup_logo",
103107
"Change the logo and background images for the server");
104108
setup_menu_entry("Shunned", "shun",
105109
"Show artifacts that are shunned by this repository");
106
- setup_menu_entry("Log", "rcvfromlist",
110
+ setup_menu_entry("Artifact Receipts Log", "rcvfromlist",
107111
"A record of received artifacts and their sources");
108
- setup_menu_entry("User-Log", "access_log",
112
+ setup_menu_entry("User Log", "access_log",
109113
"A record of login attempts");
114
+ setup_menu_entry("Administrative Log", "admin_log",
115
+ "View the admin_log entries");
110116
setup_menu_entry("Stats", "stat",
111117
"Display repository statistics");
112118
setup_menu_entry("SQL", "admin_sql",
113119
"Enter raw SQL commands");
114120
setup_menu_entry("TH1", "admin_th1",
@@ -376,12 +382,14 @@
376382
}
377383
login_verify_csrf_secret();
378384
db_multi_exec(
379385
"REPLACE INTO user(uid,login,info,pw,cap,mtime) "
380386
"VALUES(nullif(%d,0),%Q,%Q,%Q,%Q,now())",
381
- uid, P("login"), P("info"), zPw, zCap
387
+ uid, zLogin, P("info"), zPw, zCap
382388
);
389
+ admin_log( "Updated user [%q] with capabilities [%q].",
390
+ zLogin, zCap );
383391
if( atoi(PD("all","0"))>0 ){
384392
Blob sql;
385393
char *zErr = 0;
386394
blob_zero(&sql);
387395
if( zOldLogin==0 ){
@@ -403,12 +411,16 @@
403411
zLogin, P("pw"), zLogin, P("info"), zCap,
404412
zOldLogin
405413
);
406414
login_group_sql(blob_str(&sql), "<li> ", " </li>\n", &zErr);
407415
blob_reset(&sql);
416
+ admin_log( "Updated user [%q] in all login groups "
417
+ "with capabilities [%q].",
418
+ zLogin, zCap );
408419
if( zErr ){
409420
style_header("User Change Error");
421
+ admin_log( "Error updating user '%q': %s'.", zLogin, zErr );
410422
@ <span class="loginError">%s(zErr)</span>
411423
@
412424
@ <p><a href="setup_uedit?id=%d(uid)">[Bummer]</a></p>
413425
style_footer();
414426
return;
@@ -858,10 +870,12 @@
858870
if( zQ ){
859871
int iQ = fossil_strcmp(zQ,"on")==0 || atoi(zQ);
860872
if( iQ!=iVal ){
861873
login_verify_csrf_secret();
862874
db_set(zVar, iQ ? "1" : "0", 0);
875
+ admin_log("Set option [%q] to [%q].",
876
+ zVar, iQ ? "on" : "off");
863877
iVal = iQ;
864878
}
865879
}
866880
@ <input type="checkbox" name="%s(zQParm)"
867881
if( iVal ){
@@ -885,12 +899,15 @@
885899
int disabled /* 1 if disabled */
886900
){
887901
const char *zVal = db_get(zVar, zDflt);
888902
const char *zQ = P(zQParm);
889903
if( zQ && fossil_strcmp(zQ,zVal)!=0 ){
904
+ const int nZQ = (int)strlen(zQ);
890905
login_verify_csrf_secret();
891906
db_set(zVar, zQ, 0);
907
+ admin_log("Set entry_attribute %Q to: %.*s%s",
908
+ zVar, 20, zQ, (nZQ>20 ? "..." : ""));
892909
zVal = zQ;
893910
}
894911
@ <input type="text" id="%s(zQParm)" name="%s(zQParm)" value="%h(zVal)" size="%d(width)"
895912
if( disabled ){
896913
@ disabled="disabled"
@@ -911,12 +928,15 @@
911928
int disabled /* 1 if the textarea should not be editable */
912929
){
913930
const char *z = db_get(zVar, (char*)zDflt);
914931
const char *zQ = P(zQP);
915932
if( zQ && !disabled && fossil_strcmp(zQ,z)!=0){
933
+ const int nZQ = (int)strlen(zQ);
916934
login_verify_csrf_secret();
917935
db_set(zVar, zQ, 0);
936
+ admin_log("Set textarea_attribute %Q to: %.*s%s",
937
+ zVar, 20, zQ, (nZQ>20 ? "..." : ""));
918938
z = zQ;
919939
}
920940
if( rows>0 && cols>0 ){
921941
@ <textarea id="id%s(zQP)" name="%s(zQP)" rows="%d(rows)"
922942
if( disabled ){
@@ -942,12 +962,15 @@
942962
){
943963
const char *z = db_get(zVar, (char*)zDflt);
944964
const char *zQ = P(zQP);
945965
int i;
946966
if( zQ && fossil_strcmp(zQ,z)!=0){
967
+ const int nZQ = (int)strlen(zQ);
947968
login_verify_csrf_secret();
948969
db_set(zVar, zQ, 0);
970
+ admin_log("Set multiple_choice_attribute %Q to: %.*s%s",
971
+ zVar, 20, zQ, (nZQ>20 ? "..." : ""));
949972
z = zQ;
950973
}
951974
@ <select size="1" name="%s(zQP)" id="id%s(zQP)">
952975
for(i=0; i<nChoice*2; i+=2){
953976
const char *zSel = fossil_strcmp(azChoice[i],z)==0 ? " selected" : "";
@@ -968,10 +991,18 @@
968991
969992
style_header("Access Control Settings");
970993
db_begin_transaction();
971994
@ <form action="%s(g.zTop)/setup_access" method="post"><div>
972995
login_insert_csrf_secret();
996
+ @ <hr />
997
+ onoff_attribute("Redirect to HTTPS on the Login page",
998
+ "redirect-to-https", "redirhttps", 0, 0);
999
+ @ <p>When selected, force the use of HTTPS for the Login page.
1000
+ @ <p>Details: When enabled, this option causes the $secureurl TH1
1001
+ @ variable is set to an "https:" variant of $baseurl. Otherwise,
1002
+ @ $secureurl is just an alias for $baseurl. Also when enabled, the
1003
+ @ Login page redirects to https if accessed via http.
9731004
@ <hr />
9741005
onoff_attribute("Require password for local access",
9751006
"localauth", "localauth", 0, 0);
9761007
@ <p>When enabled, the password sign-in is always required for
9771008
@ web access. When disabled, unrestricted web access from 127.0.0.1
@@ -1248,11 +1279,12 @@
12481279
char zTmDiff[20];
12491280
static const char *const azTimeFormats[] = {
12501281
"0", "HH:MM",
12511282
"1", "HH:MM:SS",
12521283
"2", "YYYY-MM-DD HH:MM",
1253
- "3", "YYMMDD HH:MM"
1284
+ "3", "YYMMDD HH:MM",
1285
+ "4", "(off)"
12541286
};
12551287
login_check_credentials();
12561288
if( !g.perm.Setup ){
12571289
login_needed();
12581290
}
@@ -1294,12 +1326,12 @@
12941326
}else{
12951327
@ %s(zTmDiff) hours ahead of UTC.</p>
12961328
}
12971329
12981330
@ <hr />
1299
- multiple_choice_attribute("Per-Item Time Format", "timeline-date-format", "tdf", "0",
1300
- 4, azTimeFormats);
1331
+ multiple_choice_attribute("Per-Item Time Format", "timeline-date-format",
1332
+ "tdf", "0", ArraySize(azTimeFormats)/2, azTimeFormats);
13011333
@ <p>If the "HH:MM" or "HH:MM:SS" format is selected, then the date is shown
13021334
@ in a separate box (using CSS class "timelineDate") whenever the date changes.
13031335
@ With the "YYYY-MM-DD&nbsp;HH:MM" and "YYMMDD ..." formats, the complete date
13041336
@ and time is shown on every timeline entry (using the CSS class "timelineTime").</p>
13051337
@@ -1546,11 +1578,11 @@
15461578
char *zHead = strstr(z, "<head>");
15471579
if( strstr(z, "<base href=")==0 && zHead!=0 ){
15481580
char *zNew;
15491581
char *zTail = &zHead[6];
15501582
while( fossil_isspace(zTail[0]) ) zTail++;
1551
- zNew = mprintf("%.*s\n<base href=\"$baseurl/$current_page\" />\n%s",
1583
+ zNew = mprintf("%.*s\n<base href=\"$secureurl/$current_page\" />\n%s",
15521584
zHead+6-z, z, zTail);
15531585
cgi_replace_parameter("header", zNew);
15541586
db_set("header", zNew, 0);
15551587
}
15561588
}
@@ -1560,11 +1592,11 @@
15601592
15611593
/* Make sure the header contains <base href="...">. Issue a warning
15621594
** if it does not. */
15631595
if( !cgi_header_contains("<base href=") ){
15641596
@ <p class="generalError">Please add
1565
- @ <tt>&lt;base href="$baseurl/$current_page"&gt;</tt> after
1597
+ @ <tt>&lt;base href="$secureurl/$current_page"&gt;</tt> after
15661598
@ <tt>&lt;head&gt;</tt> in the header!
15671599
@ <input type="submit" name="fixbase" value="Add &lt;base&gt; Now"></p>
15681600
}
15691601
15701602
login_insert_csrf_secret();
@@ -2010,5 +2042,83 @@
20102042
@ <pre class="th1error">%h(zR)</pre>
20112043
}
20122044
}
20132045
style_footer();
20142046
}
2047
+
2048
+static void admin_log_render_limits(){
2049
+ int const count = db_int(0,"SELECT COUNT(*) FROM admin_log");
2050
+ int i;
2051
+ int limits[] = {
2052
+ 10, 20, 50, 100, 250, 500, 0
2053
+ };
2054
+ for(i = 0; limits[i]; ++i ){
2055
+ cgi_printf("%s<a href='?n=%d'>%d</a>",
2056
+ i ? " " : "",
2057
+ limits[i], limits[i]);
2058
+ if(limits[i]>count) break;
2059
+ }
2060
+}
2061
+
2062
+/*
2063
+** WEBPAGE: admin_log
2064
+**
2065
+** Shows the contents of the admin_log table, which is only created if
2066
+** the admin-log setting is enabled. Requires Admin or Setup ('a' or
2067
+** 's') permissions.
2068
+*/
2069
+void page_admin_log(){
2070
+ Stmt stLog = empty_Stmt;
2071
+ Blob qLog = empty_blob;
2072
+ int limit;
2073
+ int fLogEnabled;
2074
+ int counter = 0;
2075
+ login_check_credentials();
2076
+ if( !g.perm.Setup && !g.perm.Admin ){
2077
+ login_needed();
2078
+ }
2079
+ style_header("Admin Log");
2080
+ create_admin_log_table();
2081
+ limit = atoi(PD("n","20"));
2082
+ fLogEnabled = db_get_boolean("admin-log", 0);
2083
+ @ <div>Admin logging is %s(fLogEnabled?"on":"off").</div>
2084
+
2085
+
2086
+ @ <div>Limit results to: <span>
2087
+ admin_log_render_limits();
2088
+ @ </span></div>
2089
+
2090
+ blob_append_sql(&qLog,
2091
+ "SELECT datetime(time,'unixepoch'), who, page, what "
2092
+ "FROM admin_log "
2093
+ "ORDER BY time DESC ");
2094
+ if(limit>0){
2095
+ @ %d(limit) Most recent entries:
2096
+ blob_append_sql(&qLog, "LIMIT %d", limit);
2097
+ }
2098
+ db_prepare(&stLog, "%s", blob_sql_text(&qLog));
2099
+ blob_reset(&qLog);
2100
+ @ <table id="adminLogTable" class="adminLogTable" width="100%%">
2101
+ @ <thead>
2102
+ @ <th>Time</th>
2103
+ @ <th>User</th>
2104
+ @ <th>Page</th>
2105
+ @ <th width="60%%">Message</th>
2106
+ @ </thead><tbody>
2107
+ while( SQLITE_ROW == db_step(&stLog) ){
2108
+ char const * zTime = db_column_text(&stLog, 0);
2109
+ char const * zUser = db_column_text(&stLog, 1);
2110
+ char const * zPage = db_column_text(&stLog, 2);
2111
+ char const * zMessage = db_column_text(&stLog, 3);
2112
+ @ <tr class="row%d(counter++%2)">
2113
+ @ <td class="adminTime">%s(zTime)</td>
2114
+ @ <td>%s(zUser)</td>
2115
+ @ <td>%s(zPage)</td>
2116
+ @ <td>%h(zMessage)</td>
2117
+ @ </tr>
2118
+ }
2119
+ @ </tbody></table>
2120
+ if(limit>0 && counter<limit){
2121
+ @ <div>%d(counter) entries shown.</div>
2122
+ }
2123
+ style_footer();
2124
+}
20152125
--- src/setup.c
+++ src/setup.c
@@ -19,10 +19,14 @@
19 */
20 #include "config.h"
21 #include <assert.h>
22 #include "setup.h"
23
 
 
 
 
24 /*
25 ** The table of web pages supported by this application is generated
26 ** automatically by the "mkindex" program and written into a file
27 ** named "page_index.h". We include that file here to get access
28 ** to the table.
@@ -62,11 +66,11 @@
62
63 /* Make sure the header contains <base href="...">. Issue a warning
64 ** if it does not. */
65 if( !cgi_header_contains("<base href=") ){
66 @ <p class="generalError"><b>Configuration Error:</b> Please add
67 @ <tt>&lt;base href="$baseurl/$current_page"&gt;</tt> after
68 @ <tt>&lt;head&gt;</tt> in the <a href="setup_header">HTML header</a>!</p>
69 }
70
71 @ <table border="0" cellspacing="7">
72 setup_menu_entry("Users", "setup_ulist",
@@ -101,14 +105,16 @@
101 "Edit HTML text for an ad unit inserted after the menu bar");
102 setup_menu_entry("Logo", "setup_logo",
103 "Change the logo and background images for the server");
104 setup_menu_entry("Shunned", "shun",
105 "Show artifacts that are shunned by this repository");
106 setup_menu_entry("Log", "rcvfromlist",
107 "A record of received artifacts and their sources");
108 setup_menu_entry("User-Log", "access_log",
109 "A record of login attempts");
 
 
110 setup_menu_entry("Stats", "stat",
111 "Display repository statistics");
112 setup_menu_entry("SQL", "admin_sql",
113 "Enter raw SQL commands");
114 setup_menu_entry("TH1", "admin_th1",
@@ -376,12 +382,14 @@
376 }
377 login_verify_csrf_secret();
378 db_multi_exec(
379 "REPLACE INTO user(uid,login,info,pw,cap,mtime) "
380 "VALUES(nullif(%d,0),%Q,%Q,%Q,%Q,now())",
381 uid, P("login"), P("info"), zPw, zCap
382 );
 
 
383 if( atoi(PD("all","0"))>0 ){
384 Blob sql;
385 char *zErr = 0;
386 blob_zero(&sql);
387 if( zOldLogin==0 ){
@@ -403,12 +411,16 @@
403 zLogin, P("pw"), zLogin, P("info"), zCap,
404 zOldLogin
405 );
406 login_group_sql(blob_str(&sql), "<li> ", " </li>\n", &zErr);
407 blob_reset(&sql);
 
 
 
408 if( zErr ){
409 style_header("User Change Error");
 
410 @ <span class="loginError">%s(zErr)</span>
411 @
412 @ <p><a href="setup_uedit?id=%d(uid)">[Bummer]</a></p>
413 style_footer();
414 return;
@@ -858,10 +870,12 @@
858 if( zQ ){
859 int iQ = fossil_strcmp(zQ,"on")==0 || atoi(zQ);
860 if( iQ!=iVal ){
861 login_verify_csrf_secret();
862 db_set(zVar, iQ ? "1" : "0", 0);
 
 
863 iVal = iQ;
864 }
865 }
866 @ <input type="checkbox" name="%s(zQParm)"
867 if( iVal ){
@@ -885,12 +899,15 @@
885 int disabled /* 1 if disabled */
886 ){
887 const char *zVal = db_get(zVar, zDflt);
888 const char *zQ = P(zQParm);
889 if( zQ && fossil_strcmp(zQ,zVal)!=0 ){
 
890 login_verify_csrf_secret();
891 db_set(zVar, zQ, 0);
 
 
892 zVal = zQ;
893 }
894 @ <input type="text" id="%s(zQParm)" name="%s(zQParm)" value="%h(zVal)" size="%d(width)"
895 if( disabled ){
896 @ disabled="disabled"
@@ -911,12 +928,15 @@
911 int disabled /* 1 if the textarea should not be editable */
912 ){
913 const char *z = db_get(zVar, (char*)zDflt);
914 const char *zQ = P(zQP);
915 if( zQ && !disabled && fossil_strcmp(zQ,z)!=0){
 
916 login_verify_csrf_secret();
917 db_set(zVar, zQ, 0);
 
 
918 z = zQ;
919 }
920 if( rows>0 && cols>0 ){
921 @ <textarea id="id%s(zQP)" name="%s(zQP)" rows="%d(rows)"
922 if( disabled ){
@@ -942,12 +962,15 @@
942 ){
943 const char *z = db_get(zVar, (char*)zDflt);
944 const char *zQ = P(zQP);
945 int i;
946 if( zQ && fossil_strcmp(zQ,z)!=0){
 
947 login_verify_csrf_secret();
948 db_set(zVar, zQ, 0);
 
 
949 z = zQ;
950 }
951 @ <select size="1" name="%s(zQP)" id="id%s(zQP)">
952 for(i=0; i<nChoice*2; i+=2){
953 const char *zSel = fossil_strcmp(azChoice[i],z)==0 ? " selected" : "";
@@ -968,10 +991,18 @@
968
969 style_header("Access Control Settings");
970 db_begin_transaction();
971 @ <form action="%s(g.zTop)/setup_access" method="post"><div>
972 login_insert_csrf_secret();
 
 
 
 
 
 
 
 
973 @ <hr />
974 onoff_attribute("Require password for local access",
975 "localauth", "localauth", 0, 0);
976 @ <p>When enabled, the password sign-in is always required for
977 @ web access. When disabled, unrestricted web access from 127.0.0.1
@@ -1248,11 +1279,12 @@
1248 char zTmDiff[20];
1249 static const char *const azTimeFormats[] = {
1250 "0", "HH:MM",
1251 "1", "HH:MM:SS",
1252 "2", "YYYY-MM-DD HH:MM",
1253 "3", "YYMMDD HH:MM"
 
1254 };
1255 login_check_credentials();
1256 if( !g.perm.Setup ){
1257 login_needed();
1258 }
@@ -1294,12 +1326,12 @@
1294 }else{
1295 @ %s(zTmDiff) hours ahead of UTC.</p>
1296 }
1297
1298 @ <hr />
1299 multiple_choice_attribute("Per-Item Time Format", "timeline-date-format", "tdf", "0",
1300 4, azTimeFormats);
1301 @ <p>If the "HH:MM" or "HH:MM:SS" format is selected, then the date is shown
1302 @ in a separate box (using CSS class "timelineDate") whenever the date changes.
1303 @ With the "YYYY-MM-DD&nbsp;HH:MM" and "YYMMDD ..." formats, the complete date
1304 @ and time is shown on every timeline entry (using the CSS class "timelineTime").</p>
1305
@@ -1546,11 +1578,11 @@
1546 char *zHead = strstr(z, "<head>");
1547 if( strstr(z, "<base href=")==0 && zHead!=0 ){
1548 char *zNew;
1549 char *zTail = &zHead[6];
1550 while( fossil_isspace(zTail[0]) ) zTail++;
1551 zNew = mprintf("%.*s\n<base href=\"$baseurl/$current_page\" />\n%s",
1552 zHead+6-z, z, zTail);
1553 cgi_replace_parameter("header", zNew);
1554 db_set("header", zNew, 0);
1555 }
1556 }
@@ -1560,11 +1592,11 @@
1560
1561 /* Make sure the header contains <base href="...">. Issue a warning
1562 ** if it does not. */
1563 if( !cgi_header_contains("<base href=") ){
1564 @ <p class="generalError">Please add
1565 @ <tt>&lt;base href="$baseurl/$current_page"&gt;</tt> after
1566 @ <tt>&lt;head&gt;</tt> in the header!
1567 @ <input type="submit" name="fixbase" value="Add &lt;base&gt; Now"></p>
1568 }
1569
1570 login_insert_csrf_secret();
@@ -2010,5 +2042,83 @@
2010 @ <pre class="th1error">%h(zR)</pre>
2011 }
2012 }
2013 style_footer();
2014 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2015
--- src/setup.c
+++ src/setup.c
@@ -19,10 +19,14 @@
19 */
20 #include "config.h"
21 #include <assert.h>
22 #include "setup.h"
23
24 #if INTERFACE
25 #define ArraySize(x) (sizeof(x)/sizeof(x[0]))
26 #endif
27
28 /*
29 ** The table of web pages supported by this application is generated
30 ** automatically by the "mkindex" program and written into a file
31 ** named "page_index.h". We include that file here to get access
32 ** to the table.
@@ -62,11 +66,11 @@
66
67 /* Make sure the header contains <base href="...">. Issue a warning
68 ** if it does not. */
69 if( !cgi_header_contains("<base href=") ){
70 @ <p class="generalError"><b>Configuration Error:</b> Please add
71 @ <tt>&lt;base href="$secureurl/$current_page"&gt;</tt> after
72 @ <tt>&lt;head&gt;</tt> in the <a href="setup_header">HTML header</a>!</p>
73 }
74
75 @ <table border="0" cellspacing="7">
76 setup_menu_entry("Users", "setup_ulist",
@@ -101,14 +105,16 @@
105 "Edit HTML text for an ad unit inserted after the menu bar");
106 setup_menu_entry("Logo", "setup_logo",
107 "Change the logo and background images for the server");
108 setup_menu_entry("Shunned", "shun",
109 "Show artifacts that are shunned by this repository");
110 setup_menu_entry("Artifact Receipts Log", "rcvfromlist",
111 "A record of received artifacts and their sources");
112 setup_menu_entry("User Log", "access_log",
113 "A record of login attempts");
114 setup_menu_entry("Administrative Log", "admin_log",
115 "View the admin_log entries");
116 setup_menu_entry("Stats", "stat",
117 "Display repository statistics");
118 setup_menu_entry("SQL", "admin_sql",
119 "Enter raw SQL commands");
120 setup_menu_entry("TH1", "admin_th1",
@@ -376,12 +382,14 @@
382 }
383 login_verify_csrf_secret();
384 db_multi_exec(
385 "REPLACE INTO user(uid,login,info,pw,cap,mtime) "
386 "VALUES(nullif(%d,0),%Q,%Q,%Q,%Q,now())",
387 uid, zLogin, P("info"), zPw, zCap
388 );
389 admin_log( "Updated user [%q] with capabilities [%q].",
390 zLogin, zCap );
391 if( atoi(PD("all","0"))>0 ){
392 Blob sql;
393 char *zErr = 0;
394 blob_zero(&sql);
395 if( zOldLogin==0 ){
@@ -403,12 +411,16 @@
411 zLogin, P("pw"), zLogin, P("info"), zCap,
412 zOldLogin
413 );
414 login_group_sql(blob_str(&sql), "<li> ", " </li>\n", &zErr);
415 blob_reset(&sql);
416 admin_log( "Updated user [%q] in all login groups "
417 "with capabilities [%q].",
418 zLogin, zCap );
419 if( zErr ){
420 style_header("User Change Error");
421 admin_log( "Error updating user '%q': %s'.", zLogin, zErr );
422 @ <span class="loginError">%s(zErr)</span>
423 @
424 @ <p><a href="setup_uedit?id=%d(uid)">[Bummer]</a></p>
425 style_footer();
426 return;
@@ -858,10 +870,12 @@
870 if( zQ ){
871 int iQ = fossil_strcmp(zQ,"on")==0 || atoi(zQ);
872 if( iQ!=iVal ){
873 login_verify_csrf_secret();
874 db_set(zVar, iQ ? "1" : "0", 0);
875 admin_log("Set option [%q] to [%q].",
876 zVar, iQ ? "on" : "off");
877 iVal = iQ;
878 }
879 }
880 @ <input type="checkbox" name="%s(zQParm)"
881 if( iVal ){
@@ -885,12 +899,15 @@
899 int disabled /* 1 if disabled */
900 ){
901 const char *zVal = db_get(zVar, zDflt);
902 const char *zQ = P(zQParm);
903 if( zQ && fossil_strcmp(zQ,zVal)!=0 ){
904 const int nZQ = (int)strlen(zQ);
905 login_verify_csrf_secret();
906 db_set(zVar, zQ, 0);
907 admin_log("Set entry_attribute %Q to: %.*s%s",
908 zVar, 20, zQ, (nZQ>20 ? "..." : ""));
909 zVal = zQ;
910 }
911 @ <input type="text" id="%s(zQParm)" name="%s(zQParm)" value="%h(zVal)" size="%d(width)"
912 if( disabled ){
913 @ disabled="disabled"
@@ -911,12 +928,15 @@
928 int disabled /* 1 if the textarea should not be editable */
929 ){
930 const char *z = db_get(zVar, (char*)zDflt);
931 const char *zQ = P(zQP);
932 if( zQ && !disabled && fossil_strcmp(zQ,z)!=0){
933 const int nZQ = (int)strlen(zQ);
934 login_verify_csrf_secret();
935 db_set(zVar, zQ, 0);
936 admin_log("Set textarea_attribute %Q to: %.*s%s",
937 zVar, 20, zQ, (nZQ>20 ? "..." : ""));
938 z = zQ;
939 }
940 if( rows>0 && cols>0 ){
941 @ <textarea id="id%s(zQP)" name="%s(zQP)" rows="%d(rows)"
942 if( disabled ){
@@ -942,12 +962,15 @@
962 ){
963 const char *z = db_get(zVar, (char*)zDflt);
964 const char *zQ = P(zQP);
965 int i;
966 if( zQ && fossil_strcmp(zQ,z)!=0){
967 const int nZQ = (int)strlen(zQ);
968 login_verify_csrf_secret();
969 db_set(zVar, zQ, 0);
970 admin_log("Set multiple_choice_attribute %Q to: %.*s%s",
971 zVar, 20, zQ, (nZQ>20 ? "..." : ""));
972 z = zQ;
973 }
974 @ <select size="1" name="%s(zQP)" id="id%s(zQP)">
975 for(i=0; i<nChoice*2; i+=2){
976 const char *zSel = fossil_strcmp(azChoice[i],z)==0 ? " selected" : "";
@@ -968,10 +991,18 @@
991
992 style_header("Access Control Settings");
993 db_begin_transaction();
994 @ <form action="%s(g.zTop)/setup_access" method="post"><div>
995 login_insert_csrf_secret();
996 @ <hr />
997 onoff_attribute("Redirect to HTTPS on the Login page",
998 "redirect-to-https", "redirhttps", 0, 0);
999 @ <p>When selected, force the use of HTTPS for the Login page.
1000 @ <p>Details: When enabled, this option causes the $secureurl TH1
1001 @ variable is set to an "https:" variant of $baseurl. Otherwise,
1002 @ $secureurl is just an alias for $baseurl. Also when enabled, the
1003 @ Login page redirects to https if accessed via http.
1004 @ <hr />
1005 onoff_attribute("Require password for local access",
1006 "localauth", "localauth", 0, 0);
1007 @ <p>When enabled, the password sign-in is always required for
1008 @ web access. When disabled, unrestricted web access from 127.0.0.1
@@ -1248,11 +1279,12 @@
1279 char zTmDiff[20];
1280 static const char *const azTimeFormats[] = {
1281 "0", "HH:MM",
1282 "1", "HH:MM:SS",
1283 "2", "YYYY-MM-DD HH:MM",
1284 "3", "YYMMDD HH:MM",
1285 "4", "(off)"
1286 };
1287 login_check_credentials();
1288 if( !g.perm.Setup ){
1289 login_needed();
1290 }
@@ -1294,12 +1326,12 @@
1326 }else{
1327 @ %s(zTmDiff) hours ahead of UTC.</p>
1328 }
1329
1330 @ <hr />
1331 multiple_choice_attribute("Per-Item Time Format", "timeline-date-format",
1332 "tdf", "0", ArraySize(azTimeFormats)/2, azTimeFormats);
1333 @ <p>If the "HH:MM" or "HH:MM:SS" format is selected, then the date is shown
1334 @ in a separate box (using CSS class "timelineDate") whenever the date changes.
1335 @ With the "YYYY-MM-DD&nbsp;HH:MM" and "YYMMDD ..." formats, the complete date
1336 @ and time is shown on every timeline entry (using the CSS class "timelineTime").</p>
1337
@@ -1546,11 +1578,11 @@
1578 char *zHead = strstr(z, "<head>");
1579 if( strstr(z, "<base href=")==0 && zHead!=0 ){
1580 char *zNew;
1581 char *zTail = &zHead[6];
1582 while( fossil_isspace(zTail[0]) ) zTail++;
1583 zNew = mprintf("%.*s\n<base href=\"$secureurl/$current_page\" />\n%s",
1584 zHead+6-z, z, zTail);
1585 cgi_replace_parameter("header", zNew);
1586 db_set("header", zNew, 0);
1587 }
1588 }
@@ -1560,11 +1592,11 @@
1592
1593 /* Make sure the header contains <base href="...">. Issue a warning
1594 ** if it does not. */
1595 if( !cgi_header_contains("<base href=") ){
1596 @ <p class="generalError">Please add
1597 @ <tt>&lt;base href="$secureurl/$current_page"&gt;</tt> after
1598 @ <tt>&lt;head&gt;</tt> in the header!
1599 @ <input type="submit" name="fixbase" value="Add &lt;base&gt; Now"></p>
1600 }
1601
1602 login_insert_csrf_secret();
@@ -2010,5 +2042,83 @@
2042 @ <pre class="th1error">%h(zR)</pre>
2043 }
2044 }
2045 style_footer();
2046 }
2047
2048 static void admin_log_render_limits(){
2049 int const count = db_int(0,"SELECT COUNT(*) FROM admin_log");
2050 int i;
2051 int limits[] = {
2052 10, 20, 50, 100, 250, 500, 0
2053 };
2054 for(i = 0; limits[i]; ++i ){
2055 cgi_printf("%s<a href='?n=%d'>%d</a>",
2056 i ? " " : "",
2057 limits[i], limits[i]);
2058 if(limits[i]>count) break;
2059 }
2060 }
2061
2062 /*
2063 ** WEBPAGE: admin_log
2064 **
2065 ** Shows the contents of the admin_log table, which is only created if
2066 ** the admin-log setting is enabled. Requires Admin or Setup ('a' or
2067 ** 's') permissions.
2068 */
2069 void page_admin_log(){
2070 Stmt stLog = empty_Stmt;
2071 Blob qLog = empty_blob;
2072 int limit;
2073 int fLogEnabled;
2074 int counter = 0;
2075 login_check_credentials();
2076 if( !g.perm.Setup && !g.perm.Admin ){
2077 login_needed();
2078 }
2079 style_header("Admin Log");
2080 create_admin_log_table();
2081 limit = atoi(PD("n","20"));
2082 fLogEnabled = db_get_boolean("admin-log", 0);
2083 @ <div>Admin logging is %s(fLogEnabled?"on":"off").</div>
2084
2085
2086 @ <div>Limit results to: <span>
2087 admin_log_render_limits();
2088 @ </span></div>
2089
2090 blob_append_sql(&qLog,
2091 "SELECT datetime(time,'unixepoch'), who, page, what "
2092 "FROM admin_log "
2093 "ORDER BY time DESC ");
2094 if(limit>0){
2095 @ %d(limit) Most recent entries:
2096 blob_append_sql(&qLog, "LIMIT %d", limit);
2097 }
2098 db_prepare(&stLog, "%s", blob_sql_text(&qLog));
2099 blob_reset(&qLog);
2100 @ <table id="adminLogTable" class="adminLogTable" width="100%%">
2101 @ <thead>
2102 @ <th>Time</th>
2103 @ <th>User</th>
2104 @ <th>Page</th>
2105 @ <th width="60%%">Message</th>
2106 @ </thead><tbody>
2107 while( SQLITE_ROW == db_step(&stLog) ){
2108 char const * zTime = db_column_text(&stLog, 0);
2109 char const * zUser = db_column_text(&stLog, 1);
2110 char const * zPage = db_column_text(&stLog, 2);
2111 char const * zMessage = db_column_text(&stLog, 3);
2112 @ <tr class="row%d(counter++%2)">
2113 @ <td class="adminTime">%s(zTime)</td>
2114 @ <td>%s(zUser)</td>
2115 @ <td>%s(zPage)</td>
2116 @ <td>%h(zMessage)</td>
2117 @ </tr>
2118 }
2119 @ </tbody></table>
2120 if(limit>0 && counter<limit){
2121 @ <div>%d(counter) entries shown.</div>
2122 }
2123 style_footer();
2124 }
2125
+185 -75
--- src/shell.c
+++ src/shell.c
@@ -170,11 +170,12 @@
170170
/* Saved resource information for the beginning of an operation */
171171
static HANDLE hProcess;
172172
static FILETIME ftKernelBegin;
173173
static FILETIME ftUserBegin;
174174
static sqlite3_int64 ftWallBegin;
175
-typedef BOOL (WINAPI *GETPROCTIMES)(HANDLE, LPFILETIME, LPFILETIME, LPFILETIME, LPFILETIME);
175
+typedef BOOL (WINAPI *GETPROCTIMES)(HANDLE, LPFILETIME, LPFILETIME,
176
+ LPFILETIME, LPFILETIME);
176177
static GETPROCTIMES getProcessTimesAddr = NULL;
177178
178179
/*
179180
** Check to see if we have timer support. Return 1 if necessary
180181
** support found (or found previously).
@@ -181,19 +182,20 @@
181182
*/
182183
static int hasTimer(void){
183184
if( getProcessTimesAddr ){
184185
return 1;
185186
} else {
186
- /* GetProcessTimes() isn't supported in WIN95 and some other Windows versions.
187
- ** See if the version we are running on has it, and if it does, save off
188
- ** a pointer to it and the current process handle.
187
+ /* GetProcessTimes() isn't supported in WIN95 and some other Windows
188
+ ** versions. See if the version we are running on has it, and if it
189
+ ** does, save off a pointer to it and the current process handle.
189190
*/
190191
hProcess = GetCurrentProcess();
191192
if( hProcess ){
192193
HINSTANCE hinstLib = LoadLibrary(TEXT("Kernel32.dll"));
193194
if( NULL != hinstLib ){
194
- getProcessTimesAddr = (GETPROCTIMES) GetProcAddress(hinstLib, "GetProcessTimes");
195
+ getProcessTimesAddr =
196
+ (GETPROCTIMES) GetProcAddress(hinstLib, "GetProcessTimes");
195197
if( NULL != getProcessTimesAddr ){
196198
return 1;
197199
}
198200
FreeLibrary(hinstLib);
199201
}
@@ -206,11 +208,12 @@
206208
** Begin timing an operation
207209
*/
208210
static void beginTimer(void){
209211
if( enableTimer && getProcessTimesAddr ){
210212
FILETIME ftCreation, ftExit;
211
- getProcessTimesAddr(hProcess, &ftCreation, &ftExit, &ftKernelBegin, &ftUserBegin);
213
+ getProcessTimesAddr(hProcess,&ftCreation,&ftExit,
214
+ &ftKernelBegin,&ftUserBegin);
212215
ftWallBegin = timeOfDay();
213216
}
214217
}
215218
216219
/* Return the difference of two FILETIME structs in seconds */
@@ -225,11 +228,11 @@
225228
*/
226229
static void endTimer(void){
227230
if( enableTimer && getProcessTimesAddr){
228231
FILETIME ftCreation, ftExit, ftKernelEnd, ftUserEnd;
229232
sqlite3_int64 ftWallEnd = timeOfDay();
230
- getProcessTimesAddr(hProcess, &ftCreation, &ftExit, &ftKernelEnd, &ftUserEnd);
233
+ getProcessTimesAddr(hProcess,&ftCreation,&ftExit,&ftKernelEnd,&ftUserEnd);
231234
printf("Run Time: real %.3f user %f sys %f\n",
232235
(ftWallEnd - ftWallBegin)*0.001,
233236
timeDiff(&ftUserBegin, &ftUserEnd),
234237
timeDiff(&ftKernelBegin, &ftKernelEnd));
235238
}
@@ -455,10 +458,11 @@
455458
struct ShellState {
456459
sqlite3 *db; /* The database */
457460
int echoOn; /* True to echo input commands */
458461
int autoEQP; /* Run EXPLAIN QUERY PLAN prior to seach SQL stmt */
459462
int statsOn; /* True to display memory stats before each finalize */
463
+ int scanstatsOn; /* True to display scan stats before each finalize */
460464
int outCount; /* Revert to stdout when reaching zero */
461465
int cnt; /* Number of records displayed so far */
462466
FILE *out; /* Write results here */
463467
FILE *traceOut; /* Output for sqlite3_trace() */
464468
int nErr; /* Number of errors seen */
@@ -723,11 +727,17 @@
723727
724728
/*
725729
** This is the callback routine that the shell
726730
** invokes for each row of a query result.
727731
*/
728
-static int shell_callback(void *pArg, int nArg, char **azArg, char **azCol, int *aiType){
732
+static int shell_callback(
733
+ void *pArg,
734
+ int nArg, /* Number of result columns */
735
+ char **azArg, /* Text of each result column */
736
+ char **azCol, /* Column names */
737
+ int *aiType /* Column types */
738
+){
729739
int i;
730740
ShellState *p = (ShellState*)pArg;
731741
732742
switch( p->mode ){
733743
case MODE_Line: {
@@ -1102,61 +1112,81 @@
11021112
11031113
if( pArg && pArg->out ){
11041114
11051115
iHiwtr = iCur = -1;
11061116
sqlite3_status(SQLITE_STATUS_MEMORY_USED, &iCur, &iHiwtr, bReset);
1107
- fprintf(pArg->out, "Memory Used: %d (max %d) bytes\n", iCur, iHiwtr);
1117
+ fprintf(pArg->out,
1118
+ "Memory Used: %d (max %d) bytes\n",
1119
+ iCur, iHiwtr);
11081120
iHiwtr = iCur = -1;
11091121
sqlite3_status(SQLITE_STATUS_MALLOC_COUNT, &iCur, &iHiwtr, bReset);
1110
- fprintf(pArg->out, "Number of Outstanding Allocations: %d (max %d)\n", iCur, iHiwtr);
1122
+ fprintf(pArg->out, "Number of Outstanding Allocations: %d (max %d)\n",
1123
+ iCur, iHiwtr);
11111124
if( pArg->shellFlgs & SHFLG_Pagecache ){
11121125
iHiwtr = iCur = -1;
11131126
sqlite3_status(SQLITE_STATUS_PAGECACHE_USED, &iCur, &iHiwtr, bReset);
1114
- fprintf(pArg->out, "Number of Pcache Pages Used: %d (max %d) pages\n", iCur, iHiwtr);
1127
+ fprintf(pArg->out,
1128
+ "Number of Pcache Pages Used: %d (max %d) pages\n",
1129
+ iCur, iHiwtr);
11151130
}
11161131
iHiwtr = iCur = -1;
11171132
sqlite3_status(SQLITE_STATUS_PAGECACHE_OVERFLOW, &iCur, &iHiwtr, bReset);
1118
- fprintf(pArg->out, "Number of Pcache Overflow Bytes: %d (max %d) bytes\n", iCur, iHiwtr);
1133
+ fprintf(pArg->out,
1134
+ "Number of Pcache Overflow Bytes: %d (max %d) bytes\n",
1135
+ iCur, iHiwtr);
11191136
if( pArg->shellFlgs & SHFLG_Scratch ){
11201137
iHiwtr = iCur = -1;
11211138
sqlite3_status(SQLITE_STATUS_SCRATCH_USED, &iCur, &iHiwtr, bReset);
1122
- fprintf(pArg->out, "Number of Scratch Allocations Used: %d (max %d)\n", iCur, iHiwtr);
1139
+ fprintf(pArg->out, "Number of Scratch Allocations Used: %d (max %d)\n",
1140
+ iCur, iHiwtr);
11231141
}
11241142
iHiwtr = iCur = -1;
11251143
sqlite3_status(SQLITE_STATUS_SCRATCH_OVERFLOW, &iCur, &iHiwtr, bReset);
1126
- fprintf(pArg->out, "Number of Scratch Overflow Bytes: %d (max %d) bytes\n", iCur, iHiwtr);
1144
+ fprintf(pArg->out,
1145
+ "Number of Scratch Overflow Bytes: %d (max %d) bytes\n",
1146
+ iCur, iHiwtr);
11271147
iHiwtr = iCur = -1;
11281148
sqlite3_status(SQLITE_STATUS_MALLOC_SIZE, &iCur, &iHiwtr, bReset);
1129
- fprintf(pArg->out, "Largest Allocation: %d bytes\n", iHiwtr);
1149
+ fprintf(pArg->out, "Largest Allocation: %d bytes\n",
1150
+ iHiwtr);
11301151
iHiwtr = iCur = -1;
11311152
sqlite3_status(SQLITE_STATUS_PAGECACHE_SIZE, &iCur, &iHiwtr, bReset);
1132
- fprintf(pArg->out, "Largest Pcache Allocation: %d bytes\n", iHiwtr);
1153
+ fprintf(pArg->out, "Largest Pcache Allocation: %d bytes\n",
1154
+ iHiwtr);
11331155
iHiwtr = iCur = -1;
11341156
sqlite3_status(SQLITE_STATUS_SCRATCH_SIZE, &iCur, &iHiwtr, bReset);
1135
- fprintf(pArg->out, "Largest Scratch Allocation: %d bytes\n", iHiwtr);
1157
+ fprintf(pArg->out, "Largest Scratch Allocation: %d bytes\n",
1158
+ iHiwtr);
11361159
#ifdef YYTRACKMAXSTACKDEPTH
11371160
iHiwtr = iCur = -1;
11381161
sqlite3_status(SQLITE_STATUS_PARSER_STACK, &iCur, &iHiwtr, bReset);
1139
- fprintf(pArg->out, "Deepest Parser Stack: %d (max %d)\n", iCur, iHiwtr);
1162
+ fprintf(pArg->out, "Deepest Parser Stack: %d (max %d)\n",
1163
+ iCur, iHiwtr);
11401164
#endif
11411165
}
11421166
11431167
if( pArg && pArg->out && db ){
11441168
if( pArg->shellFlgs & SHFLG_Lookaside ){
11451169
iHiwtr = iCur = -1;
1146
- sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_USED, &iCur, &iHiwtr, bReset);
1147
- fprintf(pArg->out, "Lookaside Slots Used: %d (max %d)\n", iCur, iHiwtr);
1148
- sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_HIT, &iCur, &iHiwtr, bReset);
1170
+ sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_USED,
1171
+ &iCur, &iHiwtr, bReset);
1172
+ fprintf(pArg->out, "Lookaside Slots Used: %d (max %d)\n",
1173
+ iCur, iHiwtr);
1174
+ sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_HIT,
1175
+ &iCur, &iHiwtr, bReset);
11491176
fprintf(pArg->out, "Successful lookaside attempts: %d\n", iHiwtr);
1150
- sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE, &iCur, &iHiwtr, bReset);
1177
+ sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE,
1178
+ &iCur, &iHiwtr, bReset);
11511179
fprintf(pArg->out, "Lookaside failures due to size: %d\n", iHiwtr);
1152
- sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL, &iCur, &iHiwtr, bReset);
1180
+ sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL,
1181
+ &iCur, &iHiwtr, bReset);
11531182
fprintf(pArg->out, "Lookaside failures due to OOM: %d\n", iHiwtr);
11541183
}
11551184
iHiwtr = iCur = -1;
11561185
sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_USED, &iCur, &iHiwtr, bReset);
1157
- fprintf(pArg->out, "Pager Heap Usage: %d bytes\n", iCur); iHiwtr = iCur = -1;
1186
+ fprintf(pArg->out, "Pager Heap Usage: %d bytes\n",iCur);
1187
+ iHiwtr = iCur = -1;
11581188
sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_HIT, &iCur, &iHiwtr, 1);
11591189
fprintf(pArg->out, "Page cache hits: %d\n", iCur);
11601190
iHiwtr = iCur = -1;
11611191
sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_MISS, &iCur, &iHiwtr, 1);
11621192
fprintf(pArg->out, "Page cache misses: %d\n", iCur);
@@ -1163,29 +1193,75 @@
11631193
iHiwtr = iCur = -1;
11641194
sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_WRITE, &iCur, &iHiwtr, 1);
11651195
fprintf(pArg->out, "Page cache writes: %d\n", iCur);
11661196
iHiwtr = iCur = -1;
11671197
sqlite3_db_status(db, SQLITE_DBSTATUS_SCHEMA_USED, &iCur, &iHiwtr, bReset);
1168
- fprintf(pArg->out, "Schema Heap Usage: %d bytes\n", iCur);
1198
+ fprintf(pArg->out, "Schema Heap Usage: %d bytes\n",iCur);
11691199
iHiwtr = iCur = -1;
11701200
sqlite3_db_status(db, SQLITE_DBSTATUS_STMT_USED, &iCur, &iHiwtr, bReset);
1171
- fprintf(pArg->out, "Statement Heap/Lookaside Usage: %d bytes\n", iCur);
1201
+ fprintf(pArg->out, "Statement Heap/Lookaside Usage: %d bytes\n",iCur);
11721202
}
11731203
11741204
if( pArg && pArg->out && db && pArg->pStmt ){
1175
- iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_FULLSCAN_STEP, bReset);
1205
+ iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_FULLSCAN_STEP,
1206
+ bReset);
11761207
fprintf(pArg->out, "Fullscan Steps: %d\n", iCur);
11771208
iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_SORT, bReset);
11781209
fprintf(pArg->out, "Sort Operations: %d\n", iCur);
1179
- iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_AUTOINDEX, bReset);
1210
+ iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_AUTOINDEX,bReset);
11801211
fprintf(pArg->out, "Autoindex Inserts: %d\n", iCur);
11811212
iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP, bReset);
11821213
fprintf(pArg->out, "Virtual Machine Steps: %d\n", iCur);
11831214
}
11841215
11851216
return 0;
11861217
}
1218
+
1219
+/*
1220
+** Display scan stats.
1221
+*/
1222
+static void display_scanstats(
1223
+ sqlite3 *db, /* Database to query */
1224
+ ShellState *pArg /* Pointer to ShellState */
1225
+){
1226
+#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
1227
+ int i, k, n, mx;
1228
+ fprintf(pArg->out, "-------- scanstats --------\n");
1229
+ mx = 0;
1230
+ for(k=0; k<=mx; k++){
1231
+ double rEstLoop = 1.0;
1232
+ for(i=n=0; 1; i++){
1233
+ sqlite3_stmt *p = pArg->pStmt;
1234
+ sqlite3_int64 nLoop, nVisit;
1235
+ double rEst;
1236
+ int iSid;
1237
+ const char *zExplain;
1238
+ if( sqlite3_stmt_scanstatus(p, i, SQLITE_SCANSTAT_NLOOP, (void*)&nLoop) ){
1239
+ break;
1240
+ }
1241
+ sqlite3_stmt_scanstatus(p, i, SQLITE_SCANSTAT_SELECTID, (void*)&iSid);
1242
+ if( iSid>mx ) mx = iSid;
1243
+ if( iSid!=k ) continue;
1244
+ if( n==0 ){
1245
+ rEstLoop = (double)nLoop;
1246
+ if( k>0 ) fprintf(pArg->out, "-------- subquery %d -------\n", k);
1247
+ }
1248
+ n++;
1249
+ sqlite3_stmt_scanstatus(p, i, SQLITE_SCANSTAT_NVISIT, (void*)&nVisit);
1250
+ sqlite3_stmt_scanstatus(p, i, SQLITE_SCANSTAT_EST, (void*)&rEst);
1251
+ sqlite3_stmt_scanstatus(p, i, SQLITE_SCANSTAT_EXPLAIN, (void*)&zExplain);
1252
+ fprintf(pArg->out, "Loop %2d: %s\n", n, zExplain);
1253
+ rEstLoop *= rEst;
1254
+ fprintf(pArg->out,
1255
+ " nLoop=%-8lld nRow=%-8lld estRow=%-8lld estRow/Loop=%-8g\n",
1256
+ nLoop, nVisit, (sqlite3_int64)(rEstLoop+0.5), rEst
1257
+ );
1258
+ }
1259
+ }
1260
+ fprintf(pArg->out, "---------------------------\n");
1261
+#endif
1262
+}
11871263
11881264
/*
11891265
** Parameter azArray points to a zero-terminated array of strings. zStr
11901266
** points to a single nul-terminated string. Return non-zero if zStr
11911267
** is equal, according to strcmp(), to any of the strings in the array.
@@ -1224,11 +1300,12 @@
12241300
int nAlloc = 0; /* Allocated size of p->aiIndent[], abYield */
12251301
int iOp; /* Index of operation in p->aiIndent[] */
12261302
12271303
const char *azNext[] = { "Next", "Prev", "VPrev", "VNext", "SorterNext",
12281304
"NextIfOpen", "PrevIfOpen", 0 };
1229
- const char *azYield[] = { "Yield", "SeekLT", "SeekGT", "RowSetRead", "Rewind", 0 };
1305
+ const char *azYield[] = { "Yield", "SeekLT", "SeekGT", "RowSetRead",
1306
+ "Rewind", 0 };
12301307
const char *azGoto[] = { "Goto", 0 };
12311308
12321309
/* Try to figure out if this is really an EXPLAIN statement. If this
12331310
** cannot be verified, return early. */
12341311
zSql = sqlite3_sql(pSql);
@@ -1337,11 +1414,12 @@
13371414
}
13381415
13391416
/* Show the EXPLAIN QUERY PLAN if .eqp is on */
13401417
if( pArg && pArg->autoEQP ){
13411418
sqlite3_stmt *pExplain;
1342
- char *zEQP = sqlite3_mprintf("EXPLAIN QUERY PLAN %s", sqlite3_sql(pStmt));
1419
+ char *zEQP = sqlite3_mprintf("EXPLAIN QUERY PLAN %s",
1420
+ sqlite3_sql(pStmt));
13431421
rc = sqlite3_prepare_v2(db, zEQP, -1, &pExplain, 0);
13441422
if( rc==SQLITE_OK ){
13451423
while( sqlite3_step(pExplain)==SQLITE_ROW ){
13461424
fprintf(pArg->out,"--EQP-- %d,", sqlite3_column_int(pExplain, 0));
13471425
fprintf(pArg->out,"%d,", sqlite3_column_int(pExplain, 1));
@@ -1351,21 +1429,10 @@
13511429
}
13521430
sqlite3_finalize(pExplain);
13531431
sqlite3_free(zEQP);
13541432
}
13551433
1356
-#if USE_SYSTEM_SQLITE+0==1
1357
- /* Output TESTCTRL_EXPLAIN text of requested */
1358
- if( pArg && pArg->mode==MODE_Explain && sqlite3_libversion_number()<3008007 ){
1359
- const char *zExplain = 0;
1360
- sqlite3_test_control(SQLITE_TESTCTRL_EXPLAIN_STMT, pStmt, &zExplain);
1361
- if( zExplain && zExplain[0] ){
1362
- fprintf(pArg->out, "%s", zExplain);
1363
- }
1364
- }
1365
-#endif
1366
-
13671434
/* If the shell is currently in ".explain" mode, gather the extra
13681435
** data required to add indents to the output.*/
13691436
if( pArg && pArg->mode==MODE_Explain ){
13701437
explain_data_prepare(pArg, pStmt);
13711438
}
@@ -1431,10 +1498,15 @@
14311498
14321499
/* print usage stats if stats on */
14331500
if( pArg && pArg->statsOn ){
14341501
display_stats(db, pArg, 0);
14351502
}
1503
+
1504
+ /* print loop-counters if required */
1505
+ if( pArg && pArg->scanstatsOn ){
1506
+ display_scanstats(db, pArg);
1507
+ }
14361508
14371509
/* Finalize the statement just executed. If this fails, save a
14381510
** copy of the error message. Otherwise, set zSql to point to the
14391511
** next statement to execute. */
14401512
rc2 = sqlite3_finalize(pStmt);
@@ -1642,10 +1714,11 @@
16421714
".prompt MAIN CONTINUE Replace the standard prompts\n"
16431715
".quit Exit this program\n"
16441716
".read FILENAME Execute SQL in FILENAME\n"
16451717
".restore ?DB? FILE Restore content of DB (default \"main\") from FILE\n"
16461718
".save FILE Write in-memory database into FILE\n"
1719
+ ".scanstats on|off Turn sqlite3_stmt_scanstatus() metrics on or off\n"
16471720
".schema ?TABLE? Show the CREATE statements\n"
16481721
" If TABLE specified, only show tables matching\n"
16491722
" LIKE pattern TABLE.\n"
16501723
".separator STRING ?NL? Change separator used by output mode and .import\n"
16511724
" NL is the end-of-line mark for CSV\n"
@@ -3023,10 +3096,23 @@
30233096
rc = 1;
30243097
}
30253098
sqlite3_close(pSrc);
30263099
}else
30273100
3101
+
3102
+ if( c=='s' && strncmp(azArg[0], "scanstats", n)==0 ){
3103
+ if( nArg==2 ){
3104
+ p->scanstatsOn = booleanValue(azArg[1]);
3105
+#ifndef SQLITE_ENABLE_STMT_SCANSTATUS
3106
+ fprintf(stderr, "Warning: .scanstats not available in this build.\n");
3107
+#endif
3108
+ }else{
3109
+ fprintf(stderr, "Usage: .scanstats on|off\n");
3110
+ rc = 1;
3111
+ }
3112
+ }else
3113
+
30283114
if( c=='s' && strncmp(azArg[0], "schema", n)==0 ){
30293115
ShellState data;
30303116
char *zErrMsg = 0;
30313117
open_db(p, 0);
30323118
memcpy(&data, p, sizeof(data));
@@ -3280,11 +3366,11 @@
32803366
if( nPrintCol<1 ) nPrintCol = 1;
32813367
nPrintRow = (nRow + nPrintCol - 1)/nPrintCol;
32823368
for(i=0; i<nPrintRow; i++){
32833369
for(j=i; j<nRow; j+=nPrintRow){
32843370
char *zSp = j<nPrintRow ? "" : " ";
3285
- fprintf(p->out, "%s%-*s", zSp, maxlen, azResult[j] ? azResult[j] : "");
3371
+ fprintf(p->out, "%s%-*s", zSp, maxlen, azResult[j] ? azResult[j]:"");
32863372
}
32873373
fprintf(p->out, "\n");
32883374
}
32893375
}
32903376
for(ii=0; ii<nRow; ii++) sqlite3_free(azResult[ii]);
@@ -3750,11 +3836,12 @@
37503836
*/
37513837
static char *find_home_dir(void){
37523838
static char *home_dir = NULL;
37533839
if( home_dir ) return home_dir;
37543840
3755
-#if !defined(_WIN32) && !defined(WIN32) && !defined(_WIN32_WCE) && !defined(__RTP__) && !defined(_WRS_KERNEL)
3841
+#if !defined(_WIN32) && !defined(WIN32) && !defined(_WIN32_WCE) \
3842
+ && !defined(__RTP__) && !defined(_WRS_KERNEL)
37563843
{
37573844
struct passwd *pwent;
37583845
uid_t uid = getuid();
37593846
if( (pwent=getpwuid(uid)) != NULL) {
37603847
home_dir = pwent->pw_dir;
@@ -3949,14 +4036,16 @@
39494036
39504037
int main(int argc, char **argv){
39514038
char *zErrMsg = 0;
39524039
ShellState data;
39534040
const char *zInitFile = 0;
3954
- char *zFirstCmd = 0;
39554041
int i;
39564042
int rc = 0;
39574043
int warnInmemoryDb = 0;
4044
+ int readStdin = 1;
4045
+ int nCmd = 0;
4046
+ char **azCmd = 0;
39584047
39594048
#if USE_SYSTEM_SQLITE+0!=1
39604049
if( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)!=0 ){
39614050
fprintf(stderr, "SQLite header and source version mismatch\n%s\n%s\n",
39624051
sqlite3_sourceid(), SQLITE_SOURCE_ID);
@@ -3971,10 +4060,22 @@
39714060
** else is done.
39724061
*/
39734062
#ifdef SIGINT
39744063
signal(SIGINT, interrupt_handler);
39754064
#endif
4065
+
4066
+#ifdef SQLITE_SHELL_DBNAME_PROC
4067
+ {
4068
+ /* If the SQLITE_SHELL_DBNAME_PROC macro is defined, then it is the name
4069
+ ** of a C-function that will provide the name of the database file. Use
4070
+ ** this compile-time option to embed this shell program in larger
4071
+ ** applications. */
4072
+ extern void SQLITE_SHELL_DBNAME_PROC(const char**);
4073
+ SQLITE_SHELL_DBNAME_PROC(&data.zDbFilename);
4074
+ warnInmemoryDb = 0;
4075
+ }
4076
+#endif
39764077
39774078
/* Do an initial pass through the command-line argument to locate
39784079
** the name of the database file, the name of the initialization file,
39794080
** the size of the alternative malloc heap,
39804081
** and the first command to execute.
@@ -3983,19 +4084,22 @@
39834084
char *z;
39844085
z = argv[i];
39854086
if( z[0]!='-' ){
39864087
if( data.zDbFilename==0 ){
39874088
data.zDbFilename = z;
3988
- continue;
3989
- }
3990
- if( zFirstCmd==0 ){
3991
- zFirstCmd = z;
3992
- continue;
3993
- }
3994
- fprintf(stderr,"%s: Error: too many options: \"%s\"\n", Argv0, argv[i]);
3995
- fprintf(stderr,"Use -help for a list of options.\n");
3996
- return 1;
4089
+ }else{
4090
+ /* Excesss arguments are interpreted as SQL (or dot-commands) and
4091
+ ** mean that nothing is read from stdin */
4092
+ readStdin = 0;
4093
+ nCmd++;
4094
+ azCmd = realloc(azCmd, sizeof(azCmd[0])*nCmd);
4095
+ if( azCmd==0 ){
4096
+ fprintf(stderr, "out of memory\n");
4097
+ exit(1);
4098
+ }
4099
+ azCmd[nCmd-1] = z;
4100
+ }
39974101
}
39984102
if( z[1]=='-' ) z++;
39994103
if( strcmp(z,"-separator")==0
40004104
|| strcmp(z,"-nullvalue")==0
40014105
|| strcmp(z,"-newline")==0
@@ -4082,15 +4186,10 @@
40824186
warnInmemoryDb = argc==1;
40834187
#else
40844188
fprintf(stderr,"%s: Error: no database filename specified\n", Argv0);
40854189
return 1;
40864190
#endif
4087
-#ifdef SQLITE_SHELL_DBNAME_PROC
4088
- { extern void SQLITE_SHELL_DBNAME_PROC(const char**);
4089
- SQLITE_SHELL_DBNAME_PROC(&data.zDbFilename);
4090
- warnInmemoryDb = 0; }
4091
-#endif
40924191
}
40934192
data.out = stdout;
40944193
40954194
/* Go ahead and open the database file if it already exists. If the
40964195
** file does not exist, delay opening it. This prevents empty database
@@ -4149,10 +4248,12 @@
41494248
data.echoOn = 1;
41504249
}else if( strcmp(z,"-eqp")==0 ){
41514250
data.autoEQP = 1;
41524251
}else if( strcmp(z,"-stats")==0 ){
41534252
data.statsOn = 1;
4253
+ }else if( strcmp(z,"-scanstats")==0 ){
4254
+ data.scanstatsOn = 1;
41544255
}else if( strcmp(z,"-bail")==0 ){
41554256
bail_on_error = 1;
41564257
}else if( strcmp(z,"-version")==0 ){
41574258
printf("%s %s\n", sqlite3_libversion(), sqlite3_sourceid());
41584259
return 0;
@@ -4181,10 +4282,14 @@
41814282
i++;
41824283
#endif
41834284
}else if( strcmp(z,"-help")==0 ){
41844285
usage(1);
41854286
}else if( strcmp(z,"-cmd")==0 ){
4287
+ /* Run commands that follow -cmd first and separately from commands
4288
+ ** that simply appear on the command-line. This seems goofy. It would
4289
+ ** be better if all commands ran in the order that they appear. But
4290
+ ** we retain the goofy behavior for historical compatibility. */
41864291
if( i==argc-1 ) break;
41874292
z = cmdline_option_value(argc,argv,++i);
41884293
if( z[0]=='.' ){
41894294
rc = do_meta_command(z, &data);
41904295
if( rc && bail_on_error ) return rc==2 ? 0 : rc;
@@ -4204,27 +4309,32 @@
42044309
fprintf(stderr,"Use -help for a list of options.\n");
42054310
return 1;
42064311
}
42074312
}
42084313
4209
- if( zFirstCmd ){
4210
- /* Run just the command that follows the database name
4211
- */
4212
- if( zFirstCmd[0]=='.' ){
4213
- rc = do_meta_command(zFirstCmd, &data);
4214
- if( rc==2 ) rc = 0;
4215
- }else{
4216
- open_db(&data, 0);
4217
- rc = shell_exec(data.db, zFirstCmd, shell_callback, &data, &zErrMsg);
4218
- if( zErrMsg!=0 ){
4219
- fprintf(stderr,"Error: %s\n", zErrMsg);
4220
- return rc!=0 ? rc : 1;
4221
- }else if( rc!=0 ){
4222
- fprintf(stderr,"Error: unable to process SQL \"%s\"\n", zFirstCmd);
4223
- return rc;
4224
- }
4225
- }
4314
+ if( !readStdin ){
4315
+ /* Run all arguments that do not begin with '-' as if they were separate
4316
+ ** command-line inputs, except for the argToSkip argument which contains
4317
+ ** the database filename.
4318
+ */
4319
+ for(i=0; i<nCmd; i++){
4320
+ if( azCmd[i][0]=='.' ){
4321
+ rc = do_meta_command(azCmd[i], &data);
4322
+ if( rc ) return rc==2 ? 0 : rc;
4323
+ }else{
4324
+ open_db(&data, 0);
4325
+ rc = shell_exec(data.db, azCmd[i], shell_callback, &data, &zErrMsg);
4326
+ if( zErrMsg!=0 ){
4327
+ fprintf(stderr,"Error: %s\n", zErrMsg);
4328
+ return rc!=0 ? rc : 1;
4329
+ }else if( rc!=0 ){
4330
+ fprintf(stderr,"Error: unable to process SQL: %s\n", azCmd[i]);
4331
+ return rc;
4332
+ }
4333
+ }
4334
+ }
4335
+ free(azCmd);
42264336
}else{
42274337
/* Run commands received from standard input
42284338
*/
42294339
if( stdin_is_interactive ){
42304340
char *zHome;
42314341
--- src/shell.c
+++ src/shell.c
@@ -170,11 +170,12 @@
170 /* Saved resource information for the beginning of an operation */
171 static HANDLE hProcess;
172 static FILETIME ftKernelBegin;
173 static FILETIME ftUserBegin;
174 static sqlite3_int64 ftWallBegin;
175 typedef BOOL (WINAPI *GETPROCTIMES)(HANDLE, LPFILETIME, LPFILETIME, LPFILETIME, LPFILETIME);
 
176 static GETPROCTIMES getProcessTimesAddr = NULL;
177
178 /*
179 ** Check to see if we have timer support. Return 1 if necessary
180 ** support found (or found previously).
@@ -181,19 +182,20 @@
181 */
182 static int hasTimer(void){
183 if( getProcessTimesAddr ){
184 return 1;
185 } else {
186 /* GetProcessTimes() isn't supported in WIN95 and some other Windows versions.
187 ** See if the version we are running on has it, and if it does, save off
188 ** a pointer to it and the current process handle.
189 */
190 hProcess = GetCurrentProcess();
191 if( hProcess ){
192 HINSTANCE hinstLib = LoadLibrary(TEXT("Kernel32.dll"));
193 if( NULL != hinstLib ){
194 getProcessTimesAddr = (GETPROCTIMES) GetProcAddress(hinstLib, "GetProcessTimes");
 
195 if( NULL != getProcessTimesAddr ){
196 return 1;
197 }
198 FreeLibrary(hinstLib);
199 }
@@ -206,11 +208,12 @@
206 ** Begin timing an operation
207 */
208 static void beginTimer(void){
209 if( enableTimer && getProcessTimesAddr ){
210 FILETIME ftCreation, ftExit;
211 getProcessTimesAddr(hProcess, &ftCreation, &ftExit, &ftKernelBegin, &ftUserBegin);
 
212 ftWallBegin = timeOfDay();
213 }
214 }
215
216 /* Return the difference of two FILETIME structs in seconds */
@@ -225,11 +228,11 @@
225 */
226 static void endTimer(void){
227 if( enableTimer && getProcessTimesAddr){
228 FILETIME ftCreation, ftExit, ftKernelEnd, ftUserEnd;
229 sqlite3_int64 ftWallEnd = timeOfDay();
230 getProcessTimesAddr(hProcess, &ftCreation, &ftExit, &ftKernelEnd, &ftUserEnd);
231 printf("Run Time: real %.3f user %f sys %f\n",
232 (ftWallEnd - ftWallBegin)*0.001,
233 timeDiff(&ftUserBegin, &ftUserEnd),
234 timeDiff(&ftKernelBegin, &ftKernelEnd));
235 }
@@ -455,10 +458,11 @@
455 struct ShellState {
456 sqlite3 *db; /* The database */
457 int echoOn; /* True to echo input commands */
458 int autoEQP; /* Run EXPLAIN QUERY PLAN prior to seach SQL stmt */
459 int statsOn; /* True to display memory stats before each finalize */
 
460 int outCount; /* Revert to stdout when reaching zero */
461 int cnt; /* Number of records displayed so far */
462 FILE *out; /* Write results here */
463 FILE *traceOut; /* Output for sqlite3_trace() */
464 int nErr; /* Number of errors seen */
@@ -723,11 +727,17 @@
723
724 /*
725 ** This is the callback routine that the shell
726 ** invokes for each row of a query result.
727 */
728 static int shell_callback(void *pArg, int nArg, char **azArg, char **azCol, int *aiType){
 
 
 
 
 
 
729 int i;
730 ShellState *p = (ShellState*)pArg;
731
732 switch( p->mode ){
733 case MODE_Line: {
@@ -1102,61 +1112,81 @@
1102
1103 if( pArg && pArg->out ){
1104
1105 iHiwtr = iCur = -1;
1106 sqlite3_status(SQLITE_STATUS_MEMORY_USED, &iCur, &iHiwtr, bReset);
1107 fprintf(pArg->out, "Memory Used: %d (max %d) bytes\n", iCur, iHiwtr);
 
 
1108 iHiwtr = iCur = -1;
1109 sqlite3_status(SQLITE_STATUS_MALLOC_COUNT, &iCur, &iHiwtr, bReset);
1110 fprintf(pArg->out, "Number of Outstanding Allocations: %d (max %d)\n", iCur, iHiwtr);
 
1111 if( pArg->shellFlgs & SHFLG_Pagecache ){
1112 iHiwtr = iCur = -1;
1113 sqlite3_status(SQLITE_STATUS_PAGECACHE_USED, &iCur, &iHiwtr, bReset);
1114 fprintf(pArg->out, "Number of Pcache Pages Used: %d (max %d) pages\n", iCur, iHiwtr);
 
 
1115 }
1116 iHiwtr = iCur = -1;
1117 sqlite3_status(SQLITE_STATUS_PAGECACHE_OVERFLOW, &iCur, &iHiwtr, bReset);
1118 fprintf(pArg->out, "Number of Pcache Overflow Bytes: %d (max %d) bytes\n", iCur, iHiwtr);
 
 
1119 if( pArg->shellFlgs & SHFLG_Scratch ){
1120 iHiwtr = iCur = -1;
1121 sqlite3_status(SQLITE_STATUS_SCRATCH_USED, &iCur, &iHiwtr, bReset);
1122 fprintf(pArg->out, "Number of Scratch Allocations Used: %d (max %d)\n", iCur, iHiwtr);
 
1123 }
1124 iHiwtr = iCur = -1;
1125 sqlite3_status(SQLITE_STATUS_SCRATCH_OVERFLOW, &iCur, &iHiwtr, bReset);
1126 fprintf(pArg->out, "Number of Scratch Overflow Bytes: %d (max %d) bytes\n", iCur, iHiwtr);
 
 
1127 iHiwtr = iCur = -1;
1128 sqlite3_status(SQLITE_STATUS_MALLOC_SIZE, &iCur, &iHiwtr, bReset);
1129 fprintf(pArg->out, "Largest Allocation: %d bytes\n", iHiwtr);
 
1130 iHiwtr = iCur = -1;
1131 sqlite3_status(SQLITE_STATUS_PAGECACHE_SIZE, &iCur, &iHiwtr, bReset);
1132 fprintf(pArg->out, "Largest Pcache Allocation: %d bytes\n", iHiwtr);
 
1133 iHiwtr = iCur = -1;
1134 sqlite3_status(SQLITE_STATUS_SCRATCH_SIZE, &iCur, &iHiwtr, bReset);
1135 fprintf(pArg->out, "Largest Scratch Allocation: %d bytes\n", iHiwtr);
 
1136 #ifdef YYTRACKMAXSTACKDEPTH
1137 iHiwtr = iCur = -1;
1138 sqlite3_status(SQLITE_STATUS_PARSER_STACK, &iCur, &iHiwtr, bReset);
1139 fprintf(pArg->out, "Deepest Parser Stack: %d (max %d)\n", iCur, iHiwtr);
 
1140 #endif
1141 }
1142
1143 if( pArg && pArg->out && db ){
1144 if( pArg->shellFlgs & SHFLG_Lookaside ){
1145 iHiwtr = iCur = -1;
1146 sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_USED, &iCur, &iHiwtr, bReset);
1147 fprintf(pArg->out, "Lookaside Slots Used: %d (max %d)\n", iCur, iHiwtr);
1148 sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_HIT, &iCur, &iHiwtr, bReset);
 
 
 
1149 fprintf(pArg->out, "Successful lookaside attempts: %d\n", iHiwtr);
1150 sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE, &iCur, &iHiwtr, bReset);
 
1151 fprintf(pArg->out, "Lookaside failures due to size: %d\n", iHiwtr);
1152 sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL, &iCur, &iHiwtr, bReset);
 
1153 fprintf(pArg->out, "Lookaside failures due to OOM: %d\n", iHiwtr);
1154 }
1155 iHiwtr = iCur = -1;
1156 sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_USED, &iCur, &iHiwtr, bReset);
1157 fprintf(pArg->out, "Pager Heap Usage: %d bytes\n", iCur); iHiwtr = iCur = -1;
 
1158 sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_HIT, &iCur, &iHiwtr, 1);
1159 fprintf(pArg->out, "Page cache hits: %d\n", iCur);
1160 iHiwtr = iCur = -1;
1161 sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_MISS, &iCur, &iHiwtr, 1);
1162 fprintf(pArg->out, "Page cache misses: %d\n", iCur);
@@ -1163,29 +1193,75 @@
1163 iHiwtr = iCur = -1;
1164 sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_WRITE, &iCur, &iHiwtr, 1);
1165 fprintf(pArg->out, "Page cache writes: %d\n", iCur);
1166 iHiwtr = iCur = -1;
1167 sqlite3_db_status(db, SQLITE_DBSTATUS_SCHEMA_USED, &iCur, &iHiwtr, bReset);
1168 fprintf(pArg->out, "Schema Heap Usage: %d bytes\n", iCur);
1169 iHiwtr = iCur = -1;
1170 sqlite3_db_status(db, SQLITE_DBSTATUS_STMT_USED, &iCur, &iHiwtr, bReset);
1171 fprintf(pArg->out, "Statement Heap/Lookaside Usage: %d bytes\n", iCur);
1172 }
1173
1174 if( pArg && pArg->out && db && pArg->pStmt ){
1175 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_FULLSCAN_STEP, bReset);
 
1176 fprintf(pArg->out, "Fullscan Steps: %d\n", iCur);
1177 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_SORT, bReset);
1178 fprintf(pArg->out, "Sort Operations: %d\n", iCur);
1179 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_AUTOINDEX, bReset);
1180 fprintf(pArg->out, "Autoindex Inserts: %d\n", iCur);
1181 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP, bReset);
1182 fprintf(pArg->out, "Virtual Machine Steps: %d\n", iCur);
1183 }
1184
1185 return 0;
1186 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1187
1188 /*
1189 ** Parameter azArray points to a zero-terminated array of strings. zStr
1190 ** points to a single nul-terminated string. Return non-zero if zStr
1191 ** is equal, according to strcmp(), to any of the strings in the array.
@@ -1224,11 +1300,12 @@
1224 int nAlloc = 0; /* Allocated size of p->aiIndent[], abYield */
1225 int iOp; /* Index of operation in p->aiIndent[] */
1226
1227 const char *azNext[] = { "Next", "Prev", "VPrev", "VNext", "SorterNext",
1228 "NextIfOpen", "PrevIfOpen", 0 };
1229 const char *azYield[] = { "Yield", "SeekLT", "SeekGT", "RowSetRead", "Rewind", 0 };
 
1230 const char *azGoto[] = { "Goto", 0 };
1231
1232 /* Try to figure out if this is really an EXPLAIN statement. If this
1233 ** cannot be verified, return early. */
1234 zSql = sqlite3_sql(pSql);
@@ -1337,11 +1414,12 @@
1337 }
1338
1339 /* Show the EXPLAIN QUERY PLAN if .eqp is on */
1340 if( pArg && pArg->autoEQP ){
1341 sqlite3_stmt *pExplain;
1342 char *zEQP = sqlite3_mprintf("EXPLAIN QUERY PLAN %s", sqlite3_sql(pStmt));
 
1343 rc = sqlite3_prepare_v2(db, zEQP, -1, &pExplain, 0);
1344 if( rc==SQLITE_OK ){
1345 while( sqlite3_step(pExplain)==SQLITE_ROW ){
1346 fprintf(pArg->out,"--EQP-- %d,", sqlite3_column_int(pExplain, 0));
1347 fprintf(pArg->out,"%d,", sqlite3_column_int(pExplain, 1));
@@ -1351,21 +1429,10 @@
1351 }
1352 sqlite3_finalize(pExplain);
1353 sqlite3_free(zEQP);
1354 }
1355
1356 #if USE_SYSTEM_SQLITE+0==1
1357 /* Output TESTCTRL_EXPLAIN text of requested */
1358 if( pArg && pArg->mode==MODE_Explain && sqlite3_libversion_number()<3008007 ){
1359 const char *zExplain = 0;
1360 sqlite3_test_control(SQLITE_TESTCTRL_EXPLAIN_STMT, pStmt, &zExplain);
1361 if( zExplain && zExplain[0] ){
1362 fprintf(pArg->out, "%s", zExplain);
1363 }
1364 }
1365 #endif
1366
1367 /* If the shell is currently in ".explain" mode, gather the extra
1368 ** data required to add indents to the output.*/
1369 if( pArg && pArg->mode==MODE_Explain ){
1370 explain_data_prepare(pArg, pStmt);
1371 }
@@ -1431,10 +1498,15 @@
1431
1432 /* print usage stats if stats on */
1433 if( pArg && pArg->statsOn ){
1434 display_stats(db, pArg, 0);
1435 }
 
 
 
 
 
1436
1437 /* Finalize the statement just executed. If this fails, save a
1438 ** copy of the error message. Otherwise, set zSql to point to the
1439 ** next statement to execute. */
1440 rc2 = sqlite3_finalize(pStmt);
@@ -1642,10 +1714,11 @@
1642 ".prompt MAIN CONTINUE Replace the standard prompts\n"
1643 ".quit Exit this program\n"
1644 ".read FILENAME Execute SQL in FILENAME\n"
1645 ".restore ?DB? FILE Restore content of DB (default \"main\") from FILE\n"
1646 ".save FILE Write in-memory database into FILE\n"
 
1647 ".schema ?TABLE? Show the CREATE statements\n"
1648 " If TABLE specified, only show tables matching\n"
1649 " LIKE pattern TABLE.\n"
1650 ".separator STRING ?NL? Change separator used by output mode and .import\n"
1651 " NL is the end-of-line mark for CSV\n"
@@ -3023,10 +3096,23 @@
3023 rc = 1;
3024 }
3025 sqlite3_close(pSrc);
3026 }else
3027
 
 
 
 
 
 
 
 
 
 
 
 
 
3028 if( c=='s' && strncmp(azArg[0], "schema", n)==0 ){
3029 ShellState data;
3030 char *zErrMsg = 0;
3031 open_db(p, 0);
3032 memcpy(&data, p, sizeof(data));
@@ -3280,11 +3366,11 @@
3280 if( nPrintCol<1 ) nPrintCol = 1;
3281 nPrintRow = (nRow + nPrintCol - 1)/nPrintCol;
3282 for(i=0; i<nPrintRow; i++){
3283 for(j=i; j<nRow; j+=nPrintRow){
3284 char *zSp = j<nPrintRow ? "" : " ";
3285 fprintf(p->out, "%s%-*s", zSp, maxlen, azResult[j] ? azResult[j] : "");
3286 }
3287 fprintf(p->out, "\n");
3288 }
3289 }
3290 for(ii=0; ii<nRow; ii++) sqlite3_free(azResult[ii]);
@@ -3750,11 +3836,12 @@
3750 */
3751 static char *find_home_dir(void){
3752 static char *home_dir = NULL;
3753 if( home_dir ) return home_dir;
3754
3755 #if !defined(_WIN32) && !defined(WIN32) && !defined(_WIN32_WCE) && !defined(__RTP__) && !defined(_WRS_KERNEL)
 
3756 {
3757 struct passwd *pwent;
3758 uid_t uid = getuid();
3759 if( (pwent=getpwuid(uid)) != NULL) {
3760 home_dir = pwent->pw_dir;
@@ -3949,14 +4036,16 @@
3949
3950 int main(int argc, char **argv){
3951 char *zErrMsg = 0;
3952 ShellState data;
3953 const char *zInitFile = 0;
3954 char *zFirstCmd = 0;
3955 int i;
3956 int rc = 0;
3957 int warnInmemoryDb = 0;
 
 
 
3958
3959 #if USE_SYSTEM_SQLITE+0!=1
3960 if( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)!=0 ){
3961 fprintf(stderr, "SQLite header and source version mismatch\n%s\n%s\n",
3962 sqlite3_sourceid(), SQLITE_SOURCE_ID);
@@ -3971,10 +4060,22 @@
3971 ** else is done.
3972 */
3973 #ifdef SIGINT
3974 signal(SIGINT, interrupt_handler);
3975 #endif
 
 
 
 
 
 
 
 
 
 
 
 
3976
3977 /* Do an initial pass through the command-line argument to locate
3978 ** the name of the database file, the name of the initialization file,
3979 ** the size of the alternative malloc heap,
3980 ** and the first command to execute.
@@ -3983,19 +4084,22 @@
3983 char *z;
3984 z = argv[i];
3985 if( z[0]!='-' ){
3986 if( data.zDbFilename==0 ){
3987 data.zDbFilename = z;
3988 continue;
3989 }
3990 if( zFirstCmd==0 ){
3991 zFirstCmd = z;
3992 continue;
3993 }
3994 fprintf(stderr,"%s: Error: too many options: \"%s\"\n", Argv0, argv[i]);
3995 fprintf(stderr,"Use -help for a list of options.\n");
3996 return 1;
 
 
 
3997 }
3998 if( z[1]=='-' ) z++;
3999 if( strcmp(z,"-separator")==0
4000 || strcmp(z,"-nullvalue")==0
4001 || strcmp(z,"-newline")==0
@@ -4082,15 +4186,10 @@
4082 warnInmemoryDb = argc==1;
4083 #else
4084 fprintf(stderr,"%s: Error: no database filename specified\n", Argv0);
4085 return 1;
4086 #endif
4087 #ifdef SQLITE_SHELL_DBNAME_PROC
4088 { extern void SQLITE_SHELL_DBNAME_PROC(const char**);
4089 SQLITE_SHELL_DBNAME_PROC(&data.zDbFilename);
4090 warnInmemoryDb = 0; }
4091 #endif
4092 }
4093 data.out = stdout;
4094
4095 /* Go ahead and open the database file if it already exists. If the
4096 ** file does not exist, delay opening it. This prevents empty database
@@ -4149,10 +4248,12 @@
4149 data.echoOn = 1;
4150 }else if( strcmp(z,"-eqp")==0 ){
4151 data.autoEQP = 1;
4152 }else if( strcmp(z,"-stats")==0 ){
4153 data.statsOn = 1;
 
 
4154 }else if( strcmp(z,"-bail")==0 ){
4155 bail_on_error = 1;
4156 }else if( strcmp(z,"-version")==0 ){
4157 printf("%s %s\n", sqlite3_libversion(), sqlite3_sourceid());
4158 return 0;
@@ -4181,10 +4282,14 @@
4181 i++;
4182 #endif
4183 }else if( strcmp(z,"-help")==0 ){
4184 usage(1);
4185 }else if( strcmp(z,"-cmd")==0 ){
 
 
 
 
4186 if( i==argc-1 ) break;
4187 z = cmdline_option_value(argc,argv,++i);
4188 if( z[0]=='.' ){
4189 rc = do_meta_command(z, &data);
4190 if( rc && bail_on_error ) return rc==2 ? 0 : rc;
@@ -4204,27 +4309,32 @@
4204 fprintf(stderr,"Use -help for a list of options.\n");
4205 return 1;
4206 }
4207 }
4208
4209 if( zFirstCmd ){
4210 /* Run just the command that follows the database name
4211 */
4212 if( zFirstCmd[0]=='.' ){
4213 rc = do_meta_command(zFirstCmd, &data);
4214 if( rc==2 ) rc = 0;
4215 }else{
4216 open_db(&data, 0);
4217 rc = shell_exec(data.db, zFirstCmd, shell_callback, &data, &zErrMsg);
4218 if( zErrMsg!=0 ){
4219 fprintf(stderr,"Error: %s\n", zErrMsg);
4220 return rc!=0 ? rc : 1;
4221 }else if( rc!=0 ){
4222 fprintf(stderr,"Error: unable to process SQL \"%s\"\n", zFirstCmd);
4223 return rc;
4224 }
4225 }
 
 
 
 
 
4226 }else{
4227 /* Run commands received from standard input
4228 */
4229 if( stdin_is_interactive ){
4230 char *zHome;
4231
--- src/shell.c
+++ src/shell.c
@@ -170,11 +170,12 @@
170 /* Saved resource information for the beginning of an operation */
171 static HANDLE hProcess;
172 static FILETIME ftKernelBegin;
173 static FILETIME ftUserBegin;
174 static sqlite3_int64 ftWallBegin;
175 typedef BOOL (WINAPI *GETPROCTIMES)(HANDLE, LPFILETIME, LPFILETIME,
176 LPFILETIME, LPFILETIME);
177 static GETPROCTIMES getProcessTimesAddr = NULL;
178
179 /*
180 ** Check to see if we have timer support. Return 1 if necessary
181 ** support found (or found previously).
@@ -181,19 +182,20 @@
182 */
183 static int hasTimer(void){
184 if( getProcessTimesAddr ){
185 return 1;
186 } else {
187 /* GetProcessTimes() isn't supported in WIN95 and some other Windows
188 ** versions. See if the version we are running on has it, and if it
189 ** does, save off a pointer to it and the current process handle.
190 */
191 hProcess = GetCurrentProcess();
192 if( hProcess ){
193 HINSTANCE hinstLib = LoadLibrary(TEXT("Kernel32.dll"));
194 if( NULL != hinstLib ){
195 getProcessTimesAddr =
196 (GETPROCTIMES) GetProcAddress(hinstLib, "GetProcessTimes");
197 if( NULL != getProcessTimesAddr ){
198 return 1;
199 }
200 FreeLibrary(hinstLib);
201 }
@@ -206,11 +208,12 @@
208 ** Begin timing an operation
209 */
210 static void beginTimer(void){
211 if( enableTimer && getProcessTimesAddr ){
212 FILETIME ftCreation, ftExit;
213 getProcessTimesAddr(hProcess,&ftCreation,&ftExit,
214 &ftKernelBegin,&ftUserBegin);
215 ftWallBegin = timeOfDay();
216 }
217 }
218
219 /* Return the difference of two FILETIME structs in seconds */
@@ -225,11 +228,11 @@
228 */
229 static void endTimer(void){
230 if( enableTimer && getProcessTimesAddr){
231 FILETIME ftCreation, ftExit, ftKernelEnd, ftUserEnd;
232 sqlite3_int64 ftWallEnd = timeOfDay();
233 getProcessTimesAddr(hProcess,&ftCreation,&ftExit,&ftKernelEnd,&ftUserEnd);
234 printf("Run Time: real %.3f user %f sys %f\n",
235 (ftWallEnd - ftWallBegin)*0.001,
236 timeDiff(&ftUserBegin, &ftUserEnd),
237 timeDiff(&ftKernelBegin, &ftKernelEnd));
238 }
@@ -455,10 +458,11 @@
458 struct ShellState {
459 sqlite3 *db; /* The database */
460 int echoOn; /* True to echo input commands */
461 int autoEQP; /* Run EXPLAIN QUERY PLAN prior to seach SQL stmt */
462 int statsOn; /* True to display memory stats before each finalize */
463 int scanstatsOn; /* True to display scan stats before each finalize */
464 int outCount; /* Revert to stdout when reaching zero */
465 int cnt; /* Number of records displayed so far */
466 FILE *out; /* Write results here */
467 FILE *traceOut; /* Output for sqlite3_trace() */
468 int nErr; /* Number of errors seen */
@@ -723,11 +727,17 @@
727
728 /*
729 ** This is the callback routine that the shell
730 ** invokes for each row of a query result.
731 */
732 static int shell_callback(
733 void *pArg,
734 int nArg, /* Number of result columns */
735 char **azArg, /* Text of each result column */
736 char **azCol, /* Column names */
737 int *aiType /* Column types */
738 ){
739 int i;
740 ShellState *p = (ShellState*)pArg;
741
742 switch( p->mode ){
743 case MODE_Line: {
@@ -1102,61 +1112,81 @@
1112
1113 if( pArg && pArg->out ){
1114
1115 iHiwtr = iCur = -1;
1116 sqlite3_status(SQLITE_STATUS_MEMORY_USED, &iCur, &iHiwtr, bReset);
1117 fprintf(pArg->out,
1118 "Memory Used: %d (max %d) bytes\n",
1119 iCur, iHiwtr);
1120 iHiwtr = iCur = -1;
1121 sqlite3_status(SQLITE_STATUS_MALLOC_COUNT, &iCur, &iHiwtr, bReset);
1122 fprintf(pArg->out, "Number of Outstanding Allocations: %d (max %d)\n",
1123 iCur, iHiwtr);
1124 if( pArg->shellFlgs & SHFLG_Pagecache ){
1125 iHiwtr = iCur = -1;
1126 sqlite3_status(SQLITE_STATUS_PAGECACHE_USED, &iCur, &iHiwtr, bReset);
1127 fprintf(pArg->out,
1128 "Number of Pcache Pages Used: %d (max %d) pages\n",
1129 iCur, iHiwtr);
1130 }
1131 iHiwtr = iCur = -1;
1132 sqlite3_status(SQLITE_STATUS_PAGECACHE_OVERFLOW, &iCur, &iHiwtr, bReset);
1133 fprintf(pArg->out,
1134 "Number of Pcache Overflow Bytes: %d (max %d) bytes\n",
1135 iCur, iHiwtr);
1136 if( pArg->shellFlgs & SHFLG_Scratch ){
1137 iHiwtr = iCur = -1;
1138 sqlite3_status(SQLITE_STATUS_SCRATCH_USED, &iCur, &iHiwtr, bReset);
1139 fprintf(pArg->out, "Number of Scratch Allocations Used: %d (max %d)\n",
1140 iCur, iHiwtr);
1141 }
1142 iHiwtr = iCur = -1;
1143 sqlite3_status(SQLITE_STATUS_SCRATCH_OVERFLOW, &iCur, &iHiwtr, bReset);
1144 fprintf(pArg->out,
1145 "Number of Scratch Overflow Bytes: %d (max %d) bytes\n",
1146 iCur, iHiwtr);
1147 iHiwtr = iCur = -1;
1148 sqlite3_status(SQLITE_STATUS_MALLOC_SIZE, &iCur, &iHiwtr, bReset);
1149 fprintf(pArg->out, "Largest Allocation: %d bytes\n",
1150 iHiwtr);
1151 iHiwtr = iCur = -1;
1152 sqlite3_status(SQLITE_STATUS_PAGECACHE_SIZE, &iCur, &iHiwtr, bReset);
1153 fprintf(pArg->out, "Largest Pcache Allocation: %d bytes\n",
1154 iHiwtr);
1155 iHiwtr = iCur = -1;
1156 sqlite3_status(SQLITE_STATUS_SCRATCH_SIZE, &iCur, &iHiwtr, bReset);
1157 fprintf(pArg->out, "Largest Scratch Allocation: %d bytes\n",
1158 iHiwtr);
1159 #ifdef YYTRACKMAXSTACKDEPTH
1160 iHiwtr = iCur = -1;
1161 sqlite3_status(SQLITE_STATUS_PARSER_STACK, &iCur, &iHiwtr, bReset);
1162 fprintf(pArg->out, "Deepest Parser Stack: %d (max %d)\n",
1163 iCur, iHiwtr);
1164 #endif
1165 }
1166
1167 if( pArg && pArg->out && db ){
1168 if( pArg->shellFlgs & SHFLG_Lookaside ){
1169 iHiwtr = iCur = -1;
1170 sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_USED,
1171 &iCur, &iHiwtr, bReset);
1172 fprintf(pArg->out, "Lookaside Slots Used: %d (max %d)\n",
1173 iCur, iHiwtr);
1174 sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_HIT,
1175 &iCur, &iHiwtr, bReset);
1176 fprintf(pArg->out, "Successful lookaside attempts: %d\n", iHiwtr);
1177 sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE,
1178 &iCur, &iHiwtr, bReset);
1179 fprintf(pArg->out, "Lookaside failures due to size: %d\n", iHiwtr);
1180 sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL,
1181 &iCur, &iHiwtr, bReset);
1182 fprintf(pArg->out, "Lookaside failures due to OOM: %d\n", iHiwtr);
1183 }
1184 iHiwtr = iCur = -1;
1185 sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_USED, &iCur, &iHiwtr, bReset);
1186 fprintf(pArg->out, "Pager Heap Usage: %d bytes\n",iCur);
1187 iHiwtr = iCur = -1;
1188 sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_HIT, &iCur, &iHiwtr, 1);
1189 fprintf(pArg->out, "Page cache hits: %d\n", iCur);
1190 iHiwtr = iCur = -1;
1191 sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_MISS, &iCur, &iHiwtr, 1);
1192 fprintf(pArg->out, "Page cache misses: %d\n", iCur);
@@ -1163,29 +1193,75 @@
1193 iHiwtr = iCur = -1;
1194 sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_WRITE, &iCur, &iHiwtr, 1);
1195 fprintf(pArg->out, "Page cache writes: %d\n", iCur);
1196 iHiwtr = iCur = -1;
1197 sqlite3_db_status(db, SQLITE_DBSTATUS_SCHEMA_USED, &iCur, &iHiwtr, bReset);
1198 fprintf(pArg->out, "Schema Heap Usage: %d bytes\n",iCur);
1199 iHiwtr = iCur = -1;
1200 sqlite3_db_status(db, SQLITE_DBSTATUS_STMT_USED, &iCur, &iHiwtr, bReset);
1201 fprintf(pArg->out, "Statement Heap/Lookaside Usage: %d bytes\n",iCur);
1202 }
1203
1204 if( pArg && pArg->out && db && pArg->pStmt ){
1205 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_FULLSCAN_STEP,
1206 bReset);
1207 fprintf(pArg->out, "Fullscan Steps: %d\n", iCur);
1208 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_SORT, bReset);
1209 fprintf(pArg->out, "Sort Operations: %d\n", iCur);
1210 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_AUTOINDEX,bReset);
1211 fprintf(pArg->out, "Autoindex Inserts: %d\n", iCur);
1212 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP, bReset);
1213 fprintf(pArg->out, "Virtual Machine Steps: %d\n", iCur);
1214 }
1215
1216 return 0;
1217 }
1218
1219 /*
1220 ** Display scan stats.
1221 */
1222 static void display_scanstats(
1223 sqlite3 *db, /* Database to query */
1224 ShellState *pArg /* Pointer to ShellState */
1225 ){
1226 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
1227 int i, k, n, mx;
1228 fprintf(pArg->out, "-------- scanstats --------\n");
1229 mx = 0;
1230 for(k=0; k<=mx; k++){
1231 double rEstLoop = 1.0;
1232 for(i=n=0; 1; i++){
1233 sqlite3_stmt *p = pArg->pStmt;
1234 sqlite3_int64 nLoop, nVisit;
1235 double rEst;
1236 int iSid;
1237 const char *zExplain;
1238 if( sqlite3_stmt_scanstatus(p, i, SQLITE_SCANSTAT_NLOOP, (void*)&nLoop) ){
1239 break;
1240 }
1241 sqlite3_stmt_scanstatus(p, i, SQLITE_SCANSTAT_SELECTID, (void*)&iSid);
1242 if( iSid>mx ) mx = iSid;
1243 if( iSid!=k ) continue;
1244 if( n==0 ){
1245 rEstLoop = (double)nLoop;
1246 if( k>0 ) fprintf(pArg->out, "-------- subquery %d -------\n", k);
1247 }
1248 n++;
1249 sqlite3_stmt_scanstatus(p, i, SQLITE_SCANSTAT_NVISIT, (void*)&nVisit);
1250 sqlite3_stmt_scanstatus(p, i, SQLITE_SCANSTAT_EST, (void*)&rEst);
1251 sqlite3_stmt_scanstatus(p, i, SQLITE_SCANSTAT_EXPLAIN, (void*)&zExplain);
1252 fprintf(pArg->out, "Loop %2d: %s\n", n, zExplain);
1253 rEstLoop *= rEst;
1254 fprintf(pArg->out,
1255 " nLoop=%-8lld nRow=%-8lld estRow=%-8lld estRow/Loop=%-8g\n",
1256 nLoop, nVisit, (sqlite3_int64)(rEstLoop+0.5), rEst
1257 );
1258 }
1259 }
1260 fprintf(pArg->out, "---------------------------\n");
1261 #endif
1262 }
1263
1264 /*
1265 ** Parameter azArray points to a zero-terminated array of strings. zStr
1266 ** points to a single nul-terminated string. Return non-zero if zStr
1267 ** is equal, according to strcmp(), to any of the strings in the array.
@@ -1224,11 +1300,12 @@
1300 int nAlloc = 0; /* Allocated size of p->aiIndent[], abYield */
1301 int iOp; /* Index of operation in p->aiIndent[] */
1302
1303 const char *azNext[] = { "Next", "Prev", "VPrev", "VNext", "SorterNext",
1304 "NextIfOpen", "PrevIfOpen", 0 };
1305 const char *azYield[] = { "Yield", "SeekLT", "SeekGT", "RowSetRead",
1306 "Rewind", 0 };
1307 const char *azGoto[] = { "Goto", 0 };
1308
1309 /* Try to figure out if this is really an EXPLAIN statement. If this
1310 ** cannot be verified, return early. */
1311 zSql = sqlite3_sql(pSql);
@@ -1337,11 +1414,12 @@
1414 }
1415
1416 /* Show the EXPLAIN QUERY PLAN if .eqp is on */
1417 if( pArg && pArg->autoEQP ){
1418 sqlite3_stmt *pExplain;
1419 char *zEQP = sqlite3_mprintf("EXPLAIN QUERY PLAN %s",
1420 sqlite3_sql(pStmt));
1421 rc = sqlite3_prepare_v2(db, zEQP, -1, &pExplain, 0);
1422 if( rc==SQLITE_OK ){
1423 while( sqlite3_step(pExplain)==SQLITE_ROW ){
1424 fprintf(pArg->out,"--EQP-- %d,", sqlite3_column_int(pExplain, 0));
1425 fprintf(pArg->out,"%d,", sqlite3_column_int(pExplain, 1));
@@ -1351,21 +1429,10 @@
1429 }
1430 sqlite3_finalize(pExplain);
1431 sqlite3_free(zEQP);
1432 }
1433
 
 
 
 
 
 
 
 
 
 
 
1434 /* If the shell is currently in ".explain" mode, gather the extra
1435 ** data required to add indents to the output.*/
1436 if( pArg && pArg->mode==MODE_Explain ){
1437 explain_data_prepare(pArg, pStmt);
1438 }
@@ -1431,10 +1498,15 @@
1498
1499 /* print usage stats if stats on */
1500 if( pArg && pArg->statsOn ){
1501 display_stats(db, pArg, 0);
1502 }
1503
1504 /* print loop-counters if required */
1505 if( pArg && pArg->scanstatsOn ){
1506 display_scanstats(db, pArg);
1507 }
1508
1509 /* Finalize the statement just executed. If this fails, save a
1510 ** copy of the error message. Otherwise, set zSql to point to the
1511 ** next statement to execute. */
1512 rc2 = sqlite3_finalize(pStmt);
@@ -1642,10 +1714,11 @@
1714 ".prompt MAIN CONTINUE Replace the standard prompts\n"
1715 ".quit Exit this program\n"
1716 ".read FILENAME Execute SQL in FILENAME\n"
1717 ".restore ?DB? FILE Restore content of DB (default \"main\") from FILE\n"
1718 ".save FILE Write in-memory database into FILE\n"
1719 ".scanstats on|off Turn sqlite3_stmt_scanstatus() metrics on or off\n"
1720 ".schema ?TABLE? Show the CREATE statements\n"
1721 " If TABLE specified, only show tables matching\n"
1722 " LIKE pattern TABLE.\n"
1723 ".separator STRING ?NL? Change separator used by output mode and .import\n"
1724 " NL is the end-of-line mark for CSV\n"
@@ -3023,10 +3096,23 @@
3096 rc = 1;
3097 }
3098 sqlite3_close(pSrc);
3099 }else
3100
3101
3102 if( c=='s' && strncmp(azArg[0], "scanstats", n)==0 ){
3103 if( nArg==2 ){
3104 p->scanstatsOn = booleanValue(azArg[1]);
3105 #ifndef SQLITE_ENABLE_STMT_SCANSTATUS
3106 fprintf(stderr, "Warning: .scanstats not available in this build.\n");
3107 #endif
3108 }else{
3109 fprintf(stderr, "Usage: .scanstats on|off\n");
3110 rc = 1;
3111 }
3112 }else
3113
3114 if( c=='s' && strncmp(azArg[0], "schema", n)==0 ){
3115 ShellState data;
3116 char *zErrMsg = 0;
3117 open_db(p, 0);
3118 memcpy(&data, p, sizeof(data));
@@ -3280,11 +3366,11 @@
3366 if( nPrintCol<1 ) nPrintCol = 1;
3367 nPrintRow = (nRow + nPrintCol - 1)/nPrintCol;
3368 for(i=0; i<nPrintRow; i++){
3369 for(j=i; j<nRow; j+=nPrintRow){
3370 char *zSp = j<nPrintRow ? "" : " ";
3371 fprintf(p->out, "%s%-*s", zSp, maxlen, azResult[j] ? azResult[j]:"");
3372 }
3373 fprintf(p->out, "\n");
3374 }
3375 }
3376 for(ii=0; ii<nRow; ii++) sqlite3_free(azResult[ii]);
@@ -3750,11 +3836,12 @@
3836 */
3837 static char *find_home_dir(void){
3838 static char *home_dir = NULL;
3839 if( home_dir ) return home_dir;
3840
3841 #if !defined(_WIN32) && !defined(WIN32) && !defined(_WIN32_WCE) \
3842 && !defined(__RTP__) && !defined(_WRS_KERNEL)
3843 {
3844 struct passwd *pwent;
3845 uid_t uid = getuid();
3846 if( (pwent=getpwuid(uid)) != NULL) {
3847 home_dir = pwent->pw_dir;
@@ -3949,14 +4036,16 @@
4036
4037 int main(int argc, char **argv){
4038 char *zErrMsg = 0;
4039 ShellState data;
4040 const char *zInitFile = 0;
 
4041 int i;
4042 int rc = 0;
4043 int warnInmemoryDb = 0;
4044 int readStdin = 1;
4045 int nCmd = 0;
4046 char **azCmd = 0;
4047
4048 #if USE_SYSTEM_SQLITE+0!=1
4049 if( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)!=0 ){
4050 fprintf(stderr, "SQLite header and source version mismatch\n%s\n%s\n",
4051 sqlite3_sourceid(), SQLITE_SOURCE_ID);
@@ -3971,10 +4060,22 @@
4060 ** else is done.
4061 */
4062 #ifdef SIGINT
4063 signal(SIGINT, interrupt_handler);
4064 #endif
4065
4066 #ifdef SQLITE_SHELL_DBNAME_PROC
4067 {
4068 /* If the SQLITE_SHELL_DBNAME_PROC macro is defined, then it is the name
4069 ** of a C-function that will provide the name of the database file. Use
4070 ** this compile-time option to embed this shell program in larger
4071 ** applications. */
4072 extern void SQLITE_SHELL_DBNAME_PROC(const char**);
4073 SQLITE_SHELL_DBNAME_PROC(&data.zDbFilename);
4074 warnInmemoryDb = 0;
4075 }
4076 #endif
4077
4078 /* Do an initial pass through the command-line argument to locate
4079 ** the name of the database file, the name of the initialization file,
4080 ** the size of the alternative malloc heap,
4081 ** and the first command to execute.
@@ -3983,19 +4084,22 @@
4084 char *z;
4085 z = argv[i];
4086 if( z[0]!='-' ){
4087 if( data.zDbFilename==0 ){
4088 data.zDbFilename = z;
4089 }else{
4090 /* Excesss arguments are interpreted as SQL (or dot-commands) and
4091 ** mean that nothing is read from stdin */
4092 readStdin = 0;
4093 nCmd++;
4094 azCmd = realloc(azCmd, sizeof(azCmd[0])*nCmd);
4095 if( azCmd==0 ){
4096 fprintf(stderr, "out of memory\n");
4097 exit(1);
4098 }
4099 azCmd[nCmd-1] = z;
4100 }
4101 }
4102 if( z[1]=='-' ) z++;
4103 if( strcmp(z,"-separator")==0
4104 || strcmp(z,"-nullvalue")==0
4105 || strcmp(z,"-newline")==0
@@ -4082,15 +4186,10 @@
4186 warnInmemoryDb = argc==1;
4187 #else
4188 fprintf(stderr,"%s: Error: no database filename specified\n", Argv0);
4189 return 1;
4190 #endif
 
 
 
 
 
4191 }
4192 data.out = stdout;
4193
4194 /* Go ahead and open the database file if it already exists. If the
4195 ** file does not exist, delay opening it. This prevents empty database
@@ -4149,10 +4248,12 @@
4248 data.echoOn = 1;
4249 }else if( strcmp(z,"-eqp")==0 ){
4250 data.autoEQP = 1;
4251 }else if( strcmp(z,"-stats")==0 ){
4252 data.statsOn = 1;
4253 }else if( strcmp(z,"-scanstats")==0 ){
4254 data.scanstatsOn = 1;
4255 }else if( strcmp(z,"-bail")==0 ){
4256 bail_on_error = 1;
4257 }else if( strcmp(z,"-version")==0 ){
4258 printf("%s %s\n", sqlite3_libversion(), sqlite3_sourceid());
4259 return 0;
@@ -4181,10 +4282,14 @@
4282 i++;
4283 #endif
4284 }else if( strcmp(z,"-help")==0 ){
4285 usage(1);
4286 }else if( strcmp(z,"-cmd")==0 ){
4287 /* Run commands that follow -cmd first and separately from commands
4288 ** that simply appear on the command-line. This seems goofy. It would
4289 ** be better if all commands ran in the order that they appear. But
4290 ** we retain the goofy behavior for historical compatibility. */
4291 if( i==argc-1 ) break;
4292 z = cmdline_option_value(argc,argv,++i);
4293 if( z[0]=='.' ){
4294 rc = do_meta_command(z, &data);
4295 if( rc && bail_on_error ) return rc==2 ? 0 : rc;
@@ -4204,27 +4309,32 @@
4309 fprintf(stderr,"Use -help for a list of options.\n");
4310 return 1;
4311 }
4312 }
4313
4314 if( !readStdin ){
4315 /* Run all arguments that do not begin with '-' as if they were separate
4316 ** command-line inputs, except for the argToSkip argument which contains
4317 ** the database filename.
4318 */
4319 for(i=0; i<nCmd; i++){
4320 if( azCmd[i][0]=='.' ){
4321 rc = do_meta_command(azCmd[i], &data);
4322 if( rc ) return rc==2 ? 0 : rc;
4323 }else{
4324 open_db(&data, 0);
4325 rc = shell_exec(data.db, azCmd[i], shell_callback, &data, &zErrMsg);
4326 if( zErrMsg!=0 ){
4327 fprintf(stderr,"Error: %s\n", zErrMsg);
4328 return rc!=0 ? rc : 1;
4329 }else if( rc!=0 ){
4330 fprintf(stderr,"Error: unable to process SQL: %s\n", azCmd[i]);
4331 return rc;
4332 }
4333 }
4334 }
4335 free(azCmd);
4336 }else{
4337 /* Run commands received from standard input
4338 */
4339 if( stdin_is_interactive ){
4340 char *zHome;
4341
+44 -13
--- src/shun.c
+++ src/shun.c
@@ -56,10 +56,11 @@
5656
if( P("rebuild") ){
5757
db_close(1);
5858
db_open_repository(g.zRepositoryName);
5959
db_begin_transaction();
6060
rebuild_db(0, 0, 0);
61
+ admin_log("Rebuilt database.");
6162
db_end_transaction(0);
6263
}
6364
if( zUuid ){
6465
char *p;
6566
int i = 0;
@@ -101,10 +102,11 @@
101102
while( *p ){
102103
db_multi_exec("DELETE FROM shun WHERE uuid=%Q", p);
103104
if( !db_exists("SELECT 1 FROM blob WHERE uuid=%Q", p) ){
104105
allExist = 0;
105106
}
107
+ admin_log("Unshunned %Q", p);
106108
p += UUID_SIZE+1;
107109
}
108110
if( allExist ){
109111
@ <p class="noMoreShun">Artifact(s)<br />
110112
for( p = zUuid ; *p ; p += UUID_SIZE+1 ){
@@ -139,10 +141,11 @@
139141
if( tagid ){
140142
db_multi_exec("DELETE FROM ticket WHERE tkt_uuid=%Q", p);
141143
db_multi_exec("DELETE FROM tag WHERE tagid=%d", tagid);
142144
db_multi_exec("DELETE FROM tagxref WHERE tagid=%d", tagid);
143145
}
146
+ admin_log("Shunned %Q", p);
144147
p += UUID_SIZE+1;
145148
}
146149
@ <p class="shunned">Artifact(s)<br />
147150
for( p = zUuid ; *p ; p += UUID_SIZE+1 ){
148151
@ <a href="%s(g.zTop)/artifact/%s(p)">%s(p)</a><br />
@@ -292,37 +295,50 @@
292295
**
293296
** Show a listing of RCVFROM table entries.
294297
*/
295298
void rcvfromlist_page(void){
296299
int ofst = atoi(PD("ofst","0"));
300
+ int showAll = P("all")!=0;
297301
int cnt;
298302
Stmt q;
299303
300304
login_check_credentials();
301305
if( !g.perm.Admin ){
302306
login_needed();
303307
}
304
- style_header("Content Sources");
308
+ style_header("Artifact Receipts");
309
+ if( showAll ){
310
+ ofst = 0;
311
+ }else{
312
+ style_submenu_element("All", "All", "rcvfromlist?all=1");
313
+ }
305314
if( ofst>0 ){
306315
style_submenu_element("Newer", "Newer", "rcvfromlist?ofst=%d",
307316
ofst>30 ? ofst-30 : 0);
308317
}
318
+ db_multi_exec(
319
+ "CREATE TEMP TABLE rcvidUsed(x INTEGER PRIMARY KEY);"
320
+ "INSERT OR IGNORE INTO rcvidUsed(x) SELECT rcvid FROM blob;"
321
+ );
309322
db_prepare(&q,
310
- "SELECT rcvid, login, datetime(rcvfrom.mtime), rcvfrom.ipaddr"
323
+ "SELECT rcvid, login, datetime(rcvfrom.mtime), rcvfrom.ipaddr,"
324
+ " EXISTS(SELECT 1 FROM rcvidUsed WHERE x=rcvfrom.rcvid)"
311325
" FROM rcvfrom LEFT JOIN user USING(uid)"
312
- " ORDER BY rcvid DESC LIMIT 31 OFFSET %d",
313
- ofst
326
+ " ORDER BY rcvid DESC LIMIT %d OFFSET %d",
327
+ showAll ? -1 : 31, ofst
314328
);
315329
@ <p>Whenever new artifacts are added to the repository, either by
316330
@ push or using the web interface, an entry is made in the RCVFROM table
317331
@ to record the source of that artifact. This log facilitates
318332
@ finding and fixing attempts to inject illicit content into the
319333
@ repository.</p>
320334
@
321335
@ <p>Click on the "rcvid" to show a list of specific artifacts received
322336
@ by a transaction. After identifying illicit artifacts, remove them
323
- @ using the "Shun" feature.</p>
337
+ @ using the "Shun" button. If an "rcvid" is not hyperlinked, that means
338
+ @ all artifacts associated with that rcvid have already been shunned
339
+ @ or purged.</p>
324340
@
325341
@ <table cellpadding="0" cellspacing="0" border="0">
326342
@ <tr><th style="padding-right: 15px;text-align: right;">rcvid</th>
327343
@ <th style="padding-right: 15px;text-align: left;">Date</th>
328344
@ <th style="padding-right: 15px;text-align: left;">User</th>
@@ -331,17 +347,22 @@
331347
while( db_step(&q)==SQLITE_ROW ){
332348
int rcvid = db_column_int(&q, 0);
333349
const char *zUser = db_column_text(&q, 1);
334350
const char *zDate = db_column_text(&q, 2);
335351
const char *zIpAddr = db_column_text(&q, 3);
336
- if( cnt==30 ){
352
+ if( cnt==30 && !showAll ){
337353
style_submenu_element("Older", "Older",
338354
"rcvfromlist?ofst=%d", ofst+30);
339355
}else{
340356
cnt++;
341357
@ <tr>
342
- @ <td style="padding-right: 15px;text-align: right;"><a href="rcvfrom?rcvid=%d(rcvid)">%d(rcvid)</a></td>
358
+ if( db_column_int(&q,4) ){
359
+ @ <td style="padding-right: 15px;text-align: right;">
360
+ @ <a href="rcvfrom?rcvid=%d(rcvid)">%d(rcvid)</a></td>
361
+ }else{
362
+ @ <td style="padding-right: 15px;text-align: right;">%d(rcvid)</td>
363
+ }
343364
@ <td style="padding-right: 15px;text-align: left;">%s(zDate)</td>
344365
@ <td style="padding-right: 15px;text-align: left;">%h(zUser)</td>
345366
@ <td style="text-align: left;">%s(zIpAddr)</td>
346367
@ </tr>
347368
}
@@ -362,22 +383,24 @@
362383
363384
login_check_credentials();
364385
if( !g.perm.Admin ){
365386
login_needed();
366387
}
367
- style_header("Content Source %d", rcvid);
388
+ style_header("Artifact Receipt %d", rcvid);
368389
if( db_exists(
369390
"SELECT 1 FROM blob WHERE rcvid=%d AND"
370391
" NOT EXISTS (SELECT 1 FROM shun WHERE shun.uuid=blob.uuid)", rcvid)
371392
){
372
- style_submenu_element("Shun All", "Shun All", "shun?shun&rcvid=%d#addshun", rcvid);
393
+ style_submenu_element("Shun All", "Shun All",
394
+ "shun?shun&rcvid=%d#addshun", rcvid);
373395
}
374396
if( db_exists(
375397
"SELECT 1 FROM blob WHERE rcvid=%d AND"
376398
" EXISTS (SELECT 1 FROM shun WHERE shun.uuid=blob.uuid)", rcvid)
377399
){
378
- style_submenu_element("Unshun All", "Unshun All", "shun?accept&rcvid=%d#delshun", rcvid);
400
+ style_submenu_element("Unshun All", "Unshun All",
401
+ "shun?accept&rcvid=%d#delshun", rcvid);
379402
}
380403
db_prepare(&q,
381404
"SELECT login, datetime(rcvfrom.mtime), rcvfrom.ipaddr"
382405
" FROM rcvfrom LEFT JOIN user USING(uid)"
383406
" WHERE rcvid=%d",
@@ -396,22 +419,30 @@
396419
@ <td valign="top">%s(zDate)</td></tr>
397420
@ <tr><th valign="top" align="right">IP&nbsp;Address:</th>
398421
@ <td valign="top">%s(zIpAddr)</td></tr>
399422
}
400423
db_finalize(&q);
424
+ db_multi_exec(
425
+ "CREATE TEMP TABLE toshow(rid INTEGER PRIMARY KEY);"
426
+ "INSERT INTO toshow SELECT rid FROM blob WHERE rcvid=%d", rcvid
427
+ );
428
+ describe_artifacts("IN toshow");
401429
db_prepare(&q,
402
- "SELECT rid, uuid, size FROM blob WHERE rcvid=%d", rcvid
430
+ "SELECT blob.rid, blob.uuid, blob.size, description.summary\n"
431
+ " FROM blob LEFT JOIN description ON (blob.rid=description.rid)"
432
+ " WHERE blob.rcvid=%d", rcvid
403433
);
404434
@ <tr><th valign="top" align="right">Artifacts:</th>
405435
@ <td valign="top">
406436
while( db_step(&q)==SQLITE_ROW ){
407
- int rid = db_column_int(&q, 0);
408437
const char *zUuid = db_column_text(&q, 1);
409438
int size = db_column_int(&q, 2);
439
+ const char *zDesc = db_column_text(&q, 3);
440
+ if( zDesc==0 ) zDesc = "";
410441
@ <a href="%s(g.zTop)/info/%s(zUuid)">%s(zUuid)</a>
411
- @ (rid: %d(rid), size: %d(size))<br />
442
+ @ %h(zDesc) (size: %d(size))<br />
412443
}
413444
@ </td></tr>
414445
@ </table>
415446
db_finalize(&q);
416447
style_footer();
417448
}
418449
--- src/shun.c
+++ src/shun.c
@@ -56,10 +56,11 @@
56 if( P("rebuild") ){
57 db_close(1);
58 db_open_repository(g.zRepositoryName);
59 db_begin_transaction();
60 rebuild_db(0, 0, 0);
 
61 db_end_transaction(0);
62 }
63 if( zUuid ){
64 char *p;
65 int i = 0;
@@ -101,10 +102,11 @@
101 while( *p ){
102 db_multi_exec("DELETE FROM shun WHERE uuid=%Q", p);
103 if( !db_exists("SELECT 1 FROM blob WHERE uuid=%Q", p) ){
104 allExist = 0;
105 }
 
106 p += UUID_SIZE+1;
107 }
108 if( allExist ){
109 @ <p class="noMoreShun">Artifact(s)<br />
110 for( p = zUuid ; *p ; p += UUID_SIZE+1 ){
@@ -139,10 +141,11 @@
139 if( tagid ){
140 db_multi_exec("DELETE FROM ticket WHERE tkt_uuid=%Q", p);
141 db_multi_exec("DELETE FROM tag WHERE tagid=%d", tagid);
142 db_multi_exec("DELETE FROM tagxref WHERE tagid=%d", tagid);
143 }
 
144 p += UUID_SIZE+1;
145 }
146 @ <p class="shunned">Artifact(s)<br />
147 for( p = zUuid ; *p ; p += UUID_SIZE+1 ){
148 @ <a href="%s(g.zTop)/artifact/%s(p)">%s(p)</a><br />
@@ -292,37 +295,50 @@
292 **
293 ** Show a listing of RCVFROM table entries.
294 */
295 void rcvfromlist_page(void){
296 int ofst = atoi(PD("ofst","0"));
 
297 int cnt;
298 Stmt q;
299
300 login_check_credentials();
301 if( !g.perm.Admin ){
302 login_needed();
303 }
304 style_header("Content Sources");
 
 
 
 
 
305 if( ofst>0 ){
306 style_submenu_element("Newer", "Newer", "rcvfromlist?ofst=%d",
307 ofst>30 ? ofst-30 : 0);
308 }
 
 
 
 
309 db_prepare(&q,
310 "SELECT rcvid, login, datetime(rcvfrom.mtime), rcvfrom.ipaddr"
 
311 " FROM rcvfrom LEFT JOIN user USING(uid)"
312 " ORDER BY rcvid DESC LIMIT 31 OFFSET %d",
313 ofst
314 );
315 @ <p>Whenever new artifacts are added to the repository, either by
316 @ push or using the web interface, an entry is made in the RCVFROM table
317 @ to record the source of that artifact. This log facilitates
318 @ finding and fixing attempts to inject illicit content into the
319 @ repository.</p>
320 @
321 @ <p>Click on the "rcvid" to show a list of specific artifacts received
322 @ by a transaction. After identifying illicit artifacts, remove them
323 @ using the "Shun" feature.</p>
 
 
324 @
325 @ <table cellpadding="0" cellspacing="0" border="0">
326 @ <tr><th style="padding-right: 15px;text-align: right;">rcvid</th>
327 @ <th style="padding-right: 15px;text-align: left;">Date</th>
328 @ <th style="padding-right: 15px;text-align: left;">User</th>
@@ -331,17 +347,22 @@
331 while( db_step(&q)==SQLITE_ROW ){
332 int rcvid = db_column_int(&q, 0);
333 const char *zUser = db_column_text(&q, 1);
334 const char *zDate = db_column_text(&q, 2);
335 const char *zIpAddr = db_column_text(&q, 3);
336 if( cnt==30 ){
337 style_submenu_element("Older", "Older",
338 "rcvfromlist?ofst=%d", ofst+30);
339 }else{
340 cnt++;
341 @ <tr>
342 @ <td style="padding-right: 15px;text-align: right;"><a href="rcvfrom?rcvid=%d(rcvid)">%d(rcvid)</a></td>
 
 
 
 
 
343 @ <td style="padding-right: 15px;text-align: left;">%s(zDate)</td>
344 @ <td style="padding-right: 15px;text-align: left;">%h(zUser)</td>
345 @ <td style="text-align: left;">%s(zIpAddr)</td>
346 @ </tr>
347 }
@@ -362,22 +383,24 @@
362
363 login_check_credentials();
364 if( !g.perm.Admin ){
365 login_needed();
366 }
367 style_header("Content Source %d", rcvid);
368 if( db_exists(
369 "SELECT 1 FROM blob WHERE rcvid=%d AND"
370 " NOT EXISTS (SELECT 1 FROM shun WHERE shun.uuid=blob.uuid)", rcvid)
371 ){
372 style_submenu_element("Shun All", "Shun All", "shun?shun&rcvid=%d#addshun", rcvid);
 
373 }
374 if( db_exists(
375 "SELECT 1 FROM blob WHERE rcvid=%d AND"
376 " EXISTS (SELECT 1 FROM shun WHERE shun.uuid=blob.uuid)", rcvid)
377 ){
378 style_submenu_element("Unshun All", "Unshun All", "shun?accept&rcvid=%d#delshun", rcvid);
 
379 }
380 db_prepare(&q,
381 "SELECT login, datetime(rcvfrom.mtime), rcvfrom.ipaddr"
382 " FROM rcvfrom LEFT JOIN user USING(uid)"
383 " WHERE rcvid=%d",
@@ -396,22 +419,30 @@
396 @ <td valign="top">%s(zDate)</td></tr>
397 @ <tr><th valign="top" align="right">IP&nbsp;Address:</th>
398 @ <td valign="top">%s(zIpAddr)</td></tr>
399 }
400 db_finalize(&q);
 
 
 
 
 
401 db_prepare(&q,
402 "SELECT rid, uuid, size FROM blob WHERE rcvid=%d", rcvid
 
 
403 );
404 @ <tr><th valign="top" align="right">Artifacts:</th>
405 @ <td valign="top">
406 while( db_step(&q)==SQLITE_ROW ){
407 int rid = db_column_int(&q, 0);
408 const char *zUuid = db_column_text(&q, 1);
409 int size = db_column_int(&q, 2);
 
 
410 @ <a href="%s(g.zTop)/info/%s(zUuid)">%s(zUuid)</a>
411 @ (rid: %d(rid), size: %d(size))<br />
412 }
413 @ </td></tr>
414 @ </table>
415 db_finalize(&q);
416 style_footer();
417 }
418
--- src/shun.c
+++ src/shun.c
@@ -56,10 +56,11 @@
56 if( P("rebuild") ){
57 db_close(1);
58 db_open_repository(g.zRepositoryName);
59 db_begin_transaction();
60 rebuild_db(0, 0, 0);
61 admin_log("Rebuilt database.");
62 db_end_transaction(0);
63 }
64 if( zUuid ){
65 char *p;
66 int i = 0;
@@ -101,10 +102,11 @@
102 while( *p ){
103 db_multi_exec("DELETE FROM shun WHERE uuid=%Q", p);
104 if( !db_exists("SELECT 1 FROM blob WHERE uuid=%Q", p) ){
105 allExist = 0;
106 }
107 admin_log("Unshunned %Q", p);
108 p += UUID_SIZE+1;
109 }
110 if( allExist ){
111 @ <p class="noMoreShun">Artifact(s)<br />
112 for( p = zUuid ; *p ; p += UUID_SIZE+1 ){
@@ -139,10 +141,11 @@
141 if( tagid ){
142 db_multi_exec("DELETE FROM ticket WHERE tkt_uuid=%Q", p);
143 db_multi_exec("DELETE FROM tag WHERE tagid=%d", tagid);
144 db_multi_exec("DELETE FROM tagxref WHERE tagid=%d", tagid);
145 }
146 admin_log("Shunned %Q", p);
147 p += UUID_SIZE+1;
148 }
149 @ <p class="shunned">Artifact(s)<br />
150 for( p = zUuid ; *p ; p += UUID_SIZE+1 ){
151 @ <a href="%s(g.zTop)/artifact/%s(p)">%s(p)</a><br />
@@ -292,37 +295,50 @@
295 **
296 ** Show a listing of RCVFROM table entries.
297 */
298 void rcvfromlist_page(void){
299 int ofst = atoi(PD("ofst","0"));
300 int showAll = P("all")!=0;
301 int cnt;
302 Stmt q;
303
304 login_check_credentials();
305 if( !g.perm.Admin ){
306 login_needed();
307 }
308 style_header("Artifact Receipts");
309 if( showAll ){
310 ofst = 0;
311 }else{
312 style_submenu_element("All", "All", "rcvfromlist?all=1");
313 }
314 if( ofst>0 ){
315 style_submenu_element("Newer", "Newer", "rcvfromlist?ofst=%d",
316 ofst>30 ? ofst-30 : 0);
317 }
318 db_multi_exec(
319 "CREATE TEMP TABLE rcvidUsed(x INTEGER PRIMARY KEY);"
320 "INSERT OR IGNORE INTO rcvidUsed(x) SELECT rcvid FROM blob;"
321 );
322 db_prepare(&q,
323 "SELECT rcvid, login, datetime(rcvfrom.mtime), rcvfrom.ipaddr,"
324 " EXISTS(SELECT 1 FROM rcvidUsed WHERE x=rcvfrom.rcvid)"
325 " FROM rcvfrom LEFT JOIN user USING(uid)"
326 " ORDER BY rcvid DESC LIMIT %d OFFSET %d",
327 showAll ? -1 : 31, ofst
328 );
329 @ <p>Whenever new artifacts are added to the repository, either by
330 @ push or using the web interface, an entry is made in the RCVFROM table
331 @ to record the source of that artifact. This log facilitates
332 @ finding and fixing attempts to inject illicit content into the
333 @ repository.</p>
334 @
335 @ <p>Click on the "rcvid" to show a list of specific artifacts received
336 @ by a transaction. After identifying illicit artifacts, remove them
337 @ using the "Shun" button. If an "rcvid" is not hyperlinked, that means
338 @ all artifacts associated with that rcvid have already been shunned
339 @ or purged.</p>
340 @
341 @ <table cellpadding="0" cellspacing="0" border="0">
342 @ <tr><th style="padding-right: 15px;text-align: right;">rcvid</th>
343 @ <th style="padding-right: 15px;text-align: left;">Date</th>
344 @ <th style="padding-right: 15px;text-align: left;">User</th>
@@ -331,17 +347,22 @@
347 while( db_step(&q)==SQLITE_ROW ){
348 int rcvid = db_column_int(&q, 0);
349 const char *zUser = db_column_text(&q, 1);
350 const char *zDate = db_column_text(&q, 2);
351 const char *zIpAddr = db_column_text(&q, 3);
352 if( cnt==30 && !showAll ){
353 style_submenu_element("Older", "Older",
354 "rcvfromlist?ofst=%d", ofst+30);
355 }else{
356 cnt++;
357 @ <tr>
358 if( db_column_int(&q,4) ){
359 @ <td style="padding-right: 15px;text-align: right;">
360 @ <a href="rcvfrom?rcvid=%d(rcvid)">%d(rcvid)</a></td>
361 }else{
362 @ <td style="padding-right: 15px;text-align: right;">%d(rcvid)</td>
363 }
364 @ <td style="padding-right: 15px;text-align: left;">%s(zDate)</td>
365 @ <td style="padding-right: 15px;text-align: left;">%h(zUser)</td>
366 @ <td style="text-align: left;">%s(zIpAddr)</td>
367 @ </tr>
368 }
@@ -362,22 +383,24 @@
383
384 login_check_credentials();
385 if( !g.perm.Admin ){
386 login_needed();
387 }
388 style_header("Artifact Receipt %d", rcvid);
389 if( db_exists(
390 "SELECT 1 FROM blob WHERE rcvid=%d AND"
391 " NOT EXISTS (SELECT 1 FROM shun WHERE shun.uuid=blob.uuid)", rcvid)
392 ){
393 style_submenu_element("Shun All", "Shun All",
394 "shun?shun&rcvid=%d#addshun", rcvid);
395 }
396 if( db_exists(
397 "SELECT 1 FROM blob WHERE rcvid=%d AND"
398 " EXISTS (SELECT 1 FROM shun WHERE shun.uuid=blob.uuid)", rcvid)
399 ){
400 style_submenu_element("Unshun All", "Unshun All",
401 "shun?accept&rcvid=%d#delshun", rcvid);
402 }
403 db_prepare(&q,
404 "SELECT login, datetime(rcvfrom.mtime), rcvfrom.ipaddr"
405 " FROM rcvfrom LEFT JOIN user USING(uid)"
406 " WHERE rcvid=%d",
@@ -396,22 +419,30 @@
419 @ <td valign="top">%s(zDate)</td></tr>
420 @ <tr><th valign="top" align="right">IP&nbsp;Address:</th>
421 @ <td valign="top">%s(zIpAddr)</td></tr>
422 }
423 db_finalize(&q);
424 db_multi_exec(
425 "CREATE TEMP TABLE toshow(rid INTEGER PRIMARY KEY);"
426 "INSERT INTO toshow SELECT rid FROM blob WHERE rcvid=%d", rcvid
427 );
428 describe_artifacts("IN toshow");
429 db_prepare(&q,
430 "SELECT blob.rid, blob.uuid, blob.size, description.summary\n"
431 " FROM blob LEFT JOIN description ON (blob.rid=description.rid)"
432 " WHERE blob.rcvid=%d", rcvid
433 );
434 @ <tr><th valign="top" align="right">Artifacts:</th>
435 @ <td valign="top">
436 while( db_step(&q)==SQLITE_ROW ){
 
437 const char *zUuid = db_column_text(&q, 1);
438 int size = db_column_int(&q, 2);
439 const char *zDesc = db_column_text(&q, 3);
440 if( zDesc==0 ) zDesc = "";
441 @ <a href="%s(g.zTop)/info/%s(zUuid)">%s(zUuid)</a>
442 @ %h(zDesc) (size: %d(size))<br />
443 }
444 @ </td></tr>
445 @ </table>
446 db_finalize(&q);
447 style_footer();
448 }
449
+17 -6
--- src/sqlcmd.c
+++ src/sqlcmd.c
@@ -106,10 +106,24 @@
106106
sqlite3_result_blob(context, pOut, nOut, sqlite3_free);
107107
}else{
108108
sqlite3_result_error(context, "input is not zlib compressed", -1);
109109
}
110110
}
111
+
112
+/*
113
+** Add the content(), compress(), and decompress() SQL functions to
114
+** database connection db.
115
+*/
116
+int add_content_sql_commands(sqlite3 *db){
117
+ sqlite3_create_function(db, "content", 1, SQLITE_UTF8, 0,
118
+ sqlcmd_content, 0, 0);
119
+ sqlite3_create_function(db, "compress", 1, SQLITE_UTF8, 0,
120
+ sqlcmd_compress, 0, 0);
121
+ sqlite3_create_function(db, "decompress", 1, SQLITE_UTF8, 0,
122
+ sqlcmd_decompress, 0, 0);
123
+ return SQLITE_OK;
124
+}
111125
112126
/*
113127
** This is the "automatic extension" initializer that runs right after
114128
** the connection to the repository database is opened. Set up the
115129
** database connection to be more useful to the human operator.
@@ -117,17 +131,14 @@
117131
static int sqlcmd_autoinit(
118132
sqlite3 *db,
119133
const char **pzErrMsg,
120134
const void *notUsed
121135
){
122
- sqlite3_create_function(db, "content", 1, SQLITE_UTF8, 0,
123
- sqlcmd_content, 0, 0);
124
- sqlite3_create_function(db, "compress", 1, SQLITE_UTF8, 0,
125
- sqlcmd_compress, 0, 0);
126
- sqlite3_create_function(db, "decompress", 1, SQLITE_UTF8, 0,
127
- sqlcmd_decompress, 0, 0);
136
+ add_content_sql_commands(db);
128137
re_add_sql_func(db);
138
+ g.zMainDbType = "repository";
139
+ foci_register(db);
129140
g.repositoryOpen = 1;
130141
g.db = db;
131142
return SQLITE_OK;
132143
}
133144
134145
--- src/sqlcmd.c
+++ src/sqlcmd.c
@@ -106,10 +106,24 @@
106 sqlite3_result_blob(context, pOut, nOut, sqlite3_free);
107 }else{
108 sqlite3_result_error(context, "input is not zlib compressed", -1);
109 }
110 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
112 /*
113 ** This is the "automatic extension" initializer that runs right after
114 ** the connection to the repository database is opened. Set up the
115 ** database connection to be more useful to the human operator.
@@ -117,17 +131,14 @@
117 static int sqlcmd_autoinit(
118 sqlite3 *db,
119 const char **pzErrMsg,
120 const void *notUsed
121 ){
122 sqlite3_create_function(db, "content", 1, SQLITE_UTF8, 0,
123 sqlcmd_content, 0, 0);
124 sqlite3_create_function(db, "compress", 1, SQLITE_UTF8, 0,
125 sqlcmd_compress, 0, 0);
126 sqlite3_create_function(db, "decompress", 1, SQLITE_UTF8, 0,
127 sqlcmd_decompress, 0, 0);
128 re_add_sql_func(db);
 
 
129 g.repositoryOpen = 1;
130 g.db = db;
131 return SQLITE_OK;
132 }
133
134
--- src/sqlcmd.c
+++ src/sqlcmd.c
@@ -106,10 +106,24 @@
106 sqlite3_result_blob(context, pOut, nOut, sqlite3_free);
107 }else{
108 sqlite3_result_error(context, "input is not zlib compressed", -1);
109 }
110 }
111
112 /*
113 ** Add the content(), compress(), and decompress() SQL functions to
114 ** database connection db.
115 */
116 int add_content_sql_commands(sqlite3 *db){
117 sqlite3_create_function(db, "content", 1, SQLITE_UTF8, 0,
118 sqlcmd_content, 0, 0);
119 sqlite3_create_function(db, "compress", 1, SQLITE_UTF8, 0,
120 sqlcmd_compress, 0, 0);
121 sqlite3_create_function(db, "decompress", 1, SQLITE_UTF8, 0,
122 sqlcmd_decompress, 0, 0);
123 return SQLITE_OK;
124 }
125
126 /*
127 ** This is the "automatic extension" initializer that runs right after
128 ** the connection to the repository database is opened. Set up the
129 ** database connection to be more useful to the human operator.
@@ -117,17 +131,14 @@
131 static int sqlcmd_autoinit(
132 sqlite3 *db,
133 const char **pzErrMsg,
134 const void *notUsed
135 ){
136 add_content_sql_commands(db);
 
 
 
 
 
137 re_add_sql_func(db);
138 g.zMainDbType = "repository";
139 foci_register(db);
140 g.repositoryOpen = 1;
141 g.db = db;
142 return SQLITE_OK;
143 }
144
145
+2567 -1087
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1,8 +1,8 @@
11
/******************************************************************************
22
** This file is an amalgamation of many separate C source files from SQLite
3
-** version 3.8.7.1. By combining all the individual C code files into this
3
+** version 3.8.8. By combining all the individual C code files into this
44
** single large file, the entire code can be compiled as a single translation
55
** unit. This allows many compilers to do optimizations that would not be
66
** possible if the files were compiled separately. Performance improvements
77
** of 5% or more are commonly seen when SQLite is compiled as a single
88
** translation unit.
@@ -179,11 +179,11 @@
179179
180180
181181
/*
182182
** These no-op macros are used in front of interfaces to mark those
183183
** interfaces as either deprecated or experimental. New applications
184
-** should not use deprecated interfaces - they are support for backwards
184
+** should not use deprecated interfaces - they are supported for backwards
185185
** compatibility only. Application writers should be aware that
186186
** experimental interfaces are subject to change in point releases.
187187
**
188188
** These macros used to resolve to various kinds of compiler magic that
189189
** would generate warning messages when they were used. But that
@@ -229,13 +229,13 @@
229229
**
230230
** See also: [sqlite3_libversion()],
231231
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
232232
** [sqlite_version()] and [sqlite_source_id()].
233233
*/
234
-#define SQLITE_VERSION "3.8.7.1"
235
-#define SQLITE_VERSION_NUMBER 3008007
236
-#define SQLITE_SOURCE_ID "2014-10-29 01:27:43 83afe23e553e802c0947c80d0ffdd120423e7c52"
234
+#define SQLITE_VERSION "3.8.8"
235
+#define SQLITE_VERSION_NUMBER 3008008
236
+#define SQLITE_SOURCE_ID "2014-12-06 14:56:49 6aeece19a235344be2537e66a3fe08b1febfb5a0"
237237
238238
/*
239239
** CAPI3REF: Run-Time Library Version Numbers
240240
** KEYWORDS: sqlite3_version, sqlite3_sourceid
241241
**
@@ -1343,11 +1343,11 @@
13431343
** <li> SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED
13441344
** <li> SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE
13451345
** </ul>
13461346
**
13471347
** When unlocking, the same SHARED or EXCLUSIVE flag must be supplied as
1348
-** was given no the corresponding lock.
1348
+** was given on the corresponding lock.
13491349
**
13501350
** The xShmLock method can transition between unlocked and SHARED or
13511351
** between unlocked and EXCLUSIVE. It cannot transition between SHARED
13521352
** and EXCLUSIVE.
13531353
*/
@@ -1626,30 +1626,32 @@
16261626
** it is not possible to set the Serialized [threading mode] and
16271627
** [sqlite3_config()] will return [SQLITE_ERROR] if called with the
16281628
** SQLITE_CONFIG_SERIALIZED configuration option.</dd>
16291629
**
16301630
** [[SQLITE_CONFIG_MALLOC]] <dt>SQLITE_CONFIG_MALLOC</dt>
1631
-** <dd> ^(This option takes a single argument which is a pointer to an
1632
-** instance of the [sqlite3_mem_methods] structure. The argument specifies
1631
+** <dd> ^(The SQLITE_CONFIG_MALLOC option takes a single argument which is
1632
+** a pointer to an instance of the [sqlite3_mem_methods] structure.
1633
+** The argument specifies
16331634
** alternative low-level memory allocation routines to be used in place of
16341635
** the memory allocation routines built into SQLite.)^ ^SQLite makes
16351636
** its own private copy of the content of the [sqlite3_mem_methods] structure
16361637
** before the [sqlite3_config()] call returns.</dd>
16371638
**
16381639
** [[SQLITE_CONFIG_GETMALLOC]] <dt>SQLITE_CONFIG_GETMALLOC</dt>
1639
-** <dd> ^(This option takes a single argument which is a pointer to an
1640
-** instance of the [sqlite3_mem_methods] structure. The [sqlite3_mem_methods]
1640
+** <dd> ^(The SQLITE_CONFIG_GETMALLOC option takes a single argument which
1641
+** is a pointer to an instance of the [sqlite3_mem_methods] structure.
1642
+** The [sqlite3_mem_methods]
16411643
** structure is filled with the currently defined memory allocation routines.)^
16421644
** This option can be used to overload the default memory allocation
16431645
** routines with a wrapper that simulations memory allocation failure or
16441646
** tracks memory usage, for example. </dd>
16451647
**
16461648
** [[SQLITE_CONFIG_MEMSTATUS]] <dt>SQLITE_CONFIG_MEMSTATUS</dt>
1647
-** <dd> ^This option takes single argument of type int, interpreted as a
1648
-** boolean, which enables or disables the collection of memory allocation
1649
-** statistics. ^(When memory allocation statistics are disabled, the
1650
-** following SQLite interfaces become non-operational:
1649
+** <dd> ^The SQLITE_CONFIG_MEMSTATUS option takes single argument of type int,
1650
+** interpreted as a boolean, which enables or disables the collection of
1651
+** memory allocation statistics. ^(When memory allocation statistics are
1652
+** disabled, the following SQLite interfaces become non-operational:
16511653
** <ul>
16521654
** <li> [sqlite3_memory_used()]
16531655
** <li> [sqlite3_memory_highwater()]
16541656
** <li> [sqlite3_soft_heap_limit64()]
16551657
** <li> [sqlite3_status()]
@@ -1658,78 +1660,92 @@
16581660
** compiled with [SQLITE_DEFAULT_MEMSTATUS]=0 in which case memory
16591661
** allocation statistics are disabled by default.
16601662
** </dd>
16611663
**
16621664
** [[SQLITE_CONFIG_SCRATCH]] <dt>SQLITE_CONFIG_SCRATCH</dt>
1663
-** <dd> ^This option specifies a static memory buffer that SQLite can use for
1664
-** scratch memory. There are three arguments: A pointer an 8-byte
1665
+** <dd> ^The SQLITE_CONFIG_SCRATCH option specifies a static memory buffer
1666
+** that SQLite can use for scratch memory. ^(There are three arguments
1667
+** to SQLITE_CONFIG_SCRATCH: A pointer an 8-byte
16651668
** aligned memory buffer from which the scratch allocations will be
16661669
** drawn, the size of each scratch allocation (sz),
1667
-** and the maximum number of scratch allocations (N). The sz
1668
-** argument must be a multiple of 16.
1670
+** and the maximum number of scratch allocations (N).)^
16691671
** The first argument must be a pointer to an 8-byte aligned buffer
16701672
** of at least sz*N bytes of memory.
1671
-** ^SQLite will use no more than two scratch buffers per thread. So
1672
-** N should be set to twice the expected maximum number of threads.
1673
-** ^SQLite will never require a scratch buffer that is more than 6
1674
-** times the database page size. ^If SQLite needs needs additional
1673
+** ^SQLite will not use more than one scratch buffers per thread.
1674
+** ^SQLite will never request a scratch buffer that is more than 6
1675
+** times the database page size.
1676
+** ^If SQLite needs needs additional
16751677
** scratch memory beyond what is provided by this configuration option, then
1676
-** [sqlite3_malloc()] will be used to obtain the memory needed.</dd>
1678
+** [sqlite3_malloc()] will be used to obtain the memory needed.<p>
1679
+** ^When the application provides any amount of scratch memory using
1680
+** SQLITE_CONFIG_SCRATCH, SQLite avoids unnecessary large
1681
+** [sqlite3_malloc|heap allocations].
1682
+** This can help [Robson proof|prevent memory allocation failures] due to heap
1683
+** fragmentation in low-memory embedded systems.
1684
+** </dd>
16771685
**
16781686
** [[SQLITE_CONFIG_PAGECACHE]] <dt>SQLITE_CONFIG_PAGECACHE</dt>
1679
-** <dd> ^This option specifies a static memory buffer that SQLite can use for
1680
-** the database page cache with the default page cache implementation.
1687
+** <dd> ^The SQLITE_CONFIG_PAGECACHE option specifies a static memory buffer
1688
+** that SQLite can use for the database page cache with the default page
1689
+** cache implementation.
16811690
** This configuration should not be used if an application-define page
1682
-** cache implementation is loaded using the SQLITE_CONFIG_PCACHE2 option.
1683
-** There are three arguments to this option: A pointer to 8-byte aligned
1691
+** cache implementation is loaded using the [SQLITE_CONFIG_PCACHE2]
1692
+** configuration option.
1693
+** ^There are three arguments to SQLITE_CONFIG_PAGECACHE: A pointer to
1694
+** 8-byte aligned
16841695
** memory, the size of each page buffer (sz), and the number of pages (N).
16851696
** The sz argument should be the size of the largest database page
1686
-** (a power of two between 512 and 32768) plus a little extra for each
1687
-** page header. ^The page header size is 20 to 40 bytes depending on
1688
-** the host architecture. ^It is harmless, apart from the wasted memory,
1689
-** to make sz a little too large. The first
1690
-** argument should point to an allocation of at least sz*N bytes of memory.
1697
+** (a power of two between 512 and 32768) plus some extra bytes for each
1698
+** page header. ^The number of extra bytes needed by the page header
1699
+** can be determined using the [SQLITE_CONFIG_PCACHE_HDRSZ] option
1700
+** to [sqlite3_config()].
1701
+** ^It is harmless, apart from the wasted memory,
1702
+** for the sz parameter to be larger than necessary. The first
1703
+** argument should pointer to an 8-byte aligned block of memory that
1704
+** is at least sz*N bytes of memory, otherwise subsequent behavior is
1705
+** undefined.
16911706
** ^SQLite will use the memory provided by the first argument to satisfy its
16921707
** memory needs for the first N pages that it adds to cache. ^If additional
16931708
** page cache memory is needed beyond what is provided by this option, then
1694
-** SQLite goes to [sqlite3_malloc()] for the additional storage space.
1695
-** The pointer in the first argument must
1696
-** be aligned to an 8-byte boundary or subsequent behavior of SQLite
1697
-** will be undefined.</dd>
1709
+** SQLite goes to [sqlite3_malloc()] for the additional storage space.</dd>
16981710
**
16991711
** [[SQLITE_CONFIG_HEAP]] <dt>SQLITE_CONFIG_HEAP</dt>
1700
-** <dd> ^This option specifies a static memory buffer that SQLite will use
1701
-** for all of its dynamic memory allocation needs beyond those provided
1702
-** for by [SQLITE_CONFIG_SCRATCH] and [SQLITE_CONFIG_PAGECACHE].
1703
-** There are three arguments: An 8-byte aligned pointer to the memory,
1712
+** <dd> ^The SQLITE_CONFIG_HEAP option specifies a static memory buffer
1713
+** that SQLite will use for all of its dynamic memory allocation needs
1714
+** beyond those provided for by [SQLITE_CONFIG_SCRATCH] and
1715
+** [SQLITE_CONFIG_PAGECACHE].
1716
+** ^The SQLITE_CONFIG_HEAP option is only available if SQLite is compiled
1717
+** with either [SQLITE_ENABLE_MEMSYS3] or [SQLITE_ENABLE_MEMSYS5] and returns
1718
+** [SQLITE_ERROR] if invoked otherwise.
1719
+** ^There are three arguments to SQLITE_CONFIG_HEAP:
1720
+** An 8-byte aligned pointer to the memory,
17041721
** the number of bytes in the memory buffer, and the minimum allocation size.
17051722
** ^If the first pointer (the memory pointer) is NULL, then SQLite reverts
17061723
** to using its default memory allocator (the system malloc() implementation),
17071724
** undoing any prior invocation of [SQLITE_CONFIG_MALLOC]. ^If the
1708
-** memory pointer is not NULL and either [SQLITE_ENABLE_MEMSYS3] or
1709
-** [SQLITE_ENABLE_MEMSYS5] are defined, then the alternative memory
1725
+** memory pointer is not NULL then the alternative memory
17101726
** allocator is engaged to handle all of SQLites memory allocation needs.
17111727
** The first pointer (the memory pointer) must be aligned to an 8-byte
17121728
** boundary or subsequent behavior of SQLite will be undefined.
17131729
** The minimum allocation size is capped at 2**12. Reasonable values
17141730
** for the minimum allocation size are 2**5 through 2**8.</dd>
17151731
**
17161732
** [[SQLITE_CONFIG_MUTEX]] <dt>SQLITE_CONFIG_MUTEX</dt>
1717
-** <dd> ^(This option takes a single argument which is a pointer to an
1718
-** instance of the [sqlite3_mutex_methods] structure. The argument specifies
1719
-** alternative low-level mutex routines to be used in place
1720
-** the mutex routines built into SQLite.)^ ^SQLite makes a copy of the
1721
-** content of the [sqlite3_mutex_methods] structure before the call to
1733
+** <dd> ^(The SQLITE_CONFIG_MUTEX option takes a single argument which is a
1734
+** pointer to an instance of the [sqlite3_mutex_methods] structure.
1735
+** The argument specifies alternative low-level mutex routines to be used
1736
+** in place the mutex routines built into SQLite.)^ ^SQLite makes a copy of
1737
+** the content of the [sqlite3_mutex_methods] structure before the call to
17221738
** [sqlite3_config()] returns. ^If SQLite is compiled with
17231739
** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
17241740
** the entire mutexing subsystem is omitted from the build and hence calls to
17251741
** [sqlite3_config()] with the SQLITE_CONFIG_MUTEX configuration option will
17261742
** return [SQLITE_ERROR].</dd>
17271743
**
17281744
** [[SQLITE_CONFIG_GETMUTEX]] <dt>SQLITE_CONFIG_GETMUTEX</dt>
1729
-** <dd> ^(This option takes a single argument which is a pointer to an
1730
-** instance of the [sqlite3_mutex_methods] structure. The
1745
+** <dd> ^(The SQLITE_CONFIG_GETMUTEX option takes a single argument which
1746
+** is a pointer to an instance of the [sqlite3_mutex_methods] structure. The
17311747
** [sqlite3_mutex_methods]
17321748
** structure is filled with the currently defined mutex routines.)^
17331749
** This option can be used to overload the default mutex allocation
17341750
** routines with a wrapper used to track mutex usage for performance
17351751
** profiling or testing, for example. ^If SQLite is compiled with
@@ -1737,29 +1753,29 @@
17371753
** the entire mutexing subsystem is omitted from the build and hence calls to
17381754
** [sqlite3_config()] with the SQLITE_CONFIG_GETMUTEX configuration option will
17391755
** return [SQLITE_ERROR].</dd>
17401756
**
17411757
** [[SQLITE_CONFIG_LOOKASIDE]] <dt>SQLITE_CONFIG_LOOKASIDE</dt>
1742
-** <dd> ^(This option takes two arguments that determine the default
1743
-** memory allocation for the lookaside memory allocator on each
1744
-** [database connection]. The first argument is the
1758
+** <dd> ^(The SQLITE_CONFIG_LOOKASIDE option takes two arguments that determine
1759
+** the default size of lookaside memory on each [database connection].
1760
+** The first argument is the
17451761
** size of each lookaside buffer slot and the second is the number of
1746
-** slots allocated to each database connection.)^ ^(This option sets the
1747
-** <i>default</i> lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE]
1748
-** verb to [sqlite3_db_config()] can be used to change the lookaside
1762
+** slots allocated to each database connection.)^ ^(SQLITE_CONFIG_LOOKASIDE
1763
+** sets the <i>default</i> lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE]
1764
+** option to [sqlite3_db_config()] can be used to change the lookaside
17491765
** configuration on individual connections.)^ </dd>
17501766
**
17511767
** [[SQLITE_CONFIG_PCACHE2]] <dt>SQLITE_CONFIG_PCACHE2</dt>
1752
-** <dd> ^(This option takes a single argument which is a pointer to
1753
-** an [sqlite3_pcache_methods2] object. This object specifies the interface
1754
-** to a custom page cache implementation.)^ ^SQLite makes a copy of the
1755
-** object and uses it for page cache memory allocations.</dd>
1768
+** <dd> ^(The SQLITE_CONFIG_PCACHE2 option takes a single argument which is
1769
+** a pointer to an [sqlite3_pcache_methods2] object. This object specifies
1770
+** the interface to a custom page cache implementation.)^
1771
+** ^SQLite makes a copy of the [sqlite3_pcache_methods2] object.</dd>
17561772
**
17571773
** [[SQLITE_CONFIG_GETPCACHE2]] <dt>SQLITE_CONFIG_GETPCACHE2</dt>
1758
-** <dd> ^(This option takes a single argument which is a pointer to an
1759
-** [sqlite3_pcache_methods2] object. SQLite copies of the current
1760
-** page cache implementation into that object.)^ </dd>
1774
+** <dd> ^(The SQLITE_CONFIG_GETPCACHE2 option takes a single argument which
1775
+** is a pointer to an [sqlite3_pcache_methods2] object. SQLite copies of
1776
+** the current page cache implementation into that object.)^ </dd>
17611777
**
17621778
** [[SQLITE_CONFIG_LOG]] <dt>SQLITE_CONFIG_LOG</dt>
17631779
** <dd> The SQLITE_CONFIG_LOG option is used to configure the SQLite
17641780
** global [error log].
17651781
** (^The SQLITE_CONFIG_LOG option takes two arguments: a pointer to a
@@ -1778,26 +1794,28 @@
17781794
** supplied by the application must not invoke any SQLite interface.
17791795
** In a multi-threaded application, the application-defined logger
17801796
** function must be threadsafe. </dd>
17811797
**
17821798
** [[SQLITE_CONFIG_URI]] <dt>SQLITE_CONFIG_URI
1783
-** <dd>^(This option takes a single argument of type int. If non-zero, then
1784
-** URI handling is globally enabled. If the parameter is zero, then URI handling
1785
-** is globally disabled.)^ ^If URI handling is globally enabled, all filenames
1786
-** passed to [sqlite3_open()], [sqlite3_open_v2()], [sqlite3_open16()] or
1799
+** <dd>^(The SQLITE_CONFIG_URI option takes a single argument of type int.
1800
+** If non-zero, then URI handling is globally enabled. If the parameter is zero,
1801
+** then URI handling is globally disabled.)^ ^If URI handling is globally
1802
+** enabled, all filenames passed to [sqlite3_open()], [sqlite3_open_v2()],
1803
+** [sqlite3_open16()] or
17871804
** specified as part of [ATTACH] commands are interpreted as URIs, regardless
17881805
** of whether or not the [SQLITE_OPEN_URI] flag is set when the database
17891806
** connection is opened. ^If it is globally disabled, filenames are
17901807
** only interpreted as URIs if the SQLITE_OPEN_URI flag is set when the
17911808
** database connection is opened. ^(By default, URI handling is globally
17921809
** disabled. The default value may be changed by compiling with the
17931810
** [SQLITE_USE_URI] symbol defined.)^
17941811
**
17951812
** [[SQLITE_CONFIG_COVERING_INDEX_SCAN]] <dt>SQLITE_CONFIG_COVERING_INDEX_SCAN
1796
-** <dd>^This option takes a single integer argument which is interpreted as
1797
-** a boolean in order to enable or disable the use of covering indices for
1798
-** full table scans in the query optimizer. ^The default setting is determined
1813
+** <dd>^The SQLITE_CONFIG_COVERING_INDEX_SCAN option takes a single integer
1814
+** argument which is interpreted as a boolean in order to enable or disable
1815
+** the use of covering indices for full table scans in the query optimizer.
1816
+** ^The default setting is determined
17991817
** by the [SQLITE_ALLOW_COVERING_INDEX_SCAN] compile-time option, or is "on"
18001818
** if that compile-time option is omitted.
18011819
** The ability to disable the use of covering indices for full table scans
18021820
** is because some incorrectly coded legacy applications might malfunction
18031821
** when the optimization is enabled. Providing the ability to
@@ -1833,23 +1851,32 @@
18331851
** that are the default mmap size limit (the default setting for
18341852
** [PRAGMA mmap_size]) and the maximum allowed mmap size limit.
18351853
** ^The default setting can be overridden by each database connection using
18361854
** either the [PRAGMA mmap_size] command, or by using the
18371855
** [SQLITE_FCNTL_MMAP_SIZE] file control. ^(The maximum allowed mmap size
1838
-** cannot be changed at run-time. Nor may the maximum allowed mmap size
1839
-** exceed the compile-time maximum mmap size set by the
1856
+** will be silently truncated if necessary so that it does not exceed the
1857
+** compile-time maximum mmap size set by the
18401858
** [SQLITE_MAX_MMAP_SIZE] compile-time option.)^
18411859
** ^If either argument to this option is negative, then that argument is
18421860
** changed to its compile-time default.
18431861
**
18441862
** [[SQLITE_CONFIG_WIN32_HEAPSIZE]]
18451863
** <dt>SQLITE_CONFIG_WIN32_HEAPSIZE
1846
-** <dd>^This option is only available if SQLite is compiled for Windows
1847
-** with the [SQLITE_WIN32_MALLOC] pre-processor macro defined.
1848
-** SQLITE_CONFIG_WIN32_HEAPSIZE takes a 32-bit unsigned integer value
1864
+** <dd>^The SQLITE_CONFIG_WIN32_HEAPSIZE option is only available if SQLite is
1865
+** compiled for Windows with the [SQLITE_WIN32_MALLOC] pre-processor macro
1866
+** defined. ^SQLITE_CONFIG_WIN32_HEAPSIZE takes a 32-bit unsigned integer value
18491867
** that specifies the maximum size of the created heap.
18501868
** </dl>
1869
+**
1870
+** [[SQLITE_CONFIG_PCACHE_HDRSZ]]
1871
+** <dt>SQLITE_CONFIG_PCACHE_HDRSZ
1872
+** <dd>^The SQLITE_CONFIG_PCACHE_HDRSZ option takes a single parameter which
1873
+** is a pointer to an integer and writes into that integer the number of extra
1874
+** bytes per page required for each page in [SQLITE_CONFIG_PAGECACHE].
1875
+** The amount of extra space required can change depending on the compiler,
1876
+** target platform, and SQLite version.
1877
+** </dl>
18511878
*/
18521879
#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
18531880
#define SQLITE_CONFIG_MULTITHREAD 2 /* nil */
18541881
#define SQLITE_CONFIG_SERIALIZED 3 /* nil */
18551882
#define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */
@@ -1870,10 +1897,11 @@
18701897
#define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */
18711898
#define SQLITE_CONFIG_COVERING_INDEX_SCAN 20 /* int */
18721899
#define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */
18731900
#define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */
18741901
#define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */
1902
+#define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */
18751903
18761904
/*
18771905
** CAPI3REF: Database Connection Configuration Options
18781906
**
18791907
** These constants are the available integer configuration options that
@@ -1997,51 +2025,49 @@
19972025
SQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*);
19982026
19992027
/*
20002028
** CAPI3REF: Count The Number Of Rows Modified
20012029
**
2002
-** ^This function returns the number of database rows that were changed
2003
-** or inserted or deleted by the most recently completed SQL statement
2004
-** on the [database connection] specified by the first parameter.
2005
-** ^(Only changes that are directly specified by the [INSERT], [UPDATE],
2006
-** or [DELETE] statement are counted. Auxiliary changes caused by
2007
-** triggers or [foreign key actions] are not counted.)^ Use the
2008
-** [sqlite3_total_changes()] function to find the total number of changes
2009
-** including changes caused by triggers and foreign key actions.
2010
-**
2011
-** ^Changes to a view that are simulated by an [INSTEAD OF trigger]
2012
-** are not counted. Only real table changes are counted.
2013
-**
2014
-** ^(A "row change" is a change to a single row of a single table
2015
-** caused by an INSERT, DELETE, or UPDATE statement. Rows that
2016
-** are changed as side effects of [REPLACE] constraint resolution,
2017
-** rollback, ABORT processing, [DROP TABLE], or by any other
2018
-** mechanisms do not count as direct row changes.)^
2019
-**
2020
-** A "trigger context" is a scope of execution that begins and
2021
-** ends with the script of a [CREATE TRIGGER | trigger].
2022
-** Most SQL statements are
2023
-** evaluated outside of any trigger. This is the "top level"
2024
-** trigger context. If a trigger fires from the top level, a
2025
-** new trigger context is entered for the duration of that one
2026
-** trigger. Subtriggers create subcontexts for their duration.
2027
-**
2028
-** ^Calling [sqlite3_exec()] or [sqlite3_step()] recursively does
2029
-** not create a new trigger context.
2030
-**
2031
-** ^This function returns the number of direct row changes in the
2032
-** most recent INSERT, UPDATE, or DELETE statement within the same
2033
-** trigger context.
2034
-**
2035
-** ^Thus, when called from the top level, this function returns the
2036
-** number of changes in the most recent INSERT, UPDATE, or DELETE
2037
-** that also occurred at the top level. ^(Within the body of a trigger,
2038
-** the sqlite3_changes() interface can be called to find the number of
2039
-** changes in the most recently completed INSERT, UPDATE, or DELETE
2040
-** statement within the body of the same trigger.
2041
-** However, the number returned does not include changes
2042
-** caused by subtriggers since those have their own context.)^
2030
+** ^This function returns the number of rows modified, inserted or
2031
+** deleted by the most recently completed INSERT, UPDATE or DELETE
2032
+** statement on the database connection specified by the only parameter.
2033
+** ^Executing any other type of SQL statement does not modify the value
2034
+** returned by this function.
2035
+**
2036
+** ^Only changes made directly by the INSERT, UPDATE or DELETE statement are
2037
+** considered - auxiliary changes caused by [CREATE TRIGGER | triggers],
2038
+** [foreign key actions] or [REPLACE] constraint resolution are not counted.
2039
+**
2040
+** Changes to a view that are intercepted by
2041
+** [INSTEAD OF trigger | INSTEAD OF triggers] are not counted. ^The value
2042
+** returned by sqlite3_changes() immediately after an INSERT, UPDATE or
2043
+** DELETE statement run on a view is always zero. Only changes made to real
2044
+** tables are counted.
2045
+**
2046
+** Things are more complicated if the sqlite3_changes() function is
2047
+** executed while a trigger program is running. This may happen if the
2048
+** program uses the [changes() SQL function], or if some other callback
2049
+** function invokes sqlite3_changes() directly. Essentially:
2050
+**
2051
+** <ul>
2052
+** <li> ^(Before entering a trigger program the value returned by
2053
+** sqlite3_changes() function is saved. After the trigger program
2054
+** has finished, the original value is restored.)^
2055
+**
2056
+** <li> ^(Within a trigger program each INSERT, UPDATE and DELETE
2057
+** statement sets the value returned by sqlite3_changes()
2058
+** upon completion as normal. Of course, this value will not include
2059
+** any changes performed by sub-triggers, as the sqlite3_changes()
2060
+** value will be saved and restored after each sub-trigger has run.)^
2061
+** </ul>
2062
+**
2063
+** ^This means that if the changes() SQL function (or similar) is used
2064
+** by the first INSERT, UPDATE or DELETE statement within a trigger, it
2065
+** returns the value as set when the calling statement began executing.
2066
+** ^If it is used by the second or subsequent such statement within a trigger
2067
+** program, the value returned reflects the number of rows modified by the
2068
+** previous INSERT, UPDATE or DELETE statement within the same trigger.
20432069
**
20442070
** See also the [sqlite3_total_changes()] interface, the
20452071
** [count_changes pragma], and the [changes() SQL function].
20462072
**
20472073
** If a separate thread makes changes on the same database connection
@@ -2051,24 +2077,21 @@
20512077
SQLITE_API int sqlite3_changes(sqlite3*);
20522078
20532079
/*
20542080
** CAPI3REF: Total Number Of Rows Modified
20552081
**
2056
-** ^This function returns the number of row changes caused by [INSERT],
2057
-** [UPDATE] or [DELETE] statements since the [database connection] was opened.
2058
-** ^(The count returned by sqlite3_total_changes() includes all changes
2059
-** from all [CREATE TRIGGER | trigger] contexts and changes made by
2060
-** [foreign key actions]. However,
2061
-** the count does not include changes used to implement [REPLACE] constraints,
2062
-** do rollbacks or ABORT processing, or [DROP TABLE] processing. The
2063
-** count does not include rows of views that fire an [INSTEAD OF trigger],
2064
-** though if the INSTEAD OF trigger makes changes of its own, those changes
2065
-** are counted.)^
2066
-** ^The sqlite3_total_changes() function counts the changes as soon as
2067
-** the statement that makes them is completed (when the statement handle
2068
-** is passed to [sqlite3_reset()] or [sqlite3_finalize()]).
2069
-**
2082
+** ^This function returns the total number of rows inserted, modified or
2083
+** deleted by all [INSERT], [UPDATE] or [DELETE] statements completed
2084
+** since the database connection was opened, including those executed as
2085
+** part of trigger programs. ^Executing any other type of SQL statement
2086
+** does not affect the value returned by sqlite3_total_changes().
2087
+**
2088
+** ^Changes made as part of [foreign key actions] are included in the
2089
+** count, but those made as part of REPLACE constraint resolution are
2090
+** not. ^Changes to a view that are intercepted by INSTEAD OF triggers
2091
+** are not counted.
2092
+**
20702093
** See also the [sqlite3_changes()] interface, the
20712094
** [count_changes pragma], and the [total_changes() SQL function].
20722095
**
20732096
** If a separate thread makes changes on the same database connection
20742097
** while [sqlite3_total_changes()] is running then the value
@@ -2151,10 +2174,11 @@
21512174
SQLITE_API int sqlite3_complete(const char *sql);
21522175
SQLITE_API int sqlite3_complete16(const void *sql);
21532176
21542177
/*
21552178
** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors
2179
+** KEYWORDS: {busy-handler callback} {busy handler}
21562180
**
21572181
** ^The sqlite3_busy_handler(D,X,P) routine sets a callback function X
21582182
** that might be invoked with argument P whenever
21592183
** an attempt is made to access a database table associated with
21602184
** [database connection] D when another thread
@@ -2167,11 +2191,11 @@
21672191
** is not NULL, then the callback might be invoked with two arguments.
21682192
**
21692193
** ^The first argument to the busy handler is a copy of the void* pointer which
21702194
** is the third argument to sqlite3_busy_handler(). ^The second argument to
21712195
** the busy handler callback is the number of times that the busy handler has
2172
-** been invoked for the same locking event. ^If the
2196
+** been invoked previously for the same locking event. ^If the
21732197
** busy callback returns 0, then no additional attempts are made to
21742198
** access the database and [SQLITE_BUSY] is returned
21752199
** to the application.
21762200
** ^If the callback returns non-zero, then another attempt
21772201
** is made to access the database and the cycle repeats.
@@ -2542,17 +2566,18 @@
25422566
** already uses the largest possible [ROWID]. The PRNG is also used for
25432567
** the build-in random() and randomblob() SQL functions. This interface allows
25442568
** applications to access the same PRNG for other purposes.
25452569
**
25462570
** ^A call to this routine stores N bytes of randomness into buffer P.
2547
-** ^If N is less than one, then P can be a NULL pointer.
2571
+** ^The P parameter can be a NULL pointer.
25482572
**
25492573
** ^If this routine has not been previously called or if the previous
2550
-** call had N less than one, then the PRNG is seeded using randomness
2551
-** obtained from the xRandomness method of the default [sqlite3_vfs] object.
2552
-** ^If the previous call to this routine had an N of 1 or more then
2553
-** the pseudo-randomness is generated
2574
+** call had N less than one or a NULL pointer for P, then the PRNG is
2575
+** seeded using randomness obtained from the xRandomness method of
2576
+** the default [sqlite3_vfs] object.
2577
+** ^If the previous call to this routine had an N of 1 or more and a
2578
+** non-NULL P then the pseudo-randomness is generated
25542579
** internally and without recourse to the [sqlite3_vfs] xRandomness
25552580
** method.
25562581
*/
25572582
SQLITE_API void sqlite3_randomness(int N, void *P);
25582583
@@ -4270,13 +4295,13 @@
42704295
** CAPI3REF: Text Encodings
42714296
**
42724297
** These constant define integer codes that represent the various
42734298
** text encodings supported by SQLite.
42744299
*/
4275
-#define SQLITE_UTF8 1
4276
-#define SQLITE_UTF16LE 2
4277
-#define SQLITE_UTF16BE 3
4300
+#define SQLITE_UTF8 1 /* IMP: R-37514-35566 */
4301
+#define SQLITE_UTF16LE 2 /* IMP: R-03371-37637 */
4302
+#define SQLITE_UTF16BE 3 /* IMP: R-51971-34154 */
42784303
#define SQLITE_UTF16 4 /* Use native byte order */
42794304
#define SQLITE_ANY 5 /* Deprecated */
42804305
#define SQLITE_UTF16_ALIGNED 8 /* sqlite3_create_collation only */
42814306
42824307
/*
@@ -4621,11 +4646,12 @@
46214646
** If these routines are called from within the different thread
46224647
** than the one containing the application-defined function that received
46234648
** the [sqlite3_context] pointer, the results are undefined.
46244649
*/
46254650
SQLITE_API void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));
4626
-SQLITE_API void sqlite3_result_blob64(sqlite3_context*,const void*,sqlite3_uint64,void(*)(void*));
4651
+SQLITE_API void sqlite3_result_blob64(sqlite3_context*,const void*,
4652
+ sqlite3_uint64,void(*)(void*));
46274653
SQLITE_API void sqlite3_result_double(sqlite3_context*, double);
46284654
SQLITE_API void sqlite3_result_error(sqlite3_context*, const char*, int);
46294655
SQLITE_API void sqlite3_result_error16(sqlite3_context*, const void*, int);
46304656
SQLITE_API void sqlite3_result_error_toobig(sqlite3_context*);
46314657
SQLITE_API void sqlite3_result_error_nomem(sqlite3_context*);
@@ -5762,31 +5788,47 @@
57625788
** in other words, the same BLOB that would be selected by:
57635789
**
57645790
** <pre>
57655791
** SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow;
57665792
** </pre>)^
5793
+**
5794
+** ^(Parameter zDb is not the filename that contains the database, but
5795
+** rather the symbolic name of the database. For attached databases, this is
5796
+** the name that appears after the AS keyword in the [ATTACH] statement.
5797
+** For the main database file, the database name is "main". For TEMP
5798
+** tables, the database name is "temp".)^
57675799
**
57685800
** ^If the flags parameter is non-zero, then the BLOB is opened for read
5769
-** and write access. ^If it is zero, the BLOB is opened for read access.
5770
-** ^It is not possible to open a column that is part of an index or primary
5771
-** key for writing. ^If [foreign key constraints] are enabled, it is
5772
-** not possible to open a column that is part of a [child key] for writing.
5773
-**
5774
-** ^Note that the database name is not the filename that contains
5775
-** the database but rather the symbolic name of the database that
5776
-** appears after the AS keyword when the database is connected using [ATTACH].
5777
-** ^For the main database file, the database name is "main".
5778
-** ^For TEMP tables, the database name is "temp".
5779
-**
5780
-** ^(On success, [SQLITE_OK] is returned and the new [BLOB handle] is written
5781
-** to *ppBlob. Otherwise an [error code] is returned and *ppBlob is set
5782
-** to be a null pointer.)^
5783
-** ^This function sets the [database connection] error code and message
5784
-** accessible via [sqlite3_errcode()] and [sqlite3_errmsg()] and related
5785
-** functions. ^Note that the *ppBlob variable is always initialized in a
5786
-** way that makes it safe to invoke [sqlite3_blob_close()] on *ppBlob
5787
-** regardless of the success or failure of this routine.
5801
+** and write access. ^If the flags parameter is zero, the BLOB is opened for
5802
+** read-only access.
5803
+**
5804
+** ^(On success, [SQLITE_OK] is returned and the new [BLOB handle] is stored
5805
+** in *ppBlob. Otherwise an [error code] is returned and, unless the error
5806
+** code is SQLITE_MISUSE, *ppBlob is set to NULL.)^ ^This means that, provided
5807
+** the API is not misused, it is always safe to call [sqlite3_blob_close()]
5808
+** on *ppBlob after this function it returns.
5809
+**
5810
+** This function fails with SQLITE_ERROR if any of the following are true:
5811
+** <ul>
5812
+** <li> ^(Database zDb does not exist)^,
5813
+** <li> ^(Table zTable does not exist within database zDb)^,
5814
+** <li> ^(Table zTable is a WITHOUT ROWID table)^,
5815
+** <li> ^(Column zColumn does not exist)^,
5816
+** <li> ^(Row iRow is not present in the table)^,
5817
+** <li> ^(The specified column of row iRow contains a value that is not
5818
+** a TEXT or BLOB value)^,
5819
+** <li> ^(Column zColumn is part of an index, PRIMARY KEY or UNIQUE
5820
+** constraint and the blob is being opened for read/write access)^,
5821
+** <li> ^([foreign key constraints | Foreign key constraints] are enabled,
5822
+** column zColumn is part of a [child key] definition and the blob is
5823
+** being opened for read/write access)^.
5824
+** </ul>
5825
+**
5826
+** ^Unless it returns SQLITE_MISUSE, this function sets the
5827
+** [database connection] error code and message accessible via
5828
+** [sqlite3_errcode()] and [sqlite3_errmsg()] and related functions.
5829
+**
57885830
**
57895831
** ^(If the row that a BLOB handle points to is modified by an
57905832
** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects
57915833
** then the BLOB handle is marked as "expired".
57925834
** This is true if any column of the row is changed, even a column
@@ -5800,17 +5842,13 @@
58005842
** ^Use the [sqlite3_blob_bytes()] interface to determine the size of
58015843
** the opened blob. ^The size of a blob may not be changed by this
58025844
** interface. Use the [UPDATE] SQL command to change the size of a
58035845
** blob.
58045846
**
5805
-** ^The [sqlite3_blob_open()] interface will fail for a [WITHOUT ROWID]
5806
-** table. Incremental BLOB I/O is not possible on [WITHOUT ROWID] tables.
5807
-**
58085847
** ^The [sqlite3_bind_zeroblob()] and [sqlite3_result_zeroblob()] interfaces
5809
-** and the built-in [zeroblob] SQL function can be used, if desired,
5810
-** to create an empty, zero-filled blob in which to read or write using
5811
-** this interface.
5848
+** and the built-in [zeroblob] SQL function may be used to create a
5849
+** zero-filled blob to read or write using the incremental-blob interface.
58125850
**
58135851
** To avoid a resource leak, every open [BLOB handle] should eventually
58145852
** be released by a call to [sqlite3_blob_close()].
58155853
*/
58165854
SQLITE_API int sqlite3_blob_open(
@@ -5848,28 +5886,26 @@
58485886
SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64);
58495887
58505888
/*
58515889
** CAPI3REF: Close A BLOB Handle
58525890
**
5853
-** ^Closes an open [BLOB handle].
5854
-**
5855
-** ^Closing a BLOB shall cause the current transaction to commit
5856
-** if there are no other BLOBs, no pending prepared statements, and the
5857
-** database connection is in [autocommit mode].
5858
-** ^If any writes were made to the BLOB, they might be held in cache
5859
-** until the close operation if they will fit.
5860
-**
5861
-** ^(Closing the BLOB often forces the changes
5862
-** out to disk and so if any I/O errors occur, they will likely occur
5863
-** at the time when the BLOB is closed. Any errors that occur during
5864
-** closing are reported as a non-zero return value.)^
5865
-**
5866
-** ^(The BLOB is closed unconditionally. Even if this routine returns
5867
-** an error code, the BLOB is still closed.)^
5868
-**
5869
-** ^Calling this routine with a null pointer (such as would be returned
5870
-** by a failed call to [sqlite3_blob_open()]) is a harmless no-op.
5891
+** ^This function closes an open [BLOB handle]. ^(The BLOB handle is closed
5892
+** unconditionally. Even if this routine returns an error code, the
5893
+** handle is still closed.)^
5894
+**
5895
+** ^If the blob handle being closed was opened for read-write access, and if
5896
+** the database is in auto-commit mode and there are no other open read-write
5897
+** blob handles or active write statements, the current transaction is
5898
+** committed. ^If an error occurs while committing the transaction, an error
5899
+** code is returned and the transaction rolled back.
5900
+**
5901
+** Calling this function with an argument that is not a NULL pointer or an
5902
+** open blob handle results in undefined behaviour. ^Calling this routine
5903
+** with a null pointer (such as would be returned by a failed call to
5904
+** [sqlite3_blob_open()]) is a harmless no-op. ^Otherwise, if this function
5905
+** is passed a valid open blob handle, the values returned by the
5906
+** sqlite3_errcode() and sqlite3_errmsg() functions are set before returning.
58715907
*/
58725908
SQLITE_API int sqlite3_blob_close(sqlite3_blob *);
58735909
58745910
/*
58755911
** CAPI3REF: Return The Size Of An Open BLOB
@@ -5915,36 +5951,39 @@
59155951
SQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);
59165952
59175953
/*
59185954
** CAPI3REF: Write Data Into A BLOB Incrementally
59195955
**
5920
-** ^This function is used to write data into an open [BLOB handle] from a
5921
-** caller-supplied buffer. ^N bytes of data are copied from the buffer Z
5922
-** into the open BLOB, starting at offset iOffset.
5956
+** ^(This function is used to write data into an open [BLOB handle] from a
5957
+** caller-supplied buffer. N bytes of data are copied from the buffer Z
5958
+** into the open BLOB, starting at offset iOffset.)^
5959
+**
5960
+** ^(On success, sqlite3_blob_write() returns SQLITE_OK.
5961
+** Otherwise, an [error code] or an [extended error code] is returned.)^
5962
+** ^Unless SQLITE_MISUSE is returned, this function sets the
5963
+** [database connection] error code and message accessible via
5964
+** [sqlite3_errcode()] and [sqlite3_errmsg()] and related functions.
59235965
**
59245966
** ^If the [BLOB handle] passed as the first argument was not opened for
59255967
** writing (the flags parameter to [sqlite3_blob_open()] was zero),
59265968
** this function returns [SQLITE_READONLY].
59275969
**
5928
-** ^This function may only modify the contents of the BLOB; it is
5970
+** This function may only modify the contents of the BLOB; it is
59295971
** not possible to increase the size of a BLOB using this API.
59305972
** ^If offset iOffset is less than N bytes from the end of the BLOB,
5931
-** [SQLITE_ERROR] is returned and no data is written. ^If N is
5932
-** less than zero [SQLITE_ERROR] is returned and no data is written.
5933
-** The size of the BLOB (and hence the maximum value of N+iOffset)
5934
-** can be determined using the [sqlite3_blob_bytes()] interface.
5973
+** [SQLITE_ERROR] is returned and no data is written. The size of the
5974
+** BLOB (and hence the maximum value of N+iOffset) can be determined
5975
+** using the [sqlite3_blob_bytes()] interface. ^If N or iOffset are less
5976
+** than zero [SQLITE_ERROR] is returned and no data is written.
59355977
**
59365978
** ^An attempt to write to an expired [BLOB handle] fails with an
59375979
** error code of [SQLITE_ABORT]. ^Writes to the BLOB that occurred
59385980
** before the [BLOB handle] expired are not rolled back by the
59395981
** expiration of the handle, though of course those changes might
59405982
** have been overwritten by the statement that expired the BLOB handle
59415983
** or by other independent statements.
59425984
**
5943
-** ^(On success, sqlite3_blob_write() returns SQLITE_OK.
5944
-** Otherwise, an [error code] or an [extended error code] is returned.)^
5945
-**
59465985
** This routine only works on a [BLOB handle] which has been created
59475986
** by a prior successful call to [sqlite3_blob_open()] and which has not
59485987
** been closed by [sqlite3_blob_close()]. Passing any other pointer in
59495988
** to this routine results in undefined and probably undesirable behavior.
59505989
**
@@ -5993,38 +6032,38 @@
59936032
** use by SQLite, code that links against SQLite is
59946033
** permitted to use any of these routines.
59956034
**
59966035
** The SQLite source code contains multiple implementations
59976036
** of these mutex routines. An appropriate implementation
5998
-** is selected automatically at compile-time. ^(The following
6037
+** is selected automatically at compile-time. The following
59996038
** implementations are available in the SQLite core:
60006039
**
60016040
** <ul>
60026041
** <li> SQLITE_MUTEX_PTHREADS
60036042
** <li> SQLITE_MUTEX_W32
60046043
** <li> SQLITE_MUTEX_NOOP
6005
-** </ul>)^
6044
+** </ul>
60066045
**
6007
-** ^The SQLITE_MUTEX_NOOP implementation is a set of routines
6046
+** The SQLITE_MUTEX_NOOP implementation is a set of routines
60086047
** that does no real locking and is appropriate for use in
6009
-** a single-threaded application. ^The SQLITE_MUTEX_PTHREADS and
6048
+** a single-threaded application. The SQLITE_MUTEX_PTHREADS and
60106049
** SQLITE_MUTEX_W32 implementations are appropriate for use on Unix
60116050
** and Windows.
60126051
**
6013
-** ^(If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor
6052
+** If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor
60146053
** macro defined (with "-DSQLITE_MUTEX_APPDEF=1"), then no mutex
60156054
** implementation is included with the library. In this case the
60166055
** application must supply a custom mutex implementation using the
60176056
** [SQLITE_CONFIG_MUTEX] option of the sqlite3_config() function
60186057
** before calling sqlite3_initialize() or any other public sqlite3_
6019
-** function that calls sqlite3_initialize().)^
6058
+** function that calls sqlite3_initialize().
60206059
**
60216060
** ^The sqlite3_mutex_alloc() routine allocates a new
6022
-** mutex and returns a pointer to it. ^If it returns NULL
6023
-** that means that a mutex could not be allocated. ^SQLite
6024
-** will unwind its stack and return an error. ^(The argument
6025
-** to sqlite3_mutex_alloc() is one of these integer constants:
6061
+** mutex and returns a pointer to it. ^The sqlite3_mutex_alloc()
6062
+** routine returns NULL if it is unable to allocate the requested
6063
+** mutex. The argument to sqlite3_mutex_alloc() must one of these
6064
+** integer constants:
60266065
**
60276066
** <ul>
60286067
** <li> SQLITE_MUTEX_FAST
60296068
** <li> SQLITE_MUTEX_RECURSIVE
60306069
** <li> SQLITE_MUTEX_STATIC_MASTER
@@ -6033,68 +6072,64 @@
60336072
** <li> SQLITE_MUTEX_STATIC_PRNG
60346073
** <li> SQLITE_MUTEX_STATIC_LRU
60356074
** <li> SQLITE_MUTEX_STATIC_PMEM
60366075
** <li> SQLITE_MUTEX_STATIC_APP1
60376076
** <li> SQLITE_MUTEX_STATIC_APP2
6038
-** </ul>)^
6077
+** <li> SQLITE_MUTEX_STATIC_APP3
6078
+** </ul>
60396079
**
60406080
** ^The first two constants (SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE)
60416081
** cause sqlite3_mutex_alloc() to create
60426082
** a new mutex. ^The new mutex is recursive when SQLITE_MUTEX_RECURSIVE
60436083
** is used but not necessarily so when SQLITE_MUTEX_FAST is used.
60446084
** The mutex implementation does not need to make a distinction
60456085
** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does
6046
-** not want to. ^SQLite will only request a recursive mutex in
6047
-** cases where it really needs one. ^If a faster non-recursive mutex
6086
+** not want to. SQLite will only request a recursive mutex in
6087
+** cases where it really needs one. If a faster non-recursive mutex
60486088
** implementation is available on the host platform, the mutex subsystem
60496089
** might return such a mutex in response to SQLITE_MUTEX_FAST.
60506090
**
60516091
** ^The other allowed parameters to sqlite3_mutex_alloc() (anything other
60526092
** than SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) each return
6053
-** a pointer to a static preexisting mutex. ^Six static mutexes are
6093
+** a pointer to a static preexisting mutex. ^Nine static mutexes are
60546094
** used by the current version of SQLite. Future versions of SQLite
60556095
** may add additional static mutexes. Static mutexes are for internal
60566096
** use by SQLite only. Applications that use SQLite mutexes should
60576097
** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or
60586098
** SQLITE_MUTEX_RECURSIVE.
60596099
**
60606100
** ^Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST
60616101
** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc()
6062
-** returns a different mutex on every call. ^But for the static
6102
+** returns a different mutex on every call. ^For the static
60636103
** mutex types, the same mutex is returned on every call that has
60646104
** the same type number.
60656105
**
60666106
** ^The sqlite3_mutex_free() routine deallocates a previously
6067
-** allocated dynamic mutex. ^SQLite is careful to deallocate every
6068
-** dynamic mutex that it allocates. The dynamic mutexes must not be in
6069
-** use when they are deallocated. Attempting to deallocate a static
6070
-** mutex results in undefined behavior. ^SQLite never deallocates
6071
-** a static mutex.
6107
+** allocated dynamic mutex. Attempting to deallocate a static
6108
+** mutex results in undefined behavior.
60726109
**
60736110
** ^The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt
60746111
** to enter a mutex. ^If another thread is already within the mutex,
60756112
** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return
60766113
** SQLITE_BUSY. ^The sqlite3_mutex_try() interface returns [SQLITE_OK]
60776114
** upon successful entry. ^(Mutexes created using
60786115
** SQLITE_MUTEX_RECURSIVE can be entered multiple times by the same thread.
6079
-** In such cases the,
6116
+** In such cases, the
60806117
** mutex must be exited an equal number of times before another thread
6081
-** can enter.)^ ^(If the same thread tries to enter any other
6082
-** kind of mutex more than once, the behavior is undefined.
6083
-** SQLite will never exhibit
6084
-** such behavior in its own use of mutexes.)^
6118
+** can enter.)^ If the same thread tries to enter any mutex other
6119
+** than an SQLITE_MUTEX_RECURSIVE more than once, the behavior is undefined.
60856120
**
60866121
** ^(Some systems (for example, Windows 95) do not support the operation
60876122
** implemented by sqlite3_mutex_try(). On those systems, sqlite3_mutex_try()
6088
-** will always return SQLITE_BUSY. The SQLite core only ever uses
6089
-** sqlite3_mutex_try() as an optimization so this is acceptable behavior.)^
6123
+** will always return SQLITE_BUSY. The SQLite core only ever uses
6124
+** sqlite3_mutex_try() as an optimization so this is acceptable
6125
+** behavior.)^
60906126
**
60916127
** ^The sqlite3_mutex_leave() routine exits a mutex that was
6092
-** previously entered by the same thread. ^(The behavior
6128
+** previously entered by the same thread. The behavior
60936129
** is undefined if the mutex is not currently entered by the
6094
-** calling thread or is not currently allocated. SQLite will
6095
-** never do either.)^
6130
+** calling thread or is not currently allocated.
60966131
**
60976132
** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(), or
60986133
** sqlite3_mutex_leave() is a NULL pointer, then all three routines
60996134
** behave as no-ops.
61006135
**
@@ -6111,13 +6146,13 @@
61116146
**
61126147
** An instance of this structure defines the low-level routines
61136148
** used to allocate and use mutexes.
61146149
**
61156150
** Usually, the default mutex implementations provided by SQLite are
6116
-** sufficient, however the user has the option of substituting a custom
6151
+** sufficient, however the application has the option of substituting a custom
61176152
** implementation for specialized deployments or systems for which SQLite
6118
-** does not provide a suitable implementation. In this case, the user
6153
+** does not provide a suitable implementation. In this case, the application
61196154
** creates and populates an instance of this structure to pass
61206155
** to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option.
61216156
** Additionally, an instance of this structure can be used as an
61226157
** output variable when querying the system for the current mutex
61236158
** implementation, using the [SQLITE_CONFIG_GETMUTEX] option.
@@ -6154,17 +6189,17 @@
61546189
** by this structure are not required to handle this case, the results
61556190
** of passing a NULL pointer instead of a valid mutex handle are undefined
61566191
** (i.e. it is acceptable to provide an implementation that segfaults if
61576192
** it is passed a NULL pointer).
61586193
**
6159
-** The xMutexInit() method must be threadsafe. ^It must be harmless to
6194
+** The xMutexInit() method must be threadsafe. It must be harmless to
61606195
** invoke xMutexInit() multiple times within the same process and without
61616196
** intervening calls to xMutexEnd(). Second and subsequent calls to
61626197
** xMutexInit() must be no-ops.
61636198
**
6164
-** ^xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()]
6165
-** and its associates). ^Similarly, xMutexAlloc() must not use SQLite memory
6199
+** xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()]
6200
+** and its associates). Similarly, xMutexAlloc() must not use SQLite memory
61666201
** allocation for a static mutex. ^However xMutexAlloc() may use SQLite
61676202
** memory allocation for a fast or recursive mutex.
61686203
**
61696204
** ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is
61706205
** called, but only if the prior call to xMutexInit returned SQLITE_OK.
@@ -6186,33 +6221,33 @@
61866221
61876222
/*
61886223
** CAPI3REF: Mutex Verification Routines
61896224
**
61906225
** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routines
6191
-** are intended for use inside assert() statements. ^The SQLite core
6226
+** are intended for use inside assert() statements. The SQLite core
61926227
** never uses these routines except inside an assert() and applications
6193
-** are advised to follow the lead of the core. ^The SQLite core only
6228
+** are advised to follow the lead of the core. The SQLite core only
61946229
** provides implementations for these routines when it is compiled
6195
-** with the SQLITE_DEBUG flag. ^External mutex implementations
6230
+** with the SQLITE_DEBUG flag. External mutex implementations
61966231
** are only required to provide these routines if SQLITE_DEBUG is
61976232
** defined and if NDEBUG is not defined.
61986233
**
6199
-** ^These routines should return true if the mutex in their argument
6234
+** These routines should return true if the mutex in their argument
62006235
** is held or not held, respectively, by the calling thread.
62016236
**
6202
-** ^The implementation is not required to provide versions of these
6237
+** The implementation is not required to provide versions of these
62036238
** routines that actually work. If the implementation does not provide working
62046239
** versions of these routines, it should at least provide stubs that always
62056240
** return true so that one does not get spurious assertion failures.
62066241
**
6207
-** ^If the argument to sqlite3_mutex_held() is a NULL pointer then
6242
+** If the argument to sqlite3_mutex_held() is a NULL pointer then
62086243
** the routine should return 1. This seems counter-intuitive since
62096244
** clearly the mutex cannot be held if it does not exist. But
62106245
** the reason the mutex does not exist is because the build is not
62116246
** using mutexes. And we do not want the assert() containing the
62126247
** call to sqlite3_mutex_held() to fail, so a non-zero return is
6213
-** the appropriate thing to do. ^The sqlite3_mutex_notheld()
6248
+** the appropriate thing to do. The sqlite3_mutex_notheld()
62146249
** interface should also return 1 when given a NULL pointer.
62156250
*/
62166251
#ifndef NDEBUG
62176252
SQLITE_API int sqlite3_mutex_held(sqlite3_mutex*);
62186253
SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*);
@@ -6940,10 +6975,14 @@
69406975
** sqlite3_backup_init(D,N,S,M) identify the [database connection]
69416976
** and database name of the source database, respectively.
69426977
** ^The source and destination [database connections] (parameters S and D)
69436978
** must be different or else sqlite3_backup_init(D,N,S,M) will fail with
69446979
** an error.
6980
+**
6981
+** ^A call to sqlite3_backup_init() will fail, returning SQLITE_ERROR, if
6982
+** there is already a read or read-write transaction open on the
6983
+** destination database.
69456984
**
69466985
** ^If an error occurs within sqlite3_backup_init(D,N,S,M), then NULL is
69476986
** returned and an error code and error message are stored in the
69486987
** destination [database connection] D.
69496988
** ^The error code and message for the failed call to sqlite3_backup_init()
@@ -7334,101 +7373,118 @@
73347373
SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
73357374
73367375
/*
73377376
** CAPI3REF: Checkpoint a database
73387377
**
7339
-** ^The [sqlite3_wal_checkpoint(D,X)] interface causes database named X
7340
-** on [database connection] D to be [checkpointed]. ^If X is NULL or an
7341
-** empty string, then a checkpoint is run on all databases of
7342
-** connection D. ^If the database connection D is not in
7343
-** [WAL | write-ahead log mode] then this interface is a harmless no-op.
7344
-** ^The [sqlite3_wal_checkpoint(D,X)] interface initiates a
7345
-** [sqlite3_wal_checkpoint_v2|PASSIVE] checkpoint.
7346
-** Use the [sqlite3_wal_checkpoint_v2()] interface to get a FULL
7347
-** or RESET checkpoint.
7348
-**
7349
-** ^The [wal_checkpoint pragma] can be used to invoke this interface
7350
-** from SQL. ^The [sqlite3_wal_autocheckpoint()] interface and the
7351
-** [wal_autocheckpoint pragma] can be used to cause this interface to be
7352
-** run whenever the WAL reaches a certain size threshold.
7353
-**
7354
-** See also: [sqlite3_wal_checkpoint_v2()]
7378
+** ^(The sqlite3_wal_checkpoint(D,X) is equivalent to
7379
+** [sqlite3_wal_checkpoint_v2](D,X,[SQLITE_CHECKPOINT_PASSIVE],0,0).)^
7380
+**
7381
+** In brief, sqlite3_wal_checkpoint(D,X) causes the content in the
7382
+** [write-ahead log] for database X on [database connection] D to be
7383
+** transferred into the database file and for the write-ahead log to
7384
+** be reset. See the [checkpointing] documentation for addition
7385
+** information.
7386
+**
7387
+** This interface used to be the only way to cause a checkpoint to
7388
+** occur. But then the newer and more powerful [sqlite3_wal_checkpoint_v2()]
7389
+** interface was added. This interface is retained for backwards
7390
+** compatibility and as a convenience for applications that need to manually
7391
+** start a callback but which do not need the full power (and corresponding
7392
+** complication) of [sqlite3_wal_checkpoint_v2()].
73557393
*/
73567394
SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);
73577395
73587396
/*
73597397
** CAPI3REF: Checkpoint a database
73607398
**
7361
-** Run a checkpoint operation on WAL database zDb attached to database
7362
-** handle db. The specific operation is determined by the value of the
7363
-** eMode parameter:
7399
+** ^(The sqlite3_wal_checkpoint_v2(D,X,M,L,C) interface runs a checkpoint
7400
+** operation on database X of [database connection] D in mode M. Status
7401
+** information is written back into integers pointed to by L and C.)^
7402
+** ^(The M parameter must be a valid [checkpoint mode]:)^
73647403
**
73657404
** <dl>
73667405
** <dt>SQLITE_CHECKPOINT_PASSIVE<dd>
7367
-** Checkpoint as many frames as possible without waiting for any database
7368
-** readers or writers to finish. Sync the db file if all frames in the log
7369
-** are checkpointed. This mode is the same as calling
7370
-** sqlite3_wal_checkpoint(). The [sqlite3_busy_handler|busy-handler callback]
7371
-** is never invoked.
7406
+** ^Checkpoint as many frames as possible without waiting for any database
7407
+** readers or writers to finish, then sync the database file if all frames
7408
+** in the log were checkpointed. ^The [busy-handler callback]
7409
+** is never invoked in the SQLITE_CHECKPOINT_PASSIVE mode.
7410
+** ^On the other hand, passive mode might leave the checkpoint unfinished
7411
+** if there are concurrent readers or writers.
73727412
**
73737413
** <dt>SQLITE_CHECKPOINT_FULL<dd>
7374
-** This mode blocks (it invokes the
7414
+** ^This mode blocks (it invokes the
73757415
** [sqlite3_busy_handler|busy-handler callback]) until there is no
73767416
** database writer and all readers are reading from the most recent database
7377
-** snapshot. It then checkpoints all frames in the log file and syncs the
7378
-** database file. This call blocks database writers while it is running,
7379
-** but not database readers.
7417
+** snapshot. ^It then checkpoints all frames in the log file and syncs the
7418
+** database file. ^This mode blocks new database writers while it is pending,
7419
+** but new database readers are allowed to continue unimpeded.
73807420
**
73817421
** <dt>SQLITE_CHECKPOINT_RESTART<dd>
7382
-** This mode works the same way as SQLITE_CHECKPOINT_FULL, except after
7383
-** checkpointing the log file it blocks (calls the
7384
-** [sqlite3_busy_handler|busy-handler callback])
7385
-** until all readers are reading from the database file only. This ensures
7386
-** that the next client to write to the database file restarts the log file
7387
-** from the beginning. This call blocks database writers while it is running,
7388
-** but not database readers.
7422
+** ^This mode works the same way as SQLITE_CHECKPOINT_FULL with the addition
7423
+** that after checkpointing the log file it blocks (calls the
7424
+** [busy-handler callback])
7425
+** until all readers are reading from the database file only. ^This ensures
7426
+** that the next writer will restart the log file from the beginning.
7427
+** ^Like SQLITE_CHECKPOINT_FULL, this mode blocks new
7428
+** database writer attempts while it is pending, but does not impede readers.
7429
+**
7430
+** <dt>SQLITE_CHECKPOINT_TRUNCATE<dd>
7431
+** ^This mode works the same way as SQLITE_CHECKPOINT_RESTART with the
7432
+** addition that it also truncates the log file to zero bytes just prior
7433
+** to a successful return.
73897434
** </dl>
73907435
**
7391
-** If pnLog is not NULL, then *pnLog is set to the total number of frames in
7392
-** the log file before returning. If pnCkpt is not NULL, then *pnCkpt is set to
7393
-** the total number of checkpointed frames (including any that were already
7394
-** checkpointed when this function is called). *pnLog and *pnCkpt may be
7395
-** populated even if sqlite3_wal_checkpoint_v2() returns other than SQLITE_OK.
7396
-** If no values are available because of an error, they are both set to -1
7397
-** before returning to communicate this to the caller.
7436
+** ^If pnLog is not NULL, then *pnLog is set to the total number of frames in
7437
+** the log file or to -1 if the checkpoint could not run because
7438
+** of an error or because the database is not in [WAL mode]. ^If pnCkpt is not
7439
+** NULL,then *pnCkpt is set to the total number of checkpointed frames in the
7440
+** log file (including any that were already checkpointed before the function
7441
+** was called) or to -1 if the checkpoint could not run due to an error or
7442
+** because the database is not in WAL mode. ^Note that upon successful
7443
+** completion of an SQLITE_CHECKPOINT_TRUNCATE, the log file will have been
7444
+** truncated to zero bytes and so both *pnLog and *pnCkpt will be set to zero.
73987445
**
7399
-** All calls obtain an exclusive "checkpoint" lock on the database file. If
7446
+** ^All calls obtain an exclusive "checkpoint" lock on the database file. ^If
74007447
** any other process is running a checkpoint operation at the same time, the
7401
-** lock cannot be obtained and SQLITE_BUSY is returned. Even if there is a
7448
+** lock cannot be obtained and SQLITE_BUSY is returned. ^Even if there is a
74027449
** busy-handler configured, it will not be invoked in this case.
74037450
**
7404
-** The SQLITE_CHECKPOINT_FULL and RESTART modes also obtain the exclusive
7405
-** "writer" lock on the database file. If the writer lock cannot be obtained
7406
-** immediately, and a busy-handler is configured, it is invoked and the writer
7407
-** lock retried until either the busy-handler returns 0 or the lock is
7408
-** successfully obtained. The busy-handler is also invoked while waiting for
7409
-** database readers as described above. If the busy-handler returns 0 before
7451
+** ^The SQLITE_CHECKPOINT_FULL, RESTART and TRUNCATE modes also obtain the
7452
+** exclusive "writer" lock on the database file. ^If the writer lock cannot be
7453
+** obtained immediately, and a busy-handler is configured, it is invoked and
7454
+** the writer lock retried until either the busy-handler returns 0 or the lock
7455
+** is successfully obtained. ^The busy-handler is also invoked while waiting for
7456
+** database readers as described above. ^If the busy-handler returns 0 before
74107457
** the writer lock is obtained or while waiting for database readers, the
74117458
** checkpoint operation proceeds from that point in the same way as
74127459
** SQLITE_CHECKPOINT_PASSIVE - checkpointing as many frames as possible
7413
-** without blocking any further. SQLITE_BUSY is returned in this case.
7460
+** without blocking any further. ^SQLITE_BUSY is returned in this case.
74147461
**
7415
-** If parameter zDb is NULL or points to a zero length string, then the
7416
-** specified operation is attempted on all WAL databases. In this case the
7417
-** values written to output parameters *pnLog and *pnCkpt are undefined. If
7462
+** ^If parameter zDb is NULL or points to a zero length string, then the
7463
+** specified operation is attempted on all WAL databases [attached] to
7464
+** [database connection] db. In this case the
7465
+** values written to output parameters *pnLog and *pnCkpt are undefined. ^If
74187466
** an SQLITE_BUSY error is encountered when processing one or more of the
74197467
** attached WAL databases, the operation is still attempted on any remaining
7420
-** attached databases and SQLITE_BUSY is returned to the caller. If any other
7468
+** attached databases and SQLITE_BUSY is returned at the end. ^If any other
74217469
** error occurs while processing an attached database, processing is abandoned
7422
-** and the error code returned to the caller immediately. If no error
7470
+** and the error code is returned to the caller immediately. ^If no error
74237471
** (SQLITE_BUSY or otherwise) is encountered while processing the attached
74247472
** databases, SQLITE_OK is returned.
74257473
**
7426
-** If database zDb is the name of an attached database that is not in WAL
7427
-** mode, SQLITE_OK is returned and both *pnLog and *pnCkpt set to -1. If
7474
+** ^If database zDb is the name of an attached database that is not in WAL
7475
+** mode, SQLITE_OK is returned and both *pnLog and *pnCkpt set to -1. ^If
74287476
** zDb is not NULL (or a zero length string) and is not the name of any
74297477
** attached database, SQLITE_ERROR is returned to the caller.
7478
+**
7479
+** ^Unless it returns SQLITE_MISUSE,
7480
+** the sqlite3_wal_checkpoint_v2() interface
7481
+** sets the error information that is queried by
7482
+** [sqlite3_errcode()] and [sqlite3_errmsg()].
7483
+**
7484
+** ^The [PRAGMA wal_checkpoint] command can be used to invoke this interface
7485
+** from SQL.
74307486
*/
74317487
SQLITE_API int sqlite3_wal_checkpoint_v2(
74327488
sqlite3 *db, /* Database handle */
74337489
const char *zDb, /* Name of attached database (or NULL) */
74347490
int eMode, /* SQLITE_CHECKPOINT_* value */
@@ -7435,20 +7491,22 @@
74357491
int *pnLog, /* OUT: Size of WAL log in frames */
74367492
int *pnCkpt /* OUT: Total number of frames checkpointed */
74377493
);
74387494
74397495
/*
7440
-** CAPI3REF: Checkpoint operation parameters
7496
+** CAPI3REF: Checkpoint Mode Values
7497
+** KEYWORDS: {checkpoint mode}
74417498
**
7442
-** These constants can be used as the 3rd parameter to
7443
-** [sqlite3_wal_checkpoint_v2()]. See the [sqlite3_wal_checkpoint_v2()]
7444
-** documentation for additional information about the meaning and use of
7445
-** each of these values.
7499
+** These constants define all valid values for the "checkpoint mode" passed
7500
+** as the third parameter to the [sqlite3_wal_checkpoint_v2()] interface.
7501
+** See the [sqlite3_wal_checkpoint_v2()] documentation for details on the
7502
+** meaning of each of these checkpoint modes.
74467503
*/
7447
-#define SQLITE_CHECKPOINT_PASSIVE 0
7448
-#define SQLITE_CHECKPOINT_FULL 1
7449
-#define SQLITE_CHECKPOINT_RESTART 2
7504
+#define SQLITE_CHECKPOINT_PASSIVE 0 /* Do as much as possible w/o blocking */
7505
+#define SQLITE_CHECKPOINT_FULL 1 /* Wait for writers, then checkpoint */
7506
+#define SQLITE_CHECKPOINT_RESTART 2 /* Like FULL but wait for for readers */
7507
+#define SQLITE_CHECKPOINT_TRUNCATE 3 /* Like RESTART but also truncate WAL */
74507508
74517509
/*
74527510
** CAPI3REF: Virtual Table Interface Configuration
74537511
**
74547512
** This function may be called by either the [xConnect] or [xCreate] method
@@ -7533,10 +7591,102 @@
75337591
/* #define SQLITE_IGNORE 2 // Also used by sqlite3_authorizer() callback */
75347592
#define SQLITE_FAIL 3
75357593
/* #define SQLITE_ABORT 4 // Also an error code */
75367594
#define SQLITE_REPLACE 5
75377595
7596
+/*
7597
+** CAPI3REF: Prepared Statement Scan Status Opcodes
7598
+** KEYWORDS: {scanstatus options}
7599
+**
7600
+** The following constants can be used for the T parameter to the
7601
+** [sqlite3_stmt_scanstatus(S,X,T,V)] interface. Each constant designates a
7602
+** different metric for sqlite3_stmt_scanstatus() to return.
7603
+**
7604
+** <dl>
7605
+** [[SQLITE_SCANSTAT_NLOOP]] <dt>SQLITE_SCANSTAT_NLOOP</dt>
7606
+** <dd>^The [sqlite3_int64] variable pointed to by the T parameter will be
7607
+** set to the total number of times that the X-th loop has run.</dd>
7608
+**
7609
+** [[SQLITE_SCANSTAT_NVISIT]] <dt>SQLITE_SCANSTAT_NVISIT</dt>
7610
+** <dd>^The [sqlite3_int64] variable pointed to by the T parameter will be set
7611
+** to the total number of rows examined by all iterations of the X-th loop.</dd>
7612
+**
7613
+** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt>
7614
+** <dd>^The "double" variable pointed to by the T parameter will be set to the
7615
+** query planner's estimate for the average number of rows output from each
7616
+** iteration of the X-th loop. If the query planner's estimates was accurate,
7617
+** then this value will approximate the quotient NVISIT/NLOOP and the
7618
+** product of this value for all prior loops with the same SELECTID will
7619
+** be the NLOOP value for the current loop.
7620
+**
7621
+** [[SQLITE_SCANSTAT_NAME]] <dt>SQLITE_SCANSTAT_NAME</dt>
7622
+** <dd>^The "const char *" variable pointed to by the T parameter will be set
7623
+** to a zero-terminated UTF-8 string containing the name of the index or table
7624
+** used for the X-th loop.
7625
+**
7626
+** [[SQLITE_SCANSTAT_EXPLAIN]] <dt>SQLITE_SCANSTAT_EXPLAIN</dt>
7627
+** <dd>^The "const char *" variable pointed to by the T parameter will be set
7628
+** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN]
7629
+** description for the X-th loop.
7630
+**
7631
+** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECT</dt>
7632
+** <dd>^The "int" variable pointed to by the T parameter will be set to the
7633
+** "select-id" for the X-th loop. The select-id identifies which query or
7634
+** subquery the loop is part of. The main query has a select-id of zero.
7635
+** The select-id is the same value as is output in the first column
7636
+** of an [EXPLAIN QUERY PLAN] query.
7637
+** </dl>
7638
+*/
7639
+#define SQLITE_SCANSTAT_NLOOP 0
7640
+#define SQLITE_SCANSTAT_NVISIT 1
7641
+#define SQLITE_SCANSTAT_EST 2
7642
+#define SQLITE_SCANSTAT_NAME 3
7643
+#define SQLITE_SCANSTAT_EXPLAIN 4
7644
+#define SQLITE_SCANSTAT_SELECTID 5
7645
+
7646
+/*
7647
+** CAPI3REF: Prepared Statement Scan Status
7648
+**
7649
+** Return status data for a single loop within query pStmt.
7650
+**
7651
+** The "iScanStatusOp" parameter determines which status information to return.
7652
+** The "iScanStatusOp" must be one of the [scanstatus options] or the behavior
7653
+** of this interface is undefined.
7654
+** ^The requested measurement is written into a variable pointed to by
7655
+** the "pOut" parameter.
7656
+** Parameter "idx" identifies the specific loop to retrieve statistics for.
7657
+** Loops are numbered starting from zero. ^If idx is out of range - less than
7658
+** zero or greater than or equal to the total number of loops used to implement
7659
+** the statement - a non-zero value is returned and the variable that pOut
7660
+** points to is unchanged.
7661
+**
7662
+** ^Statistics might not be available for all loops in all statements. ^In cases
7663
+** where there exist loops with no available statistics, this function behaves
7664
+** as if the loop did not exist - it returns non-zero and leave the variable
7665
+** that pOut points to unchanged.
7666
+**
7667
+** This API is only available if the library is built with pre-processor
7668
+** symbol [SQLITE_ENABLE_STMT_SCANSTATUS] defined.
7669
+**
7670
+** See also: [sqlite3_stmt_scanstatus_reset()]
7671
+*/
7672
+SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_stmt_scanstatus(
7673
+ sqlite3_stmt *pStmt, /* Prepared statement for which info desired */
7674
+ int idx, /* Index of loop to report on */
7675
+ int iScanStatusOp, /* Information desired. SQLITE_SCANSTAT_* */
7676
+ void *pOut /* Result written here */
7677
+);
7678
+
7679
+/*
7680
+** CAPI3REF: Zero Scan-Status Counters
7681
+**
7682
+** ^Zero all [sqlite3_stmt_scanstatus()] related event counters.
7683
+**
7684
+** This API is only available if the library is built with pre-processor
7685
+** symbol [SQLITE_ENABLE_STMT_SCANSTATUS] defined.
7686
+*/
7687
+SQLITE_API SQLITE_EXPERIMENTAL void sqlite3_stmt_scanstatus_reset(sqlite3_stmt*);
75387688
75397689
75407690
/*
75417691
** Undo the hack that converts floating point types to integer for
75427692
** builds on processors without floating point support.
@@ -7978,14 +8128,13 @@
79788128
#ifndef SQLITE_POWERSAFE_OVERWRITE
79798129
# define SQLITE_POWERSAFE_OVERWRITE 1
79808130
#endif
79818131
79828132
/*
7983
-** The SQLITE_DEFAULT_MEMSTATUS macro must be defined as either 0 or 1.
7984
-** It determines whether or not the features related to
7985
-** SQLITE_CONFIG_MEMSTATUS are available by default or not. This value can
7986
-** be overridden at runtime using the sqlite3_config() API.
8133
+** EVIDENCE-OF: R-25715-37072 Memory allocation statistics are enabled by
8134
+** default unless SQLite is compiled with SQLITE_DEFAULT_MEMSTATUS=0 in
8135
+** which case memory allocation statistics are disabled by default.
79878136
*/
79888137
#if !defined(SQLITE_DEFAULT_MEMSTATUS)
79898138
# define SQLITE_DEFAULT_MEMSTATUS 1
79908139
#endif
79918140
@@ -8611,11 +8760,11 @@
86118760
** Estimated quantities used for query planning are stored as 16-bit
86128761
** logarithms. For quantity X, the value stored is 10*log2(X). This
86138762
** gives a possible range of values of approximately 1.0e986 to 1e-986.
86148763
** But the allowed values are "grainy". Not every value is representable.
86158764
** For example, quantities 16 and 17 are both represented by a LogEst
8616
-** of 40. However, since LogEst quantaties are suppose to be estimates,
8765
+** of 40. However, since LogEst quantities are suppose to be estimates,
86178766
** not exact values, this imprecision is not a problem.
86188767
**
86198768
** "LogEst" is short for "Logarithmic Estimate".
86208769
**
86218770
** Examples:
@@ -9011,11 +9160,11 @@
90119160
SQLITE_PRIVATE int sqlite3BtreeGetAutoVacuum(Btree *);
90129161
SQLITE_PRIVATE int sqlite3BtreeBeginTrans(Btree*,int);
90139162
SQLITE_PRIVATE int sqlite3BtreeCommitPhaseOne(Btree*, const char *zMaster);
90149163
SQLITE_PRIVATE int sqlite3BtreeCommitPhaseTwo(Btree*, int);
90159164
SQLITE_PRIVATE int sqlite3BtreeCommit(Btree*);
9016
-SQLITE_PRIVATE int sqlite3BtreeRollback(Btree*,int);
9165
+SQLITE_PRIVATE int sqlite3BtreeRollback(Btree*,int,int);
90179166
SQLITE_PRIVATE int sqlite3BtreeBeginStmt(Btree*,int);
90189167
SQLITE_PRIVATE int sqlite3BtreeCreateTable(Btree*, int*, int flags);
90199168
SQLITE_PRIVATE int sqlite3BtreeIsInTrans(Btree*);
90209169
SQLITE_PRIVATE int sqlite3BtreeIsInReadTrans(Btree*);
90219170
SQLITE_PRIVATE int sqlite3BtreeIsInBackup(Btree*);
@@ -9044,11 +9193,11 @@
90449193
#define BTREE_BLOBKEY 2 /* Table has keys only - no data */
90459194
90469195
SQLITE_PRIVATE int sqlite3BtreeDropTable(Btree*, int, int*);
90479196
SQLITE_PRIVATE int sqlite3BtreeClearTable(Btree*, int, int*);
90489197
SQLITE_PRIVATE int sqlite3BtreeClearTableOfCursor(BtCursor*);
9049
-SQLITE_PRIVATE void sqlite3BtreeTripAllCursors(Btree*, int);
9198
+SQLITE_PRIVATE int sqlite3BtreeTripAllCursors(Btree*, int, int);
90509199
90519200
SQLITE_PRIVATE void sqlite3BtreeGetMeta(Btree *pBtree, int idx, u32 *pValue);
90529201
SQLITE_PRIVATE int sqlite3BtreeUpdateMeta(Btree*, int idx, u32 value);
90539202
90549203
SQLITE_PRIVATE int sqlite3BtreeNewDb(Btree *p);
@@ -9124,10 +9273,11 @@
91249273
SQLITE_PRIVATE void sqlite3BtreeIncrblobCursor(BtCursor *);
91259274
SQLITE_PRIVATE void sqlite3BtreeClearCursor(BtCursor *);
91269275
SQLITE_PRIVATE int sqlite3BtreeSetVersion(Btree *pBt, int iVersion);
91279276
SQLITE_PRIVATE void sqlite3BtreeCursorHints(BtCursor *, unsigned int mask);
91289277
SQLITE_PRIVATE int sqlite3BtreeIsReadonly(Btree *pBt);
9278
+SQLITE_PRIVATE int sqlite3HeaderSizeBtree(void);
91299279
91309280
#ifndef NDEBUG
91319281
SQLITE_PRIVATE int sqlite3BtreeCursorIsValid(BtCursor*);
91329282
#endif
91339283
@@ -9666,10 +9816,16 @@
96669816
# define VdbeCoverageAlwaysTaken(v)
96679817
# define VdbeCoverageNeverTaken(v)
96689818
# define VDBE_OFFSET_LINENO(x) 0
96699819
#endif
96709820
9821
+#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
9822
+SQLITE_PRIVATE void sqlite3VdbeScanStatus(Vdbe*, int, int, int, LogEst, const char*);
9823
+#else
9824
+# define sqlite3VdbeScanStatus(a,b,c,d,e)
9825
+#endif
9826
+
96719827
#endif
96729828
96739829
/************** End of vdbe.h ************************************************/
96749830
/************** Continuing where we left off in sqliteInt.h ******************/
96759831
/************** Include pager.h in the middle of sqliteInt.h *****************/
@@ -9862,10 +10018,12 @@
986210018
SQLITE_PRIVATE int sqlite3SectorSize(sqlite3_file *);
986310019
986410020
/* Functions used to truncate the database file. */
986510021
SQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager*,Pgno);
986610022
10023
+SQLITE_PRIVATE void sqlite3PagerRekey(DbPage*, Pgno, u16);
10024
+
986710025
#if defined(SQLITE_HAS_CODEC) && !defined(SQLITE_OMIT_WAL)
986810026
SQLITE_PRIVATE void *sqlite3PagerCodec(DbPage *);
986910027
#endif
987010028
987110029
/* Functions to support testing and debugging. */
@@ -10049,10 +10207,14 @@
1004910207
SQLITE_PRIVATE void sqlite3PcacheStats(int*,int*,int*,int*);
1005010208
#endif
1005110209
1005210210
SQLITE_PRIVATE void sqlite3PCacheSetDefault(void);
1005310211
10212
+/* Return the header size */
10213
+SQLITE_PRIVATE int sqlite3HeaderSizePcache(void);
10214
+SQLITE_PRIVATE int sqlite3HeaderSizePcache1(void);
10215
+
1005410216
#endif /* _PCACHE_H_ */
1005510217
1005610218
/************** End of pcache.h **********************************************/
1005710219
/************** Continuing where we left off in sqliteInt.h ******************/
1005810220
@@ -10735,11 +10897,11 @@
1073510897
#define SQLITE_CoverIdxScan 0x0040 /* Covering index scans */
1073610898
#define SQLITE_OrderByIdxJoin 0x0080 /* ORDER BY of joins via index */
1073710899
#define SQLITE_SubqCoroutine 0x0100 /* Evaluate subqueries as coroutines */
1073810900
#define SQLITE_Transitive 0x0200 /* Transitive constraints */
1073910901
#define SQLITE_OmitNoopJoin 0x0400 /* Omit unused tables in joins */
10740
-#define SQLITE_Stat3 0x0800 /* Use the SQLITE_STAT3 table */
10902
+#define SQLITE_Stat34 0x0800 /* Use STAT3 or STAT4 data */
1074110903
#define SQLITE_AllOpts 0xffff /* All optimizations */
1074210904
1074310905
/*
1074410906
** Macros for testing whether or not optimizations are enabled or disabled.
1074510907
*/
@@ -11317,16 +11479,18 @@
1131711479
unsigned idxType:2; /* 1==UNIQUE, 2==PRIMARY KEY, 0==CREATE INDEX */
1131811480
unsigned bUnordered:1; /* Use this index for == or IN queries only */
1131911481
unsigned uniqNotNull:1; /* True if UNIQUE and NOT NULL for all columns */
1132011482
unsigned isResized:1; /* True if resizeIndexObject() has been called */
1132111483
unsigned isCovering:1; /* True if this is a covering index */
11484
+ unsigned noSkipScan:1; /* Do not try to use skip-scan if true */
1132211485
#ifdef SQLITE_ENABLE_STAT3_OR_STAT4
1132311486
int nSample; /* Number of elements in aSample[] */
1132411487
int nSampleCol; /* Size of IndexSample.anEq[] and so on */
1132511488
tRowcnt *aAvgEq; /* Average nEq values for keys not in aSample */
1132611489
IndexSample *aSample; /* Samples of the left-most key */
11327
- tRowcnt *aiRowEst; /* Non-logarithmic stat1 data for this table */
11490
+ tRowcnt *aiRowEst; /* Non-logarithmic stat1 data for this index */
11491
+ tRowcnt nRowEst0; /* Non-logarithmic number of rows in the index */
1132811492
#endif
1132911493
};
1133011494
1133111495
/*
1133211496
** Allowed values for Index.idxType
@@ -11520,11 +11684,11 @@
1152011684
int nHeight; /* Height of the tree headed by this node */
1152111685
#endif
1152211686
int iTable; /* TK_COLUMN: cursor number of table holding column
1152311687
** TK_REGISTER: register number
1152411688
** TK_TRIGGER: 1 -> new, 0 -> old
11525
- ** EP_Unlikely: 1000 times likelihood */
11689
+ ** EP_Unlikely: 134217728 times likelihood */
1152611690
ynVar iColumn; /* TK_COLUMN: column index. -1 for rowid.
1152711691
** TK_VARIABLE: variable number (always >= 1). */
1152811692
i16 iAgg; /* Which entry in pAggInfo->aCol[] or ->aFunc[] */
1152911693
i16 iRightJoinTable; /* If EP_FromJoin, the right table of the join */
1153011694
u8 op2; /* TK_REGISTER: original value of Expr.op
@@ -11535,11 +11699,11 @@
1153511699
};
1153611700
1153711701
/*
1153811702
** The following are the meanings of bits in the Expr.flags field.
1153911703
*/
11540
-#define EP_FromJoin 0x000001 /* Originated in ON or USING clause of a join */
11704
+#define EP_FromJoin 0x000001 /* Originates in ON/USING clause of outer join */
1154111705
#define EP_Agg 0x000002 /* Contains one or more aggregate functions */
1154211706
#define EP_Resolved 0x000004 /* IDs have been resolved to COLUMNs */
1154311707
#define EP_Error 0x000008 /* Expression contains one or more errors */
1154411708
#define EP_Distinct 0x000010 /* Aggregate function with DISTINCT keyword */
1154511709
#define EP_VarSelect 0x000020 /* pSelect is correlated, not constant */
@@ -11555,10 +11719,11 @@
1155511719
#define EP_Static 0x008000 /* Held in memory not obtained from malloc() */
1155611720
#define EP_MemToken 0x010000 /* Need to sqlite3DbFree() Expr.zToken */
1155711721
#define EP_NoReduce 0x020000 /* Cannot EXPRDUP_REDUCE this Expr */
1155811722
#define EP_Unlikely 0x040000 /* unlikely() or likelihood() function */
1155911723
#define EP_Constant 0x080000 /* Node is a constant */
11724
+#define EP_CanBeNull 0x100000 /* Can be null despite NOT NULL constraint */
1156011725
1156111726
/*
1156211727
** These macros can be used to test, set, or clear bits in the
1156311728
** Expr.flags field.
1156411729
*/
@@ -12412,13 +12577,15 @@
1241212577
int (*xExprCallback)(Walker*, Expr*); /* Callback for expressions */
1241312578
int (*xSelectCallback)(Walker*,Select*); /* Callback for SELECTs */
1241412579
void (*xSelectCallback2)(Walker*,Select*);/* Second callback for SELECTs */
1241512580
Parse *pParse; /* Parser context. */
1241612581
int walkerDepth; /* Number of subqueries */
12582
+ u8 eCode; /* A small processing code */
1241712583
union { /* Extra data for callback */
1241812584
NameContext *pNC; /* Naming context */
12419
- int i; /* Integer value */
12585
+ int n; /* A counter */
12586
+ int iCur; /* A cursor number */
1242012587
SrcList *pSrcList; /* FROM clause */
1242112588
struct SrcCount *pSrcCount; /* Counting column references */
1242212589
} u;
1242312590
};
1242412591
@@ -12815,10 +12982,11 @@
1281512982
SQLITE_PRIVATE void sqlite3CloseSavepoints(sqlite3 *);
1281612983
SQLITE_PRIVATE void sqlite3LeaveMutexAndCloseZombie(sqlite3*);
1281712984
SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr*);
1281812985
SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr*);
1281912986
SQLITE_PRIVATE int sqlite3ExprIsConstantOrFunction(Expr*, u8);
12987
+SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr*,int);
1282012988
SQLITE_PRIVATE int sqlite3ExprIsInteger(Expr*, int*);
1282112989
SQLITE_PRIVATE int sqlite3ExprCanBeNull(const Expr*);
1282212990
SQLITE_PRIVATE int sqlite3ExprNeedsNoAffinityChange(const Expr*, char);
1282312991
SQLITE_PRIVATE int sqlite3IsRowid(const char*);
1282412992
SQLITE_PRIVATE void sqlite3GenerateRowDelete(Parse*,Table*,Trigger*,int,int,int,i16,u8,u8,u8);
@@ -13060,11 +13228,11 @@
1306013228
SQLITE_PRIVATE int sqlite3OpenTempDatabase(Parse *);
1306113229
1306213230
SQLITE_PRIVATE void sqlite3StrAccumInit(StrAccum*, char*, int, int);
1306313231
SQLITE_PRIVATE void sqlite3StrAccumAppend(StrAccum*,const char*,int);
1306413232
SQLITE_PRIVATE void sqlite3StrAccumAppendAll(StrAccum*,const char*);
13065
-SQLITE_PRIVATE void sqlite3AppendSpace(StrAccum*,int);
13233
+SQLITE_PRIVATE void sqlite3AppendChar(StrAccum*,int,char);
1306613234
SQLITE_PRIVATE char *sqlite3StrAccumFinish(StrAccum*);
1306713235
SQLITE_PRIVATE void sqlite3StrAccumReset(StrAccum*);
1306813236
SQLITE_PRIVATE void sqlite3SelectDestInit(SelectDest*,int,int);
1306913237
SQLITE_PRIVATE Expr *sqlite3CreateColumnExpr(sqlite3 *, SrcList *, int, int);
1307013238
@@ -13472,15 +13640,23 @@
1347213640
** compatibility for legacy applications, the URI filename capability is
1347313641
** disabled by default.
1347413642
**
1347513643
** EVIDENCE-OF: R-38799-08373 URI filenames can be enabled or disabled
1347613644
** using the SQLITE_USE_URI=1 or SQLITE_USE_URI=0 compile-time options.
13645
+**
13646
+** EVIDENCE-OF: R-43642-56306 By default, URI handling is globally
13647
+** disabled. The default value may be changed by compiling with the
13648
+** SQLITE_USE_URI symbol defined.
1347713649
*/
1347813650
#ifndef SQLITE_USE_URI
1347913651
# define SQLITE_USE_URI 0
1348013652
#endif
1348113653
13654
+/* EVIDENCE-OF: R-38720-18127 The default setting is determined by the
13655
+** SQLITE_ALLOW_COVERING_INDEX_SCAN compile-time option, or is "on" if
13656
+** that compile-time option is omitted.
13657
+*/
1348213658
#ifndef SQLITE_ALLOW_COVERING_INDEX_SCAN
1348313659
# define SQLITE_ALLOW_COVERING_INDEX_SCAN 1
1348413660
#endif
1348513661
1348613662
/*
@@ -13566,12 +13742,12 @@
1356613742
** than 1 GiB. The sqlite3_test_control() interface can be used to
1356713743
** move the pending byte.
1356813744
**
1356913745
** IMPORTANT: Changing the pending byte to any value other than
1357013746
** 0x40000000 results in an incompatible database file format!
13571
-** Changing the pending byte during operating results in undefined
13572
-** and dileterious behavior.
13747
+** Changing the pending byte during operation will result in undefined
13748
+** and incorrect behavior.
1357313749
*/
1357413750
#ifndef SQLITE_OMIT_WSD
1357513751
SQLITE_PRIVATE int sqlite3PendingByte = 0x40000000;
1357613752
#endif
1357713753
@@ -13646,10 +13822,13 @@
1364613822
#ifdef SQLITE_DISABLE_DIRSYNC
1364713823
"DISABLE_DIRSYNC",
1364813824
#endif
1364913825
#ifdef SQLITE_DISABLE_LFS
1365013826
"DISABLE_LFS",
13827
+#endif
13828
+#ifdef SQLITE_ENABLE_API_ARMOR
13829
+ "ENABLE_API_ARMOR",
1365113830
#endif
1365213831
#ifdef SQLITE_ENABLE_ATOMIC_WRITE
1365313832
"ENABLE_ATOMIC_WRITE",
1365413833
#endif
1365513834
#ifdef SQLITE_ENABLE_CEROD
@@ -13972,10 +14151,17 @@
1397214151
** The name can optionally begin with "SQLITE_" but the "SQLITE_" prefix
1397314152
** is not required for a match.
1397414153
*/
1397514154
SQLITE_API int sqlite3_compileoption_used(const char *zOptName){
1397614155
int i, n;
14156
+
14157
+#ifdef SQLITE_ENABLE_API_ARMOR
14158
+ if( zOptName==0 ){
14159
+ (void)SQLITE_MISUSE_BKPT;
14160
+ return 0;
14161
+ }
14162
+#endif
1397714163
if( sqlite3StrNICmp(zOptName, "SQLITE_", 7)==0 ) zOptName += 7;
1397814164
n = sqlite3Strlen30(zOptName);
1397914165
1398014166
/* Since ArraySize(azCompileOpt) is normally in single digits, a
1398114167
** linear search is adequate. No need for a binary search. */
@@ -14153,10 +14339,11 @@
1415314339
typedef struct VdbeFrame VdbeFrame;
1415414340
struct VdbeFrame {
1415514341
Vdbe *v; /* VM this frame belongs to */
1415614342
VdbeFrame *pParent; /* Parent of this frame, or NULL if parent is main */
1415714343
Op *aOp; /* Program instructions for parent frame */
14344
+ i64 *anExec; /* Event counters from parent frame */
1415814345
Mem *aMem; /* Array of memory cells for parent frame */
1415914346
u8 *aOnceFlag; /* Array of OP_Once flags for parent frame */
1416014347
VdbeCursor **apCsr; /* Array of Vdbe cursors for parent frame */
1416114348
void *token; /* Copy of SubProgram.token */
1416214349
i64 lastRowid; /* Last insert rowid (sqlite3.lastRowid) */
@@ -14165,11 +14352,12 @@
1416514352
int nOp; /* Size of aOp array */
1416614353
int nMem; /* Number of entries in aMem */
1416714354
int nOnceFlag; /* Number of entries in aOnceFlag */
1416814355
int nChildMem; /* Number of memory cells for child frame */
1416914356
int nChildCsr; /* Number of cursors for child frame */
14170
- int nChange; /* Statement changes (Vdbe.nChanges) */
14357
+ int nChange; /* Statement changes (Vdbe.nChange) */
14358
+ int nDbChange; /* Value of db->nChange */
1417114359
};
1417214360
1417314361
#define VdbeFrameMem(p) ((Mem *)&((u8 *)p)[ROUND8(sizeof(VdbeFrame))])
1417414362
1417514363
/*
@@ -14316,10 +14504,20 @@
1431614504
/* A bitfield type for use inside of structures. Always follow with :N where
1431714505
** N is the number of bits.
1431814506
*/
1431914507
typedef unsigned bft; /* Bit Field Type */
1432014508
14509
+typedef struct ScanStatus ScanStatus;
14510
+struct ScanStatus {
14511
+ int addrExplain; /* OP_Explain for loop */
14512
+ int addrLoop; /* Address of "loops" counter */
14513
+ int addrVisit; /* Address of "rows visited" counter */
14514
+ int iSelectID; /* The "Select-ID" for this loop */
14515
+ LogEst nEst; /* Estimated output rows per loop */
14516
+ char *zName; /* Name of table or index */
14517
+};
14518
+
1432114519
/*
1432214520
** An instance of the virtual machine. This structure contains the complete
1432314521
** state of the virtual machine.
1432414522
**
1432514523
** The "sqlite3_stmt" structure pointer that is returned by sqlite3_prepare()
@@ -14388,10 +14586,15 @@
1438814586
u32 expmask; /* Binding to these vars invalidates VM */
1438914587
SubProgram *pProgram; /* Linked list of all sub-programs used by VM */
1439014588
int nOnceFlag; /* Size of array aOnceFlag[] */
1439114589
u8 *aOnceFlag; /* Flags for OP_Once */
1439214590
AuxData *pAuxData; /* Linked list of auxdata allocations */
14591
+#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
14592
+ i64 *anExec; /* Number of times each op has been executed */
14593
+ int nScan; /* Entries in aScan[] */
14594
+ ScanStatus *aScan; /* Scan definitions for sqlite3_stmt_scanstatus() */
14595
+#endif
1439314596
};
1439414597
1439514598
/*
1439614599
** The following are allowed values for Vdbe.magic
1439714600
*/
@@ -14577,10 +14780,13 @@
1457714780
SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag){
1457814781
wsdStatInit;
1457914782
if( op<0 || op>=ArraySize(wsdStat.nowValue) ){
1458014783
return SQLITE_MISUSE_BKPT;
1458114784
}
14785
+#ifdef SQLITE_ENABLE_API_ARMOR
14786
+ if( pCurrent==0 || pHighwater==0 ) return SQLITE_MISUSE_BKPT;
14787
+#endif
1458214788
*pCurrent = wsdStat.nowValue[op];
1458314789
*pHighwater = wsdStat.mxValue[op];
1458414790
if( resetFlag ){
1458514791
wsdStat.mxValue[op] = wsdStat.nowValue[op];
1458614792
}
@@ -14596,10 +14802,15 @@
1459614802
int *pCurrent, /* Write current value here */
1459714803
int *pHighwater, /* Write high-water mark here */
1459814804
int resetFlag /* Reset high-water mark if true */
1459914805
){
1460014806
int rc = SQLITE_OK; /* Return code */
14807
+#ifdef SQLITE_ENABLE_API_ARMOR
14808
+ if( !sqlite3SafetyCheckOk(db) || pCurrent==0|| pHighwater==0 ){
14809
+ return SQLITE_MISUSE_BKPT;
14810
+ }
14811
+#endif
1460114812
sqlite3_mutex_enter(db->mutex);
1460214813
switch( op ){
1460314814
case SQLITE_DBSTATUS_LOOKASIDE_USED: {
1460414815
*pCurrent = db->lookaside.nOut;
1460514816
*pHighwater = db->lookaside.mxOut;
@@ -14774,11 +14985,11 @@
1477414985
**
1477514986
** There is only one exported symbol in this file - the function
1477614987
** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
1477714988
** All other code has file scope.
1477814989
**
14779
-** SQLite processes all times and dates as Julian Day numbers. The
14990
+** SQLite processes all times and dates as julian day numbers. The
1478014991
** dates and times are stored as the number of days since noon
1478114992
** in Greenwich on November 24, 4714 B.C. according to the Gregorian
1478214993
** calendar system.
1478314994
**
1478414995
** 1970-01-01 00:00:00 is JD 2440587.5
@@ -14789,11 +15000,11 @@
1478915000
** be represented, even though julian day numbers allow a much wider
1479015001
** range of dates.
1479115002
**
1479215003
** The Gregorian calendar system is used for all dates and times,
1479315004
** even those that predate the Gregorian calendar. Historians usually
14794
-** use the Julian calendar for dates prior to 1582-10-15 and for some
15005
+** use the julian calendar for dates prior to 1582-10-15 and for some
1479515006
** dates afterwards, depending on locale. Beware of this difference.
1479615007
**
1479715008
** The conversion algorithms are implemented based on descriptions
1479815009
** in the following text:
1479915010
**
@@ -15061,11 +15272,11 @@
1506115272
return 1;
1506215273
}
1506315274
}
1506415275
1506515276
/*
15066
-** Attempt to parse the given string into a Julian Day Number. Return
15277
+** Attempt to parse the given string into a julian day number. Return
1506715278
** the number of errors.
1506815279
**
1506915280
** The following are acceptable forms for the input string:
1507015281
**
1507115282
** YYYY-MM-DD HH:MM:SS.FFF +/-HH:MM
@@ -15632,11 +15843,11 @@
1563215843
**
1563315844
** %d day of month
1563415845
** %f ** fractional seconds SS.SSS
1563515846
** %H hour 00-24
1563615847
** %j day of year 000-366
15637
-** %J ** Julian day number
15848
+** %J ** julian day number
1563815849
** %m month 01-12
1563915850
** %M minute 00-59
1564015851
** %s seconds since 1970-01-01
1564115852
** %S seconds 00-59
1564215853
** %w day of week 0-6 sunday==0
@@ -16257,10 +16468,14 @@
1625716468
MUTEX_LOGIC(sqlite3_mutex *mutex;)
1625816469
#ifndef SQLITE_OMIT_AUTOINIT
1625916470
int rc = sqlite3_initialize();
1626016471
if( rc ) return rc;
1626116472
#endif
16473
+#ifdef SQLITE_ENABLE_API_ARMOR
16474
+ if( pVfs==0 ) return SQLITE_MISUSE_BKPT;
16475
+#endif
16476
+
1626216477
MUTEX_LOGIC( mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); )
1626316478
sqlite3_mutex_enter(mutex);
1626416479
vfsUnlink(pVfs);
1626516480
if( makeDflt || vfsList==0 ){
1626616481
pVfs->pNext = vfsList;
@@ -18614,10 +18829,11 @@
1861418829
** Retrieve a pointer to a static mutex or allocate a new dynamic one.
1861518830
*/
1861618831
SQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int id){
1861718832
#ifndef SQLITE_OMIT_AUTOINIT
1861818833
if( id<=SQLITE_MUTEX_RECURSIVE && sqlite3_initialize() ) return 0;
18834
+ if( id>SQLITE_MUTEX_RECURSIVE && sqlite3MutexInit() ) return 0;
1861918835
#endif
1862018836
return sqlite3GlobalConfig.mutex.xMutexAlloc(id);
1862118837
}
1862218838
1862318839
SQLITE_PRIVATE sqlite3_mutex *sqlite3MutexAlloc(int id){
@@ -19070,12 +19286,16 @@
1907019286
pthread_mutex_init(&p->mutex, 0);
1907119287
}
1907219288
break;
1907319289
}
1907419290
default: {
19075
- assert( iType-2 >= 0 );
19076
- assert( iType-2 < ArraySize(staticMutexes) );
19291
+#ifdef SQLITE_ENABLE_API_ARMOR
19292
+ if( iType-2<0 || iType-2>=ArraySize(staticMutexes) ){
19293
+ (void)SQLITE_MISUSE_BKPT;
19294
+ return 0;
19295
+ }
19296
+#endif
1907719297
p = &staticMutexes[iType-2];
1907819298
#if SQLITE_MUTEX_NREF
1907919299
p->id = iType;
1908019300
#endif
1908119301
break;
@@ -20293,15 +20513,16 @@
2029320513
}
2029420514
assert( sqlite3_mutex_notheld(mem0.mutex) );
2029520515
2029620516
2029720517
#if SQLITE_THREADSAFE==0 && !defined(NDEBUG)
20298
- /* Verify that no more than two scratch allocations per thread
20299
- ** are outstanding at one time. (This is only checked in the
20300
- ** single-threaded case since checking in the multi-threaded case
20301
- ** would be much more complicated.) */
20302
- assert( scratchAllocOut<=1 );
20518
+ /* EVIDENCE-OF: R-12970-05880 SQLite will not use more than one scratch
20519
+ ** buffers per thread.
20520
+ **
20521
+ ** This can only be checked in single-threaded mode.
20522
+ */
20523
+ assert( scratchAllocOut==0 );
2030320524
if( p ) scratchAllocOut++;
2030420525
#endif
2030520526
2030620527
return p;
2030720528
}
@@ -20945,11 +21166,11 @@
2094521166
sqlite_uint64 longvalue; /* Value for integer types */
2094621167
LONGDOUBLE_TYPE realvalue; /* Value for real types */
2094721168
const et_info *infop; /* Pointer to the appropriate info structure */
2094821169
char *zOut; /* Rendering buffer */
2094921170
int nOut; /* Size of the rendering buffer */
20950
- char *zExtra; /* Malloced memory used by some conversion */
21171
+ char *zExtra = 0; /* Malloced memory used by some conversion */
2095121172
#ifndef SQLITE_OMIT_FLOATING_POINT
2095221173
int exp, e2; /* exponent of real numbers */
2095321174
int nsd; /* Number of significant digits returned */
2095421175
double rounder; /* Used for rounding floating point values */
2095521176
etByte flag_dp; /* True if decimal point should be shown */
@@ -20956,10 +21177,17 @@
2095621177
etByte flag_rtz; /* True if trailing zeros should be removed */
2095721178
#endif
2095821179
PrintfArguments *pArgList = 0; /* Arguments for SQLITE_PRINTF_SQLFUNC */
2095921180
char buf[etBUFSIZE]; /* Conversion buffer */
2096021181
21182
+#ifdef SQLITE_ENABLE_API_ARMOR
21183
+ if( ap==0 ){
21184
+ (void)SQLITE_MISUSE_BKPT;
21185
+ sqlite3StrAccumReset(pAccum);
21186
+ return;
21187
+ }
21188
+#endif
2096121189
bufpt = 0;
2096221190
if( bFlags ){
2096321191
if( (bArgList = (bFlags & SQLITE_PRINTF_SQLFUNC))!=0 ){
2096421192
pArgList = va_arg(ap, PrintfArguments*);
2096521193
}
@@ -21062,11 +21290,10 @@
2106221290
return;
2106321291
}
2106421292
break;
2106521293
}
2106621294
}
21067
- zExtra = 0;
2106821295
2106921296
/*
2107021297
** At this point, variables are initialized as follows:
2107121298
**
2107221299
** flag_alternateform TRUE if a '#' is present.
@@ -21353,17 +21580,20 @@
2135321580
bufpt = getTextArg(pArgList);
2135421581
c = bufpt ? bufpt[0] : 0;
2135521582
}else{
2135621583
c = va_arg(ap,int);
2135721584
}
21358
- buf[0] = (char)c;
21359
- if( precision>=0 ){
21360
- for(idx=1; idx<precision; idx++) buf[idx] = (char)c;
21361
- length = precision;
21362
- }else{
21363
- length =1;
21585
+ if( precision>1 ){
21586
+ width -= precision-1;
21587
+ if( width>1 && !flag_leftjustify ){
21588
+ sqlite3AppendChar(pAccum, width-1, ' ');
21589
+ width = 0;
21590
+ }
21591
+ sqlite3AppendChar(pAccum, precision-1, c);
2136421592
}
21593
+ length = 1;
21594
+ buf[0] = c;
2136521595
bufpt = buf;
2136621596
break;
2136721597
case etSTRING:
2136821598
case etDYNSTRING:
2136921599
if( bArgList ){
@@ -21460,15 +21690,18 @@
2146021690
** The text of the conversion is pointed to by "bufpt" and is
2146121691
** "length" characters long. The field width is "width". Do
2146221692
** the output.
2146321693
*/
2146421694
width -= length;
21465
- if( width>0 && !flag_leftjustify ) sqlite3AppendSpace(pAccum, width);
21695
+ if( width>0 && !flag_leftjustify ) sqlite3AppendChar(pAccum, width, ' ');
2146621696
sqlite3StrAccumAppend(pAccum, bufpt, length);
21467
- if( width>0 && flag_leftjustify ) sqlite3AppendSpace(pAccum, width);
21697
+ if( width>0 && flag_leftjustify ) sqlite3AppendChar(pAccum, width, ' ');
2146821698
21469
- if( zExtra ) sqlite3_free(zExtra);
21699
+ if( zExtra ){
21700
+ sqlite3_free(zExtra);
21701
+ zExtra = 0;
21702
+ }
2147021703
}/* End for loop over the format string */
2147121704
} /* End of function */
2147221705
2147321706
/*
2147421707
** Enlarge the memory allocation on a StrAccum object so that it is
@@ -21491,10 +21724,15 @@
2149121724
return N;
2149221725
}else{
2149321726
char *zOld = (p->zText==p->zBase ? 0 : p->zText);
2149421727
i64 szNew = p->nChar;
2149521728
szNew += N + 1;
21729
+ if( szNew+p->nChar<=p->mxAlloc ){
21730
+ /* Force exponential buffer size growth as long as it does not overflow,
21731
+ ** to avoid having to call this routine too often */
21732
+ szNew += p->nChar;
21733
+ }
2149621734
if( szNew > p->mxAlloc ){
2149721735
sqlite3StrAccumReset(p);
2149821736
setStrAccumError(p, STRACCUM_TOOBIG);
2149921737
return 0;
2150021738
}else{
@@ -21507,10 +21745,11 @@
2150721745
}
2150821746
if( zNew ){
2150921747
assert( p->zText!=0 || p->nChar==0 );
2151021748
if( zOld==0 && p->nChar>0 ) memcpy(zNew, p->zText, p->nChar);
2151121749
p->zText = zNew;
21750
+ p->nAlloc = sqlite3DbMallocSize(p->db, zNew);
2151221751
}else{
2151321752
sqlite3StrAccumReset(p);
2151421753
setStrAccumError(p, STRACCUM_NOMEM);
2151521754
return 0;
2151621755
}
@@ -21517,15 +21756,15 @@
2151721756
}
2151821757
return N;
2151921758
}
2152021759
2152121760
/*
21522
-** Append N space characters to the given string buffer.
21761
+** Append N copies of character c to the given string buffer.
2152321762
*/
21524
-SQLITE_PRIVATE void sqlite3AppendSpace(StrAccum *p, int N){
21763
+SQLITE_PRIVATE void sqlite3AppendChar(StrAccum *p, int N, char c){
2152521764
if( p->nChar+N >= p->nAlloc && (N = sqlite3StrAccumEnlarge(p, N))<=0 ) return;
21526
- while( (N--)>0 ) p->zText[p->nChar++] = ' ';
21765
+ while( (N--)>0 ) p->zText[p->nChar++] = c;
2152721766
}
2152821767
2152921768
/*
2153021769
** The StrAccum "p" is not large enough to accept N new bytes of z[].
2153121770
** So enlarge if first, then do the append.
@@ -21676,10 +21915,17 @@
2167621915
*/
2167721916
SQLITE_API char *sqlite3_vmprintf(const char *zFormat, va_list ap){
2167821917
char *z;
2167921918
char zBase[SQLITE_PRINT_BUF_SIZE];
2168021919
StrAccum acc;
21920
+
21921
+#ifdef SQLITE_ENABLE_API_ARMOR
21922
+ if( zFormat==0 ){
21923
+ (void)SQLITE_MISUSE_BKPT;
21924
+ return 0;
21925
+ }
21926
+#endif
2168121927
#ifndef SQLITE_OMIT_AUTOINIT
2168221928
if( sqlite3_initialize() ) return 0;
2168321929
#endif
2168421930
sqlite3StrAccumInit(&acc, zBase, sizeof(zBase), SQLITE_MAX_LENGTH);
2168521931
acc.useMalloc = 2;
@@ -21718,10 +21964,17 @@
2171821964
** sqlite3_vsnprintf() is the varargs version.
2171921965
*/
2172021966
SQLITE_API char *sqlite3_vsnprintf(int n, char *zBuf, const char *zFormat, va_list ap){
2172121967
StrAccum acc;
2172221968
if( n<=0 ) return zBuf;
21969
+#ifdef SQLITE_ENABLE_API_ARMOR
21970
+ if( zBuf==0 || zFormat==0 ) {
21971
+ (void)SQLITE_MISUSE_BKPT;
21972
+ if( zBuf && n>0 ) zBuf[0] = 0;
21973
+ return zBuf;
21974
+ }
21975
+#endif
2172321976
sqlite3StrAccumInit(&acc, zBuf, n, 0);
2172421977
acc.useMalloc = 0;
2172521978
sqlite3VXPrintf(&acc, 0, zFormat, ap);
2172621979
return sqlite3StrAccumFinish(&acc);
2172721980
}
@@ -21909,15 +22162,23 @@
2190922162
#else
2191022163
# define wsdPrng sqlite3Prng
2191122164
#endif
2191222165
2191322166
#if SQLITE_THREADSAFE
21914
- sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_PRNG);
22167
+ sqlite3_mutex *mutex;
22168
+#endif
22169
+
22170
+#ifndef SQLITE_OMIT_AUTOINIT
22171
+ if( sqlite3_initialize() ) return;
22172
+#endif
22173
+
22174
+#if SQLITE_THREADSAFE
22175
+ mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_PRNG);
22176
+#endif
22177
+
2191522178
sqlite3_mutex_enter(mutex);
21916
-#endif
21917
-
21918
- if( N<=0 ){
22179
+ if( N<=0 || pBuf==0 ){
2191922180
wsdPrng.isInit = 0;
2192022181
sqlite3_mutex_leave(mutex);
2192122182
return;
2192222183
}
2192322184
@@ -23035,17 +23296,27 @@
2303523296
** case-independent fashion, using the same definition of "case
2303623297
** independence" that SQLite uses internally when comparing identifiers.
2303723298
*/
2303823299
SQLITE_API int sqlite3_stricmp(const char *zLeft, const char *zRight){
2303923300
register unsigned char *a, *b;
23301
+ if( zLeft==0 ){
23302
+ return zRight ? -1 : 0;
23303
+ }else if( zRight==0 ){
23304
+ return 1;
23305
+ }
2304023306
a = (unsigned char *)zLeft;
2304123307
b = (unsigned char *)zRight;
2304223308
while( *a!=0 && UpperToLower[*a]==UpperToLower[*b]){ a++; b++; }
2304323309
return UpperToLower[*a] - UpperToLower[*b];
2304423310
}
2304523311
SQLITE_API int sqlite3_strnicmp(const char *zLeft, const char *zRight, int N){
2304623312
register unsigned char *a, *b;
23313
+ if( zLeft==0 ){
23314
+ return zRight ? -1 : 0;
23315
+ }else if( zRight==0 ){
23316
+ return 1;
23317
+ }
2304723318
a = (unsigned char *)zLeft;
2304823319
b = (unsigned char *)zRight;
2304923320
while( N-- > 0 && *a!=0 && UpperToLower[*a]==UpperToLower[*b]){ a++; b++; }
2305023321
return N<0 ? 0 : UpperToLower[*a] - UpperToLower[*b];
2305123322
}
@@ -32574,10 +32845,15 @@
3257432845
#if !SQLITE_OS_WINNT && !defined(SQLITE_OMIT_WAL)
3257532846
# error "WAL mode requires support from the Windows NT kernel, compile\
3257632847
with SQLITE_OMIT_WAL."
3257732848
#endif
3257832849
32850
+#if !SQLITE_OS_WINNT && SQLITE_MAX_MMAP_SIZE>0
32851
+# error "Memory mapped files require support from the Windows NT kernel,\
32852
+ compile with SQLITE_MAX_MMAP_SIZE=0."
32853
+#endif
32854
+
3257932855
/*
3258032856
** Are most of the Win32 ANSI APIs available (i.e. with certain exceptions
3258132857
** based on the sub-platform)?
3258232858
*/
3258332859
#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && !defined(SQLITE_WIN32_NO_ANSI)
@@ -32703,14 +32979,15 @@
3270332979
# define winGetDirSep() '\\'
3270432980
#endif
3270532981
3270632982
/*
3270732983
** Do we need to manually define the Win32 file mapping APIs for use with WAL
32708
-** mode (e.g. these APIs are available in the Windows CE SDK; however, they
32709
-** are not present in the header file)?
32984
+** mode or memory mapped files (e.g. these APIs are available in the Windows
32985
+** CE SDK; however, they are not present in the header file)?
3271032986
*/
32711
-#if SQLITE_WIN32_FILEMAPPING_API && !defined(SQLITE_OMIT_WAL)
32987
+#if SQLITE_WIN32_FILEMAPPING_API && \
32988
+ (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0)
3271232989
/*
3271332990
** Two of the file mapping APIs are different under WinRT. Figure out which
3271432991
** set we need.
3271532992
*/
3271632993
#if SQLITE_OS_WINRT
@@ -32734,11 +33011,11 @@
3273433011
3273533012
/*
3273633013
** This file mapping API is common to both Win32 and WinRT.
3273733014
*/
3273833015
WINBASEAPI BOOL WINAPI UnmapViewOfFile(LPCVOID);
32739
-#endif /* SQLITE_WIN32_FILEMAPPING_API && !defined(SQLITE_OMIT_WAL) */
33016
+#endif /* SQLITE_WIN32_FILEMAPPING_API */
3274033017
3274133018
/*
3274233019
** Some Microsoft compilers lack this definition.
3274333020
*/
3274433021
#ifndef INVALID_FILE_ATTRIBUTES
@@ -33027,21 +33304,21 @@
3302733304
3302833305
#define osCreateFileW ((HANDLE(WINAPI*)(LPCWSTR,DWORD,DWORD, \
3302933306
LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE))aSyscall[5].pCurrent)
3303033307
3303133308
#if (!SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_ANSI) && \
33032
- !defined(SQLITE_OMIT_WAL))
33309
+ (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0))
3303333310
{ "CreateFileMappingA", (SYSCALL)CreateFileMappingA, 0 },
3303433311
#else
3303533312
{ "CreateFileMappingA", (SYSCALL)0, 0 },
3303633313
#endif
3303733314
3303833315
#define osCreateFileMappingA ((HANDLE(WINAPI*)(HANDLE,LPSECURITY_ATTRIBUTES, \
3303933316
DWORD,DWORD,DWORD,LPCSTR))aSyscall[6].pCurrent)
3304033317
3304133318
#if SQLITE_OS_WINCE || (!SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) && \
33042
- !defined(SQLITE_OMIT_WAL))
33319
+ (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0))
3304333320
{ "CreateFileMappingW", (SYSCALL)CreateFileMappingW, 0 },
3304433321
#else
3304533322
{ "CreateFileMappingW", (SYSCALL)0, 0 },
3304633323
#endif
3304733324
@@ -33377,11 +33654,12 @@
3337733654
#ifndef osLockFileEx
3337833655
#define osLockFileEx ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD,DWORD, \
3337933656
LPOVERLAPPED))aSyscall[48].pCurrent)
3338033657
#endif
3338133658
33382
-#if SQLITE_OS_WINCE || (!SQLITE_OS_WINRT && !defined(SQLITE_OMIT_WAL))
33659
+#if SQLITE_OS_WINCE || (!SQLITE_OS_WINRT && \
33660
+ (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0))
3338333661
{ "MapViewOfFile", (SYSCALL)MapViewOfFile, 0 },
3338433662
#else
3338533663
{ "MapViewOfFile", (SYSCALL)0, 0 },
3338633664
#endif
3338733665
@@ -33447,11 +33725,11 @@
3344733725
#endif
3344833726
3344933727
#define osUnlockFileEx ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \
3345033728
LPOVERLAPPED))aSyscall[58].pCurrent)
3345133729
33452
-#if SQLITE_OS_WINCE || !defined(SQLITE_OMIT_WAL)
33730
+#if SQLITE_OS_WINCE || !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0
3345333731
{ "UnmapViewOfFile", (SYSCALL)UnmapViewOfFile, 0 },
3345433732
#else
3345533733
{ "UnmapViewOfFile", (SYSCALL)0, 0 },
3345633734
#endif
3345733735
@@ -33510,11 +33788,11 @@
3351033788
#endif
3351133789
3351233790
#define osGetFileInformationByHandleEx ((BOOL(WINAPI*)(HANDLE, \
3351333791
FILE_INFO_BY_HANDLE_CLASS,LPVOID,DWORD))aSyscall[66].pCurrent)
3351433792
33515
-#if SQLITE_OS_WINRT && !defined(SQLITE_OMIT_WAL)
33793
+#if SQLITE_OS_WINRT && (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0)
3351633794
{ "MapViewOfFileFromApp", (SYSCALL)MapViewOfFileFromApp, 0 },
3351733795
#else
3351833796
{ "MapViewOfFileFromApp", (SYSCALL)0, 0 },
3351933797
#endif
3352033798
@@ -33574,11 +33852,11 @@
3357433852
3357533853
{ "GetProcessHeap", (SYSCALL)GetProcessHeap, 0 },
3357633854
3357733855
#define osGetProcessHeap ((HANDLE(WINAPI*)(VOID))aSyscall[74].pCurrent)
3357833856
33579
-#if SQLITE_OS_WINRT && !defined(SQLITE_OMIT_WAL)
33857
+#if SQLITE_OS_WINRT && (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0)
3358033858
{ "CreateFileMappingFromApp", (SYSCALL)CreateFileMappingFromApp, 0 },
3358133859
#else
3358233860
{ "CreateFileMappingFromApp", (SYSCALL)0, 0 },
3358333861
#endif
3358433862
@@ -39150,10 +39428,17 @@
3915039428
*/
3915139429
SQLITE_PRIVATE void sqlite3PcacheShrink(PCache *pCache){
3915239430
assert( pCache->pCache!=0 );
3915339431
sqlite3GlobalConfig.pcache2.xShrink(pCache->pCache);
3915439432
}
39433
+
39434
+/*
39435
+** Return the size of the header added by this middleware layer
39436
+** in the page-cache hierarchy.
39437
+*/
39438
+SQLITE_PRIVATE int sqlite3HeaderSizePcache(void){ return sizeof(PgHdr); }
39439
+
3915539440
3915639441
#if defined(SQLITE_CHECK_PAGES) || defined(SQLITE_DEBUG)
3915739442
/*
3915839443
** For all dirty pages currently in the cache, invoke the specified
3915939444
** callback. This is only used if the SQLITE_CHECK_PAGES macro is
@@ -40149,10 +40434,15 @@
4014940434
pcache1Shrink /* xShrink */
4015040435
};
4015140436
sqlite3_config(SQLITE_CONFIG_PCACHE2, &defaultMethods);
4015240437
}
4015340438
40439
+/*
40440
+** Return the size of the header on each page of this PCACHE implementation.
40441
+*/
40442
+SQLITE_PRIVATE int sqlite3HeaderSizePcache1(void){ return sizeof(PgHdr1); }
40443
+
4015440444
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
4015540445
/*
4015640446
** This function is called to free superfluous dynamically allocated memory
4015740447
** held by the pager system. Memory in use by any SQLite pager allocated
4015840448
** by the current thread may be sqlite3_free()ed.
@@ -43758,11 +44048,11 @@
4375844048
** should be page numbers which are never 0xffffffff. So filling
4375944049
** pPager->dbFileVers[] with all 0xff bytes should suffice.
4376044050
**
4376144051
** For an encrypted database, the situation is more complex: bytes
4376244052
** 24..39 of the database are white noise. But the probability of
43763
- ** white noising equaling 16 bytes of 0xff is vanishingly small so
44053
+ ** white noise equaling 16 bytes of 0xff is vanishingly small so
4376444054
** we should still be ok.
4376544055
*/
4376644056
memset(pPager->dbFileVers, 0xff, sizeof(pPager->dbFileVers));
4376744057
}else{
4376844058
u8 *dbFileVers = &((u8*)pPg->pData)[24];
@@ -47705,10 +47995,22 @@
4770547995
}
4770647996
4770747997
return SQLITE_OK;
4770847998
}
4770947999
#endif
48000
+
48001
+/*
48002
+** The page handle passed as the first argument refers to a dirty page
48003
+** with a page number other than iNew. This function changes the page's
48004
+** page number to iNew and sets the value of the PgHdr.flags field to
48005
+** the value passed as the third parameter.
48006
+*/
48007
+SQLITE_PRIVATE void sqlite3PagerRekey(DbPage *pPg, Pgno iNew, u16 flags){
48008
+ assert( pPg->pgno!=iNew );
48009
+ pPg->flags = flags;
48010
+ sqlite3PcacheMove(pPg, iNew);
48011
+}
4771048012
4771148013
/*
4771248014
** Return a pointer to the data for the specified page.
4771348015
*/
4771448016
SQLITE_PRIVATE void *sqlite3PagerGetData(DbPage *pPg){
@@ -47922,11 +48224,12 @@
4792248224
*/
4792348225
SQLITE_PRIVATE int sqlite3PagerCheckpoint(Pager *pPager, int eMode, int *pnLog, int *pnCkpt){
4792448226
int rc = SQLITE_OK;
4792548227
if( pPager->pWal ){
4792648228
rc = sqlite3WalCheckpoint(pPager->pWal, eMode,
47927
- pPager->xBusyHandler, pPager->pBusyHandlerArg,
48229
+ (eMode==SQLITE_CHECKPOINT_PASSIVE ? 0 : pPager->xBusyHandler),
48230
+ pPager->pBusyHandlerArg,
4792848231
pPager->ckptSyncFlags, pPager->pageSize, (u8 *)pPager->pTmpSpace,
4792948232
pnLog, pnCkpt
4793048233
);
4793148234
}
4793248235
return rc;
@@ -48103,10 +48406,11 @@
4810348406
SQLITE_PRIVATE int sqlite3PagerWalFramesize(Pager *pPager){
4810448407
assert( pPager->eState>=PAGER_READER );
4810548408
return sqlite3WalFramesize(pPager->pWal);
4810648409
}
4810748410
#endif
48411
+
4810848412
4810948413
#endif /* SQLITE_OMIT_DISKIO */
4811048414
4811148415
/************** End of pager.c ***********************************************/
4811248416
/************** Begin file wal.c *********************************************/
@@ -49613,11 +49917,11 @@
4961349917
4961449918
/*
4961549919
** Free an iterator allocated by walIteratorInit().
4961649920
*/
4961749921
static void walIteratorFree(WalIterator *p){
49618
- sqlite3ScratchFree(p);
49922
+ sqlite3_free(p);
4961949923
}
4962049924
4962149925
/*
4962249926
** Construct a WalInterator object that can be used to loop over all
4962349927
** pages in the WAL in ascending order. The caller must hold the checkpoint
@@ -49648,21 +49952,21 @@
4964849952
/* Allocate space for the WalIterator object. */
4964949953
nSegment = walFramePage(iLast) + 1;
4965049954
nByte = sizeof(WalIterator)
4965149955
+ (nSegment-1)*sizeof(struct WalSegment)
4965249956
+ iLast*sizeof(ht_slot);
49653
- p = (WalIterator *)sqlite3ScratchMalloc(nByte);
49957
+ p = (WalIterator *)sqlite3_malloc(nByte);
4965449958
if( !p ){
4965549959
return SQLITE_NOMEM;
4965649960
}
4965749961
memset(p, 0, nByte);
4965849962
p->nSegment = nSegment;
4965949963
4966049964
/* Allocate temporary space used by the merge-sort routine. This block
4966149965
** of memory will be freed before this function returns.
4966249966
*/
49663
- aTmp = (ht_slot *)sqlite3ScratchMalloc(
49967
+ aTmp = (ht_slot *)sqlite3_malloc(
4966449968
sizeof(ht_slot) * (iLast>HASHTABLE_NPAGE?HASHTABLE_NPAGE:iLast)
4966549969
);
4966649970
if( !aTmp ){
4966749971
rc = SQLITE_NOMEM;
4966849972
}
@@ -49695,11 +49999,11 @@
4969549999
p->aSegment[i].nEntry = nEntry;
4969650000
p->aSegment[i].aIndex = aIndex;
4969750001
p->aSegment[i].aPgno = (u32 *)aPgno;
4969850002
}
4969950003
}
49700
- sqlite3ScratchFree(aTmp);
50004
+ sqlite3_free(aTmp);
4970150005
4970250006
if( rc!=SQLITE_OK ){
4970350007
walIteratorFree(p);
4970450008
}
4970550009
*pp = p;
@@ -49731,10 +50035,42 @@
4973150035
** Return the page-size in bytes used by the database.
4973250036
*/
4973350037
static int walPagesize(Wal *pWal){
4973450038
return (pWal->hdr.szPage&0xfe00) + ((pWal->hdr.szPage&0x0001)<<16);
4973550039
}
50040
+
50041
+/*
50042
+** The following is guaranteed when this function is called:
50043
+**
50044
+** a) the WRITER lock is held,
50045
+** b) the entire log file has been checkpointed, and
50046
+** c) any existing readers are reading exclusively from the database
50047
+** file - there are no readers that may attempt to read a frame from
50048
+** the log file.
50049
+**
50050
+** This function updates the shared-memory structures so that the next
50051
+** client to write to the database (which may be this one) does so by
50052
+** writing frames into the start of the log file.
50053
+**
50054
+** The value of parameter salt1 is used as the aSalt[1] value in the
50055
+** new wal-index header. It should be passed a pseudo-random value (i.e.
50056
+** one obtained from sqlite3_randomness()).
50057
+*/
50058
+static void walRestartHdr(Wal *pWal, u32 salt1){
50059
+ volatile WalCkptInfo *pInfo = walCkptInfo(pWal);
50060
+ int i; /* Loop counter */
50061
+ u32 *aSalt = pWal->hdr.aSalt; /* Big-endian salt values */
50062
+ pWal->nCkpt++;
50063
+ pWal->hdr.mxFrame = 0;
50064
+ sqlite3Put4byte((u8*)&aSalt[0], 1 + sqlite3Get4byte((u8*)&aSalt[0]));
50065
+ memcpy(&pWal->hdr.aSalt[1], &salt1, 4);
50066
+ walIndexWriteHdr(pWal);
50067
+ pInfo->nBackfill = 0;
50068
+ pInfo->aReadMark[1] = 0;
50069
+ for(i=2; i<WAL_NREADER; i++) pInfo->aReadMark[i] = READMARK_NOT_USED;
50070
+ assert( pInfo->aReadMark[0]==0 );
50071
+}
4973650072
4973750073
/*
4973850074
** Copy as much content as we can from the WAL back into the database file
4973950075
** in response to an sqlite3_wal_checkpoint() request or the equivalent.
4974050076
**
@@ -49766,11 +50102,11 @@
4976650102
** time.
4976750103
*/
4976850104
static int walCheckpoint(
4976950105
Wal *pWal, /* Wal connection */
4977050106
int eMode, /* One of PASSIVE, FULL or RESTART */
49771
- int (*xBusyCall)(void*), /* Function to call when busy */
50107
+ int (*xBusy)(void*), /* Function to call when busy */
4977250108
void *pBusyArg, /* Context argument for xBusyHandler */
4977350109
int sync_flags, /* Flags for OsSync() (or 0) */
4977450110
u8 *zBuf /* Temporary buffer to use */
4977550111
){
4977650112
int rc; /* Return code */
@@ -49780,11 +50116,10 @@
4978050116
u32 iFrame = 0; /* Wal frame containing data for iDbpage */
4978150117
u32 mxSafeFrame; /* Max frame that can be backfilled */
4978250118
u32 mxPage; /* Max database page to write */
4978350119
int i; /* Loop counter */
4978450120
volatile WalCkptInfo *pInfo; /* The checkpoint status information */
49785
- int (*xBusy)(void*) = 0; /* Function to call when waiting for locks */
4978650121
4978750122
szPage = walPagesize(pWal);
4978850123
testcase( szPage<=32768 );
4978950124
testcase( szPage>=65536 );
4979050125
pInfo = walCkptInfo(pWal);
@@ -49795,11 +50130,13 @@
4979550130
if( rc!=SQLITE_OK ){
4979650131
return rc;
4979750132
}
4979850133
assert( pIter );
4979950134
49800
- if( eMode!=SQLITE_CHECKPOINT_PASSIVE ) xBusy = xBusyCall;
50135
+ /* EVIDENCE-OF: R-62920-47450 The busy-handler callback is never invoked
50136
+ ** in the SQLITE_CHECKPOINT_PASSIVE mode. */
50137
+ assert( eMode!=SQLITE_CHECKPOINT_PASSIVE || xBusy==0 );
4980150138
4980250139
/* Compute in mxSafeFrame the index of the last frame of the WAL that is
4980350140
** safe to write into the database. Frames beyond mxSafeFrame might
4980450141
** overwrite database pages that are in use by active readers and thus
4980550142
** cannot be backfilled from the WAL.
@@ -49884,23 +50221,42 @@
4988450221
/* Reset the return code so as not to report a checkpoint failure
4988550222
** just because there are active readers. */
4988650223
rc = SQLITE_OK;
4988750224
}
4988850225
49889
- /* If this is an SQLITE_CHECKPOINT_RESTART operation, and the entire wal
49890
- ** file has been copied into the database file, then block until all
49891
- ** readers have finished using the wal file. This ensures that the next
49892
- ** process to write to the database restarts the wal file.
50226
+ /* If this is an SQLITE_CHECKPOINT_RESTART or TRUNCATE operation, and the
50227
+ ** entire wal file has been copied into the database file, then block
50228
+ ** until all readers have finished using the wal file. This ensures that
50229
+ ** the next process to write to the database restarts the wal file.
4989350230
*/
4989450231
if( rc==SQLITE_OK && eMode!=SQLITE_CHECKPOINT_PASSIVE ){
4989550232
assert( pWal->writeLock );
4989650233
if( pInfo->nBackfill<pWal->hdr.mxFrame ){
4989750234
rc = SQLITE_BUSY;
49898
- }else if( eMode==SQLITE_CHECKPOINT_RESTART ){
50235
+ }else if( eMode>=SQLITE_CHECKPOINT_RESTART ){
50236
+ u32 salt1;
50237
+ sqlite3_randomness(4, &salt1);
4989950238
assert( mxSafeFrame==pWal->hdr.mxFrame );
4990050239
rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_READ_LOCK(1), WAL_NREADER-1);
4990150240
if( rc==SQLITE_OK ){
50241
+ if( eMode==SQLITE_CHECKPOINT_TRUNCATE ){
50242
+ /* IMPLEMENTATION-OF: R-44699-57140 This mode works the same way as
50243
+ ** SQLITE_CHECKPOINT_RESTART with the addition that it also
50244
+ ** truncates the log file to zero bytes just prior to a
50245
+ ** successful return.
50246
+ **
50247
+ ** In theory, it might be safe to do this without updating the
50248
+ ** wal-index header in shared memory, as all subsequent reader or
50249
+ ** writer clients should see that the entire log file has been
50250
+ ** checkpointed and behave accordingly. This seems unsafe though,
50251
+ ** as it would leave the system in a state where the contents of
50252
+ ** the wal-index header do not match the contents of the
50253
+ ** file-system. To avoid this, update the wal-index header to
50254
+ ** indicate that the log file contains zero valid frames. */
50255
+ walRestartHdr(pWal, salt1);
50256
+ rc = sqlite3OsTruncate(pWal->pWalFd, 0);
50257
+ }
4990250258
walUnlockExclusive(pWal, WAL_READ_LOCK(1), WAL_NREADER-1);
4990350259
}
4990450260
}
4990550261
}
4990650262
@@ -50634,11 +50990,10 @@
5063450990
assert( walFramePgno(pWal, iFrame)!=1 );
5063550991
rc = xUndo(pUndoCtx, walFramePgno(pWal, iFrame));
5063650992
}
5063750993
if( iMax!=pWal->hdr.mxFrame ) walCleanupHash(pWal);
5063850994
}
50639
- assert( rc==SQLITE_OK );
5064050995
return rc;
5064150996
}
5064250997
5064350998
/*
5064450999
** Argument aWalData must point to an array of WAL_SAVEPOINT_NDATA u32
@@ -50683,11 +51038,10 @@
5068351038
}
5068451039
5068551040
return rc;
5068651041
}
5068751042
50688
-
5068951043
/*
5069051044
** This function is called just before writing a set of frames to the log
5069151045
** file (see sqlite3WalFrames()). It checks to see if, instead of appending
5069251046
** to the current log file, it is possible to overwrite the start of the
5069351047
** existing log file with the new frames (i.e. "reset" the log). If so,
@@ -50716,24 +51070,12 @@
5071651070
** wal-index header to reflect this.
5071751071
**
5071851072
** In theory it would be Ok to update the cache of the header only
5071951073
** at this point. But updating the actual wal-index header is also
5072051074
** safe and means there is no special case for sqlite3WalUndo()
50721
- ** to handle if this transaction is rolled back.
50722
- */
50723
- int i; /* Loop counter */
50724
- u32 *aSalt = pWal->hdr.aSalt; /* Big-endian salt values */
50725
-
50726
- pWal->nCkpt++;
50727
- pWal->hdr.mxFrame = 0;
50728
- sqlite3Put4byte((u8*)&aSalt[0], 1 + sqlite3Get4byte((u8*)&aSalt[0]));
50729
- aSalt[1] = salt1;
50730
- walIndexWriteHdr(pWal);
50731
- pInfo->nBackfill = 0;
50732
- pInfo->aReadMark[1] = 0;
50733
- for(i=2; i<WAL_NREADER; i++) pInfo->aReadMark[i] = READMARK_NOT_USED;
50734
- assert( pInfo->aReadMark[0]==0 );
51075
+ ** to handle if this transaction is rolled back. */
51076
+ walRestartHdr(pWal, salt1);
5073551077
walUnlockExclusive(pWal, WAL_READ_LOCK(1), WAL_NREADER-1);
5073651078
}else if( rc!=SQLITE_BUSY ){
5073751079
return rc;
5073851080
}
5073951081
}
@@ -51017,11 +51359,11 @@
5101751359
** If parameter xBusy is not NULL, it is a pointer to a busy-handler
5101851360
** callback. In this case this function runs a blocking checkpoint.
5101951361
*/
5102051362
SQLITE_PRIVATE int sqlite3WalCheckpoint(
5102151363
Wal *pWal, /* Wal connection */
51022
- int eMode, /* PASSIVE, FULL or RESTART */
51364
+ int eMode, /* PASSIVE, FULL, RESTART, or TRUNCATE */
5102351365
int (*xBusy)(void*), /* Function to call when busy */
5102451366
void *pBusyArg, /* Context argument for xBusyHandler */
5102551367
int sync_flags, /* Flags to sync db file with (or 0) */
5102651368
int nBuf, /* Size of temporary buffer */
5102751369
u8 *zBuf, /* Temporary buffer to use */
@@ -51029,40 +51371,54 @@
5102951371
int *pnCkpt /* OUT: Number of backfilled frames in WAL */
5103051372
){
5103151373
int rc; /* Return code */
5103251374
int isChanged = 0; /* True if a new wal-index header is loaded */
5103351375
int eMode2 = eMode; /* Mode to pass to walCheckpoint() */
51376
+ int (*xBusy2)(void*) = xBusy; /* Busy handler for eMode2 */
5103451377
5103551378
assert( pWal->ckptLock==0 );
5103651379
assert( pWal->writeLock==0 );
5103751380
51381
+ /* EVIDENCE-OF: R-62920-47450 The busy-handler callback is never invoked
51382
+ ** in the SQLITE_CHECKPOINT_PASSIVE mode. */
51383
+ assert( eMode!=SQLITE_CHECKPOINT_PASSIVE || xBusy==0 );
51384
+
5103851385
if( pWal->readOnly ) return SQLITE_READONLY;
5103951386
WALTRACE(("WAL%p: checkpoint begins\n", pWal));
51387
+
51388
+ /* IMPLEMENTATION-OF: R-62028-47212 All calls obtain an exclusive
51389
+ ** "checkpoint" lock on the database file. */
5104051390
rc = walLockExclusive(pWal, WAL_CKPT_LOCK, 1);
5104151391
if( rc ){
51042
- /* Usually this is SQLITE_BUSY meaning that another thread or process
51043
- ** is already running a checkpoint, or maybe a recovery. But it might
51044
- ** also be SQLITE_IOERR. */
51392
+ /* EVIDENCE-OF: R-10421-19736 If any other process is running a
51393
+ ** checkpoint operation at the same time, the lock cannot be obtained and
51394
+ ** SQLITE_BUSY is returned.
51395
+ ** EVIDENCE-OF: R-53820-33897 Even if there is a busy-handler configured,
51396
+ ** it will not be invoked in this case.
51397
+ */
51398
+ testcase( rc==SQLITE_BUSY );
51399
+ testcase( xBusy!=0 );
5104551400
return rc;
5104651401
}
5104751402
pWal->ckptLock = 1;
5104851403
51049
- /* If this is a blocking-checkpoint, then obtain the write-lock as well
51050
- ** to prevent any writers from running while the checkpoint is underway.
51051
- ** This has to be done before the call to walIndexReadHdr() below.
51404
+ /* IMPLEMENTATION-OF: R-59782-36818 The SQLITE_CHECKPOINT_FULL, RESTART and
51405
+ ** TRUNCATE modes also obtain the exclusive "writer" lock on the database
51406
+ ** file.
5105251407
**
51053
- ** If the writer lock cannot be obtained, then a passive checkpoint is
51054
- ** run instead. Since the checkpointer is not holding the writer lock,
51055
- ** there is no point in blocking waiting for any readers. Assuming no
51056
- ** other error occurs, this function will return SQLITE_BUSY to the caller.
51408
+ ** EVIDENCE-OF: R-60642-04082 If the writer lock cannot be obtained
51409
+ ** immediately, and a busy-handler is configured, it is invoked and the
51410
+ ** writer lock retried until either the busy-handler returns 0 or the
51411
+ ** lock is successfully obtained.
5105751412
*/
5105851413
if( eMode!=SQLITE_CHECKPOINT_PASSIVE ){
5105951414
rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_WRITE_LOCK, 1);
5106051415
if( rc==SQLITE_OK ){
5106151416
pWal->writeLock = 1;
5106251417
}else if( rc==SQLITE_BUSY ){
5106351418
eMode2 = SQLITE_CHECKPOINT_PASSIVE;
51419
+ xBusy2 = 0;
5106451420
rc = SQLITE_OK;
5106551421
}
5106651422
}
5106751423
5106851424
/* Read the wal-index header. */
@@ -51076,11 +51432,11 @@
5107651432
/* Copy data from the log to the database file. */
5107751433
if( rc==SQLITE_OK ){
5107851434
if( pWal->hdr.mxFrame && walPagesize(pWal)!=nBuf ){
5107951435
rc = SQLITE_CORRUPT_BKPT;
5108051436
}else{
51081
- rc = walCheckpoint(pWal, eMode2, xBusy, pBusyArg, sync_flags, zBuf);
51437
+ rc = walCheckpoint(pWal, eMode2, xBusy2, pBusyArg, sync_flags, zBuf);
5108251438
}
5108351439
5108451440
/* If no error occurred, set the output variables. */
5108551441
if( rc==SQLITE_OK || rc==SQLITE_BUSY ){
5108651442
if( pnLog ) *pnLog = (int)pWal->hdr.mxFrame;
@@ -51713,10 +52069,15 @@
5171352069
** but cursors cannot be shared. Each cursor is associated with a
5171452070
** particular database connection identified BtCursor.pBtree.db.
5171552071
**
5171652072
** Fields in this structure are accessed under the BtShared.mutex
5171752073
** found at self->pBt->mutex.
52074
+**
52075
+** skipNext meaning:
52076
+** eState==SKIPNEXT && skipNext>0: Next sqlite3BtreeNext() is no-op.
52077
+** eState==SKIPNEXT && skipNext<0: Next sqlite3BtreePrevious() is no-op.
52078
+** eState==FAULT: Cursor fault with skipNext as error code.
5171852079
*/
5171952080
struct BtCursor {
5172052081
Btree *pBtree; /* The Btree to which this cursor belongs */
5172152082
BtShared *pBt; /* The BtShared this cursor points to */
5172252083
BtCursor *pNext, *pPrev; /* Forms a linked list of all cursors */
@@ -51725,11 +52086,12 @@
5172552086
CellInfo info; /* A parse of the cell we are pointing at */
5172652087
i64 nKey; /* Size of pKey, or last integer key */
5172752088
void *pKey; /* Saved key that was cursor last known position */
5172852089
Pgno pgnoRoot; /* The root page of this tree */
5172952090
int nOvflAlloc; /* Allocated size of aOverflow[] array */
51730
- int skipNext; /* Prev() is noop if negative. Next() is noop if positive */
52091
+ int skipNext; /* Prev() is noop if negative. Next() is noop if positive.
52092
+ ** Error code if eState==CURSOR_FAULT */
5173152093
u8 curFlags; /* zero or more BTCF_* flags defined below */
5173252094
u8 eState; /* One of the CURSOR_XXX constants (see below) */
5173352095
u8 hints; /* As configured by CursorSetHints() */
5173452096
i16 iPage; /* Index of current page in apPage */
5173552097
u16 aiIdx[BTCURSOR_MAX_DEPTH]; /* Current index in apPage[i] */
@@ -51771,11 +52133,11 @@
5177152133
** CURSOR_FAULT:
5177252134
** An unrecoverable error (an I/O error or a malloc failure) has occurred
5177352135
** on a different connection that shares the BtShared cache with this
5177452136
** cursor. The error has left the cache in an inconsistent state.
5177552137
** Do nothing else with this cursor. Any attempt to use the cursor
51776
-** should return the error code stored in BtCursor.skip
52138
+** should return the error code stored in BtCursor.skipNext
5177752139
*/
5177852140
#define CURSOR_INVALID 0
5177952141
#define CURSOR_VALID 1
5178052142
#define CURSOR_SKIPNEXT 2
5178152143
#define CURSOR_REQUIRESEEK 3
@@ -53321,10 +53683,15 @@
5332153683
/*
5332253684
** Defragment the page given. All Cells are moved to the
5332353685
** end of the page and all free space is collected into one
5332453686
** big FreeBlk that occurs in between the header and cell
5332553687
** pointer array and the cell content area.
53688
+**
53689
+** EVIDENCE-OF: R-44582-60138 SQLite may from time to time reorganize a
53690
+** b-tree page so that there are no freeblocks or fragment bytes, all
53691
+** unused bytes are contained in the unallocated space region, and all
53692
+** cells are packed tightly at the end of the page.
5332653693
*/
5332753694
static int defragmentPage(MemPage *pPage){
5332853695
int i; /* Loop counter */
5332953696
int pc; /* Address of the i-th cell */
5333053697
int hdr; /* Offset to the page header */
@@ -53333,28 +53700,27 @@
5333353700
int cellOffset; /* Offset to the cell pointer array */
5333453701
int cbrk; /* Offset to the cell content area */
5333553702
int nCell; /* Number of cells on the page */
5333653703
unsigned char *data; /* The page data */
5333753704
unsigned char *temp; /* Temp area for cell content */
53705
+ unsigned char *src; /* Source of content */
5333853706
int iCellFirst; /* First allowable cell index */
5333953707
int iCellLast; /* Last possible cell index */
5334053708
5334153709
5334253710
assert( sqlite3PagerIswriteable(pPage->pDbPage) );
5334353711
assert( pPage->pBt!=0 );
5334453712
assert( pPage->pBt->usableSize <= SQLITE_MAX_PAGE_SIZE );
5334553713
assert( pPage->nOverflow==0 );
5334653714
assert( sqlite3_mutex_held(pPage->pBt->mutex) );
53347
- temp = sqlite3PagerTempSpace(pPage->pBt->pPager);
53348
- data = pPage->aData;
53715
+ temp = 0;
53716
+ src = data = pPage->aData;
5334953717
hdr = pPage->hdrOffset;
5335053718
cellOffset = pPage->cellOffset;
5335153719
nCell = pPage->nCell;
5335253720
assert( nCell==get2byte(&data[hdr+3]) );
5335353721
usableSize = pPage->pBt->usableSize;
53354
- cbrk = get2byte(&data[hdr+5]);
53355
- memcpy(&temp[cbrk], &data[cbrk], usableSize - cbrk);
5335653722
cbrk = usableSize;
5335753723
iCellFirst = cellOffset + 2*nCell;
5335853724
iCellLast = usableSize - 4;
5335953725
for(i=0; i<nCell; i++){
5336053726
u8 *pAddr; /* The i-th cell pointer */
@@ -53369,11 +53735,11 @@
5336953735
if( pc<iCellFirst || pc>iCellLast ){
5337053736
return SQLITE_CORRUPT_BKPT;
5337153737
}
5337253738
#endif
5337353739
assert( pc>=iCellFirst && pc<=iCellLast );
53374
- size = cellSizePtr(pPage, &temp[pc]);
53740
+ size = cellSizePtr(pPage, &src[pc]);
5337553741
cbrk -= size;
5337653742
#if defined(SQLITE_ENABLE_OVERSIZE_CELL_CHECK)
5337753743
if( cbrk<iCellFirst ){
5337853744
return SQLITE_CORRUPT_BKPT;
5337953745
}
@@ -53383,12 +53749,20 @@
5338353749
}
5338453750
#endif
5338553751
assert( cbrk+size<=usableSize && cbrk>=iCellFirst );
5338653752
testcase( cbrk+size==usableSize );
5338753753
testcase( pc+size==usableSize );
53388
- memcpy(&data[cbrk], &temp[pc], size);
5338953754
put2byte(pAddr, cbrk);
53755
+ if( temp==0 ){
53756
+ int x;
53757
+ if( cbrk==pc ) continue;
53758
+ temp = sqlite3PagerTempSpace(pPage->pBt->pPager);
53759
+ x = get2byte(&data[hdr+5]);
53760
+ memcpy(&temp[x], &data[x], (cbrk+size) - x);
53761
+ src = temp;
53762
+ }
53763
+ memcpy(&data[cbrk], &src[pc], size);
5339053764
}
5339153765
assert( cbrk>=iCellFirst );
5339253766
put2byte(&data[hdr+5], cbrk);
5339353767
data[hdr+1] = 0;
5339453768
data[hdr+2] = 0;
@@ -53398,10 +53772,73 @@
5339853772
if( cbrk-iCellFirst!=pPage->nFree ){
5339953773
return SQLITE_CORRUPT_BKPT;
5340053774
}
5340153775
return SQLITE_OK;
5340253776
}
53777
+
53778
+/*
53779
+** Search the free-list on page pPg for space to store a cell nByte bytes in
53780
+** size. If one can be found, return a pointer to the space and remove it
53781
+** from the free-list.
53782
+**
53783
+** If no suitable space can be found on the free-list, return NULL.
53784
+**
53785
+** This function may detect corruption within pPg. If corruption is
53786
+** detected then *pRc is set to SQLITE_CORRUPT and NULL is returned.
53787
+**
53788
+** If a slot of at least nByte bytes is found but cannot be used because
53789
+** there are already at least 60 fragmented bytes on the page, return NULL.
53790
+** In this case, if pbDefrag parameter is not NULL, set *pbDefrag to true.
53791
+*/
53792
+static u8 *pageFindSlot(MemPage *pPg, int nByte, int *pRc, int *pbDefrag){
53793
+ const int hdr = pPg->hdrOffset;
53794
+ u8 * const aData = pPg->aData;
53795
+ int iAddr;
53796
+ int pc;
53797
+ int usableSize = pPg->pBt->usableSize;
53798
+
53799
+ for(iAddr=hdr+1; (pc = get2byte(&aData[iAddr]))>0; iAddr=pc){
53800
+ int size; /* Size of the free slot */
53801
+ /* EVIDENCE-OF: R-06866-39125 Freeblocks are always connected in order of
53802
+ ** increasing offset. */
53803
+ if( pc>usableSize-4 || pc<iAddr+4 ){
53804
+ *pRc = SQLITE_CORRUPT_BKPT;
53805
+ return 0;
53806
+ }
53807
+ /* EVIDENCE-OF: R-22710-53328 The third and fourth bytes of each
53808
+ ** freeblock form a big-endian integer which is the size of the freeblock
53809
+ ** in bytes, including the 4-byte header. */
53810
+ size = get2byte(&aData[pc+2]);
53811
+ if( size>=nByte ){
53812
+ int x = size - nByte;
53813
+ testcase( x==4 );
53814
+ testcase( x==3 );
53815
+ if( x<4 ){
53816
+ /* EVIDENCE-OF: R-11498-58022 In a well-formed b-tree page, the total
53817
+ ** number of bytes in fragments may not exceed 60. */
53818
+ if( aData[hdr+7]>=60 ){
53819
+ if( pbDefrag ) *pbDefrag = 1;
53820
+ return 0;
53821
+ }
53822
+ /* Remove the slot from the free-list. Update the number of
53823
+ ** fragmented bytes within the page. */
53824
+ memcpy(&aData[iAddr], &aData[pc], 2);
53825
+ aData[hdr+7] += (u8)x;
53826
+ }else if( size+pc > usableSize ){
53827
+ *pRc = SQLITE_CORRUPT_BKPT;
53828
+ return 0;
53829
+ }else{
53830
+ /* The slot remains on the free-list. Reduce its size to account
53831
+ ** for the portion used by the new allocation. */
53832
+ put2byte(&aData[pc+2], x);
53833
+ }
53834
+ return &aData[pc + x];
53835
+ }
53836
+ }
53837
+
53838
+ return 0;
53839
+}
5340353840
5340453841
/*
5340553842
** Allocate nByte bytes of space from within the B-Tree page passed
5340653843
** as the first argument. Write into *pIdx the index into pPage->aData[]
5340753844
** of the first byte of allocated space. Return either SQLITE_OK or
@@ -53416,80 +53853,58 @@
5341653853
*/
5341753854
static int allocateSpace(MemPage *pPage, int nByte, int *pIdx){
5341853855
const int hdr = pPage->hdrOffset; /* Local cache of pPage->hdrOffset */
5341953856
u8 * const data = pPage->aData; /* Local cache of pPage->aData */
5342053857
int top; /* First byte of cell content area */
53858
+ int rc = SQLITE_OK; /* Integer return code */
5342153859
int gap; /* First byte of gap between cell pointers and cell content */
53422
- int rc; /* Integer return code */
53423
- int usableSize; /* Usable size of the page */
5342453860
5342553861
assert( sqlite3PagerIswriteable(pPage->pDbPage) );
5342653862
assert( pPage->pBt );
5342753863
assert( sqlite3_mutex_held(pPage->pBt->mutex) );
5342853864
assert( nByte>=0 ); /* Minimum cell size is 4 */
5342953865
assert( pPage->nFree>=nByte );
5343053866
assert( pPage->nOverflow==0 );
53431
- usableSize = pPage->pBt->usableSize;
53432
- assert( nByte < usableSize-8 );
53867
+ assert( nByte < (int)(pPage->pBt->usableSize-8) );
5343353868
5343453869
assert( pPage->cellOffset == hdr + 12 - 4*pPage->leaf );
5343553870
gap = pPage->cellOffset + 2*pPage->nCell;
5343653871
assert( gap<=65536 );
53437
- top = get2byte(&data[hdr+5]);
53438
- if( gap>top ){
53439
- if( top==0 ){
53440
- top = 65536;
53441
- }else{
53442
- return SQLITE_CORRUPT_BKPT;
53443
- }
53444
- }
53872
+ /* EVIDENCE-OF: R-29356-02391 If the database uses a 65536-byte page size
53873
+ ** and the reserved space is zero (the usual value for reserved space)
53874
+ ** then the cell content offset of an empty page wants to be 65536.
53875
+ ** However, that integer is too large to be stored in a 2-byte unsigned
53876
+ ** integer, so a value of 0 is used in its place. */
53877
+ top = get2byteNotZero(&data[hdr+5]);
53878
+ if( gap>top ) return SQLITE_CORRUPT_BKPT;
5344553879
5344653880
/* If there is enough space between gap and top for one more cell pointer
5344753881
** array entry offset, and if the freelist is not empty, then search the
5344853882
** freelist looking for a free slot big enough to satisfy the request.
5344953883
*/
5345053884
testcase( gap+2==top );
5345153885
testcase( gap+1==top );
5345253886
testcase( gap==top );
5345353887
if( gap+2<=top && (data[hdr+1] || data[hdr+2]) ){
53454
- int pc, addr;
53455
- for(addr=hdr+1; (pc = get2byte(&data[addr]))>0; addr=pc){
53456
- int size; /* Size of the free slot */
53457
- if( pc>usableSize-4 || pc<addr+4 ){
53458
- return SQLITE_CORRUPT_BKPT;
53459
- }
53460
- size = get2byte(&data[pc+2]);
53461
- if( size>=nByte ){
53462
- int x = size - nByte;
53463
- testcase( x==4 );
53464
- testcase( x==3 );
53465
- if( x<4 ){
53466
- if( data[hdr+7]>=60 ) goto defragment_page;
53467
- /* Remove the slot from the free-list. Update the number of
53468
- ** fragmented bytes within the page. */
53469
- memcpy(&data[addr], &data[pc], 2);
53470
- data[hdr+7] += (u8)x;
53471
- }else if( size+pc > usableSize ){
53472
- return SQLITE_CORRUPT_BKPT;
53473
- }else{
53474
- /* The slot remains on the free-list. Reduce its size to account
53475
- ** for the portion used by the new allocation. */
53476
- put2byte(&data[pc+2], x);
53477
- }
53478
- *pIdx = pc + x;
53479
- return SQLITE_OK;
53480
- }
53888
+ int bDefrag = 0;
53889
+ u8 *pSpace = pageFindSlot(pPage, nByte, &rc, &bDefrag);
53890
+ if( rc ) return rc;
53891
+ if( bDefrag ) goto defragment_page;
53892
+ if( pSpace ){
53893
+ assert( pSpace>=data && (pSpace - data)<65536 );
53894
+ *pIdx = (int)(pSpace - data);
53895
+ return SQLITE_OK;
5348153896
}
5348253897
}
5348353898
5348453899
/* The request could not be fulfilled using a freelist slot. Check
5348553900
** to see if defragmentation is necessary.
5348653901
*/
5348753902
testcase( gap+2+nByte==top );
5348853903
if( gap+2+nByte>top ){
53489
-defragment_page:
53490
- testcase( pPage->nCell==0 );
53904
+ defragment_page:
53905
+ assert( pPage->nCell>0 || CORRUPT_DB );
5349153906
rc = defragmentPage(pPage);
5349253907
if( rc ) return rc;
5349353908
top = get2byteNotZero(&data[hdr+5]);
5349453909
assert( gap+nByte<=top );
5349553910
}
@@ -53532,11 +53947,11 @@
5353253947
unsigned char *data = pPage->aData; /* Page content */
5353353948
5353453949
assert( pPage->pBt!=0 );
5353553950
assert( sqlite3PagerIswriteable(pPage->pDbPage) );
5353653951
assert( iStart>=pPage->hdrOffset+6+pPage->childPtrSize );
53537
- assert( iEnd <= pPage->pBt->usableSize );
53952
+ assert( CORRUPT_DB || iEnd <= pPage->pBt->usableSize );
5353853953
assert( sqlite3_mutex_held(pPage->pBt->mutex) );
5353953954
assert( iSize>=4 ); /* Minimum cell size is 4 */
5354053955
assert( iStart<=iLast );
5354153956
5354253957
/* Overwrite deleted information with zeros when the secure_delete
@@ -53627,22 +54042,36 @@
5362754042
pPage->leaf = (u8)(flagByte>>3); assert( PTF_LEAF == 1<<3 );
5362854043
flagByte &= ~PTF_LEAF;
5362954044
pPage->childPtrSize = 4-4*pPage->leaf;
5363054045
pBt = pPage->pBt;
5363154046
if( flagByte==(PTF_LEAFDATA | PTF_INTKEY) ){
54047
+ /* EVIDENCE-OF: R-03640-13415 A value of 5 means the page is an interior
54048
+ ** table b-tree page. */
54049
+ assert( (PTF_LEAFDATA|PTF_INTKEY)==5 );
54050
+ /* EVIDENCE-OF: R-20501-61796 A value of 13 means the page is a leaf
54051
+ ** table b-tree page. */
54052
+ assert( (PTF_LEAFDATA|PTF_INTKEY|PTF_LEAF)==13 );
5363254053
pPage->intKey = 1;
5363354054
pPage->intKeyLeaf = pPage->leaf;
5363454055
pPage->noPayload = !pPage->leaf;
5363554056
pPage->maxLocal = pBt->maxLeaf;
5363654057
pPage->minLocal = pBt->minLeaf;
5363754058
}else if( flagByte==PTF_ZERODATA ){
54059
+ /* EVIDENCE-OF: R-27225-53936 A value of 2 means the page is an interior
54060
+ ** index b-tree page. */
54061
+ assert( (PTF_ZERODATA)==2 );
54062
+ /* EVIDENCE-OF: R-16571-11615 A value of 10 means the page is a leaf
54063
+ ** index b-tree page. */
54064
+ assert( (PTF_ZERODATA|PTF_LEAF)==10 );
5363854065
pPage->intKey = 0;
5363954066
pPage->intKeyLeaf = 0;
5364054067
pPage->noPayload = 0;
5364154068
pPage->maxLocal = pBt->maxLocal;
5364254069
pPage->minLocal = pBt->minLocal;
5364354070
}else{
54071
+ /* EVIDENCE-OF: R-47608-56469 Any other value for the b-tree page type is
54072
+ ** an error. */
5364454073
return SQLITE_CORRUPT_BKPT;
5364554074
}
5364654075
pPage->max1bytePayload = pBt->max1bytePayload;
5364754076
return SQLITE_OK;
5364854077
}
@@ -53678,25 +54107,37 @@
5367854107
5367954108
pBt = pPage->pBt;
5368054109
5368154110
hdr = pPage->hdrOffset;
5368254111
data = pPage->aData;
54112
+ /* EVIDENCE-OF: R-28594-02890 The one-byte flag at offset 0 indicating
54113
+ ** the b-tree page type. */
5368354114
if( decodeFlags(pPage, data[hdr]) ) return SQLITE_CORRUPT_BKPT;
5368454115
assert( pBt->pageSize>=512 && pBt->pageSize<=65536 );
5368554116
pPage->maskPage = (u16)(pBt->pageSize - 1);
5368654117
pPage->nOverflow = 0;
5368754118
usableSize = pBt->usableSize;
53688
- pPage->cellOffset = cellOffset = hdr + 12 - 4*pPage->leaf;
54119
+ pPage->cellOffset = cellOffset = hdr + 8 + pPage->childPtrSize;
5368954120
pPage->aDataEnd = &data[usableSize];
5369054121
pPage->aCellIdx = &data[cellOffset];
54122
+ /* EVIDENCE-OF: R-58015-48175 The two-byte integer at offset 5 designates
54123
+ ** the start of the cell content area. A zero value for this integer is
54124
+ ** interpreted as 65536. */
5369154125
top = get2byteNotZero(&data[hdr+5]);
54126
+ /* EVIDENCE-OF: R-37002-32774 The two-byte integer at offset 3 gives the
54127
+ ** number of cells on the page. */
5369254128
pPage->nCell = get2byte(&data[hdr+3]);
5369354129
if( pPage->nCell>MX_CELL(pBt) ){
5369454130
/* To many cells for a single page. The page must be corrupt */
5369554131
return SQLITE_CORRUPT_BKPT;
5369654132
}
5369754133
testcase( pPage->nCell==MX_CELL(pBt) );
54134
+ /* EVIDENCE-OF: R-24089-57979 If a page contains no cells (which is only
54135
+ ** possible for a root page of a table that contains no rows) then the
54136
+ ** offset to the cell content area will equal the page size minus the
54137
+ ** bytes of reserved space. */
54138
+ assert( pPage->nCell>0 || top==usableSize || CORRUPT_DB );
5369854139
5369954140
/* A malformed database page might cause us to read past the end
5370054141
** of page when parsing a cell.
5370154142
**
5370254143
** The following block of code checks early to see if a cell extends
@@ -53726,17 +54167,24 @@
5372654167
}
5372754168
if( !pPage->leaf ) iCellLast++;
5372854169
}
5372954170
#endif
5373054171
53731
- /* Compute the total free space on the page */
54172
+ /* Compute the total free space on the page
54173
+ ** EVIDENCE-OF: R-23588-34450 The two-byte integer at offset 1 gives the
54174
+ ** start of the first freeblock on the page, or is zero if there are no
54175
+ ** freeblocks. */
5373254176
pc = get2byte(&data[hdr+1]);
53733
- nFree = data[hdr+7] + top;
54177
+ nFree = data[hdr+7] + top; /* Init nFree to non-freeblock free space */
5373454178
while( pc>0 ){
5373554179
u16 next, size;
5373654180
if( pc<iCellFirst || pc>iCellLast ){
53737
- /* Start of free block is off the page */
54181
+ /* EVIDENCE-OF: R-55530-52930 In a well-formed b-tree page, there will
54182
+ ** always be at least one cell before the first freeblock.
54183
+ **
54184
+ ** Or, the freeblock is off the end of the page
54185
+ */
5373854186
return SQLITE_CORRUPT_BKPT;
5373954187
}
5374054188
next = get2byte(&data[pc]);
5374154189
size = get2byte(&data[pc+2]);
5374254190
if( (next>0 && next<=pc+size+3) || pc+size>usableSize ){
@@ -54138,10 +54586,13 @@
5413854586
pBt->pPage1 = 0;
5413954587
if( sqlite3PagerIsreadonly(pBt->pPager) ) pBt->btsFlags |= BTS_READ_ONLY;
5414054588
#ifdef SQLITE_SECURE_DELETE
5414154589
pBt->btsFlags |= BTS_SECURE_DELETE;
5414254590
#endif
54591
+ /* EVIDENCE-OF: R-51873-39618 The page size for a database file is
54592
+ ** determined by the 2-byte integer located at an offset of 16 bytes from
54593
+ ** the beginning of the database file. */
5414354594
pBt->pageSize = (zDbHeader[16]<<8) | (zDbHeader[17]<<16);
5414454595
if( pBt->pageSize<512 || pBt->pageSize>SQLITE_MAX_PAGE_SIZE
5414554596
|| ((pBt->pageSize-1)&pBt->pageSize)!=0 ){
5414654597
pBt->pageSize = 0;
5414754598
#ifndef SQLITE_OMIT_AUTOVACUUM
@@ -54156,10 +54607,13 @@
5415654607
pBt->incrVacuum = (SQLITE_DEFAULT_AUTOVACUUM==2 ? 1 : 0);
5415754608
}
5415854609
#endif
5415954610
nReserve = 0;
5416054611
}else{
54612
+ /* EVIDENCE-OF: R-37497-42412 The size of the reserved region is
54613
+ ** determined by the one-byte unsigned integer found at an offset of 20
54614
+ ** into the database file header. */
5416154615
nReserve = zDbHeader[20];
5416254616
pBt->btsFlags |= BTS_PAGESIZE_FIXED;
5416354617
#ifndef SQLITE_OMIT_AUTOVACUUM
5416454618
pBt->autoVacuum = (get4byte(&zDbHeader[36 + 4*4])?1:0);
5416554619
pBt->incrVacuum = (get4byte(&zDbHeader[36 + 7*4])?1:0);
@@ -54353,11 +54807,11 @@
5435354807
5435454808
/* Rollback any active transaction and free the handle structure.
5435554809
** The call to sqlite3BtreeRollback() drops any table-locks held by
5435654810
** this handle.
5435754811
*/
54358
- sqlite3BtreeRollback(p, SQLITE_OK);
54812
+ sqlite3BtreeRollback(p, SQLITE_OK, 0);
5435954813
sqlite3BtreeLeave(p);
5436054814
5436154815
/* If there are still other outstanding references to the shared-btree
5436254816
** structure, return now. The remainder of this procedure cleans
5436354817
** up the shared-btree.
@@ -54665,10 +55119,13 @@
5466555119
if( nPage>0 ){
5466655120
u32 pageSize;
5466755121
u32 usableSize;
5466855122
u8 *page1 = pPage1->aData;
5466955123
rc = SQLITE_NOTADB;
55124
+ /* EVIDENCE-OF: R-43737-39999 Every valid SQLite database file begins
55125
+ ** with the following 16 bytes (in hex): 53 51 4c 69 74 65 20 66 6f 72 6d
55126
+ ** 61 74 20 33 00. */
5467055127
if( memcmp(page1, zMagicHeader, 16)!=0 ){
5467155128
goto page1_init_failed;
5467255129
}
5467355130
5467455131
#ifdef SQLITE_OMIT_WAL
@@ -54705,26 +55162,39 @@
5470555162
}
5470655163
rc = SQLITE_NOTADB;
5470755164
}
5470855165
#endif
5470955166
54710
- /* The maximum embedded fraction must be exactly 25%. And the minimum
54711
- ** embedded fraction must be 12.5% for both leaf-data and non-leaf-data.
55167
+ /* EVIDENCE-OF: R-15465-20813 The maximum and minimum embedded payload
55168
+ ** fractions and the leaf payload fraction values must be 64, 32, and 32.
55169
+ **
5471255170
** The original design allowed these amounts to vary, but as of
5471355171
** version 3.6.0, we require them to be fixed.
5471455172
*/
5471555173
if( memcmp(&page1[21], "\100\040\040",3)!=0 ){
5471655174
goto page1_init_failed;
5471755175
}
55176
+ /* EVIDENCE-OF: R-51873-39618 The page size for a database file is
55177
+ ** determined by the 2-byte integer located at an offset of 16 bytes from
55178
+ ** the beginning of the database file. */
5471855179
pageSize = (page1[16]<<8) | (page1[17]<<16);
55180
+ /* EVIDENCE-OF: R-25008-21688 The size of a page is a power of two
55181
+ ** between 512 and 65536 inclusive. */
5471955182
if( ((pageSize-1)&pageSize)!=0
5472055183
|| pageSize>SQLITE_MAX_PAGE_SIZE
5472155184
|| pageSize<=256
5472255185
){
5472355186
goto page1_init_failed;
5472455187
}
5472555188
assert( (pageSize & 7)==0 );
55189
+ /* EVIDENCE-OF: R-59310-51205 The "reserved space" size in the 1-byte
55190
+ ** integer at offset 20 is the number of bytes of space at the end of
55191
+ ** each page to reserve for extensions.
55192
+ **
55193
+ ** EVIDENCE-OF: R-37497-42412 The size of the reserved region is
55194
+ ** determined by the one-byte unsigned integer found at an offset of 20
55195
+ ** into the database file header. */
5472655196
usableSize = pageSize - page1[20];
5472755197
if( (u32)pageSize!=pBt->pageSize ){
5472855198
/* After reading the first page of the database assuming a page size
5472955199
** of BtShared.pageSize, we have discovered that the page-size is
5473055200
** actually pageSize. Unlock the database, leave pBt->pPage1 at
@@ -54741,10 +55211,13 @@
5474155211
}
5474255212
if( (pBt->db->flags & SQLITE_RecoveryMode)==0 && nPage>nPageFile ){
5474355213
rc = SQLITE_CORRUPT_BKPT;
5474455214
goto page1_init_failed;
5474555215
}
55216
+ /* EVIDENCE-OF: R-28312-64704 However, the usable size is not allowed to
55217
+ ** be less than 480. In other words, if the page size is 512, then the
55218
+ ** reserved space size cannot exceed 32. */
5474655219
if( usableSize<480 ){
5474755220
goto page1_init_failed;
5474855221
}
5474955222
pBt->pageSize = pageSize;
5475055223
pBt->usableSize = usableSize;
@@ -55646,64 +56119,95 @@
5564656119
return rc;
5564756120
}
5564856121
5564956122
/*
5565056123
** This routine sets the state to CURSOR_FAULT and the error
55651
-** code to errCode for every cursor on BtShared that pBtree
55652
-** references.
55653
-**
55654
-** Every cursor is tripped, including cursors that belong
55655
-** to other database connections that happen to be sharing
55656
-** the cache with pBtree.
55657
-**
55658
-** This routine gets called when a rollback occurs.
55659
-** All cursors using the same cache must be tripped
55660
-** to prevent them from trying to use the btree after
55661
-** the rollback. The rollback may have deleted tables
55662
-** or moved root pages, so it is not sufficient to
55663
-** save the state of the cursor. The cursor must be
55664
-** invalidated.
55665
-*/
55666
-SQLITE_PRIVATE void sqlite3BtreeTripAllCursors(Btree *pBtree, int errCode){
56124
+** code to errCode for every cursor on any BtShared that pBtree
56125
+** references. Or if the writeOnly flag is set to 1, then only
56126
+** trip write cursors and leave read cursors unchanged.
56127
+**
56128
+** Every cursor is a candidate to be tripped, including cursors
56129
+** that belong to other database connections that happen to be
56130
+** sharing the cache with pBtree.
56131
+**
56132
+** This routine gets called when a rollback occurs. If the writeOnly
56133
+** flag is true, then only write-cursors need be tripped - read-only
56134
+** cursors save their current positions so that they may continue
56135
+** following the rollback. Or, if writeOnly is false, all cursors are
56136
+** tripped. In general, writeOnly is false if the transaction being
56137
+** rolled back modified the database schema. In this case b-tree root
56138
+** pages may be moved or deleted from the database altogether, making
56139
+** it unsafe for read cursors to continue.
56140
+**
56141
+** If the writeOnly flag is true and an error is encountered while
56142
+** saving the current position of a read-only cursor, all cursors,
56143
+** including all read-cursors are tripped.
56144
+**
56145
+** SQLITE_OK is returned if successful, or if an error occurs while
56146
+** saving a cursor position, an SQLite error code.
56147
+*/
56148
+SQLITE_PRIVATE int sqlite3BtreeTripAllCursors(Btree *pBtree, int errCode, int writeOnly){
5566756149
BtCursor *p;
55668
- if( pBtree==0 ) return;
55669
- sqlite3BtreeEnter(pBtree);
55670
- for(p=pBtree->pBt->pCursor; p; p=p->pNext){
55671
- int i;
55672
- sqlite3BtreeClearCursor(p);
55673
- p->eState = CURSOR_FAULT;
55674
- p->skipNext = errCode;
55675
- for(i=0; i<=p->iPage; i++){
55676
- releasePage(p->apPage[i]);
55677
- p->apPage[i] = 0;
55678
- }
55679
- }
55680
- sqlite3BtreeLeave(pBtree);
56150
+ int rc = SQLITE_OK;
56151
+
56152
+ assert( (writeOnly==0 || writeOnly==1) && BTCF_WriteFlag==1 );
56153
+ if( pBtree ){
56154
+ sqlite3BtreeEnter(pBtree);
56155
+ for(p=pBtree->pBt->pCursor; p; p=p->pNext){
56156
+ int i;
56157
+ if( writeOnly && (p->curFlags & BTCF_WriteFlag)==0 ){
56158
+ if( p->eState==CURSOR_VALID ){
56159
+ rc = saveCursorPosition(p);
56160
+ if( rc!=SQLITE_OK ){
56161
+ (void)sqlite3BtreeTripAllCursors(pBtree, rc, 0);
56162
+ break;
56163
+ }
56164
+ }
56165
+ }else{
56166
+ sqlite3BtreeClearCursor(p);
56167
+ p->eState = CURSOR_FAULT;
56168
+ p->skipNext = errCode;
56169
+ }
56170
+ for(i=0; i<=p->iPage; i++){
56171
+ releasePage(p->apPage[i]);
56172
+ p->apPage[i] = 0;
56173
+ }
56174
+ }
56175
+ sqlite3BtreeLeave(pBtree);
56176
+ }
56177
+ return rc;
5568156178
}
5568256179
5568356180
/*
55684
-** Rollback the transaction in progress. All cursors will be
55685
-** invalided by this operation. Any attempt to use a cursor
55686
-** that was open at the beginning of this operation will result
55687
-** in an error.
56181
+** Rollback the transaction in progress.
56182
+**
56183
+** If tripCode is not SQLITE_OK then cursors will be invalidated (tripped).
56184
+** Only write cursors are tripped if writeOnly is true but all cursors are
56185
+** tripped if writeOnly is false. Any attempt to use
56186
+** a tripped cursor will result in an error.
5568856187
**
5568956188
** This will release the write lock on the database file. If there
5569056189
** are no active cursors, it also releases the read lock.
5569156190
*/
55692
-SQLITE_PRIVATE int sqlite3BtreeRollback(Btree *p, int tripCode){
56191
+SQLITE_PRIVATE int sqlite3BtreeRollback(Btree *p, int tripCode, int writeOnly){
5569356192
int rc;
5569456193
BtShared *pBt = p->pBt;
5569556194
MemPage *pPage1;
5569656195
56196
+ assert( writeOnly==1 || writeOnly==0 );
56197
+ assert( tripCode==SQLITE_ABORT_ROLLBACK || tripCode==SQLITE_OK );
5569756198
sqlite3BtreeEnter(p);
5569856199
if( tripCode==SQLITE_OK ){
5569956200
rc = tripCode = saveAllCursors(pBt, 0, 0);
56201
+ if( rc ) writeOnly = 0;
5570056202
}else{
5570156203
rc = SQLITE_OK;
5570256204
}
5570356205
if( tripCode ){
55704
- sqlite3BtreeTripAllCursors(p, tripCode);
56206
+ int rc2 = sqlite3BtreeTripAllCursors(p, tripCode, writeOnly);
56207
+ assert( rc==SQLITE_OK || (writeOnly==0 && rc2==SQLITE_OK) );
56208
+ if( rc2!=SQLITE_OK ) rc = rc2;
5570556209
}
5570656210
btreeIntegrity(p);
5570756211
5570856212
if( p->inTrans==TRANS_WRITE ){
5570956213
int rc2;
@@ -56034,17 +56538,13 @@
5603456538
**
5603556539
** This routine cannot fail. It always returns SQLITE_OK.
5603656540
*/
5603756541
SQLITE_PRIVATE int sqlite3BtreeKeySize(BtCursor *pCur, i64 *pSize){
5603856542
assert( cursorHoldsMutex(pCur) );
56039
- assert( pCur->eState==CURSOR_INVALID || pCur->eState==CURSOR_VALID );
56040
- if( pCur->eState!=CURSOR_VALID ){
56041
- *pSize = 0;
56042
- }else{
56043
- getCellInfo(pCur);
56044
- *pSize = pCur->info.nKey;
56045
- }
56543
+ assert( pCur->eState==CURSOR_VALID );
56544
+ getCellInfo(pCur);
56545
+ *pSize = pCur->info.nKey;
5604656546
return SQLITE_OK;
5604756547
}
5604856548
5604956549
/*
5605056550
** Set *pSize to the number of bytes of data in the entry the
@@ -57291,10 +57791,12 @@
5729157791
5729257792
assert( sqlite3_mutex_held(pBt->mutex) );
5729357793
assert( eMode==BTALLOC_ANY || (nearby>0 && IfNotOmitAV(pBt->autoVacuum)) );
5729457794
pPage1 = pBt->pPage1;
5729557795
mxPage = btreePagecount(pBt);
57796
+ /* EVIDENCE-OF: R-05119-02637 The 4-byte big-endian integer at offset 36
57797
+ ** stores stores the total number of pages on the freelist. */
5729657798
n = get4byte(&pPage1->aData[36]);
5729757799
testcase( n==mxPage-1 );
5729857800
if( n>=mxPage ){
5729957801
return SQLITE_CORRUPT_BKPT;
5730057802
}
@@ -57337,12 +57839,18 @@
5733757839
** or until a page less than 'nearby' is located (eMode==BTALLOC_LT)
5733857840
*/
5733957841
do {
5734057842
pPrevTrunk = pTrunk;
5734157843
if( pPrevTrunk ){
57844
+ /* EVIDENCE-OF: R-01506-11053 The first integer on a freelist trunk page
57845
+ ** is the page number of the next freelist trunk page in the list or
57846
+ ** zero if this is the last freelist trunk page. */
5734257847
iTrunk = get4byte(&pPrevTrunk->aData[0]);
5734357848
}else{
57849
+ /* EVIDENCE-OF: R-59841-13798 The 4-byte big-endian integer at offset 32
57850
+ ** stores the page number of the first page of the freelist, or zero if
57851
+ ** the freelist is empty. */
5734457852
iTrunk = get4byte(&pPage1->aData[32]);
5734557853
}
5734657854
testcase( iTrunk==mxPage );
5734757855
if( iTrunk>mxPage ){
5734857856
rc = SQLITE_CORRUPT_BKPT;
@@ -57353,12 +57861,13 @@
5735357861
pTrunk = 0;
5735457862
goto end_allocate_page;
5735557863
}
5735657864
assert( pTrunk!=0 );
5735757865
assert( pTrunk->aData!=0 );
57358
-
57359
- k = get4byte(&pTrunk->aData[4]); /* # of leaves on this trunk page */
57866
+ /* EVIDENCE-OF: R-13523-04394 The second integer on a freelist trunk page
57867
+ ** is the number of leaf page pointers to follow. */
57868
+ k = get4byte(&pTrunk->aData[4]);
5736057869
if( k==0 && !searchList ){
5736157870
/* The trunk has no leaves and the list is not being searched.
5736257871
** So extract the trunk page itself and use it as the newly
5736357872
** allocated page */
5736457873
assert( pPrevTrunk==0 );
@@ -57672,10 +58181,15 @@
5767258181
** to maintain backwards compatibility with older versions of SQLite,
5767358182
** we will continue to restrict the number of entries to usableSize/4 - 8
5767458183
** for now. At some point in the future (once everyone has upgraded
5767558184
** to 3.6.0 or later) we should consider fixing the conditional above
5767658185
** to read "usableSize/4-2" instead of "usableSize/4-8".
58186
+ **
58187
+ ** EVIDENCE-OF: R-19920-11576 However, newer versions of SQLite still
58188
+ ** avoid using the last six entries in the freelist trunk page array in
58189
+ ** order that database files created by newer versions of SQLite can be
58190
+ ** read by older versions of SQLite.
5767758191
*/
5767858192
rc = sqlite3PagerWrite(pTrunk->pDbPage);
5767958193
if( rc==SQLITE_OK ){
5768058194
put4byte(&pTrunk->aData[4], nLeaf+1);
5768158195
put4byte(&pTrunk->aData[8+nLeaf*4], iPage);
@@ -58023,13 +58537,21 @@
5802358537
if( rc ){
5802458538
*pRC = rc;
5802558539
return;
5802658540
}
5802758541
pPage->nCell--;
58028
- memmove(ptr, ptr+2, 2*(pPage->nCell - idx));
58029
- put2byte(&data[hdr+3], pPage->nCell);
58030
- pPage->nFree += 2;
58542
+ if( pPage->nCell==0 ){
58543
+ memset(&data[hdr+1], 0, 4);
58544
+ data[hdr+7] = 0;
58545
+ put2byte(&data[hdr+5], pPage->pBt->usableSize);
58546
+ pPage->nFree = pPage->pBt->usableSize - pPage->hdrOffset
58547
+ - pPage->childPtrSize - 8;
58548
+ }else{
58549
+ memmove(ptr, ptr+2, 2*(pPage->nCell - idx));
58550
+ put2byte(&data[hdr+3], pPage->nCell);
58551
+ pPage->nFree += 2;
58552
+ }
5803158553
}
5803258554
5803358555
/*
5803458556
** Insert a new cell on pPage at cell index "i". pCell points to the
5803558557
** content of the cell.
@@ -58120,49 +58642,275 @@
5812058642
#endif
5812158643
}
5812258644
}
5812358645
5812458646
/*
58125
-** Add a list of cells to a page. The page should be initially empty.
58126
-** The cells are guaranteed to fit on the page.
58127
-*/
58128
-static void assemblePage(
58129
- MemPage *pPage, /* The page to be assembled */
58130
- int nCell, /* The number of cells to add to this page */
58131
- u8 **apCell, /* Pointers to cell bodies */
58132
- u16 *aSize /* Sizes of the cells */
58133
-){
58134
- int i; /* Loop counter */
58135
- u8 *pCellptr; /* Address of next cell pointer */
58136
- int cellbody; /* Address of next cell body */
58137
- u8 * const data = pPage->aData; /* Pointer to data for pPage */
58138
- const int hdr = pPage->hdrOffset; /* Offset of header on pPage */
58139
- const int nUsable = pPage->pBt->usableSize; /* Usable size of page */
58140
-
58141
- assert( pPage->nOverflow==0 );
58142
- assert( sqlite3_mutex_held(pPage->pBt->mutex) );
58143
- assert( nCell>=0 && nCell<=(int)MX_CELL(pPage->pBt)
58144
- && (int)MX_CELL(pPage->pBt)<=10921);
58145
- assert( sqlite3PagerIswriteable(pPage->pDbPage) );
58146
-
58147
- /* Check that the page has just been zeroed by zeroPage() */
58148
- assert( pPage->nCell==0 );
58149
- assert( get2byteNotZero(&data[hdr+5])==nUsable );
58150
-
58151
- pCellptr = &pPage->aCellIdx[nCell*2];
58152
- cellbody = nUsable;
58153
- for(i=nCell-1; i>=0; i--){
58154
- u16 sz = aSize[i];
58155
- pCellptr -= 2;
58156
- cellbody -= sz;
58157
- put2byte(pCellptr, cellbody);
58158
- memcpy(&data[cellbody], apCell[i], sz);
58159
- }
58160
- put2byte(&data[hdr+3], nCell);
58161
- put2byte(&data[hdr+5], cellbody);
58162
- pPage->nFree -= (nCell*2 + nUsable - cellbody);
58163
- pPage->nCell = (u16)nCell;
58647
+** Array apCell[] contains pointers to nCell b-tree page cells. The
58648
+** szCell[] array contains the size in bytes of each cell. This function
58649
+** replaces the current contents of page pPg with the contents of the cell
58650
+** array.
58651
+**
58652
+** Some of the cells in apCell[] may currently be stored in pPg. This
58653
+** function works around problems caused by this by making a copy of any
58654
+** such cells before overwriting the page data.
58655
+**
58656
+** The MemPage.nFree field is invalidated by this function. It is the
58657
+** responsibility of the caller to set it correctly.
58658
+*/
58659
+static void rebuildPage(
58660
+ MemPage *pPg, /* Edit this page */
58661
+ int nCell, /* Final number of cells on page */
58662
+ u8 **apCell, /* Array of cells */
58663
+ u16 *szCell /* Array of cell sizes */
58664
+){
58665
+ const int hdr = pPg->hdrOffset; /* Offset of header on pPg */
58666
+ u8 * const aData = pPg->aData; /* Pointer to data for pPg */
58667
+ const int usableSize = pPg->pBt->usableSize;
58668
+ u8 * const pEnd = &aData[usableSize];
58669
+ int i;
58670
+ u8 *pCellptr = pPg->aCellIdx;
58671
+ u8 *pTmp = sqlite3PagerTempSpace(pPg->pBt->pPager);
58672
+ u8 *pData;
58673
+
58674
+ i = get2byte(&aData[hdr+5]);
58675
+ memcpy(&pTmp[i], &aData[i], usableSize - i);
58676
+
58677
+ pData = pEnd;
58678
+ for(i=0; i<nCell; i++){
58679
+ u8 *pCell = apCell[i];
58680
+ if( pCell>aData && pCell<pEnd ){
58681
+ pCell = &pTmp[pCell - aData];
58682
+ }
58683
+ pData -= szCell[i];
58684
+ memcpy(pData, pCell, szCell[i]);
58685
+ put2byte(pCellptr, (pData - aData));
58686
+ pCellptr += 2;
58687
+ assert( szCell[i]==cellSizePtr(pPg, pCell) );
58688
+ }
58689
+
58690
+ /* The pPg->nFree field is now set incorrectly. The caller will fix it. */
58691
+ pPg->nCell = nCell;
58692
+ pPg->nOverflow = 0;
58693
+
58694
+ put2byte(&aData[hdr+1], 0);
58695
+ put2byte(&aData[hdr+3], pPg->nCell);
58696
+ put2byte(&aData[hdr+5], pData - aData);
58697
+ aData[hdr+7] = 0x00;
58698
+}
58699
+
58700
+/*
58701
+** Array apCell[] contains nCell pointers to b-tree cells. Array szCell
58702
+** contains the size in bytes of each such cell. This function attempts to
58703
+** add the cells stored in the array to page pPg. If it cannot (because
58704
+** the page needs to be defragmented before the cells will fit), non-zero
58705
+** is returned. Otherwise, if the cells are added successfully, zero is
58706
+** returned.
58707
+**
58708
+** Argument pCellptr points to the first entry in the cell-pointer array
58709
+** (part of page pPg) to populate. After cell apCell[0] is written to the
58710
+** page body, a 16-bit offset is written to pCellptr. And so on, for each
58711
+** cell in the array. It is the responsibility of the caller to ensure
58712
+** that it is safe to overwrite this part of the cell-pointer array.
58713
+**
58714
+** When this function is called, *ppData points to the start of the
58715
+** content area on page pPg. If the size of the content area is extended,
58716
+** *ppData is updated to point to the new start of the content area
58717
+** before returning.
58718
+**
58719
+** Finally, argument pBegin points to the byte immediately following the
58720
+** end of the space required by this page for the cell-pointer area (for
58721
+** all cells - not just those inserted by the current call). If the content
58722
+** area must be extended to before this point in order to accomodate all
58723
+** cells in apCell[], then the cells do not fit and non-zero is returned.
58724
+*/
58725
+static int pageInsertArray(
58726
+ MemPage *pPg, /* Page to add cells to */
58727
+ u8 *pBegin, /* End of cell-pointer array */
58728
+ u8 **ppData, /* IN/OUT: Page content -area pointer */
58729
+ u8 *pCellptr, /* Pointer to cell-pointer area */
58730
+ int nCell, /* Number of cells to add to pPg */
58731
+ u8 **apCell, /* Array of cells */
58732
+ u16 *szCell /* Array of cell sizes */
58733
+){
58734
+ int i;
58735
+ u8 *aData = pPg->aData;
58736
+ u8 *pData = *ppData;
58737
+ const int bFreelist = aData[1] || aData[2];
58738
+ assert( CORRUPT_DB || pPg->hdrOffset==0 ); /* Never called on page 1 */
58739
+ for(i=0; i<nCell; i++){
58740
+ int sz = szCell[i];
58741
+ int rc;
58742
+ u8 *pSlot;
58743
+ if( bFreelist==0 || (pSlot = pageFindSlot(pPg, sz, &rc, 0))==0 ){
58744
+ pData -= sz;
58745
+ if( pData<pBegin ) return 1;
58746
+ pSlot = pData;
58747
+ }
58748
+ memcpy(pSlot, apCell[i], sz);
58749
+ put2byte(pCellptr, (pSlot - aData));
58750
+ pCellptr += 2;
58751
+ }
58752
+ *ppData = pData;
58753
+ return 0;
58754
+}
58755
+
58756
+/*
58757
+** Array apCell[] contains nCell pointers to b-tree cells. Array szCell
58758
+** contains the size in bytes of each such cell. This function adds the
58759
+** space associated with each cell in the array that is currently stored
58760
+** within the body of pPg to the pPg free-list. The cell-pointers and other
58761
+** fields of the page are not updated.
58762
+**
58763
+** This function returns the total number of cells added to the free-list.
58764
+*/
58765
+static int pageFreeArray(
58766
+ MemPage *pPg, /* Page to edit */
58767
+ int nCell, /* Cells to delete */
58768
+ u8 **apCell, /* Array of cells */
58769
+ u16 *szCell /* Array of cell sizes */
58770
+){
58771
+ u8 * const aData = pPg->aData;
58772
+ u8 * const pEnd = &aData[pPg->pBt->usableSize];
58773
+ u8 * const pStart = &aData[pPg->hdrOffset + 8 + pPg->childPtrSize];
58774
+ int nRet = 0;
58775
+ int i;
58776
+ u8 *pFree = 0;
58777
+ int szFree = 0;
58778
+
58779
+ for(i=0; i<nCell; i++){
58780
+ u8 *pCell = apCell[i];
58781
+ if( pCell>=pStart && pCell<pEnd ){
58782
+ int sz = szCell[i];
58783
+ if( pFree!=(pCell + sz) ){
58784
+ if( pFree ){
58785
+ assert( pFree>aData && (pFree - aData)<65536 );
58786
+ freeSpace(pPg, (u16)(pFree - aData), szFree);
58787
+ }
58788
+ pFree = pCell;
58789
+ szFree = sz;
58790
+ if( pFree+sz>pEnd ) return 0;
58791
+ }else{
58792
+ pFree = pCell;
58793
+ szFree += sz;
58794
+ }
58795
+ nRet++;
58796
+ }
58797
+ }
58798
+ if( pFree ){
58799
+ assert( pFree>aData && (pFree - aData)<65536 );
58800
+ freeSpace(pPg, (u16)(pFree - aData), szFree);
58801
+ }
58802
+ return nRet;
58803
+}
58804
+
58805
+/*
58806
+** apCell[] and szCell[] contains pointers to and sizes of all cells in the
58807
+** pages being balanced. The current page, pPg, has pPg->nCell cells starting
58808
+** with apCell[iOld]. After balancing, this page should hold nNew cells
58809
+** starting at apCell[iNew].
58810
+**
58811
+** This routine makes the necessary adjustments to pPg so that it contains
58812
+** the correct cells after being balanced.
58813
+**
58814
+** The pPg->nFree field is invalid when this function returns. It is the
58815
+** responsibility of the caller to set it correctly.
58816
+*/
58817
+static void editPage(
58818
+ MemPage *pPg, /* Edit this page */
58819
+ int iOld, /* Index of first cell currently on page */
58820
+ int iNew, /* Index of new first cell on page */
58821
+ int nNew, /* Final number of cells on page */
58822
+ u8 **apCell, /* Array of cells */
58823
+ u16 *szCell /* Array of cell sizes */
58824
+){
58825
+ u8 * const aData = pPg->aData;
58826
+ const int hdr = pPg->hdrOffset;
58827
+ u8 *pBegin = &pPg->aCellIdx[nNew * 2];
58828
+ int nCell = pPg->nCell; /* Cells stored on pPg */
58829
+ u8 *pData;
58830
+ u8 *pCellptr;
58831
+ int i;
58832
+ int iOldEnd = iOld + pPg->nCell + pPg->nOverflow;
58833
+ int iNewEnd = iNew + nNew;
58834
+
58835
+#ifdef SQLITE_DEBUG
58836
+ u8 *pTmp = sqlite3PagerTempSpace(pPg->pBt->pPager);
58837
+ memcpy(pTmp, aData, pPg->pBt->usableSize);
58838
+#endif
58839
+
58840
+ /* Remove cells from the start and end of the page */
58841
+ if( iOld<iNew ){
58842
+ int nShift = pageFreeArray(
58843
+ pPg, iNew-iOld, &apCell[iOld], &szCell[iOld]
58844
+ );
58845
+ memmove(pPg->aCellIdx, &pPg->aCellIdx[nShift*2], nCell*2);
58846
+ nCell -= nShift;
58847
+ }
58848
+ if( iNewEnd < iOldEnd ){
58849
+ nCell -= pageFreeArray(
58850
+ pPg, iOldEnd-iNewEnd, &apCell[iNewEnd], &szCell[iNewEnd]
58851
+ );
58852
+ }
58853
+
58854
+ pData = &aData[get2byteNotZero(&aData[hdr+5])];
58855
+ if( pData<pBegin ) goto editpage_fail;
58856
+
58857
+ /* Add cells to the start of the page */
58858
+ if( iNew<iOld ){
58859
+ int nAdd = MIN(nNew,iOld-iNew);
58860
+ assert( (iOld-iNew)<nNew || nCell==0 || CORRUPT_DB );
58861
+ pCellptr = pPg->aCellIdx;
58862
+ memmove(&pCellptr[nAdd*2], pCellptr, nCell*2);
58863
+ if( pageInsertArray(
58864
+ pPg, pBegin, &pData, pCellptr,
58865
+ nAdd, &apCell[iNew], &szCell[iNew]
58866
+ ) ) goto editpage_fail;
58867
+ nCell += nAdd;
58868
+ }
58869
+
58870
+ /* Add any overflow cells */
58871
+ for(i=0; i<pPg->nOverflow; i++){
58872
+ int iCell = (iOld + pPg->aiOvfl[i]) - iNew;
58873
+ if( iCell>=0 && iCell<nNew ){
58874
+ pCellptr = &pPg->aCellIdx[iCell * 2];
58875
+ memmove(&pCellptr[2], pCellptr, (nCell - iCell) * 2);
58876
+ nCell++;
58877
+ if( pageInsertArray(
58878
+ pPg, pBegin, &pData, pCellptr,
58879
+ 1, &apCell[iCell + iNew], &szCell[iCell + iNew]
58880
+ ) ) goto editpage_fail;
58881
+ }
58882
+ }
58883
+
58884
+ /* Append cells to the end of the page */
58885
+ pCellptr = &pPg->aCellIdx[nCell*2];
58886
+ if( pageInsertArray(
58887
+ pPg, pBegin, &pData, pCellptr,
58888
+ nNew-nCell, &apCell[iNew+nCell], &szCell[iNew+nCell]
58889
+ ) ) goto editpage_fail;
58890
+
58891
+ pPg->nCell = nNew;
58892
+ pPg->nOverflow = 0;
58893
+
58894
+ put2byte(&aData[hdr+3], pPg->nCell);
58895
+ put2byte(&aData[hdr+5], pData - aData);
58896
+
58897
+#ifdef SQLITE_DEBUG
58898
+ for(i=0; i<nNew && !CORRUPT_DB; i++){
58899
+ u8 *pCell = apCell[i+iNew];
58900
+ int iOff = get2byte(&pPg->aCellIdx[i*2]);
58901
+ if( pCell>=aData && pCell<&aData[pPg->pBt->usableSize] ){
58902
+ pCell = &pTmp[pCell - aData];
58903
+ }
58904
+ assert( 0==memcmp(pCell, &aData[iOff], szCell[i+iNew]) );
58905
+ }
58906
+#endif
58907
+
58908
+ return;
58909
+ editpage_fail:
58910
+ /* Unable to edit this page. Rebuild it from scratch instead. */
58911
+ rebuildPage(pPg, nNew, &apCell[iNew], &szCell[iNew]);
5816458912
}
5816558913
5816658914
/*
5816758915
** The following parameters determine how many adjacent pages get involved
5816858916
** in a balancing operation. NN is the number of neighbors on either side
@@ -58212,11 +58960,11 @@
5821258960
assert( sqlite3_mutex_held(pPage->pBt->mutex) );
5821358961
assert( sqlite3PagerIswriteable(pParent->pDbPage) );
5821458962
assert( pPage->nOverflow==1 );
5821558963
5821658964
/* This error condition is now caught prior to reaching this function */
58217
- if( pPage->nCell==0 ) return SQLITE_CORRUPT_BKPT;
58965
+ if( NEVER(pPage->nCell==0) ) return SQLITE_CORRUPT_BKPT;
5821858966
5821958967
/* Allocate a new page. This page will become the right-sibling of
5822058968
** pPage. Make the parent page writable, so that the new divider cell
5822158969
** may be inserted. If both these operations are successful, proceed.
5822258970
*/
@@ -58230,11 +58978,12 @@
5823058978
u8 *pStop;
5823158979
5823258980
assert( sqlite3PagerIswriteable(pNew->pDbPage) );
5823358981
assert( pPage->aData[0]==(PTF_INTKEY|PTF_LEAFDATA|PTF_LEAF) );
5823458982
zeroPage(pNew, PTF_INTKEY|PTF_LEAFDATA|PTF_LEAF);
58235
- assemblePage(pNew, 1, &pCell, &szCell);
58983
+ rebuildPage(pNew, 1, &pCell, &szCell);
58984
+ pNew->nFree = pBt->usableSize - pNew->cellOffset - 2 - szCell;
5823658985
5823758986
/* If this is an auto-vacuum database, update the pointer map
5823858987
** with entries for the new page, and any pointer from the
5823958988
** cell on the page to an overflow page. If either of these
5824058989
** operations fails, the return code is set, but the contents
@@ -58449,21 +59198,26 @@
5844959198
int subtotal; /* Subtotal of bytes in cells on one page */
5845059199
int iSpace1 = 0; /* First unused byte of aSpace1[] */
5845159200
int iOvflSpace = 0; /* First unused byte of aOvflSpace[] */
5845259201
int szScratch; /* Size of scratch memory requested */
5845359202
MemPage *apOld[NB]; /* pPage and up to two siblings */
58454
- MemPage *apCopy[NB]; /* Private copies of apOld[] pages */
5845559203
MemPage *apNew[NB+2]; /* pPage and up to NB siblings after balancing */
5845659204
u8 *pRight; /* Location in parent of right-sibling pointer */
5845759205
u8 *apDiv[NB-1]; /* Divider cells in pParent */
5845859206
int cntNew[NB+2]; /* Index in aCell[] of cell after i-th page */
58459
- int szNew[NB+2]; /* Combined size of cells place on i-th page */
59207
+ int cntOld[NB+2]; /* Old index in aCell[] after i-th page */
59208
+ int szNew[NB+2]; /* Combined size of cells placed on i-th page */
5846059209
u8 **apCell = 0; /* All cells begin balanced */
5846159210
u16 *szCell; /* Local size of all cells in apCell[] */
5846259211
u8 *aSpace1; /* Space for copies of dividers cells */
5846359212
Pgno pgno; /* Temp var to store a page number in */
59213
+ u8 abDone[NB+2]; /* True after i'th new page is populated */
59214
+ Pgno aPgno[NB+2]; /* Page numbers of new pages before shuffling */
59215
+ Pgno aPgOrder[NB+2]; /* Copy of aPgno[] used for sorting pages */
59216
+ u16 aPgFlags[NB+2]; /* flags field of new pages before shuffling */
5846459217
59218
+ memset(abDone, 0, sizeof(abDone));
5846559219
pBt = pParent->pBt;
5846659220
assert( sqlite3_mutex_held(pBt->mutex) );
5846759221
assert( sqlite3PagerIswriteable(pParent->pDbPage) );
5846859222
5846959223
#if 0
@@ -58568,16 +59322,18 @@
5856859322
nMaxCells = (nMaxCells + 3)&~3;
5856959323
5857059324
/*
5857159325
** Allocate space for memory structures
5857259326
*/
58573
- k = pBt->pageSize + ROUND8(sizeof(MemPage));
5857459327
szScratch =
5857559328
nMaxCells*sizeof(u8*) /* apCell */
5857659329
+ nMaxCells*sizeof(u16) /* szCell */
58577
- + pBt->pageSize /* aSpace1 */
58578
- + k*nOld; /* Page copies (apCopy) */
59330
+ + pBt->pageSize; /* aSpace1 */
59331
+
59332
+ /* EVIDENCE-OF: R-28375-38319 SQLite will never request a scratch buffer
59333
+ ** that is more than 6 times the database page size. */
59334
+ assert( szScratch<=6*pBt->pageSize );
5857959335
apCell = sqlite3ScratchMalloc( szScratch );
5858059336
if( apCell==0 ){
5858159337
rc = SQLITE_NOMEM;
5858259338
goto balance_cleanup;
5858359339
}
@@ -58586,12 +59342,12 @@
5858659342
assert( EIGHT_BYTE_ALIGNMENT(aSpace1) );
5858759343
5858859344
/*
5858959345
** Load pointers to all cells on sibling pages and the divider cells
5859059346
** into the local apCell[] array. Make copies of the divider cells
58591
- ** into space obtained from aSpace1[] and remove the divider cells
58592
- ** from pParent.
59347
+ ** into space obtained from aSpace1[]. The divider cells have already
59348
+ ** been removed from pParent.
5859359349
**
5859459350
** If the siblings are on leaf pages, then the child pointers of the
5859559351
** divider cells are stripped from the cells before they are copied
5859659352
** into aSpace1[]. In this way, all cells in apCell[] are without
5859759353
** child pointers. If siblings are not leaves, then all cell in
@@ -58603,19 +59359,11 @@
5860359359
*/
5860459360
leafCorrection = apOld[0]->leaf*4;
5860559361
leafData = apOld[0]->intKeyLeaf;
5860659362
for(i=0; i<nOld; i++){
5860759363
int limit;
58608
-
58609
- /* Before doing anything else, take a copy of the i'th original sibling
58610
- ** The rest of this function will use data from the copies rather
58611
- ** that the original pages since the original pages will be in the
58612
- ** process of being overwritten. */
58613
- MemPage *pOld = apCopy[i] = (MemPage*)&aSpace1[pBt->pageSize + k*i];
58614
- memcpy(pOld, apOld[i], sizeof(MemPage));
58615
- pOld->aData = (void*)&pOld[1];
58616
- memcpy(pOld->aData, apOld[i]->aData, pBt->pageSize);
59364
+ MemPage *pOld = apOld[i];
5861759365
5861859366
limit = pOld->nCell+pOld->nOverflow;
5861959367
if( pOld->nOverflow>0 ){
5862059368
for(j=0; j<limit; j++){
5862159369
assert( nCell<nMaxCells );
@@ -58632,10 +59380,11 @@
5863259380
apCell[nCell] = findCellv2(aData, maskPage, cellOffset, j);
5863359381
szCell[nCell] = cellSizePtr(pOld, apCell[nCell]);
5863459382
nCell++;
5863559383
}
5863659384
}
59385
+ cntOld[i] = nCell;
5863759386
if( i<nOld-1 && !leafData){
5863859387
u16 sz = (u16)szNew[i];
5863959388
u8 *pTemp;
5864059389
assert( nCell<nMaxCells );
5864159390
szCell[nCell] = sz;
@@ -58654,11 +59403,15 @@
5865459403
** pointer of the divider cell */
5865559404
memcpy(apCell[nCell], &pOld->aData[8], 4);
5865659405
}else{
5865759406
assert( leafCorrection==4 );
5865859407
if( szCell[nCell]<4 ){
58659
- /* Do not allow any cells smaller than 4 bytes. */
59408
+ /* Do not allow any cells smaller than 4 bytes. If a smaller cell
59409
+ ** does exist, pad it with 0x00 bytes. */
59410
+ assert( szCell[nCell]==3 );
59411
+ assert( apCell[nCell]==&pTemp[iSpace1-3] );
59412
+ pTemp[iSpace1++] = 0x00;
5866059413
szCell[nCell] = 4;
5866159414
}
5866259415
}
5866359416
nCell++;
5866459417
}
@@ -58683,11 +59436,11 @@
5868359436
usableSpace = pBt->usableSize - 12 + leafCorrection;
5868459437
for(subtotal=k=i=0; i<nCell; i++){
5868559438
assert( i<nMaxCells );
5868659439
subtotal += szCell[i] + 2;
5868759440
if( subtotal > usableSpace ){
58688
- szNew[k] = subtotal - szCell[i];
59441
+ szNew[k] = subtotal - szCell[i] - 2;
5868959442
cntNew[k] = i;
5869059443
if( leafData ){ i--; }
5869159444
subtotal = 0;
5869259445
k++;
5869359446
if( k>NB+1 ){ rc = SQLITE_CORRUPT_BKPT; goto balance_cleanup; }
@@ -58697,13 +59450,14 @@
5869759450
cntNew[k] = nCell;
5869859451
k++;
5869959452
5870059453
/*
5870159454
** The packing computed by the previous block is biased toward the siblings
58702
- ** on the left side. The left siblings are always nearly full, while the
58703
- ** right-most sibling might be nearly empty. This block of code attempts
58704
- ** to adjust the packing of siblings to get a better balance.
59455
+ ** on the left side (siblings with smaller keys). The left siblings are
59456
+ ** always nearly full, while the right-most sibling might be nearly empty.
59457
+ ** The next block of code attempts to adjust the packing of siblings to
59458
+ ** get a better balance.
5870559459
**
5870659460
** This adjustment is more than an optimization. The packing above might
5870759461
** be so out of balance as to be illegal. For example, the right-most
5870859462
** sibling might be completely empty. This adjustment is not optional.
5870959463
*/
@@ -58728,26 +59482,22 @@
5872859482
}
5872959483
szNew[i] = szRight;
5873059484
szNew[i-1] = szLeft;
5873159485
}
5873259486
58733
- /* Either we found one or more cells (cntnew[0])>0) or pPage is
58734
- ** a virtual root page. A virtual root page is when the real root
58735
- ** page is page 1 and we are the only child of that page.
58736
- **
58737
- ** UPDATE: The assert() below is not necessarily true if the database
58738
- ** file is corrupt. The corruption will be detected and reported later
58739
- ** in this procedure so there is no need to act upon it now.
59487
+ /* Sanity check: For a non-corrupt database file one of the follwing
59488
+ ** must be true:
59489
+ ** (1) We found one or more cells (cntNew[0])>0), or
59490
+ ** (2) pPage is a virtual root page. A virtual root page is when
59491
+ ** the real root page is page 1 and we are the only child of
59492
+ ** that page.
5874059493
*/
58741
-#if 0
58742
- assert( cntNew[0]>0 || (pParent->pgno==1 && pParent->nCell==0) );
58743
-#endif
58744
-
58745
- TRACE(("BALANCE: old: %d %d %d ",
58746
- apOld[0]->pgno,
58747
- nOld>=2 ? apOld[1]->pgno : 0,
58748
- nOld>=3 ? apOld[2]->pgno : 0
59494
+ assert( cntNew[0]>0 || (pParent->pgno==1 && pParent->nCell==0) || CORRUPT_DB);
59495
+ TRACE(("BALANCE: old: %d(nc=%d) %d(nc=%d) %d(nc=%d)\n",
59496
+ apOld[0]->pgno, apOld[0]->nCell,
59497
+ nOld>=2 ? apOld[1]->pgno : 0, nOld>=2 ? apOld[1]->nCell : 0,
59498
+ nOld>=3 ? apOld[2]->pgno : 0, nOld>=3 ? apOld[2]->nCell : 0
5874959499
));
5875059500
5875159501
/*
5875259502
** Allocate k new pages. Reuse old pages where possible.
5875359503
*/
@@ -58766,12 +59516,14 @@
5876659516
if( rc ) goto balance_cleanup;
5876759517
}else{
5876859518
assert( i>0 );
5876959519
rc = allocateBtreePage(pBt, &pNew, &pgno, (bBulk ? 1 : pgno), 0);
5877059520
if( rc ) goto balance_cleanup;
59521
+ zeroPage(pNew, pageFlags);
5877159522
apNew[i] = pNew;
5877259523
nNew++;
59524
+ cntOld[i] = nCell;
5877359525
5877459526
/* Set the pointer-map entry for the new sibling page. */
5877559527
if( ISAUTOVACUUM ){
5877659528
ptrmapPut(pBt, pNew->pgno, PTRMAP_BTREE, pParent->pgno, &rc);
5877759529
if( rc!=SQLITE_OK ){
@@ -58779,139 +59531,251 @@
5877959531
}
5878059532
}
5878159533
}
5878259534
}
5878359535
58784
- /* Free any old pages that were not reused as new pages.
58785
- */
58786
- while( i<nOld ){
58787
- freePage(apOld[i], &rc);
58788
- if( rc ) goto balance_cleanup;
58789
- releasePage(apOld[i]);
58790
- apOld[i] = 0;
58791
- i++;
58792
- }
58793
-
5879459536
/*
58795
- ** Put the new pages in ascending order. This helps to
58796
- ** keep entries in the disk file in order so that a scan
58797
- ** of the table is a linear scan through the file. That
58798
- ** in turn helps the operating system to deliver pages
58799
- ** from the disk more rapidly.
58800
- **
58801
- ** An O(n^2) insertion sort algorithm is used, but since
58802
- ** n is never more than NB (a small constant), that should
58803
- ** not be a problem.
58804
- **
58805
- ** When NB==3, this one optimization makes the database
58806
- ** about 25% faster for large insertions and deletions.
58807
- */
58808
- for(i=0; i<k-1; i++){
58809
- int minV = apNew[i]->pgno;
58810
- int minI = i;
58811
- for(j=i+1; j<k; j++){
58812
- if( apNew[j]->pgno<(unsigned)minV ){
58813
- minI = j;
58814
- minV = apNew[j]->pgno;
58815
- }
58816
- }
58817
- if( minI>i ){
58818
- MemPage *pT;
58819
- pT = apNew[i];
58820
- apNew[i] = apNew[minI];
58821
- apNew[minI] = pT;
58822
- }
58823
- }
58824
- TRACE(("new: %d(%d) %d(%d) %d(%d) %d(%d) %d(%d)\n",
58825
- apNew[0]->pgno, szNew[0],
59537
+ ** Reassign page numbers so that the new pages are in ascending order.
59538
+ ** This helps to keep entries in the disk file in order so that a scan
59539
+ ** of the table is closer to a linear scan through the file. That in turn
59540
+ ** helps the operating system to deliver pages from the disk more rapidly.
59541
+ **
59542
+ ** An O(n^2) insertion sort algorithm is used, but since n is never more
59543
+ ** than (NB+2) (a small constant), that should not be a problem.
59544
+ **
59545
+ ** When NB==3, this one optimization makes the database about 25% faster
59546
+ ** for large insertions and deletions.
59547
+ */
59548
+ for(i=0; i<nNew; i++){
59549
+ aPgOrder[i] = aPgno[i] = apNew[i]->pgno;
59550
+ aPgFlags[i] = apNew[i]->pDbPage->flags;
59551
+ for(j=0; j<i; j++){
59552
+ if( aPgno[j]==aPgno[i] ){
59553
+ /* This branch is taken if the set of sibling pages somehow contains
59554
+ ** duplicate entries. This can happen if the database is corrupt.
59555
+ ** It would be simpler to detect this as part of the loop below, but
59556
+ ** we do the detection here in order to avoid populating the pager
59557
+ ** cache with two separate objects associated with the same
59558
+ ** page number. */
59559
+ assert( CORRUPT_DB );
59560
+ rc = SQLITE_CORRUPT_BKPT;
59561
+ goto balance_cleanup;
59562
+ }
59563
+ }
59564
+ }
59565
+ for(i=0; i<nNew; i++){
59566
+ int iBest = 0; /* aPgno[] index of page number to use */
59567
+ for(j=1; j<nNew; j++){
59568
+ if( aPgOrder[j]<aPgOrder[iBest] ) iBest = j;
59569
+ }
59570
+ pgno = aPgOrder[iBest];
59571
+ aPgOrder[iBest] = 0xffffffff;
59572
+ if( iBest!=i ){
59573
+ if( iBest>i ){
59574
+ sqlite3PagerRekey(apNew[iBest]->pDbPage, pBt->nPage+iBest+1, 0);
59575
+ }
59576
+ sqlite3PagerRekey(apNew[i]->pDbPage, pgno, aPgFlags[iBest]);
59577
+ apNew[i]->pgno = pgno;
59578
+ }
59579
+ }
59580
+
59581
+ TRACE(("BALANCE: new: %d(%d nc=%d) %d(%d nc=%d) %d(%d nc=%d) "
59582
+ "%d(%d nc=%d) %d(%d nc=%d)\n",
59583
+ apNew[0]->pgno, szNew[0], cntNew[0],
5882659584
nNew>=2 ? apNew[1]->pgno : 0, nNew>=2 ? szNew[1] : 0,
59585
+ nNew>=2 ? cntNew[1] - cntNew[0] - !leafData : 0,
5882759586
nNew>=3 ? apNew[2]->pgno : 0, nNew>=3 ? szNew[2] : 0,
59587
+ nNew>=3 ? cntNew[2] - cntNew[1] - !leafData : 0,
5882859588
nNew>=4 ? apNew[3]->pgno : 0, nNew>=4 ? szNew[3] : 0,
58829
- nNew>=5 ? apNew[4]->pgno : 0, nNew>=5 ? szNew[4] : 0));
59589
+ nNew>=4 ? cntNew[3] - cntNew[2] - !leafData : 0,
59590
+ nNew>=5 ? apNew[4]->pgno : 0, nNew>=5 ? szNew[4] : 0,
59591
+ nNew>=5 ? cntNew[4] - cntNew[3] - !leafData : 0
59592
+ ));
5883059593
5883159594
assert( sqlite3PagerIswriteable(pParent->pDbPage) );
5883259595
put4byte(pRight, apNew[nNew-1]->pgno);
5883359596
58834
- /*
58835
- ** Evenly distribute the data in apCell[] across the new pages.
58836
- ** Insert divider cells into pParent as necessary.
59597
+ /* If the sibling pages are not leaves, ensure that the right-child pointer
59598
+ ** of the right-most new sibling page is set to the value that was
59599
+ ** originally in the same field of the right-most old sibling page. */
59600
+ if( (pageFlags & PTF_LEAF)==0 && nOld!=nNew ){
59601
+ MemPage *pOld = (nNew>nOld ? apNew : apOld)[nOld-1];
59602
+ memcpy(&apNew[nNew-1]->aData[8], &pOld->aData[8], 4);
59603
+ }
59604
+
59605
+ /* Make any required updates to pointer map entries associated with
59606
+ ** cells stored on sibling pages following the balance operation. Pointer
59607
+ ** map entries associated with divider cells are set by the insertCell()
59608
+ ** routine. The associated pointer map entries are:
59609
+ **
59610
+ ** a) if the cell contains a reference to an overflow chain, the
59611
+ ** entry associated with the first page in the overflow chain, and
59612
+ **
59613
+ ** b) if the sibling pages are not leaves, the child page associated
59614
+ ** with the cell.
59615
+ **
59616
+ ** If the sibling pages are not leaves, then the pointer map entry
59617
+ ** associated with the right-child of each sibling may also need to be
59618
+ ** updated. This happens below, after the sibling pages have been
59619
+ ** populated, not here.
5883759620
*/
58838
- j = 0;
58839
- for(i=0; i<nNew; i++){
58840
- /* Assemble the new sibling page. */
59621
+ if( ISAUTOVACUUM ){
59622
+ MemPage *pNew = apNew[0];
59623
+ u8 *aOld = pNew->aData;
59624
+ int cntOldNext = pNew->nCell + pNew->nOverflow;
59625
+ int usableSize = pBt->usableSize;
59626
+ int iNew = 0;
59627
+ int iOld = 0;
59628
+
59629
+ for(i=0; i<nCell; i++){
59630
+ u8 *pCell = apCell[i];
59631
+ if( i==cntOldNext ){
59632
+ MemPage *pOld = (++iOld)<nNew ? apNew[iOld] : apOld[iOld];
59633
+ cntOldNext += pOld->nCell + pOld->nOverflow + !leafData;
59634
+ aOld = pOld->aData;
59635
+ }
59636
+ if( i==cntNew[iNew] ){
59637
+ pNew = apNew[++iNew];
59638
+ if( !leafData ) continue;
59639
+ }
59640
+
59641
+ /* Cell pCell is destined for new sibling page pNew. Originally, it
59642
+ ** was either part of sibling page iOld (possibly an overflow cell),
59643
+ ** or else the divider cell to the left of sibling page iOld. So,
59644
+ ** if sibling page iOld had the same page number as pNew, and if
59645
+ ** pCell really was a part of sibling page iOld (not a divider or
59646
+ ** overflow cell), we can skip updating the pointer map entries. */
59647
+ if( iOld>=nNew
59648
+ || pNew->pgno!=aPgno[iOld]
59649
+ || pCell<aOld
59650
+ || pCell>=&aOld[usableSize]
59651
+ ){
59652
+ if( !leafCorrection ){
59653
+ ptrmapPut(pBt, get4byte(pCell), PTRMAP_BTREE, pNew->pgno, &rc);
59654
+ }
59655
+ if( szCell[i]>pNew->minLocal ){
59656
+ ptrmapPutOvflPtr(pNew, pCell, &rc);
59657
+ }
59658
+ }
59659
+ }
59660
+ }
59661
+
59662
+ /* Insert new divider cells into pParent. */
59663
+ for(i=0; i<nNew-1; i++){
59664
+ u8 *pCell;
59665
+ u8 *pTemp;
59666
+ int sz;
5884159667
MemPage *pNew = apNew[i];
58842
- assert( j<nMaxCells );
58843
- zeroPage(pNew, pageFlags);
58844
- assemblePage(pNew, cntNew[i]-j, &apCell[j], &szCell[j]);
58845
- assert( pNew->nCell>0 || (nNew==1 && cntNew[0]==0) );
58846
- assert( pNew->nOverflow==0 );
58847
-
5884859668
j = cntNew[i];
5884959669
58850
- /* If the sibling page assembled above was not the right-most sibling,
58851
- ** insert a divider cell into the parent page.
58852
- */
58853
- assert( i<nNew-1 || j==nCell );
58854
- if( j<nCell ){
58855
- u8 *pCell;
58856
- u8 *pTemp;
58857
- int sz;
58858
-
58859
- assert( j<nMaxCells );
58860
- pCell = apCell[j];
58861
- sz = szCell[j] + leafCorrection;
58862
- pTemp = &aOvflSpace[iOvflSpace];
58863
- if( !pNew->leaf ){
58864
- memcpy(&pNew->aData[8], pCell, 4);
58865
- }else if( leafData ){
58866
- /* If the tree is a leaf-data tree, and the siblings are leaves,
58867
- ** then there is no divider cell in apCell[]. Instead, the divider
58868
- ** cell consists of the integer key for the right-most cell of
58869
- ** the sibling-page assembled above only.
58870
- */
58871
- CellInfo info;
58872
- j--;
58873
- btreeParseCellPtr(pNew, apCell[j], &info);
58874
- pCell = pTemp;
58875
- sz = 4 + putVarint(&pCell[4], info.nKey);
58876
- pTemp = 0;
58877
- }else{
58878
- pCell -= 4;
58879
- /* Obscure case for non-leaf-data trees: If the cell at pCell was
58880
- ** previously stored on a leaf node, and its reported size was 4
58881
- ** bytes, then it may actually be smaller than this
58882
- ** (see btreeParseCellPtr(), 4 bytes is the minimum size of
58883
- ** any cell). But it is important to pass the correct size to
58884
- ** insertCell(), so reparse the cell now.
58885
- **
58886
- ** Note that this can never happen in an SQLite data file, as all
58887
- ** cells are at least 4 bytes. It only happens in b-trees used
58888
- ** to evaluate "IN (SELECT ...)" and similar clauses.
58889
- */
58890
- if( szCell[j]==4 ){
58891
- assert(leafCorrection==4);
58892
- sz = cellSizePtr(pParent, pCell);
58893
- }
58894
- }
58895
- iOvflSpace += sz;
58896
- assert( sz<=pBt->maxLocal+23 );
58897
- assert( iOvflSpace <= (int)pBt->pageSize );
58898
- insertCell(pParent, nxDiv, pCell, sz, pTemp, pNew->pgno, &rc);
58899
- if( rc!=SQLITE_OK ) goto balance_cleanup;
58900
- assert( sqlite3PagerIswriteable(pParent->pDbPage) );
58901
-
58902
- j++;
58903
- nxDiv++;
58904
- }
58905
- }
58906
- assert( j==nCell );
59670
+ assert( j<nMaxCells );
59671
+ pCell = apCell[j];
59672
+ sz = szCell[j] + leafCorrection;
59673
+ pTemp = &aOvflSpace[iOvflSpace];
59674
+ if( !pNew->leaf ){
59675
+ memcpy(&pNew->aData[8], pCell, 4);
59676
+ }else if( leafData ){
59677
+ /* If the tree is a leaf-data tree, and the siblings are leaves,
59678
+ ** then there is no divider cell in apCell[]. Instead, the divider
59679
+ ** cell consists of the integer key for the right-most cell of
59680
+ ** the sibling-page assembled above only.
59681
+ */
59682
+ CellInfo info;
59683
+ j--;
59684
+ btreeParseCellPtr(pNew, apCell[j], &info);
59685
+ pCell = pTemp;
59686
+ sz = 4 + putVarint(&pCell[4], info.nKey);
59687
+ pTemp = 0;
59688
+ }else{
59689
+ pCell -= 4;
59690
+ /* Obscure case for non-leaf-data trees: If the cell at pCell was
59691
+ ** previously stored on a leaf node, and its reported size was 4
59692
+ ** bytes, then it may actually be smaller than this
59693
+ ** (see btreeParseCellPtr(), 4 bytes is the minimum size of
59694
+ ** any cell). But it is important to pass the correct size to
59695
+ ** insertCell(), so reparse the cell now.
59696
+ **
59697
+ ** Note that this can never happen in an SQLite data file, as all
59698
+ ** cells are at least 4 bytes. It only happens in b-trees used
59699
+ ** to evaluate "IN (SELECT ...)" and similar clauses.
59700
+ */
59701
+ if( szCell[j]==4 ){
59702
+ assert(leafCorrection==4);
59703
+ sz = cellSizePtr(pParent, pCell);
59704
+ }
59705
+ }
59706
+ iOvflSpace += sz;
59707
+ assert( sz<=pBt->maxLocal+23 );
59708
+ assert( iOvflSpace <= (int)pBt->pageSize );
59709
+ insertCell(pParent, nxDiv+i, pCell, sz, pTemp, pNew->pgno, &rc);
59710
+ if( rc!=SQLITE_OK ) goto balance_cleanup;
59711
+ assert( sqlite3PagerIswriteable(pParent->pDbPage) );
59712
+ }
59713
+
59714
+ /* Now update the actual sibling pages. The order in which they are updated
59715
+ ** is important, as this code needs to avoid disrupting any page from which
59716
+ ** cells may still to be read. In practice, this means:
59717
+ **
59718
+ ** (1) If cells are moving left (from apNew[iPg] to apNew[iPg-1])
59719
+ ** then it is not safe to update page apNew[iPg] until after
59720
+ ** the left-hand sibling apNew[iPg-1] has been updated.
59721
+ **
59722
+ ** (2) If cells are moving right (from apNew[iPg] to apNew[iPg+1])
59723
+ ** then it is not safe to update page apNew[iPg] until after
59724
+ ** the right-hand sibling apNew[iPg+1] has been updated.
59725
+ **
59726
+ ** If neither of the above apply, the page is safe to update.
59727
+ **
59728
+ ** The iPg value in the following loop starts at nNew-1 goes down
59729
+ ** to 0, then back up to nNew-1 again, thus making two passes over
59730
+ ** the pages. On the initial downward pass, only condition (1) above
59731
+ ** needs to be tested because (2) will always be true from the previous
59732
+ ** step. On the upward pass, both conditions are always true, so the
59733
+ ** upwards pass simply processes pages that were missed on the downward
59734
+ ** pass.
59735
+ */
59736
+ for(i=1-nNew; i<nNew; i++){
59737
+ int iPg = i<0 ? -i : i;
59738
+ assert( iPg>=0 && iPg<nNew );
59739
+ if( abDone[iPg] ) continue; /* Skip pages already processed */
59740
+ if( i>=0 /* On the upwards pass, or... */
59741
+ || cntOld[iPg-1]>=cntNew[iPg-1] /* Condition (1) is true */
59742
+ ){
59743
+ int iNew;
59744
+ int iOld;
59745
+ int nNewCell;
59746
+
59747
+ /* Verify condition (1): If cells are moving left, update iPg
59748
+ ** only after iPg-1 has already been updated. */
59749
+ assert( iPg==0 || cntOld[iPg-1]>=cntNew[iPg-1] || abDone[iPg-1] );
59750
+
59751
+ /* Verify condition (2): If cells are moving right, update iPg
59752
+ ** only after iPg+1 has already been updated. */
59753
+ assert( cntNew[iPg]>=cntOld[iPg] || abDone[iPg+1] );
59754
+
59755
+ if( iPg==0 ){
59756
+ iNew = iOld = 0;
59757
+ nNewCell = cntNew[0];
59758
+ }else{
59759
+ iOld = iPg<nOld ? (cntOld[iPg-1] + !leafData) : nCell;
59760
+ iNew = cntNew[iPg-1] + !leafData;
59761
+ nNewCell = cntNew[iPg] - iNew;
59762
+ }
59763
+
59764
+ editPage(apNew[iPg], iOld, iNew, nNewCell, apCell, szCell);
59765
+ abDone[iPg]++;
59766
+ apNew[iPg]->nFree = usableSpace-szNew[iPg];
59767
+ assert( apNew[iPg]->nOverflow==0 );
59768
+ assert( apNew[iPg]->nCell==nNewCell );
59769
+ }
59770
+ }
59771
+
59772
+ /* All pages have been processed exactly once */
59773
+ assert( memcmp(abDone, "\01\01\01\01\01", nNew)==0 );
59774
+
5890759775
assert( nOld>0 );
5890859776
assert( nNew>0 );
58909
- if( (pageFlags & PTF_LEAF)==0 ){
58910
- u8 *zChild = &apCopy[nOld-1]->aData[8];
58911
- memcpy(&apNew[nNew-1]->aData[8], zChild, 4);
58912
- }
5891359777
5891459778
if( isRoot && pParent->nCell==0 && pParent->hdrOffset<=apNew[0]->nFree ){
5891559779
/* The root page of the b-tree now contains no cells. The only sibling
5891659780
** page is the right-child of the parent. Copy the contents of the
5891759781
** child page into the parent, decreasing the overall height of the
@@ -58920,130 +59784,54 @@
5892059784
**
5892159785
** If this is an auto-vacuum database, the call to copyNodeContent()
5892259786
** sets all pointer-map entries corresponding to database image pages
5892359787
** for which the pointer is stored within the content being copied.
5892459788
**
58925
- ** The second assert below verifies that the child page is defragmented
58926
- ** (it must be, as it was just reconstructed using assemblePage()). This
58927
- ** is important if the parent page happens to be page 1 of the database
58928
- ** image. */
59789
+ ** It is critical that the child page be defragmented before being
59790
+ ** copied into the parent, because if the parent is page 1 then it will
59791
+ ** by smaller than the child due to the database header, and so all the
59792
+ ** free space needs to be up front.
59793
+ */
5892959794
assert( nNew==1 );
59795
+ rc = defragmentPage(apNew[0]);
59796
+ testcase( rc!=SQLITE_OK );
5893059797
assert( apNew[0]->nFree ==
58931
- (get2byte(&apNew[0]->aData[5])-apNew[0]->cellOffset-apNew[0]->nCell*2)
59798
+ (get2byte(&apNew[0]->aData[5])-apNew[0]->cellOffset-apNew[0]->nCell*2)
59799
+ || rc!=SQLITE_OK
5893259800
);
5893359801
copyNodeContent(apNew[0], pParent, &rc);
5893459802
freePage(apNew[0], &rc);
58935
- }else if( ISAUTOVACUUM ){
58936
- /* Fix the pointer-map entries for all the cells that were shifted around.
58937
- ** There are several different types of pointer-map entries that need to
58938
- ** be dealt with by this routine. Some of these have been set already, but
58939
- ** many have not. The following is a summary:
58940
- **
58941
- ** 1) The entries associated with new sibling pages that were not
58942
- ** siblings when this function was called. These have already
58943
- ** been set. We don't need to worry about old siblings that were
58944
- ** moved to the free-list - the freePage() code has taken care
58945
- ** of those.
58946
- **
58947
- ** 2) The pointer-map entries associated with the first overflow
58948
- ** page in any overflow chains used by new divider cells. These
58949
- ** have also already been taken care of by the insertCell() code.
58950
- **
58951
- ** 3) If the sibling pages are not leaves, then the child pages of
58952
- ** cells stored on the sibling pages may need to be updated.
58953
- **
58954
- ** 4) If the sibling pages are not internal intkey nodes, then any
58955
- ** overflow pages used by these cells may need to be updated
58956
- ** (internal intkey nodes never contain pointers to overflow pages).
58957
- **
58958
- ** 5) If the sibling pages are not leaves, then the pointer-map
58959
- ** entries for the right-child pages of each sibling may need
58960
- ** to be updated.
58961
- **
58962
- ** Cases 1 and 2 are dealt with above by other code. The next
58963
- ** block deals with cases 3 and 4 and the one after that, case 5. Since
58964
- ** setting a pointer map entry is a relatively expensive operation, this
58965
- ** code only sets pointer map entries for child or overflow pages that have
58966
- ** actually moved between pages. */
58967
- MemPage *pNew = apNew[0];
58968
- MemPage *pOld = apCopy[0];
58969
- int nOverflow = pOld->nOverflow;
58970
- int iNextOld = pOld->nCell + nOverflow;
58971
- int iOverflow = (nOverflow ? pOld->aiOvfl[0] : -1);
58972
- j = 0; /* Current 'old' sibling page */
58973
- k = 0; /* Current 'new' sibling page */
58974
- for(i=0; i<nCell; i++){
58975
- int isDivider = 0;
58976
- while( i==iNextOld ){
58977
- /* Cell i is the cell immediately following the last cell on old
58978
- ** sibling page j. If the siblings are not leaf pages of an
58979
- ** intkey b-tree, then cell i was a divider cell. */
58980
- assert( j+1 < ArraySize(apCopy) );
58981
- assert( j+1 < nOld );
58982
- pOld = apCopy[++j];
58983
- iNextOld = i + !leafData + pOld->nCell + pOld->nOverflow;
58984
- if( pOld->nOverflow ){
58985
- nOverflow = pOld->nOverflow;
58986
- iOverflow = i + !leafData + pOld->aiOvfl[0];
58987
- }
58988
- isDivider = !leafData;
58989
- }
58990
-
58991
- assert(nOverflow>0 || iOverflow<i );
58992
- assert(nOverflow<2 || pOld->aiOvfl[0]==pOld->aiOvfl[1]-1);
58993
- assert(nOverflow<3 || pOld->aiOvfl[1]==pOld->aiOvfl[2]-1);
58994
- if( i==iOverflow ){
58995
- isDivider = 1;
58996
- if( (--nOverflow)>0 ){
58997
- iOverflow++;
58998
- }
58999
- }
59000
-
59001
- if( i==cntNew[k] ){
59002
- /* Cell i is the cell immediately following the last cell on new
59003
- ** sibling page k. If the siblings are not leaf pages of an
59004
- ** intkey b-tree, then cell i is a divider cell. */
59005
- pNew = apNew[++k];
59006
- if( !leafData ) continue;
59007
- }
59008
- assert( j<nOld );
59009
- assert( k<nNew );
59010
-
59011
- /* If the cell was originally divider cell (and is not now) or
59012
- ** an overflow cell, or if the cell was located on a different sibling
59013
- ** page before the balancing, then the pointer map entries associated
59014
- ** with any child or overflow pages need to be updated. */
59015
- if( isDivider || pOld->pgno!=pNew->pgno ){
59016
- if( !leafCorrection ){
59017
- ptrmapPut(pBt, get4byte(apCell[i]), PTRMAP_BTREE, pNew->pgno, &rc);
59018
- }
59019
- if( szCell[i]>pNew->minLocal ){
59020
- ptrmapPutOvflPtr(pNew, apCell[i], &rc);
59021
- }
59022
- }
59023
- }
59024
-
59025
- if( !leafCorrection ){
59026
- for(i=0; i<nNew; i++){
59027
- u32 key = get4byte(&apNew[i]->aData[8]);
59028
- ptrmapPut(pBt, key, PTRMAP_BTREE, apNew[i]->pgno, &rc);
59029
- }
59030
- }
59803
+ }else if( ISAUTOVACUUM && !leafCorrection ){
59804
+ /* Fix the pointer map entries associated with the right-child of each
59805
+ ** sibling page. All other pointer map entries have already been taken
59806
+ ** care of. */
59807
+ for(i=0; i<nNew; i++){
59808
+ u32 key = get4byte(&apNew[i]->aData[8]);
59809
+ ptrmapPut(pBt, key, PTRMAP_BTREE, apNew[i]->pgno, &rc);
59810
+ }
59811
+ }
59812
+
59813
+ assert( pParent->isInit );
59814
+ TRACE(("BALANCE: finished: old=%d new=%d cells=%d\n",
59815
+ nOld, nNew, nCell));
59816
+
59817
+ /* Free any old pages that were not reused as new pages.
59818
+ */
59819
+ for(i=nNew; i<nOld; i++){
59820
+ freePage(apOld[i], &rc);
59821
+ }
5903159822
5903259823
#if 0
59824
+ if( ISAUTOVACUUM && rc==SQLITE_OK && apNew[0]->isInit ){
5903359825
/* The ptrmapCheckPages() contains assert() statements that verify that
5903459826
** all pointer map pages are set correctly. This is helpful while
5903559827
** debugging. This is usually disabled because a corrupt database may
5903659828
** cause an assert() statement to fail. */
5903759829
ptrmapCheckPages(apNew, nNew);
5903859830
ptrmapCheckPages(&pParent, 1);
59831
+ }
5903959832
#endif
59040
- }
59041
-
59042
- assert( pParent->isInit );
59043
- TRACE(("BALANCE: finished: old=%d new=%d cells=%d\n",
59044
- nOld, nNew, nCell));
5904559833
5904659834
/*
5904759835
** Cleanup before returning.
5904859836
*/
5904959837
balance_cleanup:
@@ -60424,12 +61212,18 @@
6042461212
}else{
6042561213
int contentOffset = get2byteNotZero(&data[hdr+5]);
6042661214
assert( contentOffset<=usableSize ); /* Enforced by btreeInitPage() */
6042761215
memset(hit+contentOffset, 0, usableSize-contentOffset);
6042861216
memset(hit, 1, contentOffset);
61217
+ /* EVIDENCE-OF: R-37002-32774 The two-byte integer at offset 3 gives the
61218
+ ** number of cells on the page. */
6042961219
nCell = get2byte(&data[hdr+3]);
61220
+ /* EVIDENCE-OF: R-23882-45353 The cell pointer array of a b-tree page
61221
+ ** immediately follows the b-tree page header. */
6043061222
cellStart = hdr + 12 - 4*pPage->leaf;
61223
+ /* EVIDENCE-OF: R-02776-14802 The cell pointer array consists of K 2-byte
61224
+ ** integer offsets to the cell contents. */
6043161225
for(i=0; i<nCell; i++){
6043261226
int pc = get2byte(&data[cellStart+i*2]);
6043361227
u32 size = 65536;
6043461228
int j;
6043561229
if( pc<=usableSize-4 ){
@@ -60441,18 +61235,27 @@
6044161235
"Corruption detected in cell %d on page %d",i,iPage);
6044261236
}else{
6044361237
for(j=pc+size-1; j>=pc; j--) hit[j]++;
6044461238
}
6044561239
}
61240
+ /* EVIDENCE-OF: R-20690-50594 The second field of the b-tree page header
61241
+ ** is the offset of the first freeblock, or zero if there are no
61242
+ ** freeblocks on the page. */
6044661243
i = get2byte(&data[hdr+1]);
6044761244
while( i>0 ){
6044861245
int size, j;
6044961246
assert( i<=usableSize-4 ); /* Enforced by btreeInitPage() */
6045061247
size = get2byte(&data[i+2]);
6045161248
assert( i+size<=usableSize ); /* Enforced by btreeInitPage() */
6045261249
for(j=i+size-1; j>=i; j--) hit[j]++;
61250
+ /* EVIDENCE-OF: R-58208-19414 The first 2 bytes of a freeblock are a
61251
+ ** big-endian integer which is the offset in the b-tree page of the next
61252
+ ** freeblock in the chain, or zero if the freeblock is the last on the
61253
+ ** chain. */
6045361254
j = get2byte(&data[i]);
61255
+ /* EVIDENCE-OF: R-06866-39125 Freeblocks are always connected in order of
61256
+ ** increasing offset. */
6045461257
assert( j==0 || j>i+size ); /* Enforced by btreeInitPage() */
6045561258
assert( j<=usableSize-4 ); /* Enforced by btreeInitPage() */
6045661259
i = j;
6045761260
}
6045861261
for(i=cnt=0; i<usableSize; i++){
@@ -60462,10 +61265,15 @@
6046261265
checkAppendMsg(pCheck,
6046361266
"Multiple uses for byte %d of page %d", i, iPage);
6046461267
break;
6046561268
}
6046661269
}
61270
+ /* EVIDENCE-OF: R-43263-13491 The total number of bytes in all fragments
61271
+ ** is stored in the fifth field of the b-tree page header.
61272
+ ** EVIDENCE-OF: R-07161-27322 The one-byte integer at offset 7 gives the
61273
+ ** number of fragmented free bytes within the cell content area.
61274
+ */
6046761275
if( cnt!=data[hdr+7] ){
6046861276
checkAppendMsg(pCheck,
6046961277
"Fragmentation of %d bytes reported as %d on page %d",
6047061278
cnt, data[hdr+7], iPage);
6047161279
}
@@ -60865,10 +61673,15 @@
6086561673
*/
6086661674
SQLITE_PRIVATE int sqlite3BtreeIsReadonly(Btree *p){
6086761675
return (p->pBt->btsFlags & BTS_READ_ONLY)!=0;
6086861676
}
6086961677
61678
+/*
61679
+** Return the size of the header added to each page by this module.
61680
+*/
61681
+SQLITE_PRIVATE int sqlite3HeaderSizeBtree(void){ return sizeof(MemPage); }
61682
+
6087061683
/************** End of btree.c ***********************************************/
6087161684
/************** Begin file backup.c ******************************************/
6087261685
/*
6087361686
** 2009 January 28
6087461687
**
@@ -60988,10 +61801,24 @@
6098861801
static int setDestPgsz(sqlite3_backup *p){
6098961802
int rc;
6099061803
rc = sqlite3BtreeSetPageSize(p->pDest,sqlite3BtreeGetPageSize(p->pSrc),-1,0);
6099161804
return rc;
6099261805
}
61806
+
61807
+/*
61808
+** Check that there is no open read-transaction on the b-tree passed as the
61809
+** second argument. If there is not, return SQLITE_OK. Otherwise, if there
61810
+** is an open read-transaction, return SQLITE_ERROR and leave an error
61811
+** message in database handle db.
61812
+*/
61813
+static int checkReadTransaction(sqlite3 *db, Btree *p){
61814
+ if( sqlite3BtreeIsInReadTrans(p) ){
61815
+ sqlite3ErrorWithMsg(db, SQLITE_ERROR, "destination database is in use");
61816
+ return SQLITE_ERROR;
61817
+ }
61818
+ return SQLITE_OK;
61819
+}
6099361820
6099461821
/*
6099561822
** Create an sqlite3_backup process to copy the contents of zSrcDb from
6099661823
** connection handle pSrcDb to zDestDb in pDestDb. If successful, return
6099761824
** a pointer to the new sqlite3_backup object.
@@ -61004,10 +61831,17 @@
6100461831
const char *zDestDb, /* Name of database within pDestDb */
6100561832
sqlite3* pSrcDb, /* Database connection to read from */
6100661833
const char *zSrcDb /* Name of database within pSrcDb */
6100761834
){
6100861835
sqlite3_backup *p; /* Value to return */
61836
+
61837
+#ifdef SQLITE_ENABLE_API_ARMOR
61838
+ if( !sqlite3SafetyCheckOk(pSrcDb)||!sqlite3SafetyCheckOk(pDestDb) ){
61839
+ (void)SQLITE_MISUSE_BKPT;
61840
+ return 0;
61841
+ }
61842
+#endif
6100961843
6101061844
/* Lock the source database handle. The destination database
6101161845
** handle is not locked in this routine, but it is locked in
6101261846
** sqlite3_backup_step(). The user is required to ensure that no
6101361847
** other thread accesses the destination handle for the duration
@@ -61041,16 +61875,19 @@
6104161875
p->pDestDb = pDestDb;
6104261876
p->pSrcDb = pSrcDb;
6104361877
p->iNext = 1;
6104461878
p->isAttached = 0;
6104561879
61046
- if( 0==p->pSrc || 0==p->pDest || setDestPgsz(p)==SQLITE_NOMEM ){
61880
+ if( 0==p->pSrc || 0==p->pDest
61881
+ || setDestPgsz(p)==SQLITE_NOMEM
61882
+ || checkReadTransaction(pDestDb, p->pDest)!=SQLITE_OK
61883
+ ){
6104761884
/* One (or both) of the named databases did not exist or an OOM
61048
- ** error was hit. The error has already been written into the
61049
- ** pDestDb handle. All that is left to do here is free the
61050
- ** sqlite3_backup structure.
61051
- */
61885
+ ** error was hit. Or there is a transaction open on the destination
61886
+ ** database. The error has already been written into the pDestDb
61887
+ ** handle. All that is left to do here is free the sqlite3_backup
61888
+ ** structure. */
6105261889
sqlite3_free(p);
6105361890
p = 0;
6105461891
}
6105561892
}
6105661893
if( p ){
@@ -61201,10 +62038,13 @@
6120162038
int rc;
6120262039
int destMode; /* Destination journal mode */
6120362040
int pgszSrc = 0; /* Source page size */
6120462041
int pgszDest = 0; /* Destination page size */
6120562042
62043
+#ifdef SQLITE_ENABLE_API_ARMOR
62044
+ if( p==0 ) return SQLITE_MISUSE_BKPT;
62045
+#endif
6120662046
sqlite3_mutex_enter(p->pSrcDb->mutex);
6120762047
sqlite3BtreeEnter(p->pSrc);
6120862048
if( p->pDestDb ){
6120962049
sqlite3_mutex_enter(p->pDestDb->mutex);
6121062050
}
@@ -61464,11 +62304,11 @@
6146462304
}
6146562305
*pp = p->pNext;
6146662306
}
6146762307
6146862308
/* If a transaction is still open on the Btree, roll it back. */
61469
- sqlite3BtreeRollback(p->pDest, SQLITE_OK);
62309
+ sqlite3BtreeRollback(p->pDest, SQLITE_OK, 0);
6147062310
6147162311
/* Set the error code of the destination database handle. */
6147262312
rc = (p->rc==SQLITE_DONE) ? SQLITE_OK : p->rc;
6147362313
if( p->pDestDb ){
6147462314
sqlite3Error(p->pDestDb, rc);
@@ -61490,18 +62330,30 @@
6149062330
/*
6149162331
** Return the number of pages still to be backed up as of the most recent
6149262332
** call to sqlite3_backup_step().
6149362333
*/
6149462334
SQLITE_API int sqlite3_backup_remaining(sqlite3_backup *p){
62335
+#ifdef SQLITE_ENABLE_API_ARMOR
62336
+ if( p==0 ){
62337
+ (void)SQLITE_MISUSE_BKPT;
62338
+ return 0;
62339
+ }
62340
+#endif
6149562341
return p->nRemaining;
6149662342
}
6149762343
6149862344
/*
6149962345
** Return the total number of pages in the source database as of the most
6150062346
** recent call to sqlite3_backup_step().
6150162347
*/
6150262348
SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p){
62349
+#ifdef SQLITE_ENABLE_API_ARMOR
62350
+ if( p==0 ){
62351
+ (void)SQLITE_MISUSE_BKPT;
62352
+ return 0;
62353
+ }
62354
+#endif
6150362355
return p->nPagecount;
6150462356
}
6150562357
6150662358
/*
6150762359
** This function is called after the contents of page iPage of the
@@ -63788,10 +64640,38 @@
6378864640
}
6378964641
p->nOp += nOp;
6379064642
}
6379164643
return addr;
6379264644
}
64645
+
64646
+#if defined(SQLITE_ENABLE_STMT_SCANSTATUS)
64647
+/*
64648
+** Add an entry to the array of counters managed by sqlite3_stmt_scanstatus().
64649
+*/
64650
+SQLITE_PRIVATE void sqlite3VdbeScanStatus(
64651
+ Vdbe *p, /* VM to add scanstatus() to */
64652
+ int addrExplain, /* Address of OP_Explain (or 0) */
64653
+ int addrLoop, /* Address of loop counter */
64654
+ int addrVisit, /* Address of rows visited counter */
64655
+ LogEst nEst, /* Estimated number of output rows */
64656
+ const char *zName /* Name of table or index being scanned */
64657
+){
64658
+ int nByte = (p->nScan+1) * sizeof(ScanStatus);
64659
+ ScanStatus *aNew;
64660
+ aNew = (ScanStatus*)sqlite3DbRealloc(p->db, p->aScan, nByte);
64661
+ if( aNew ){
64662
+ ScanStatus *pNew = &aNew[p->nScan++];
64663
+ pNew->addrExplain = addrExplain;
64664
+ pNew->addrLoop = addrLoop;
64665
+ pNew->addrVisit = addrVisit;
64666
+ pNew->nEst = nEst;
64667
+ pNew->zName = sqlite3DbStrDup(p->db, zName);
64668
+ p->aScan = aNew;
64669
+ }
64670
+}
64671
+#endif
64672
+
6379364673
6379464674
/*
6379564675
** Change the value of the P1 operand for a specific instruction.
6379664676
** This routine is useful when a large program is loaded from a
6379764677
** static array using sqlite3VdbeAddOpList but we want to make a
@@ -64887,10 +65767,13 @@
6488765767
p->apArg = allocSpace(p->apArg, nArg*sizeof(Mem*), &zCsr, zEnd, &nByte);
6488865768
p->azVar = allocSpace(p->azVar, nVar*sizeof(char*), &zCsr, zEnd, &nByte);
6488965769
p->apCsr = allocSpace(p->apCsr, nCursor*sizeof(VdbeCursor*),
6489065770
&zCsr, zEnd, &nByte);
6489165771
p->aOnceFlag = allocSpace(p->aOnceFlag, nOnce, &zCsr, zEnd, &nByte);
65772
+#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
65773
+ p->anExec = allocSpace(p->anExec, p->nOp*sizeof(i64), &zCsr, zEnd, &nByte);
65774
+#endif
6489265775
if( nByte ){
6489365776
p->pFree = sqlite3DbMallocZero(db, nByte);
6489465777
}
6489565778
zCsr = p->pFree;
6489665779
zEnd = &zCsr[nByte];
@@ -64903,11 +65786,11 @@
6490365786
for(n=0; n<nVar; n++){
6490465787
p->aVar[n].flags = MEM_Null;
6490565788
p->aVar[n].db = db;
6490665789
}
6490765790
}
64908
- if( p->azVar ){
65791
+ if( p->azVar && pParse->nzVar>0 ){
6490965792
p->nzVar = pParse->nzVar;
6491065793
memcpy(p->azVar, pParse->azVar, p->nzVar*sizeof(p->azVar[0]));
6491165794
memset(pParse->azVar, 0, pParse->nzVar*sizeof(pParse->azVar[0]));
6491265795
}
6491365796
if( p->aMem ){
@@ -64954,10 +65837,13 @@
6495465837
** is used, for example, when a trigger sub-program is halted to restore
6495565838
** control to the main program.
6495665839
*/
6495765840
SQLITE_PRIVATE int sqlite3VdbeFrameRestore(VdbeFrame *pFrame){
6495865841
Vdbe *v = pFrame->v;
65842
+#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
65843
+ v->anExec = pFrame->anExec;
65844
+#endif
6495965845
v->aOnceFlag = pFrame->aOnceFlag;
6496065846
v->nOnceFlag = pFrame->nOnceFlag;
6496165847
v->aOp = pFrame->aOp;
6496265848
v->nOp = pFrame->nOp;
6496365849
v->aMem = pFrame->aMem;
@@ -64964,10 +65850,11 @@
6496465850
v->nMem = pFrame->nMem;
6496565851
v->apCsr = pFrame->apCsr;
6496665852
v->nCursor = pFrame->nCursor;
6496765853
v->db->lastRowid = pFrame->lastRowid;
6496865854
v->nChange = pFrame->nChange;
65855
+ v->db->nChange = pFrame->nDbChange;
6496965856
return pFrame->pc;
6497065857
}
6497165858
6497265859
/*
6497365860
** Close all cursors.
@@ -65531,10 +66418,11 @@
6553166418
** so, abort any other statements this handle currently has active.
6553266419
*/
6553366420
sqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK);
6553466421
sqlite3CloseSavepoints(db);
6553566422
db->autoCommit = 1;
66423
+ p->nChange = 0;
6553666424
}
6553766425
}
6553866426
}
6553966427
6554066428
/* Check for immediate foreign key violations. */
@@ -65571,18 +66459,20 @@
6557166459
sqlite3VdbeLeave(p);
6557266460
return SQLITE_BUSY;
6557366461
}else if( rc!=SQLITE_OK ){
6557466462
p->rc = rc;
6557566463
sqlite3RollbackAll(db, SQLITE_OK);
66464
+ p->nChange = 0;
6557666465
}else{
6557766466
db->nDeferredCons = 0;
6557866467
db->nDeferredImmCons = 0;
6557966468
db->flags &= ~SQLITE_DeferFKs;
6558066469
sqlite3CommitInternalChanges(db);
6558166470
}
6558266471
}else{
6558366472
sqlite3RollbackAll(db, SQLITE_OK);
66473
+ p->nChange = 0;
6558466474
}
6558566475
db->nStatement = 0;
6558666476
}else if( eStatementOp==0 ){
6558766477
if( p->rc==SQLITE_OK || p->errorAction==OE_Fail ){
6558866478
eStatementOp = SAVEPOINT_RELEASE;
@@ -65590,10 +66480,11 @@
6559066480
eStatementOp = SAVEPOINT_ROLLBACK;
6559166481
}else{
6559266482
sqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK);
6559366483
sqlite3CloseSavepoints(db);
6559466484
db->autoCommit = 1;
66485
+ p->nChange = 0;
6559566486
}
6559666487
}
6559766488
6559866489
/* If eStatementOp is non-zero, then a statement transaction needs to
6559966490
** be committed or rolled back. Call sqlite3VdbeCloseStatement() to
@@ -65610,10 +66501,11 @@
6561066501
p->zErrMsg = 0;
6561166502
}
6561266503
sqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK);
6561366504
sqlite3CloseSavepoints(db);
6561466505
db->autoCommit = 1;
66506
+ p->nChange = 0;
6561566507
}
6561666508
}
6561766509
6561866510
/* If this was an INSERT, UPDATE or DELETE and no statement transaction
6561966511
** has been rolled back, update the database connection change-counter.
@@ -65871,10 +66763,16 @@
6587166763
for(i=p->nzVar-1; i>=0; i--) sqlite3DbFree(db, p->azVar[i]);
6587266764
vdbeFreeOpArray(db, p->aOp, p->nOp);
6587366765
sqlite3DbFree(db, p->aColName);
6587466766
sqlite3DbFree(db, p->zSql);
6587566767
sqlite3DbFree(db, p->pFree);
66768
+#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
66769
+ for(i=0; i<p->nScan; i++){
66770
+ sqlite3DbFree(db, p->aScan[i].zName);
66771
+ }
66772
+ sqlite3DbFree(db, p->aScan);
66773
+#endif
6587666774
}
6587766775
6587866776
/*
6587966777
** Delete an entire VDBE.
6588066778
*/
@@ -66029,13 +66927,11 @@
6602966927
/* Figure out whether to use 1, 2, 4, 6 or 8 bytes. */
6603066928
# define MAX_6BYTE ((((i64)0x00008000)<<32)-1)
6603166929
i64 i = pMem->u.i;
6603266930
u64 u;
6603366931
if( i<0 ){
66034
- if( i<(-MAX_6BYTE) ) return 6;
66035
- /* Previous test prevents: u = -(-9223372036854775808) */
66036
- u = -i;
66932
+ u = ~i;
6603766933
}else{
6603866934
u = i;
6603966935
}
6604066936
if( u<=127 ){
6604166937
return ((i&1)==i && file_format>=4) ? 8+(u32)u : 1;
@@ -66197,14 +67093,18 @@
6619767093
){
6619867094
u64 x = FOUR_BYTE_UINT(buf);
6619967095
u32 y = FOUR_BYTE_UINT(buf+4);
6620067096
x = (x<<32) + y;
6620167097
if( serial_type==6 ){
67098
+ /* EVIDENCE-OF: R-29851-52272 Value is a big-endian 64-bit
67099
+ ** twos-complement integer. */
6620267100
pMem->u.i = *(i64*)&x;
6620367101
pMem->flags = MEM_Int;
6620467102
testcase( pMem->u.i<0 );
6620567103
}else{
67104
+ /* EVIDENCE-OF: R-57343-49114 Value is a big-endian IEEE 754-2008 64-bit
67105
+ ** floating point number. */
6620667106
#if !defined(NDEBUG) && !defined(SQLITE_OMIT_FLOATING_POINT)
6620767107
/* Verify that integers and floating point values use the same
6620867108
** byte order. Or, that if SQLITE_MIXED_ENDIAN_64BIT_FLOAT is
6620967109
** defined that 64-bit floating point values really are mixed
6621067110
** endian.
@@ -66228,39 +67128,50 @@
6622867128
Mem *pMem /* Memory cell to write value into */
6622967129
){
6623067130
switch( serial_type ){
6623167131
case 10: /* Reserved for future use */
6623267132
case 11: /* Reserved for future use */
66233
- case 0: { /* NULL */
67133
+ case 0: { /* Null */
67134
+ /* EVIDENCE-OF: R-24078-09375 Value is a NULL. */
6623467135
pMem->flags = MEM_Null;
6623567136
break;
6623667137
}
66237
- case 1: { /* 1-byte signed integer */
67138
+ case 1: {
67139
+ /* EVIDENCE-OF: R-44885-25196 Value is an 8-bit twos-complement
67140
+ ** integer. */
6623867141
pMem->u.i = ONE_BYTE_INT(buf);
6623967142
pMem->flags = MEM_Int;
6624067143
testcase( pMem->u.i<0 );
6624167144
return 1;
6624267145
}
6624367146
case 2: { /* 2-byte signed integer */
67147
+ /* EVIDENCE-OF: R-49794-35026 Value is a big-endian 16-bit
67148
+ ** twos-complement integer. */
6624467149
pMem->u.i = TWO_BYTE_INT(buf);
6624567150
pMem->flags = MEM_Int;
6624667151
testcase( pMem->u.i<0 );
6624767152
return 2;
6624867153
}
6624967154
case 3: { /* 3-byte signed integer */
67155
+ /* EVIDENCE-OF: R-37839-54301 Value is a big-endian 24-bit
67156
+ ** twos-complement integer. */
6625067157
pMem->u.i = THREE_BYTE_INT(buf);
6625167158
pMem->flags = MEM_Int;
6625267159
testcase( pMem->u.i<0 );
6625367160
return 3;
6625467161
}
6625567162
case 4: { /* 4-byte signed integer */
67163
+ /* EVIDENCE-OF: R-01849-26079 Value is a big-endian 32-bit
67164
+ ** twos-complement integer. */
6625667165
pMem->u.i = FOUR_BYTE_INT(buf);
6625767166
pMem->flags = MEM_Int;
6625867167
testcase( pMem->u.i<0 );
6625967168
return 4;
6626067169
}
6626167170
case 5: { /* 6-byte signed integer */
67171
+ /* EVIDENCE-OF: R-50385-09674 Value is a big-endian 48-bit
67172
+ ** twos-complement integer. */
6626267173
pMem->u.i = FOUR_BYTE_UINT(buf+2) + (((i64)1)<<32)*TWO_BYTE_INT(buf);
6626367174
pMem->flags = MEM_Int;
6626467175
testcase( pMem->u.i<0 );
6626567176
return 6;
6626667177
}
@@ -66270,15 +67181,21 @@
6627067181
** to avoid having to move the frame pointer in the common case */
6627167182
return serialGet(buf,serial_type,pMem);
6627267183
}
6627367184
case 8: /* Integer 0 */
6627467185
case 9: { /* Integer 1 */
67186
+ /* EVIDENCE-OF: R-12976-22893 Value is the integer 0. */
67187
+ /* EVIDENCE-OF: R-18143-12121 Value is the integer 1. */
6627567188
pMem->u.i = serial_type-8;
6627667189
pMem->flags = MEM_Int;
6627767190
return 0;
6627867191
}
6627967192
default: {
67193
+ /* EVIDENCE-OF: R-14606-31564 Value is a BLOB that is (N-12)/2 bytes in
67194
+ ** length.
67195
+ ** EVIDENCE-OF: R-28401-00140 Value is a string in the text encoding and
67196
+ ** (N-13)/2 bytes in length. */
6628067197
static const u16 aFlag[] = { MEM_Blob|MEM_Ephem, MEM_Str|MEM_Ephem };
6628167198
pMem->z = (char *)buf;
6628267199
pMem->n = (serial_type-12)/2;
6628367200
pMem->flags = aFlag[serial_type&1];
6628467201
return pMem->n;
@@ -68238,15 +69155,23 @@
6823869155
sqlite3_stmt *pStmt,
6823969156
int N,
6824069157
const void *(*xFunc)(Mem*),
6824169158
int useType
6824269159
){
68243
- const void *ret = 0;
68244
- Vdbe *p = (Vdbe *)pStmt;
69160
+ const void *ret;
69161
+ Vdbe *p;
6824569162
int n;
68246
- sqlite3 *db = p->db;
68247
-
69163
+ sqlite3 *db;
69164
+#ifdef SQLITE_ENABLE_API_ARMOR
69165
+ if( pStmt==0 ){
69166
+ (void)SQLITE_MISUSE_BKPT;
69167
+ return 0;
69168
+ }
69169
+#endif
69170
+ ret = 0;
69171
+ p = (Vdbe *)pStmt;
69172
+ db = p->db;
6824869173
assert( db!=0 );
6824969174
n = sqlite3_column_count(pStmt);
6825069175
if( N<n && N>=0 ){
6825169176
N += useType*n;
6825269177
sqlite3_mutex_enter(db->mutex);
@@ -68707,10 +69632,16 @@
6870769632
** prepared statement for the database connection. Return NULL if there
6870869633
** are no more.
6870969634
*/
6871069635
SQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt){
6871169636
sqlite3_stmt *pNext;
69637
+#ifdef SQLITE_ENABLE_API_ARMOR
69638
+ if( !sqlite3SafetyCheckOk(pDb) ){
69639
+ (void)SQLITE_MISUSE_BKPT;
69640
+ return 0;
69641
+ }
69642
+#endif
6871269643
sqlite3_mutex_enter(pDb->mutex);
6871369644
if( pStmt==0 ){
6871469645
pNext = (sqlite3_stmt*)pDb->pVdbe;
6871569646
}else{
6871669647
pNext = (sqlite3_stmt*)((Vdbe*)pStmt)->pNext;
@@ -68722,15 +69653,91 @@
6872269653
/*
6872369654
** Return the value of a status counter for a prepared statement
6872469655
*/
6872569656
SQLITE_API int sqlite3_stmt_status(sqlite3_stmt *pStmt, int op, int resetFlag){
6872669657
Vdbe *pVdbe = (Vdbe*)pStmt;
68727
- u32 v = pVdbe->aCounter[op];
69658
+ u32 v;
69659
+#ifdef SQLITE_ENABLE_API_ARMOR
69660
+ if( !pStmt ){
69661
+ (void)SQLITE_MISUSE_BKPT;
69662
+ return 0;
69663
+ }
69664
+#endif
69665
+ v = pVdbe->aCounter[op];
6872869666
if( resetFlag ) pVdbe->aCounter[op] = 0;
6872969667
return (int)v;
6873069668
}
6873169669
69670
+#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
69671
+/*
69672
+** Return status data for a single loop within query pStmt.
69673
+*/
69674
+SQLITE_API int sqlite3_stmt_scanstatus(
69675
+ sqlite3_stmt *pStmt, /* Prepared statement being queried */
69676
+ int idx, /* Index of loop to report on */
69677
+ int iScanStatusOp, /* Which metric to return */
69678
+ void *pOut /* OUT: Write the answer here */
69679
+){
69680
+ Vdbe *p = (Vdbe*)pStmt;
69681
+ ScanStatus *pScan;
69682
+ if( idx<0 || idx>=p->nScan ) return 1;
69683
+ pScan = &p->aScan[idx];
69684
+ switch( iScanStatusOp ){
69685
+ case SQLITE_SCANSTAT_NLOOP: {
69686
+ *(sqlite3_int64*)pOut = p->anExec[pScan->addrLoop];
69687
+ break;
69688
+ }
69689
+ case SQLITE_SCANSTAT_NVISIT: {
69690
+ *(sqlite3_int64*)pOut = p->anExec[pScan->addrVisit];
69691
+ break;
69692
+ }
69693
+ case SQLITE_SCANSTAT_EST: {
69694
+ double r = 1.0;
69695
+ LogEst x = pScan->nEst;
69696
+ while( x<100 ){
69697
+ x += 10;
69698
+ r *= 0.5;
69699
+ }
69700
+ *(double*)pOut = r*sqlite3LogEstToInt(x);
69701
+ break;
69702
+ }
69703
+ case SQLITE_SCANSTAT_NAME: {
69704
+ *(const char**)pOut = pScan->zName;
69705
+ break;
69706
+ }
69707
+ case SQLITE_SCANSTAT_EXPLAIN: {
69708
+ if( pScan->addrExplain ){
69709
+ *(const char**)pOut = p->aOp[ pScan->addrExplain ].p4.z;
69710
+ }else{
69711
+ *(const char**)pOut = 0;
69712
+ }
69713
+ break;
69714
+ }
69715
+ case SQLITE_SCANSTAT_SELECTID: {
69716
+ if( pScan->addrExplain ){
69717
+ *(int*)pOut = p->aOp[ pScan->addrExplain ].p1;
69718
+ }else{
69719
+ *(int*)pOut = -1;
69720
+ }
69721
+ break;
69722
+ }
69723
+ default: {
69724
+ return 1;
69725
+ }
69726
+ }
69727
+ return 0;
69728
+}
69729
+
69730
+/*
69731
+** Zero all counters associated with the sqlite3_stmt_scanstatus() data.
69732
+*/
69733
+SQLITE_API void sqlite3_stmt_scanstatus_reset(sqlite3_stmt *pStmt){
69734
+ Vdbe *p = (Vdbe*)pStmt;
69735
+ memset(p->anExec, 0, p->nOp * sizeof(i64));
69736
+}
69737
+#endif /* SQLITE_ENABLE_STMT_SCANSTATUS */
69738
+
6873269739
/************** End of vdbeapi.c *********************************************/
6873369740
/************** Begin file vdbetrace.c ***************************************/
6873469741
/*
6873569742
** 2009 November 25
6873669743
**
@@ -69612,10 +70619,13 @@
6961270619
#ifdef VDBE_PROFILE
6961370620
start = sqlite3Hwtime();
6961470621
#endif
6961570622
nVmStep++;
6961670623
pOp = &aOp[pc];
70624
+#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
70625
+ if( p->anExec ) p->anExec[pc]++;
70626
+#endif
6961770627
6961870628
/* Only allow tracing if SQLITE_DEBUG is defined.
6961970629
*/
6962070630
#ifdef SQLITE_DEBUG
6962170631
if( db->flags & SQLITE_VdbeTrace ){
@@ -71302,11 +72312,11 @@
7130272312
assert( pReg->flags & MEM_Blob );
7130372313
assert( memIsValid(pReg) );
7130472314
pC->payloadSize = pC->szRow = avail = pReg->n;
7130572315
pC->aRow = (u8*)pReg->z;
7130672316
}else{
71307
- MemSetTypeFlag(pDest, MEM_Null);
72317
+ sqlite3VdbeMemSetNull(pDest);
7130872318
goto op_column_out;
7130972319
}
7131072320
}else{
7131172321
assert( pCrsr );
7131272322
if( pC->isTable==0 ){
@@ -71637,11 +72647,14 @@
7163772647
testcase( serial_type==127 );
7163872648
testcase( serial_type==128 );
7163972649
nHdr += serial_type<=127 ? 1 : sqlite3VarintLen(serial_type);
7164072650
}while( (--pRec)>=pData0 );
7164172651
71642
- /* Add the initial header varint and total the size */
72652
+ /* EVIDENCE-OF: R-22564-11647 The header begins with a single varint
72653
+ ** which determines the total number of bytes in the header. The varint
72654
+ ** value is the size of the header in bytes including the size varint
72655
+ ** itself. */
7164372656
testcase( nHdr==126 );
7164472657
testcase( nHdr==127 );
7164572658
if( nHdr<=126 ){
7164672659
/* The common case */
7164772660
nHdr += 1;
@@ -71671,11 +72684,15 @@
7167172684
j = nHdr;
7167272685
assert( pData0<=pLast );
7167372686
pRec = pData0;
7167472687
do{
7167572688
serial_type = pRec->uTemp;
72689
+ /* EVIDENCE-OF: R-06529-47362 Following the size varint are one or more
72690
+ ** additional varints, one per column. */
7167672691
i += putVarint32(&zNewRecord[i], serial_type); /* serial type */
72692
+ /* EVIDENCE-OF: R-64536-51728 The values for each column in the record
72693
+ ** immediately follow the header. */
7167772694
j += sqlite3VdbeSerialPut(&zNewRecord[j], pRec, serial_type); /* content */
7167872695
}while( (++pRec)<=pLast );
7167972696
assert( i==nHdr );
7168072697
assert( j==nByte );
7168172698
@@ -71826,23 +72843,30 @@
7182672843
goto vdbe_return;
7182772844
}
7182872845
db->isTransactionSavepoint = 0;
7182972846
rc = p->rc;
7183072847
}else{
72848
+ int isSchemaChange;
7183172849
iSavepoint = db->nSavepoint - iSavepoint - 1;
7183272850
if( p1==SAVEPOINT_ROLLBACK ){
72851
+ isSchemaChange = (db->flags & SQLITE_InternChanges)!=0;
7183372852
for(ii=0; ii<db->nDb; ii++){
71834
- sqlite3BtreeTripAllCursors(db->aDb[ii].pBt, SQLITE_ABORT);
72853
+ rc = sqlite3BtreeTripAllCursors(db->aDb[ii].pBt,
72854
+ SQLITE_ABORT_ROLLBACK,
72855
+ isSchemaChange==0);
72856
+ if( rc!=SQLITE_OK ) goto abort_due_to_error;
7183572857
}
72858
+ }else{
72859
+ isSchemaChange = 0;
7183672860
}
7183772861
for(ii=0; ii<db->nDb; ii++){
7183872862
rc = sqlite3BtreeSavepoint(db->aDb[ii].pBt, p1, iSavepoint);
7183972863
if( rc!=SQLITE_OK ){
7184072864
goto abort_due_to_error;
7184172865
}
7184272866
}
71843
- if( p1==SAVEPOINT_ROLLBACK && (db->flags&SQLITE_InternChanges)!=0 ){
72867
+ if( isSchemaChange ){
7184472868
sqlite3ExpirePreparedStatements(db);
7184572869
sqlite3ResetAllSchemasOfConnection(db);
7184672870
db->flags = (db->flags | SQLITE_InternChanges);
7184772871
}
7184872872
}
@@ -72235,11 +73259,11 @@
7223573259
assert( p->bIsReader );
7223673260
assert( pOp->opcode==OP_OpenRead || pOp->opcode==OP_ReopenIdx
7223773261
|| p->readOnly==0 );
7223873262
7223973263
if( p->expired ){
72240
- rc = SQLITE_ABORT;
73264
+ rc = SQLITE_ABORT_ROLLBACK;
7224173265
break;
7224273266
}
7224373267
7224473268
nField = 0;
7224573269
pKeyInfo = 0;
@@ -72799,14 +73823,14 @@
7279973823
}
7280073824
pIdxKey = &r;
7280173825
}else{
7280273826
pIdxKey = sqlite3VdbeAllocUnpackedRecord(
7280373827
pC->pKeyInfo, aTempRec, sizeof(aTempRec), &pFree
72804
- );
73828
+ );
7280573829
if( pIdxKey==0 ) goto no_mem;
7280673830
assert( pIn3->flags & MEM_Blob );
72807
- assert( (pIn3->flags & MEM_Zero)==0 ); /* zeroblobs already expanded */
73831
+ ExpandBlob(pIn3);
7280873832
sqlite3VdbeRecordUnpack(pC->pKeyInfo, pIn3->n, pIn3->z, pIdxKey);
7280973833
}
7281073834
pIdxKey->default_rc = 0;
7281173835
if( pOp->opcode==OP_NoConflict ){
7281273836
/* For the OP_NoConflict opcode, take the jump if any of the
@@ -73402,10 +74426,14 @@
7340274426
#endif /* SQLITE_OMIT_VIRTUALTABLE */
7340374427
}else{
7340474428
assert( pC->pCursor!=0 );
7340574429
rc = sqlite3VdbeCursorRestore(pC);
7340674430
if( rc ) goto abort_due_to_error;
74431
+ if( pC->nullRow ){
74432
+ pOut->flags = MEM_Null;
74433
+ break;
74434
+ }
7340774435
rc = sqlite3BtreeKeySize(pC->pCursor, &v);
7340874436
assert( rc==SQLITE_OK ); /* Always so because of CursorRestore() above */
7340974437
}
7341074438
pOut->u.i = v;
7341174439
break;
@@ -73492,13 +74520,13 @@
7349274520
}
7349374521
/* Opcode: Rewind P1 P2 * * *
7349474522
**
7349574523
** The next use of the Rowid or Column or Next instruction for P1
7349674524
** will refer to the first entry in the database table or index.
73497
-** If the table or index is empty and P2>0, then jump immediately to P2.
73498
-** If P2 is 0 or if the table or index is not empty, fall through
73499
-** to the following instruction.
74525
+** If the table or index is empty, jump immediately to P2.
74526
+** If the table or index is not empty, fall through to the following
74527
+** instruction.
7350074528
**
7350174529
** This opcode leaves the cursor configured to move in forward order,
7350274530
** from the beginning toward the end. In other words, the cursor is
7350374531
** configured to use Next, not Prev.
7350474532
*/
@@ -74410,10 +75438,13 @@
7441075438
pFrame->aOp = p->aOp;
7441175439
pFrame->nOp = p->nOp;
7441275440
pFrame->token = pProgram->token;
7441375441
pFrame->aOnceFlag = p->aOnceFlag;
7441475442
pFrame->nOnceFlag = p->nOnceFlag;
75443
+#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
75444
+ pFrame->anExec = p->anExec;
75445
+#endif
7441575446
7441675447
pEnd = &VdbeFrameMem(pFrame)[pFrame->nChildMem];
7441775448
for(pMem=VdbeFrameMem(pFrame); pMem!=pEnd; pMem++){
7441875449
pMem->flags = MEM_Undefined;
7441975450
pMem->db = db;
@@ -74427,10 +75458,11 @@
7442775458
7442875459
p->nFrame++;
7442975460
pFrame->pParent = p->pFrame;
7443075461
pFrame->lastRowid = lastRowid;
7443175462
pFrame->nChange = p->nChange;
75463
+ pFrame->nDbChange = p->db->nChange;
7443275464
p->nChange = 0;
7443375465
p->pFrame = pFrame;
7443475466
p->aMem = aMem = &VdbeFrameMem(pFrame)[-1];
7443575467
p->nMem = pFrame->nChildMem;
7443675468
p->nCursor = (u16)pFrame->nChildCsr;
@@ -74437,10 +75469,13 @@
7443775469
p->apCsr = (VdbeCursor **)&aMem[p->nMem+1];
7443875470
p->aOp = aOp = pProgram->aOp;
7443975471
p->nOp = pProgram->nOp;
7444075472
p->aOnceFlag = (u8 *)&p->apCsr[p->nCursor];
7444175473
p->nOnceFlag = pProgram->nOnce;
75474
+#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
75475
+ p->anExec = 0;
75476
+#endif
7444275477
pc = -1;
7444375478
memset(p->aOnceFlag, 0, p->nOnceFlag);
7444475479
7444575480
break;
7444675481
}
@@ -74681,12 +75716,12 @@
7468175716
7468275717
#ifndef SQLITE_OMIT_WAL
7468375718
/* Opcode: Checkpoint P1 P2 P3 * *
7468475719
**
7468575720
** Checkpoint database P1. This is a no-op if P1 is not currently in
74686
-** WAL mode. Parameter P2 is one of SQLITE_CHECKPOINT_PASSIVE, FULL
74687
-** or RESTART. Write 1 or 0 into mem[P3] if the checkpoint returns
75721
+** WAL mode. Parameter P2 is one of SQLITE_CHECKPOINT_PASSIVE, FULL,
75722
+** RESTART, or TRUNCATE. Write 1 or 0 into mem[P3] if the checkpoint returns
7468875723
** SQLITE_BUSY or not, respectively. Write the number of pages in the
7468975724
** WAL after the checkpoint into mem[P3+1] and the number of pages
7469075725
** in the WAL that have been checkpointed after the checkpoint
7469175726
** completes into mem[P3+2]. However on an error, mem[P3+1] and
7469275727
** mem[P3+2] are initialized to -1.
@@ -74700,10 +75735,11 @@
7470075735
aRes[0] = 0;
7470175736
aRes[1] = aRes[2] = -1;
7470275737
assert( pOp->p2==SQLITE_CHECKPOINT_PASSIVE
7470375738
|| pOp->p2==SQLITE_CHECKPOINT_FULL
7470475739
|| pOp->p2==SQLITE_CHECKPOINT_RESTART
75740
+ || pOp->p2==SQLITE_CHECKPOINT_TRUNCATE
7470575741
);
7470675742
rc = sqlite3Checkpoint(db, pOp->p1, pOp->p2, &aRes[1], &aRes[2]);
7470775743
if( rc==SQLITE_BUSY ){
7470875744
rc = SQLITE_OK;
7470975745
aRes[0] = 1;
@@ -75625,10 +76661,15 @@
7562576661
char *zErr = 0;
7562676662
Table *pTab;
7562776663
Parse *pParse = 0;
7562876664
Incrblob *pBlob = 0;
7562976665
76666
+#ifdef SQLITE_ENABLE_API_ARMOR
76667
+ if( !sqlite3SafetyCheckOk(db) || ppBlob==0 || zTable==0 ){
76668
+ return SQLITE_MISUSE_BKPT;
76669
+ }
76670
+#endif
7563076671
flags = !!flags; /* flags = (flags ? 1 : 0); */
7563176672
*ppBlob = 0;
7563276673
7563376674
sqlite3_mutex_enter(db->mutex);
7563476675
@@ -75843,11 +76884,10 @@
7584376884
v = (Vdbe*)p->pStmt;
7584476885
7584576886
if( n<0 || iOffset<0 || (iOffset+n)>p->nByte ){
7584676887
/* Request is out of range. Return a transient error. */
7584776888
rc = SQLITE_ERROR;
75848
- sqlite3Error(db, SQLITE_ERROR);
7584976889
}else if( v==0 ){
7585076890
/* If there is no statement handle, then the blob-handle has
7585176891
** already been invalidated. Return SQLITE_ABORT in this case.
7585276892
*/
7585376893
rc = SQLITE_ABORT;
@@ -75861,14 +76901,14 @@
7586176901
sqlite3BtreeLeaveCursor(p->pCsr);
7586276902
if( rc==SQLITE_ABORT ){
7586376903
sqlite3VdbeFinalize(v);
7586476904
p->pStmt = 0;
7586576905
}else{
75866
- db->errCode = rc;
7586776906
v->rc = rc;
7586876907
}
7586976908
}
76909
+ sqlite3Error(db, rc);
7587076910
rc = sqlite3ApiExit(db, rc);
7587176911
sqlite3_mutex_leave(db->mutex);
7587276912
return rc;
7587376913
}
7587476914
@@ -76041,11 +77081,11 @@
7604177081
** itself.
7604277082
**
7604377083
** The sorter is running in multi-threaded mode if (a) the library was built
7604477084
** with pre-processor symbol SQLITE_MAX_WORKER_THREADS set to a value greater
7604577085
** than zero, and (b) worker threads have been enabled at runtime by calling
76046
-** sqlite3_config(SQLITE_CONFIG_WORKER_THREADS, ...).
77086
+** "PRAGMA threads=N" with some value of N greater than 0.
7604777087
**
7604877088
** When Rewind() is called, any data remaining in memory is flushed to a
7604977089
** final PMA. So at this point the data is stored in some number of sorted
7605077090
** PMAs within temporary files on disk.
7605177091
**
@@ -76086,10 +77126,17 @@
7608677126
*/
7608777127
#if 0
7608877128
# define SQLITE_DEBUG_SORTER_THREADS 1
7608977129
#endif
7609077130
77131
+/*
77132
+** Hard-coded maximum amount of data to accumulate in memory before flushing
77133
+** to a level 0 PMA. The purpose of this limit is to prevent various integer
77134
+** overflows. 512MiB.
77135
+*/
77136
+#define SQLITE_MAX_MXPMASIZE (1<<29)
77137
+
7609177138
/*
7609277139
** Private objects used by the sorter
7609377140
*/
7609477141
typedef struct MergeEngine MergeEngine; /* Merge PMAs together */
7609577142
typedef struct PmaReader PmaReader; /* Incrementally read one PMA */
@@ -76784,17 +77831,15 @@
7678477831
7678577832
if( !sqlite3TempInMemory(db) ){
7678677833
pSorter->mnPmaSize = SORTER_MIN_WORKING * pgsz;
7678777834
mxCache = db->aDb[0].pSchema->cache_size;
7678877835
if( mxCache<SORTER_MIN_WORKING ) mxCache = SORTER_MIN_WORKING;
76789
- pSorter->mxPmaSize = mxCache * pgsz;
77836
+ pSorter->mxPmaSize = MIN((i64)mxCache*pgsz, SQLITE_MAX_MXPMASIZE);
7679077837
76791
- /* If the application has not configure scratch memory using
76792
- ** SQLITE_CONFIG_SCRATCH then we assume it is OK to do large memory
76793
- ** allocations. If scratch memory has been configured, then assume
76794
- ** large memory allocations should be avoided to prevent heap
76795
- ** fragmentation.
77838
+ /* EVIDENCE-OF: R-26747-61719 When the application provides any amount of
77839
+ ** scratch memory using SQLITE_CONFIG_SCRATCH, SQLite avoids unnecessary
77840
+ ** large heap allocations.
7679677841
*/
7679777842
if( sqlite3GlobalConfig.pScratch==0 ){
7679877843
assert( pSorter->iMemory==0 );
7679977844
pSorter->nMemory = pgsz;
7680077845
pSorter->list.aMemory = (u8*)sqlite3Malloc(pgsz);
@@ -79162,19 +80207,19 @@
7916280207
**
7916380208
** incrAggFunctionDepth(pExpr,n) is the main routine. incrAggDepth(..)
7916480209
** is a helper function - a callback for the tree walker.
7916580210
*/
7916680211
static int incrAggDepth(Walker *pWalker, Expr *pExpr){
79167
- if( pExpr->op==TK_AGG_FUNCTION ) pExpr->op2 += pWalker->u.i;
80212
+ if( pExpr->op==TK_AGG_FUNCTION ) pExpr->op2 += pWalker->u.n;
7916880213
return WRC_Continue;
7916980214
}
7917080215
static void incrAggFunctionDepth(Expr *pExpr, int N){
7917180216
if( N>0 ){
7917280217
Walker w;
7917380218
memset(&w, 0, sizeof(w));
7917480219
w.xExprCallback = incrAggDepth;
79175
- w.u.i = N;
80220
+ w.u.n = N;
7917680221
sqlite3WalkExpr(&w, pExpr);
7917780222
}
7917880223
}
7917980224
7918080225
/*
@@ -79454,10 +80499,14 @@
7945480499
}
7945580500
}
7945680501
if( pMatch ){
7945780502
pExpr->iTable = pMatch->iCursor;
7945880503
pExpr->pTab = pMatch->pTab;
80504
+ assert( (pMatch->jointype & JT_RIGHT)==0 ); /* RIGHT JOIN not (yet) supported */
80505
+ if( (pMatch->jointype & JT_LEFT)!=0 ){
80506
+ ExprSetProperty(pExpr, EP_CanBeNull);
80507
+ }
7945980508
pSchema = pExpr->pTab->pSchema;
7946080509
}
7946180510
} /* if( pSrcList ) */
7946280511
7946380512
#ifndef SQLITE_OMIT_TRIGGER
@@ -79718,11 +80767,11 @@
7971880767
double r = -1.0;
7971980768
if( p->op!=TK_FLOAT ) return -1;
7972080769
sqlite3AtoF(p->u.zToken, &r, sqlite3Strlen30(p->u.zToken), SQLITE_UTF8);
7972180770
assert( r>=0.0 );
7972280771
if( r>1.0 ) return -1;
79723
- return (int)(r*1000.0);
80772
+ return (int)(r*134217728.0);
7972480773
}
7972580774
7972680775
/*
7972780776
** This routine is callback for sqlite3WalkExpr().
7972880777
**
@@ -79850,11 +80899,11 @@
7985080899
** EVIDENCE-OF: R-36850-34127 The likely(X) function is short-hand for
7985180900
** likelihood(X,0.9375).
7985280901
** EVIDENCE-OF: R-53436-40973 The likely(X) function is equivalent to
7985380902
** likelihood(X,0.9375). */
7985480903
/* TUNING: unlikely() probability is 0.0625. likely() is 0.9375 */
79855
- pExpr->iTable = pDef->zName[0]=='u' ? 62 : 938;
80904
+ pExpr->iTable = pDef->zName[0]=='u' ? 8388608 : 125829120;
7985680905
}
7985780906
}
7985880907
#ifndef SQLITE_OMIT_AUTHORIZATION
7985980908
auth = sqlite3AuthCheck(pParse, SQLITE_FUNCTION, 0, pDef->zName, 0);
7986080909
if( auth!=SQLITE_OK ){
@@ -81807,69 +82856,79 @@
8180782856
sqlite3DbFree(db, pList->a);
8180882857
sqlite3DbFree(db, pList);
8180982858
}
8181082859
8181182860
/*
81812
-** These routines are Walker callbacks. Walker.u.pi is a pointer
81813
-** to an integer. These routines are checking an expression to see
81814
-** if it is a constant. Set *Walker.u.i to 0 if the expression is
81815
-** not constant.
82861
+** These routines are Walker callbacks used to check expressions to
82862
+** see if they are "constant" for some definition of constant. The
82863
+** Walker.eCode value determines the type of "constant" we are looking
82864
+** for.
8181682865
**
8181782866
** These callback routines are used to implement the following:
8181882867
**
81819
-** sqlite3ExprIsConstant() pWalker->u.i==1
81820
-** sqlite3ExprIsConstantNotJoin() pWalker->u.i==2
81821
-** sqlite3ExprIsConstantOrFunction() pWalker->u.i==3 or 4
82868
+** sqlite3ExprIsConstant() pWalker->eCode==1
82869
+** sqlite3ExprIsConstantNotJoin() pWalker->eCode==2
82870
+** sqlite3ExprRefOneTableOnly() pWalker->eCode==3
82871
+** sqlite3ExprIsConstantOrFunction() pWalker->eCode==4 or 5
82872
+**
82873
+** In all cases, the callbacks set Walker.eCode=0 and abort if the expression
82874
+** is found to not be a constant.
8182282875
**
8182382876
** The sqlite3ExprIsConstantOrFunction() is used for evaluating expressions
81824
-** in a CREATE TABLE statement. The Walker.u.i value is 4 when parsing
81825
-** an existing schema and 3 when processing a new statement. A bound
82877
+** in a CREATE TABLE statement. The Walker.eCode value is 5 when parsing
82878
+** an existing schema and 4 when processing a new statement. A bound
8182682879
** parameter raises an error for new statements, but is silently converted
8182782880
** to NULL for existing schemas. This allows sqlite_master tables that
8182882881
** contain a bound parameter because they were generated by older versions
8182982882
** of SQLite to be parsed by newer versions of SQLite without raising a
8183082883
** malformed schema error.
8183182884
*/
8183282885
static int exprNodeIsConstant(Walker *pWalker, Expr *pExpr){
8183382886
81834
- /* If pWalker->u.i is 2 then any term of the expression that comes from
81835
- ** the ON or USING clauses of a join disqualifies the expression
82887
+ /* If pWalker->eCode is 2 then any term of the expression that comes from
82888
+ ** the ON or USING clauses of a left join disqualifies the expression
8183682889
** from being considered constant. */
81837
- if( pWalker->u.i==2 && ExprHasProperty(pExpr, EP_FromJoin) ){
81838
- pWalker->u.i = 0;
82890
+ if( pWalker->eCode==2 && ExprHasProperty(pExpr, EP_FromJoin) ){
82891
+ pWalker->eCode = 0;
8183982892
return WRC_Abort;
8184082893
}
8184182894
8184282895
switch( pExpr->op ){
8184382896
/* Consider functions to be constant if all their arguments are constant
81844
- ** and either pWalker->u.i==3 or 4 or the function as the SQLITE_FUNC_CONST
81845
- ** flag. */
82897
+ ** and either pWalker->eCode==4 or 5 or the function has the
82898
+ ** SQLITE_FUNC_CONST flag. */
8184682899
case TK_FUNCTION:
81847
- if( pWalker->u.i>=3 || ExprHasProperty(pExpr,EP_Constant) ){
82900
+ if( pWalker->eCode>=4 || ExprHasProperty(pExpr,EP_Constant) ){
8184882901
return WRC_Continue;
82902
+ }else{
82903
+ pWalker->eCode = 0;
82904
+ return WRC_Abort;
8184982905
}
81850
- /* Fall through */
8185182906
case TK_ID:
8185282907
case TK_COLUMN:
8185382908
case TK_AGG_FUNCTION:
8185482909
case TK_AGG_COLUMN:
8185582910
testcase( pExpr->op==TK_ID );
8185682911
testcase( pExpr->op==TK_COLUMN );
8185782912
testcase( pExpr->op==TK_AGG_FUNCTION );
8185882913
testcase( pExpr->op==TK_AGG_COLUMN );
81859
- pWalker->u.i = 0;
81860
- return WRC_Abort;
82914
+ if( pWalker->eCode==3 && pExpr->iTable==pWalker->u.iCur ){
82915
+ return WRC_Continue;
82916
+ }else{
82917
+ pWalker->eCode = 0;
82918
+ return WRC_Abort;
82919
+ }
8186182920
case TK_VARIABLE:
81862
- if( pWalker->u.i==4 ){
82921
+ if( pWalker->eCode==5 ){
8186382922
/* Silently convert bound parameters that appear inside of CREATE
8186482923
** statements into a NULL when parsing the CREATE statement text out
8186582924
** of the sqlite_master table */
8186682925
pExpr->op = TK_NULL;
81867
- }else if( pWalker->u.i==3 ){
82926
+ }else if( pWalker->eCode==4 ){
8186882927
/* A bound parameter in a CREATE statement that originates from
8186982928
** sqlite3_prepare() causes an error */
81870
- pWalker->u.i = 0;
82929
+ pWalker->eCode = 0;
8187182930
return WRC_Abort;
8187282931
}
8187382932
/* Fall through */
8187482933
default:
8187582934
testcase( pExpr->op==TK_SELECT ); /* selectNodeIsConstant will disallow */
@@ -81877,57 +82936,68 @@
8187782936
return WRC_Continue;
8187882937
}
8187982938
}
8188082939
static int selectNodeIsConstant(Walker *pWalker, Select *NotUsed){
8188182940
UNUSED_PARAMETER(NotUsed);
81882
- pWalker->u.i = 0;
82941
+ pWalker->eCode = 0;
8188382942
return WRC_Abort;
8188482943
}
81885
-static int exprIsConst(Expr *p, int initFlag){
82944
+static int exprIsConst(Expr *p, int initFlag, int iCur){
8188682945
Walker w;
8188782946
memset(&w, 0, sizeof(w));
81888
- w.u.i = initFlag;
82947
+ w.eCode = initFlag;
8188982948
w.xExprCallback = exprNodeIsConstant;
8189082949
w.xSelectCallback = selectNodeIsConstant;
82950
+ w.u.iCur = iCur;
8189182951
sqlite3WalkExpr(&w, p);
81892
- return w.u.i;
82952
+ return w.eCode;
8189382953
}
8189482954
8189582955
/*
81896
-** Walk an expression tree. Return 1 if the expression is constant
82956
+** Walk an expression tree. Return non-zero if the expression is constant
8189782957
** and 0 if it involves variables or function calls.
8189882958
**
8189982959
** For the purposes of this function, a double-quoted string (ex: "abc")
8190082960
** is considered a variable but a single-quoted string (ex: 'abc') is
8190182961
** a constant.
8190282962
*/
8190382963
SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr *p){
81904
- return exprIsConst(p, 1);
82964
+ return exprIsConst(p, 1, 0);
8190582965
}
8190682966
8190782967
/*
81908
-** Walk an expression tree. Return 1 if the expression is constant
82968
+** Walk an expression tree. Return non-zero if the expression is constant
8190982969
** that does no originate from the ON or USING clauses of a join.
8191082970
** Return 0 if it involves variables or function calls or terms from
8191182971
** an ON or USING clause.
8191282972
*/
8191382973
SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr *p){
81914
- return exprIsConst(p, 2);
82974
+ return exprIsConst(p, 2, 0);
8191582975
}
8191682976
8191782977
/*
81918
-** Walk an expression tree. Return 1 if the expression is constant
82978
+** Walk an expression tree. Return non-zero if the expression constant
82979
+** for any single row of the table with cursor iCur. In other words, the
82980
+** expression must not refer to any non-deterministic function nor any
82981
+** table other than iCur.
82982
+*/
82983
+SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr *p, int iCur){
82984
+ return exprIsConst(p, 3, iCur);
82985
+}
82986
+
82987
+/*
82988
+** Walk an expression tree. Return non-zero if the expression is constant
8191982989
** or a function call with constant arguments. Return and 0 if there
8192082990
** are any variables.
8192182991
**
8192282992
** For the purposes of this function, a double-quoted string (ex: "abc")
8192382993
** is considered a variable but a single-quoted string (ex: 'abc') is
8192482994
** a constant.
8192582995
*/
8192682996
SQLITE_PRIVATE int sqlite3ExprIsConstantOrFunction(Expr *p, u8 isInit){
8192782997
assert( isInit==0 || isInit==1 );
81928
- return exprIsConst(p, 3+isInit);
82998
+ return exprIsConst(p, 4+isInit, 0);
8192982999
}
8193083000
8193183001
/*
8193283002
** If the expression p codes a constant integer that is small enough
8193383003
** to fit in a 32-bit integer, return 1 and put the value of the integer
@@ -81990,11 +83060,12 @@
8199083060
case TK_FLOAT:
8199183061
case TK_BLOB:
8199283062
return 0;
8199383063
case TK_COLUMN:
8199483064
assert( p->pTab!=0 );
81995
- return p->iColumn>=0 && p->pTab->aCol[p->iColumn].notNull==0;
83065
+ return ExprHasProperty(p, EP_CanBeNull) ||
83066
+ (p->iColumn>=0 && p->pTab->aCol[p->iColumn].notNull==0);
8199683067
default:
8199783068
return 1;
8199883069
}
8199983070
}
8200083071
@@ -82433,11 +83504,10 @@
8243383504
sqlite3SelectDestInit(&dest, SRT_Set, pExpr->iTable);
8243483505
dest.affSdst = (u8)affinity;
8243583506
assert( (pExpr->iTable&0x0000FFFF)==pExpr->iTable );
8243683507
pSelect->iLimit = 0;
8243783508
testcase( pSelect->selFlags & SF_Distinct );
82438
- pSelect->selFlags &= ~SF_Distinct;
8243983509
testcase( pKeyInfo==0 ); /* Caused by OOM in sqlite3KeyInfoAlloc() */
8244083510
if( sqlite3Select(pParse, pSelect, &dest) ){
8244183511
sqlite3KeyInfoUnref(pKeyInfo);
8244283512
return 0;
8244383513
}
@@ -83580,11 +84650,14 @@
8358084650
target
8358184651
));
8358284652
8358384653
#ifndef SQLITE_OMIT_FLOATING_POINT
8358484654
/* If the column has REAL affinity, it may currently be stored as an
83585
- ** integer. Use OP_RealAffinity to make sure it is really real. */
84655
+ ** integer. Use OP_RealAffinity to make sure it is really real.
84656
+ **
84657
+ ** EVIDENCE-OF: R-60985-57662 SQLite will convert the value back to
84658
+ ** floating point when extracting it from the record. */
8358684659
if( pExpr->iColumn>=0
8358784660
&& pTab->aCol[pExpr->iColumn].affinity==SQLITE_AFF_REAL
8358884661
){
8358984662
sqlite3VdbeAddOp1(v, OP_RealAffinity, target);
8359084663
}
@@ -87232,27 +88305,32 @@
8723288305
aLog[i] = sqlite3LogEst(v);
8723388306
#endif
8723488307
if( *z==' ' ) z++;
8723588308
}
8723688309
#ifndef SQLITE_ENABLE_STAT3_OR_STAT4
87237
- assert( pIndex!=0 );
88310
+ assert( pIndex!=0 ); {
8723888311
#else
87239
- if( pIndex )
88312
+ if( pIndex ){
8724088313
#endif
87241
- while( z[0] ){
87242
- if( sqlite3_strglob("unordered*", z)==0 ){
87243
- pIndex->bUnordered = 1;
87244
- }else if( sqlite3_strglob("sz=[0-9]*", z)==0 ){
87245
- pIndex->szIdxRow = sqlite3LogEst(sqlite3Atoi(z+3));
87246
- }
88314
+ pIndex->bUnordered = 0;
88315
+ pIndex->noSkipScan = 0;
88316
+ while( z[0] ){
88317
+ if( sqlite3_strglob("unordered*", z)==0 ){
88318
+ pIndex->bUnordered = 1;
88319
+ }else if( sqlite3_strglob("sz=[0-9]*", z)==0 ){
88320
+ pIndex->szIdxRow = sqlite3LogEst(sqlite3Atoi(z+3));
88321
+ }else if( sqlite3_strglob("noskipscan*", z)==0 ){
88322
+ pIndex->noSkipScan = 1;
88323
+ }
8724788324
#ifdef SQLITE_ENABLE_COSTMULT
87248
- else if( sqlite3_strglob("costmult=[0-9]*",z)==0 ){
87249
- pIndex->pTable->costMult = sqlite3LogEst(sqlite3Atoi(z+9));
88325
+ else if( sqlite3_strglob("costmult=[0-9]*",z)==0 ){
88326
+ pIndex->pTable->costMult = sqlite3LogEst(sqlite3Atoi(z+9));
88327
+ }
88328
+#endif
88329
+ while( z[0]!=0 && z[0]!=' ' ) z++;
88330
+ while( z[0]==' ' ) z++;
8725088331
}
87251
-#endif
87252
- while( z[0]!=0 && z[0]!=' ' ) z++;
87253
- while( z[0]==' ' ) z++;
8725488332
}
8725588333
}
8725688334
8725788335
/*
8725888336
** This callback is invoked once for each index when reading the
@@ -87366,18 +88444,19 @@
8736688444
tRowcnt avgEq = 0;
8736788445
tRowcnt nRow; /* Number of rows in index */
8736888446
i64 nSum100 = 0; /* Number of terms contributing to sumEq */
8736988447
i64 nDist100; /* Number of distinct values in index */
8737088448
87371
- if( pIdx->aiRowEst==0 || pIdx->aiRowEst[iCol+1]==0 ){
88449
+ if( !pIdx->aiRowEst || iCol>=pIdx->nKeyCol || pIdx->aiRowEst[iCol+1]==0 ){
8737288450
nRow = pFinal->anLt[iCol];
8737388451
nDist100 = (i64)100 * pFinal->anDLt[iCol];
8737488452
nSample--;
8737588453
}else{
8737688454
nRow = pIdx->aiRowEst[0];
8737788455
nDist100 = ((i64)100 * pIdx->aiRowEst[0]) / pIdx->aiRowEst[iCol+1];
8737888456
}
88457
+ pIdx->nRowEst0 = nRow;
8737988458
8738088459
/* Set nSum to the number of distinct (iCol+1) field prefixes that
8738188460
** occur in the stat4 table for this index. Set sumEq to the sum of
8738288461
** the nEq values for column iCol for the same set (adding the value
8738388462
** only once where there exist duplicate prefixes). */
@@ -87635,11 +88714,11 @@
8763588714
}
8763688715
8763788716
8763888717
/* Load the statistics from the sqlite_stat4 table. */
8763988718
#ifdef SQLITE_ENABLE_STAT3_OR_STAT4
87640
- if( rc==SQLITE_OK ){
88719
+ if( rc==SQLITE_OK && OptimizationEnabled(db, SQLITE_Stat34) ){
8764188720
int lookasideEnabled = db->lookaside.bEnabled;
8764288721
db->lookaside.bEnabled = 0;
8764388722
rc = loadStat4(db, sInfo.zDatabase);
8764488723
db->lookaside.bEnabled = lookasideEnabled;
8764588724
}
@@ -88317,10 +89396,13 @@
8831789396
SQLITE_API int sqlite3_set_authorizer(
8831889397
sqlite3 *db,
8831989398
int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),
8832089399
void *pArg
8832189400
){
89401
+#ifdef SQLITE_ENABLE_API_ARMOR
89402
+ if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
89403
+#endif
8832289404
sqlite3_mutex_enter(db->mutex);
8832389405
db->xAuth = (sqlite3_xauth)xAuth;
8832489406
db->pAuthArg = pArg;
8832589407
sqlite3ExpirePreparedStatements(db);
8832689408
sqlite3_mutex_leave(db->mutex);
@@ -88811,11 +89893,15 @@
8881189893
** See also sqlite3LocateTable().
8881289894
*/
8881389895
SQLITE_PRIVATE Table *sqlite3FindTable(sqlite3 *db, const char *zName, const char *zDatabase){
8881489896
Table *p = 0;
8881589897
int i;
88816
- assert( zName!=0 );
89898
+
89899
+#ifdef SQLITE_ENABLE_API_ARMOR
89900
+ if( !sqlite3SafetyCheckOk(db) || zName==0 ) return 0;
89901
+#endif
89902
+
8881789903
/* All mutexes are required for schema access. Make sure we hold them. */
8881889904
assert( zDatabase!=0 || sqlite3BtreeHoldsAllMutexes(db) );
8881989905
#if SQLITE_USER_AUTHENTICATION
8882089906
/* Only the admin user is allowed to know that the sqlite_user table
8882189907
** exists */
@@ -94275,12 +95361,12 @@
9427595361
break;
9427695362
}
9427795363
default: {
9427895364
/* Because sqlite3_value_double() returns 0.0 if the argument is not
9427995365
** something that can be converted into a number, we have:
94280
- ** IMP: R-57326-31541 Abs(X) return 0.0 if X is a string or blob that
94281
- ** cannot be converted to a numeric value.
95366
+ ** IMP: R-01992-00519 Abs(X) returns 0.0 if X is a string or blob
95367
+ ** that cannot be converted to a numeric value.
9428295368
*/
9428395369
double rVal = sqlite3_value_double(argv[0]);
9428495370
if( rVal<0 ) rVal = -rVal;
9428595371
sqlite3_result_double(context, rVal);
9428695372
break;
@@ -102928,11 +104014,11 @@
102928104014
break;
102929104015
#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
102930104016
102931104017
#ifndef SQLITE_OMIT_WAL
102932104018
/*
102933
- ** PRAGMA [database.]wal_checkpoint = passive|full|restart
104019
+ ** PRAGMA [database.]wal_checkpoint = passive|full|restart|truncate
102934104020
**
102935104021
** Checkpoint the database.
102936104022
*/
102937104023
case PragTyp_WAL_CHECKPOINT: {
102938104024
int iBt = (pId2->z?iDb:SQLITE_MAX_ATTACHED);
@@ -102940,10 +104026,12 @@
102940104026
if( zRight ){
102941104027
if( sqlite3StrICmp(zRight, "full")==0 ){
102942104028
eMode = SQLITE_CHECKPOINT_FULL;
102943104029
}else if( sqlite3StrICmp(zRight, "restart")==0 ){
102944104030
eMode = SQLITE_CHECKPOINT_RESTART;
104031
+ }else if( sqlite3StrICmp(zRight, "truncate")==0 ){
104032
+ eMode = SQLITE_CHECKPOINT_TRUNCATE;
102945104033
}
102946104034
}
102947104035
sqlite3VdbeSetNumCols(v, 3);
102948104036
pParse->nMem = 3;
102949104037
sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "busy", SQLITE_STATIC);
@@ -103834,13 +104922,16 @@
103834104922
Vdbe *pOld, /* VM being reprepared */
103835104923
sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
103836104924
const char **pzTail /* OUT: End of parsed string */
103837104925
){
103838104926
int rc;
103839
- assert( ppStmt!=0 );
104927
+
104928
+#ifdef SQLITE_ENABLE_API_ARMOR
104929
+ if( ppStmt==0 ) return SQLITE_MISUSE_BKPT;
104930
+#endif
103840104931
*ppStmt = 0;
103841
- if( !sqlite3SafetyCheckOk(db) ){
104932
+ if( !sqlite3SafetyCheckOk(db)||zSql==0 ){
103842104933
return SQLITE_MISUSE_BKPT;
103843104934
}
103844104935
sqlite3_mutex_enter(db->mutex);
103845104936
sqlite3BtreeEnterAll(db);
103846104937
rc = sqlite3Prepare(db, zSql, nBytes, saveSqlFlag, pOld, ppStmt, pzTail);
@@ -103943,13 +105034,15 @@
103943105034
*/
103944105035
char *zSql8;
103945105036
const char *zTail8 = 0;
103946105037
int rc = SQLITE_OK;
103947105038
103948
- assert( ppStmt );
105039
+#ifdef SQLITE_ENABLE_API_ARMOR
105040
+ if( ppStmt==0 ) return SQLITE_MISUSE_BKPT;
105041
+#endif
103949105042
*ppStmt = 0;
103950
- if( !sqlite3SafetyCheckOk(db) ){
105043
+ if( !sqlite3SafetyCheckOk(db)||zSql==0 ){
103951105044
return SQLITE_MISUSE_BKPT;
103952105045
}
103953105046
if( nBytes>=0 ){
103954105047
int sz;
103955105048
const char *z = (const char*)zSql;
@@ -108842,11 +109935,11 @@
108842109935
**
108843109936
** SELECT DISTINCT xyz FROM ... ORDER BY xyz
108844109937
**
108845109938
** is transformed to:
108846109939
**
108847
- ** SELECT xyz FROM ... GROUP BY xyz
109940
+ ** SELECT xyz FROM ... GROUP BY xyz ORDER BY xyz
108848109941
**
108849109942
** The second form is preferred as a single index (or temp-table) may be
108850109943
** used for both the ORDER BY and DISTINCT processing. As originally
108851109944
** written the query must use a temp-table for at least one of the ORDER
108852109945
** BY and DISTINCT, and an index or separate temp-table for the other.
@@ -108855,11 +109948,10 @@
108855109948
&& sqlite3ExprListCompare(sSort.pOrderBy, p->pEList, -1)==0
108856109949
){
108857109950
p->selFlags &= ~SF_Distinct;
108858109951
p->pGroupBy = sqlite3ExprListDup(db, p->pEList, 0);
108859109952
pGroupBy = p->pGroupBy;
108860
- sSort.pOrderBy = 0;
108861109953
/* Notice that even thought SF_Distinct has been cleared from p->selFlags,
108862109954
** the sDistinct.isTnct is still set. Hence, isTnct represents the
108863109955
** original setting of the SF_Distinct flag, not the current setting */
108864109956
assert( sDistinct.isTnct );
108865109957
}
@@ -109658,10 +110750,13 @@
109658110750
char **pzErrMsg /* Write error messages here */
109659110751
){
109660110752
int rc;
109661110753
TabResult res;
109662110754
110755
+#ifdef SQLITE_ENABLE_API_ARMOR
110756
+ if( pazResult==0 ) return SQLITE_MISUSE_BKPT;
110757
+#endif
109663110758
*pazResult = 0;
109664110759
if( pnColumn ) *pnColumn = 0;
109665110760
if( pnRow ) *pnRow = 0;
109666110761
if( pzErrMsg ) *pzErrMsg = 0;
109667110762
res.zErrMsg = 0;
@@ -111721,11 +112816,11 @@
111721112816
** Two writes per page are required in step (3) because the original
111722112817
** database content must be written into the rollback journal prior to
111723112818
** overwriting the database with the vacuumed content.
111724112819
**
111725112820
** Only 1x temporary space and only 1x writes would be required if
111726
-** the copy of step (3) were replace by deleting the original database
112821
+** the copy of step (3) were replaced by deleting the original database
111727112822
** and renaming the transient database as the original. But that will
111728112823
** not work if other processes are attached to the original database.
111729112824
** And a power loss in between deleting the original and renaming the
111730112825
** transient would cause the database file to appear to be deleted
111731112826
** following reboot.
@@ -112079,10 +113174,13 @@
112079113174
sqlite3 *db, /* Database in which module is registered */
112080113175
const char *zName, /* Name assigned to this module */
112081113176
const sqlite3_module *pModule, /* The definition of the module */
112082113177
void *pAux /* Context pointer for xCreate/xConnect */
112083113178
){
113179
+#ifdef SQLITE_ENABLE_API_ARMOR
113180
+ if( !sqlite3SafetyCheckOk(db) || zName==0 ) return SQLITE_MISUSE_BKPT;
113181
+#endif
112084113182
return createModule(db, zName, pModule, pAux, 0);
112085113183
}
112086113184
112087113185
/*
112088113186
** External API function used to create a new virtual-table module.
@@ -112092,10 +113190,13 @@
112092113190
const char *zName, /* Name assigned to this module */
112093113191
const sqlite3_module *pModule, /* The definition of the module */
112094113192
void *pAux, /* Context pointer for xCreate/xConnect */
112095113193
void (*xDestroy)(void *) /* Module destructor function */
112096113194
){
113195
+#ifdef SQLITE_ENABLE_API_ARMOR
113196
+ if( !sqlite3SafetyCheckOk(db) || zName==0 ) return SQLITE_MISUSE_BKPT;
113197
+#endif
112097113198
return createModule(db, zName, pModule, pAux, xDestroy);
112098113199
}
112099113200
112100113201
/*
112101113202
** Lock the virtual table so that it cannot be disconnected.
@@ -112324,11 +113425,16 @@
112324113425
pTable->tabFlags |= TF_Virtual;
112325113426
pTable->nModuleArg = 0;
112326113427
addModuleArgument(db, pTable, sqlite3NameFromToken(db, pModuleName));
112327113428
addModuleArgument(db, pTable, 0);
112328113429
addModuleArgument(db, pTable, sqlite3DbStrDup(db, pTable->zName));
112329
- pParse->sNameToken.n = (int)(&pModuleName->z[pModuleName->n] - pName1->z);
113430
+ assert( (pParse->sNameToken.z==pName2->z && pName2->z!=0)
113431
+ || (pParse->sNameToken.z==pName1->z && pName2->z==0)
113432
+ );
113433
+ pParse->sNameToken.n = (int)(
113434
+ &pModuleName->z[pModuleName->n] - pParse->sNameToken.z
113435
+ );
112330113436
112331113437
#ifndef SQLITE_OMIT_AUTHORIZATION
112332113438
/* Creating a virtual table invokes the authorization callback twice.
112333113439
** The first invocation, to obtain permission to INSERT a row into the
112334113440
** sqlite_master table, has already been made by sqlite3StartTable().
@@ -112696,10 +113802,13 @@
112696113802
112697113803
int rc = SQLITE_OK;
112698113804
Table *pTab;
112699113805
char *zErr = 0;
112700113806
113807
+#ifdef SQLITE_ENABLE_API_ARMOR
113808
+ if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
113809
+#endif
112701113810
sqlite3_mutex_enter(db->mutex);
112702113811
if( !db->pVtabCtx || !(pTab = db->pVtabCtx->pTab) ){
112703113812
sqlite3Error(db, SQLITE_MISUSE);
112704113813
sqlite3_mutex_leave(db->mutex);
112705113814
return SQLITE_MISUSE_BKPT;
@@ -113052,10 +114161,13 @@
113052114161
*/
113053114162
SQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *db){
113054114163
static const unsigned char aMap[] = {
113055114164
SQLITE_ROLLBACK, SQLITE_ABORT, SQLITE_FAIL, SQLITE_IGNORE, SQLITE_REPLACE
113056114165
};
114166
+#ifdef SQLITE_ENABLE_API_ARMOR
114167
+ if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
114168
+#endif
113057114169
assert( OE_Rollback==1 && OE_Abort==2 && OE_Fail==3 );
113058114170
assert( OE_Ignore==4 && OE_Replace==5 );
113059114171
assert( db->vtabOnConflict>=1 && db->vtabOnConflict<=5 );
113060114172
return (int)aMap[db->vtabOnConflict-1];
113061114173
}
@@ -113067,12 +114179,14 @@
113067114179
*/
113068114180
SQLITE_API int sqlite3_vtab_config(sqlite3 *db, int op, ...){
113069114181
va_list ap;
113070114182
int rc = SQLITE_OK;
113071114183
114184
+#ifdef SQLITE_ENABLE_API_ARMOR
114185
+ if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
114186
+#endif
113072114187
sqlite3_mutex_enter(db->mutex);
113073
-
113074114188
va_start(ap, op);
113075114189
switch( op ){
113076114190
case SQLITE_VTAB_CONSTRAINT_SUPPORT: {
113077114191
VtabCtx *p = db->pVtabCtx;
113078114192
if( !p ){
@@ -113203,10 +114317,13 @@
113203114317
} in; /* Used when pWLoop->wsFlags&WHERE_IN_ABLE */
113204114318
Index *pCovidx; /* Possible covering index for WHERE_MULTI_OR */
113205114319
} u;
113206114320
struct WhereLoop *pWLoop; /* The selected WhereLoop object */
113207114321
Bitmask notReady; /* FROM entries not usable at this level */
114322
+#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
114323
+ int addrVisit; /* Address at which row is visited */
114324
+#endif
113208114325
};
113209114326
113210114327
/*
113211114328
** Each instance of this object represents an algorithm for evaluating one
113212114329
** term of a join. Every term of the FROM clause will have at least
@@ -113233,11 +114350,10 @@
113233114350
LogEst rRun; /* Cost of running each loop */
113234114351
LogEst nOut; /* Estimated number of output rows */
113235114352
union {
113236114353
struct { /* Information for internal btree tables */
113237114354
u16 nEq; /* Number of equality constraints */
113238
- u16 nSkip; /* Number of initial index columns to skip */
113239114355
Index *pIndex; /* Index used, or NULL */
113240114356
} btree;
113241114357
struct { /* Information for virtual tables */
113242114358
int idxNum; /* Index number */
113243114359
u8 needFree; /* True if sqlite3_free(idxStr) is needed */
@@ -113246,16 +114362,17 @@
113246114362
char *idxStr; /* Index identifier string */
113247114363
} vtab;
113248114364
} u;
113249114365
u32 wsFlags; /* WHERE_* flags describing the plan */
113250114366
u16 nLTerm; /* Number of entries in aLTerm[] */
114367
+ u16 nSkip; /* Number of NULL aLTerm[] entries */
113251114368
/**** whereLoopXfer() copies fields above ***********************/
113252114369
# define WHERE_LOOP_XFER_SZ offsetof(WhereLoop,nLSlot)
113253114370
u16 nLSlot; /* Number of slots allocated for aLTerm[] */
113254114371
WhereTerm **aLTerm; /* WhereTerms used */
113255114372
WhereLoop *pNextLoop; /* Next WhereLoop object in the WhereClause */
113256
- WhereTerm *aLTermSpace[4]; /* Initial aLTerm[] space */
114373
+ WhereTerm *aLTermSpace[3]; /* Initial aLTerm[] space */
113257114374
};
113258114375
113259114376
/* This object holds the prerequisites and the cost of running a
113260114377
** subquery on one operand of an OR operator in the WHERE clause.
113261114378
** See WhereOrSet for additional information
@@ -113577,10 +114694,11 @@
113577114694
#define WHERE_ONEROW 0x00001000 /* Selects no more than one row */
113578114695
#define WHERE_MULTI_OR 0x00002000 /* OR using multiple indices */
113579114696
#define WHERE_AUTO_INDEX 0x00004000 /* Uses an ephemeral index */
113580114697
#define WHERE_SKIPSCAN 0x00008000 /* Uses the skip-scan algorithm */
113581114698
#define WHERE_UNQ_WANTED 0x00010000 /* WHERE_ONEROW would have been helpful*/
114699
+#define WHERE_PARTIALIDX 0x00020000 /* The automatic index is partial */
113582114700
113583114701
/************** End of whereInt.h ********************************************/
113584114702
/************** Continuing where we left off in where.c **********************/
113585114703
113586114704
/*
@@ -113784,14 +114902,15 @@
113784114902
memcpy(pWC->a, pOld, sizeof(pWC->a[0])*pWC->nTerm);
113785114903
if( pOld!=pWC->aStatic ){
113786114904
sqlite3DbFree(db, pOld);
113787114905
}
113788114906
pWC->nSlot = sqlite3DbMallocSize(db, pWC->a)/sizeof(pWC->a[0]);
114907
+ memset(&pWC->a[pWC->nTerm], 0, sizeof(pWC->a[0])*(pWC->nSlot-pWC->nTerm));
113789114908
}
113790114909
pTerm = &pWC->a[idx = pWC->nTerm++];
113791114910
if( p && ExprHasProperty(p, EP_Unlikely) ){
113792
- pTerm->truthProb = sqlite3LogEst(p->iTable) - 99;
114911
+ pTerm->truthProb = sqlite3LogEst(p->iTable) - 270;
113793114912
}else{
113794114913
pTerm->truthProb = 1;
113795114914
}
113796114915
pTerm->pExpr = sqlite3ExprSkipCollate(p);
113797114916
pTerm->wtFlags = wtFlags;
@@ -114317,10 +115436,19 @@
114317115436
if( pDerived ){
114318115437
pDerived->flags |= pBase->flags & EP_FromJoin;
114319115438
pDerived->iRightJoinTable = pBase->iRightJoinTable;
114320115439
}
114321115440
}
115441
+
115442
+/*
115443
+** Mark term iChild as being a child of term iParent
115444
+*/
115445
+static void markTermAsChild(WhereClause *pWC, int iChild, int iParent){
115446
+ pWC->a[iChild].iParent = iParent;
115447
+ pWC->a[iChild].truthProb = pWC->a[iParent].truthProb;
115448
+ pWC->a[iParent].nChild++;
115449
+}
114322115450
114323115451
#if !defined(SQLITE_OMIT_OR_OPTIMIZATION) && !defined(SQLITE_OMIT_SUBQUERY)
114324115452
/*
114325115453
** Analyze a term that consists of two or more OR-connected
114326115454
** subterms. So in:
@@ -114615,12 +115743,11 @@
114615115743
pNew->x.pList = pList;
114616115744
idxNew = whereClauseInsert(pWC, pNew, TERM_VIRTUAL|TERM_DYNAMIC);
114617115745
testcase( idxNew==0 );
114618115746
exprAnalyze(pSrc, pWC, idxNew);
114619115747
pTerm = &pWC->a[idxTerm];
114620
- pWC->a[idxNew].iParent = idxTerm;
114621
- pTerm->nChild = 1;
115748
+ markTermAsChild(pWC, idxNew, idxTerm);
114622115749
}else{
114623115750
sqlite3ExprListDelete(db, pList);
114624115751
}
114625115752
pTerm->eOperator = WO_NOOP; /* case 1 trumps case 2 */
114626115753
}
@@ -114718,13 +115845,12 @@
114718115845
return;
114719115846
}
114720115847
idxNew = whereClauseInsert(pWC, pDup, TERM_VIRTUAL|TERM_DYNAMIC);
114721115848
if( idxNew==0 ) return;
114722115849
pNew = &pWC->a[idxNew];
114723
- pNew->iParent = idxTerm;
115850
+ markTermAsChild(pWC, idxNew, idxTerm);
114724115851
pTerm = &pWC->a[idxTerm];
114725
- pTerm->nChild = 1;
114726115852
pTerm->wtFlags |= TERM_COPIED;
114727115853
if( pExpr->op==TK_EQ
114728115854
&& !ExprHasProperty(pExpr, EP_FromJoin)
114729115855
&& OptimizationEnabled(db, SQLITE_Transitive)
114730115856
){
@@ -114777,13 +115903,12 @@
114777115903
transferJoinMarkings(pNewExpr, pExpr);
114778115904
idxNew = whereClauseInsert(pWC, pNewExpr, TERM_VIRTUAL|TERM_DYNAMIC);
114779115905
testcase( idxNew==0 );
114780115906
exprAnalyze(pSrc, pWC, idxNew);
114781115907
pTerm = &pWC->a[idxTerm];
114782
- pWC->a[idxNew].iParent = idxTerm;
115908
+ markTermAsChild(pWC, idxNew, idxTerm);
114783115909
}
114784
- pTerm->nChild = 2;
114785115910
}
114786115911
#endif /* SQLITE_OMIT_BETWEEN_OPTIMIZATION */
114787115912
114788115913
#if !defined(SQLITE_OMIT_OR_OPTIMIZATION) && !defined(SQLITE_OMIT_SUBQUERY)
114789115914
/* Analyze a term that is composed of two or more subterms connected by
@@ -114854,13 +115979,12 @@
114854115979
idxNew2 = whereClauseInsert(pWC, pNewExpr2, TERM_VIRTUAL|TERM_DYNAMIC);
114855115980
testcase( idxNew2==0 );
114856115981
exprAnalyze(pSrc, pWC, idxNew2);
114857115982
pTerm = &pWC->a[idxTerm];
114858115983
if( isComplete ){
114859
- pWC->a[idxNew1].iParent = idxTerm;
114860
- pWC->a[idxNew2].iParent = idxTerm;
114861
- pTerm->nChild = 2;
115984
+ markTermAsChild(pWC, idxNew1, idxTerm);
115985
+ markTermAsChild(pWC, idxNew2, idxTerm);
114862115986
}
114863115987
}
114864115988
#endif /* SQLITE_OMIT_LIKE_OPTIMIZATION */
114865115989
114866115990
#ifndef SQLITE_OMIT_VIRTUALTABLE
@@ -114889,13 +116013,12 @@
114889116013
pNewTerm = &pWC->a[idxNew];
114890116014
pNewTerm->prereqRight = prereqExpr;
114891116015
pNewTerm->leftCursor = pLeft->iTable;
114892116016
pNewTerm->u.leftColumn = pLeft->iColumn;
114893116017
pNewTerm->eOperator = WO_MATCH;
114894
- pNewTerm->iParent = idxTerm;
116018
+ markTermAsChild(pWC, idxNew, idxTerm);
114895116019
pTerm = &pWC->a[idxTerm];
114896
- pTerm->nChild = 1;
114897116020
pTerm->wtFlags |= TERM_COPIED;
114898116021
pNewTerm->prereqAll = pTerm->prereqAll;
114899116022
}
114900116023
}
114901116024
#endif /* SQLITE_OMIT_VIRTUALTABLE */
@@ -114912,11 +116035,11 @@
114912116035
** the start of the loop will prevent any results from being returned.
114913116036
*/
114914116037
if( pExpr->op==TK_NOTNULL
114915116038
&& pExpr->pLeft->op==TK_COLUMN
114916116039
&& pExpr->pLeft->iColumn>=0
114917
- && OptimizationEnabled(db, SQLITE_Stat3)
116040
+ && OptimizationEnabled(db, SQLITE_Stat34)
114918116041
){
114919116042
Expr *pNewExpr;
114920116043
Expr *pLeft = pExpr->pLeft;
114921116044
int idxNew;
114922116045
WhereTerm *pNewTerm;
@@ -114931,13 +116054,12 @@
114931116054
pNewTerm = &pWC->a[idxNew];
114932116055
pNewTerm->prereqRight = 0;
114933116056
pNewTerm->leftCursor = pLeft->iTable;
114934116057
pNewTerm->u.leftColumn = pLeft->iColumn;
114935116058
pNewTerm->eOperator = WO_GT;
114936
- pNewTerm->iParent = idxTerm;
116059
+ markTermAsChild(pWC, idxNew, idxTerm);
114937116060
pTerm = &pWC->a[idxTerm];
114938
- pTerm->nChild = 1;
114939116061
pTerm->wtFlags |= TERM_COPIED;
114940116062
pNewTerm->prereqAll = pTerm->prereqAll;
114941116063
}
114942116064
}
114943116065
#endif /* SQLITE_ENABLE_STAT3_OR_STAT4 */
@@ -115153,10 +116275,12 @@
115153116275
WhereLoop *pLoop; /* The Loop object */
115154116276
char *zNotUsed; /* Extra space on the end of pIdx */
115155116277
Bitmask idxCols; /* Bitmap of columns used for indexing */
115156116278
Bitmask extraCols; /* Bitmap of additional columns */
115157116279
u8 sentWarning = 0; /* True if a warnning has been issued */
116280
+ Expr *pPartial = 0; /* Partial Index Expression */
116281
+ int iContinue = 0; /* Jump here to skip excluded rows */
115158116282
115159116283
/* Generate code to skip over the creation and initialization of the
115160116284
** transient index on 2nd and subsequent iterations of the loop. */
115161116285
v = pParse->pVdbe;
115162116286
assert( v!=0 );
@@ -115168,10 +116292,16 @@
115168116292
pTable = pSrc->pTab;
115169116293
pWCEnd = &pWC->a[pWC->nTerm];
115170116294
pLoop = pLevel->pWLoop;
115171116295
idxCols = 0;
115172116296
for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){
116297
+ if( pLoop->prereq==0
116298
+ && (pTerm->wtFlags & TERM_VIRTUAL)==0
116299
+ && sqlite3ExprIsTableConstant(pTerm->pExpr, pSrc->iCursor) ){
116300
+ pPartial = sqlite3ExprAnd(pParse->db, pPartial,
116301
+ sqlite3ExprDup(pParse->db, pTerm->pExpr, 0));
116302
+ }
115173116303
if( termCanDriveIndex(pTerm, pSrc, notReady) ){
115174116304
int iCol = pTerm->u.leftColumn;
115175116305
Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol);
115176116306
testcase( iCol==BMS );
115177116307
testcase( iCol==BMS-1 );
@@ -115180,11 +116310,13 @@
115180116310
"automatic index on %s(%s)", pTable->zName,
115181116311
pTable->aCol[iCol].zName);
115182116312
sentWarning = 1;
115183116313
}
115184116314
if( (idxCols & cMask)==0 ){
115185
- if( whereLoopResize(pParse->db, pLoop, nKeyCol+1) ) return;
116315
+ if( whereLoopResize(pParse->db, pLoop, nKeyCol+1) ){
116316
+ goto end_auto_index_create;
116317
+ }
115186116318
pLoop->aLTerm[nKeyCol++] = pTerm;
115187116319
idxCols |= cMask;
115188116320
}
115189116321
}
115190116322
}
@@ -115200,24 +116332,23 @@
115200116332
** be a covering index because the index will not be updated if the
115201116333
** original table changes and the index and table cannot both be used
115202116334
** if they go out of sync.
115203116335
*/
115204116336
extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1));
115205
- mxBitCol = (pTable->nCol >= BMS-1) ? BMS-1 : pTable->nCol;
116337
+ mxBitCol = MIN(BMS-1,pTable->nCol);
115206116338
testcase( pTable->nCol==BMS-1 );
115207116339
testcase( pTable->nCol==BMS-2 );
115208116340
for(i=0; i<mxBitCol; i++){
115209116341
if( extraCols & MASKBIT(i) ) nKeyCol++;
115210116342
}
115211116343
if( pSrc->colUsed & MASKBIT(BMS-1) ){
115212116344
nKeyCol += pTable->nCol - BMS + 1;
115213116345
}
115214
- pLoop->wsFlags |= WHERE_COLUMN_EQ | WHERE_IDX_ONLY;
115215116346
115216116347
/* Construct the Index object to describe this index */
115217116348
pIdx = sqlite3AllocateIndexObject(pParse->db, nKeyCol+1, 0, &zNotUsed);
115218
- if( pIdx==0 ) return;
116349
+ if( pIdx==0 ) goto end_auto_index_create;
115219116350
pLoop->u.btree.pIndex = pIdx;
115220116351
pIdx->zName = "auto-index";
115221116352
pIdx->pTable = pTable;
115222116353
n = 0;
115223116354
idxCols = 0;
@@ -115265,22 +116396,33 @@
115265116396
sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1);
115266116397
sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
115267116398
VdbeComment((v, "for %s", pTable->zName));
115268116399
115269116400
/* Fill the automatic index with content */
116401
+ sqlite3ExprCachePush(pParse);
115270116402
addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, pLevel->iTabCur); VdbeCoverage(v);
116403
+ if( pPartial ){
116404
+ iContinue = sqlite3VdbeMakeLabel(v);
116405
+ sqlite3ExprIfFalse(pParse, pPartial, iContinue, SQLITE_JUMPIFNULL);
116406
+ pLoop->wsFlags |= WHERE_PARTIALIDX;
116407
+ }
115271116408
regRecord = sqlite3GetTempReg(pParse);
115272116409
sqlite3GenerateIndexKey(pParse, pIdx, pLevel->iTabCur, regRecord, 0, 0, 0, 0);
115273116410
sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord);
115274116411
sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
116412
+ if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue);
115275116413
sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v);
115276116414
sqlite3VdbeChangeP5(v, SQLITE_STMTSTATUS_AUTOINDEX);
115277116415
sqlite3VdbeJumpHere(v, addrTop);
115278116416
sqlite3ReleaseTempReg(pParse, regRecord);
116417
+ sqlite3ExprCachePop(pParse);
115279116418
115280116419
/* Jump here when skipping the initialization */
115281116420
sqlite3VdbeJumpHere(v, addrInit);
116421
+
116422
+end_auto_index_create:
116423
+ sqlite3ExprDelete(pParse->db, pPartial);
115282116424
}
115283116425
#endif /* SQLITE_OMIT_AUTOMATIC_INDEX */
115284116426
115285116427
#ifndef SQLITE_OMIT_VIRTUALTABLE
115286116428
/*
@@ -115436,22 +116578,22 @@
115436116578
115437116579
return pParse->nErr;
115438116580
}
115439116581
#endif /* !defined(SQLITE_OMIT_VIRTUALTABLE) */
115440116582
115441
-
115442116583
#ifdef SQLITE_ENABLE_STAT3_OR_STAT4
115443116584
/*
115444116585
** Estimate the location of a particular key among all keys in an
115445116586
** index. Store the results in aStat as follows:
115446116587
**
115447116588
** aStat[0] Est. number of rows less than pVal
115448116589
** aStat[1] Est. number of rows equal to pVal
115449116590
**
115450
-** Return SQLITE_OK on success.
116591
+** Return the index of the sample that is the smallest sample that
116592
+** is greater than or equal to pRec.
115451116593
*/
115452
-static void whereKeyStats(
116594
+static int whereKeyStats(
115453116595
Parse *pParse, /* Database connection */
115454116596
Index *pIdx, /* Index to consider domain of */
115455116597
UnpackedRecord *pRec, /* Vector of values to consider */
115456116598
int roundUp, /* Round up if true. Round down if false */
115457116599
tRowcnt *aStat /* OUT: stats written here */
@@ -115529,10 +116671,11 @@
115529116671
}else{
115530116672
iGap = iGap/3;
115531116673
}
115532116674
aStat[0] = iLower + iGap;
115533116675
}
116676
+ return i;
115534116677
}
115535116678
#endif /* SQLITE_ENABLE_STAT3_OR_STAT4 */
115536116679
115537116680
/*
115538116681
** If it is not NULL, pTerm is a term that provides an upper or lower
@@ -115679,11 +116822,11 @@
115679116822
** pLower pUpper
115680116823
**
115681116824
** If either of the upper or lower bound is not present, then NULL is passed in
115682116825
** place of the corresponding WhereTerm.
115683116826
**
115684
-** The value in (pBuilder->pNew->u.btree.nEq) is the index of the index
116827
+** The value in (pBuilder->pNew->u.btree.nEq) is the number of the index
115685116828
** column subject to the range constraint. Or, equivalently, the number of
115686116829
** equality constraints optimized by the proposed index scan. For example,
115687116830
** assuming index p is on t1(a, b), and the SQL query is:
115688116831
**
115689116832
** ... FROM t1 WHERE a = ? AND b > ? AND b < ? ...
@@ -115695,11 +116838,11 @@
115695116838
**
115696116839
** then nEq is set to 0.
115697116840
**
115698116841
** When this function is called, *pnOut is set to the sqlite3LogEst() of the
115699116842
** number of rows that the index scan is expected to visit without
115700
-** considering the range constraints. If nEq is 0, this is the number of
116843
+** considering the range constraints. If nEq is 0, then *pnOut is the number of
115701116844
** rows in the index. Assuming no error occurs, *pnOut is adjusted (reduced)
115702116845
** to account for the range constraints pLower and pUpper.
115703116846
**
115704116847
** In the absence of sqlite_stat4 ANALYZE data, or if such data cannot be
115705116848
** used, a single range inequality reduces the search space by a factor of 4.
@@ -115719,14 +116862,11 @@
115719116862
115720116863
#ifdef SQLITE_ENABLE_STAT3_OR_STAT4
115721116864
Index *p = pLoop->u.btree.pIndex;
115722116865
int nEq = pLoop->u.btree.nEq;
115723116866
115724
- if( p->nSample>0
115725
- && nEq<p->nSampleCol
115726
- && OptimizationEnabled(pParse->db, SQLITE_Stat3)
115727
- ){
116867
+ if( p->nSample>0 && nEq<p->nSampleCol ){
115728116868
if( nEq==pBuilder->nRecValid ){
115729116869
UnpackedRecord *pRec = pBuilder->pRec;
115730116870
tRowcnt a[2];
115731116871
u8 aff;
115732116872
@@ -115738,19 +116878,23 @@
115738116878
**
115739116879
** Or, if pLower is NULL or $L cannot be extracted from it (because it
115740116880
** is not a simple variable or literal value), the lower bound of the
115741116881
** range is $P. Due to a quirk in the way whereKeyStats() works, even
115742116882
** if $L is available, whereKeyStats() is called for both ($P) and
115743
- ** ($P:$L) and the larger of the two returned values used.
116883
+ ** ($P:$L) and the larger of the two returned values is used.
115744116884
**
115745116885
** Similarly, iUpper is to be set to the estimate of the number of rows
115746116886
** less than the upper bound of the range query. Where the upper bound
115747116887
** is either ($P) or ($P:$U). Again, even if $U is available, both values
115748116888
** of iUpper are requested of whereKeyStats() and the smaller used.
116889
+ **
116890
+ ** The number of rows between the two bounds is then just iUpper-iLower.
115749116891
*/
115750
- tRowcnt iLower;
115751
- tRowcnt iUpper;
116892
+ tRowcnt iLower; /* Rows less than the lower bound */
116893
+ tRowcnt iUpper; /* Rows less than the upper bound */
116894
+ int iLwrIdx = -2; /* aSample[] for the lower bound */
116895
+ int iUprIdx = -1; /* aSample[] for the upper bound */
115752116896
115753116897
if( pRec ){
115754116898
testcase( pRec->nField!=pBuilder->nRecValid );
115755116899
pRec->nField = pBuilder->nRecValid;
115756116900
}
@@ -115760,11 +116904,11 @@
115760116904
aff = p->pTable->aCol[p->aiColumn[nEq]].affinity;
115761116905
}
115762116906
/* Determine iLower and iUpper using ($P) only. */
115763116907
if( nEq==0 ){
115764116908
iLower = 0;
115765
- iUpper = sqlite3LogEstToInt(p->aiRowLogEst[0]);
116909
+ iUpper = p->nRowEst0;
115766116910
}else{
115767116911
/* Note: this call could be optimized away - since the same values must
115768116912
** have been requested when testing key $P in whereEqualScanEst(). */
115769116913
whereKeyStats(pParse, p, pRec, 0, a);
115770116914
iLower = a[0];
@@ -115784,11 +116928,11 @@
115784116928
int bOk; /* True if value is extracted from pExpr */
115785116929
Expr *pExpr = pLower->pExpr->pRight;
115786116930
rc = sqlite3Stat4ProbeSetValue(pParse, p, &pRec, pExpr, aff, nEq, &bOk);
115787116931
if( rc==SQLITE_OK && bOk ){
115788116932
tRowcnt iNew;
115789
- whereKeyStats(pParse, p, pRec, 0, a);
116933
+ iLwrIdx = whereKeyStats(pParse, p, pRec, 0, a);
115790116934
iNew = a[0] + ((pLower->eOperator & (WO_GT|WO_LE)) ? a[1] : 0);
115791116935
if( iNew>iLower ) iLower = iNew;
115792116936
nOut--;
115793116937
pLower = 0;
115794116938
}
@@ -115799,11 +116943,11 @@
115799116943
int bOk; /* True if value is extracted from pExpr */
115800116944
Expr *pExpr = pUpper->pExpr->pRight;
115801116945
rc = sqlite3Stat4ProbeSetValue(pParse, p, &pRec, pExpr, aff, nEq, &bOk);
115802116946
if( rc==SQLITE_OK && bOk ){
115803116947
tRowcnt iNew;
115804
- whereKeyStats(pParse, p, pRec, 1, a);
116948
+ iUprIdx = whereKeyStats(pParse, p, pRec, 1, a);
115805116949
iNew = a[0] + ((pUpper->eOperator & (WO_GT|WO_LE)) ? a[1] : 0);
115806116950
if( iNew<iUpper ) iUpper = iNew;
115807116951
nOut--;
115808116952
pUpper = 0;
115809116953
}
@@ -115811,10 +116955,15 @@
115811116955
115812116956
pBuilder->pRec = pRec;
115813116957
if( rc==SQLITE_OK ){
115814116958
if( iUpper>iLower ){
115815116959
nNew = sqlite3LogEst(iUpper - iLower);
116960
+ /* TUNING: If both iUpper and iLower are derived from the same
116961
+ ** sample, then assume they are 4x more selective. This brings
116962
+ ** the estimated selectivity more in line with what it would be
116963
+ ** if estimated without the use of STAT3/4 tables. */
116964
+ if( iLwrIdx==iUprIdx ) nNew -= 20; assert( 20==sqlite3LogEst(4) );
115816116965
}else{
115817116966
nNew = 10; assert( 10==sqlite3LogEst(2) );
115818116967
}
115819116968
if( nNew<nOut ){
115820116969
nOut = nNew;
@@ -115835,16 +116984,19 @@
115835116984
#endif
115836116985
assert( pUpper==0 || (pUpper->wtFlags & TERM_VNULL)==0 );
115837116986
nNew = whereRangeAdjust(pLower, nOut);
115838116987
nNew = whereRangeAdjust(pUpper, nNew);
115839116988
115840
- /* TUNING: If there is both an upper and lower limit, assume the range is
116989
+ /* TUNING: If there is both an upper and lower limit and neither limit
116990
+ ** has an application-defined likelihood(), assume the range is
115841116991
** reduced by an additional 75%. This means that, by default, an open-ended
115842116992
** range query (e.g. col > ?) is assumed to match 1/4 of the rows in the
115843116993
** index. While a closed range (e.g. col BETWEEN ? AND ?) is estimated to
115844116994
** match 1/64 of the index. */
115845
- if( pLower && pUpper ) nNew -= 20;
116995
+ if( pLower && pLower->truthProb>0 && pUpper && pUpper->truthProb>0 ){
116996
+ nNew -= 20;
116997
+ }
115846116998
115847116999
nOut -= (pLower!=0) + (pUpper!=0);
115848117000
if( nNew<10 ) nNew = 10;
115849117001
if( nNew<nOut ) nOut = nNew;
115850117002
#if defined(WHERETRACE_ENABLED)
@@ -116200,11 +117352,11 @@
116200117352
116201117353
/* This module is only called on query plans that use an index. */
116202117354
pLoop = pLevel->pWLoop;
116203117355
assert( (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 );
116204117356
nEq = pLoop->u.btree.nEq;
116205
- nSkip = pLoop->u.btree.nSkip;
117357
+ nSkip = pLoop->nSkip;
116206117358
pIdx = pLoop->u.btree.pIndex;
116207117359
assert( pIdx!=0 );
116208117360
116209117361
/* Figure out how many memory cells we will need then allocate them.
116210117362
*/
@@ -116314,11 +117466,11 @@
116314117466
** "a=? AND b>?"
116315117467
*/
116316117468
static void explainIndexRange(StrAccum *pStr, WhereLoop *pLoop, Table *pTab){
116317117469
Index *pIndex = pLoop->u.btree.pIndex;
116318117470
u16 nEq = pLoop->u.btree.nEq;
116319
- u16 nSkip = pLoop->u.btree.nSkip;
117471
+ u16 nSkip = pLoop->nSkip;
116320117472
int i, j;
116321117473
Column *aCol = pTab->aCol;
116322117474
i16 *aiColumn = pIndex->aiColumn;
116323117475
116324117476
if( nEq==0 && (pLoop->wsFlags&(WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))==0 ) return;
@@ -116345,23 +117497,27 @@
116345117497
sqlite3StrAccumAppend(pStr, ")", 1);
116346117498
}
116347117499
116348117500
/*
116349117501
** This function is a no-op unless currently processing an EXPLAIN QUERY PLAN
116350
-** command. If the query being compiled is an EXPLAIN QUERY PLAN, a single
116351
-** record is added to the output to describe the table scan strategy in
116352
-** pLevel.
117502
+** command, or if either SQLITE_DEBUG or SQLITE_ENABLE_STMT_SCANSTATUS was
117503
+** defined at compile-time. If it is not a no-op, a single OP_Explain opcode
117504
+** is added to the output to describe the table scan strategy in pLevel.
117505
+**
117506
+** If an OP_Explain opcode is added to the VM, its address is returned.
117507
+** Otherwise, if no OP_Explain is coded, zero is returned.
116353117508
*/
116354
-static void explainOneScan(
117509
+static int explainOneScan(
116355117510
Parse *pParse, /* Parse context */
116356117511
SrcList *pTabList, /* Table list this loop refers to */
116357117512
WhereLevel *pLevel, /* Scan to write OP_Explain opcode for */
116358117513
int iLevel, /* Value for "level" column of output */
116359117514
int iFrom, /* Value for "from" column of output */
116360117515
u16 wctrlFlags /* Flags passed to sqlite3WhereBegin() */
116361117516
){
116362
-#ifndef SQLITE_DEBUG
117517
+ int ret = 0;
117518
+#if !defined(SQLITE_DEBUG) && !defined(SQLITE_ENABLE_STMT_SCANSTATUS)
116363117519
if( pParse->explain==2 )
116364117520
#endif
116365117521
{
116366117522
struct SrcList_item *pItem = &pTabList->a[pLevel->iFrom];
116367117523
Vdbe *v = pParse->pVdbe; /* VM being constructed */
@@ -116374,11 +117530,11 @@
116374117530
StrAccum str; /* EQP output string */
116375117531
char zBuf[100]; /* Initial space for EQP output string */
116376117532
116377117533
pLoop = pLevel->pWLoop;
116378117534
flags = pLoop->wsFlags;
116379
- if( (flags&WHERE_MULTI_OR) || (wctrlFlags&WHERE_ONETABLE_ONLY) ) return;
117535
+ if( (flags&WHERE_MULTI_OR) || (wctrlFlags&WHERE_ONETABLE_ONLY) ) return 0;
116380117536
116381117537
isSearch = (flags&(WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))!=0
116382117538
|| ((flags&WHERE_VIRTUALTABLE)==0 && (pLoop->u.btree.nEq>0))
116383117539
|| (wctrlFlags&(WHERE_ORDERBY_MIN|WHERE_ORDERBY_MAX));
116384117540
@@ -116403,10 +117559,12 @@
116403117559
assert( !(flags&WHERE_AUTO_INDEX) || (flags&WHERE_IDX_ONLY) );
116404117560
if( !HasRowid(pItem->pTab) && IsPrimaryKeyIndex(pIdx) ){
116405117561
if( isSearch ){
116406117562
zFmt = "PRIMARY KEY";
116407117563
}
117564
+ }else if( flags & WHERE_PARTIALIDX ){
117565
+ zFmt = "AUTOMATIC PARTIAL COVERING INDEX";
116408117566
}else if( flags & WHERE_AUTO_INDEX ){
116409117567
zFmt = "AUTOMATIC COVERING INDEX";
116410117568
}else if( flags & WHERE_IDX_ONLY ){
116411117569
zFmt = "COVERING INDEX %s";
116412117570
}else{
@@ -116444,16 +117602,49 @@
116444117602
}else{
116445117603
sqlite3StrAccumAppend(&str, " (~1 row)", 9);
116446117604
}
116447117605
#endif
116448117606
zMsg = sqlite3StrAccumFinish(&str);
116449
- sqlite3VdbeAddOp4(v, OP_Explain, iId, iLevel, iFrom, zMsg, P4_DYNAMIC);
117607
+ ret = sqlite3VdbeAddOp4(v, OP_Explain, iId, iLevel, iFrom, zMsg,P4_DYNAMIC);
116450117608
}
117609
+ return ret;
116451117610
}
116452117611
#else
116453
-# define explainOneScan(u,v,w,x,y,z)
117612
+# define explainOneScan(u,v,w,x,y,z) 0
116454117613
#endif /* SQLITE_OMIT_EXPLAIN */
117614
+
117615
+#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
117616
+/*
117617
+** Configure the VM passed as the first argument with an
117618
+** sqlite3_stmt_scanstatus() entry corresponding to the scan used to
117619
+** implement level pLvl. Argument pSrclist is a pointer to the FROM
117620
+** clause that the scan reads data from.
117621
+**
117622
+** If argument addrExplain is not 0, it must be the address of an
117623
+** OP_Explain instruction that describes the same loop.
117624
+*/
117625
+static void addScanStatus(
117626
+ Vdbe *v, /* Vdbe to add scanstatus entry to */
117627
+ SrcList *pSrclist, /* FROM clause pLvl reads data from */
117628
+ WhereLevel *pLvl, /* Level to add scanstatus() entry for */
117629
+ int addrExplain /* Address of OP_Explain (or 0) */
117630
+){
117631
+ const char *zObj = 0;
117632
+ WhereLoop *pLoop = pLvl->pWLoop;
117633
+ if( (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 && pLoop->u.btree.pIndex!=0 ){
117634
+ zObj = pLoop->u.btree.pIndex->zName;
117635
+ }else{
117636
+ zObj = pSrclist->a[pLvl->iFrom].zName;
117637
+ }
117638
+ sqlite3VdbeScanStatus(
117639
+ v, addrExplain, pLvl->addrBody, pLvl->addrVisit, pLoop->nOut, zObj
117640
+ );
117641
+}
117642
+#else
117643
+# define addScanStatus(a, b, c, d) ((void)d)
117644
+#endif
117645
+
116455117646
116456117647
116457117648
/*
116458117649
** Generate code for the start of the iLevel-th loop in the WHERE clause
116459117650
** implementation described by pWInfo.
@@ -116751,11 +117942,11 @@
116751117942
u8 bSeekPastNull = 0; /* True to seek past initial nulls */
116752117943
u8 bStopAtNull = 0; /* Add condition to terminate at NULLs */
116753117944
116754117945
pIdx = pLoop->u.btree.pIndex;
116755117946
iIdxCur = pLevel->iIdxCur;
116756
- assert( nEq>=pLoop->u.btree.nSkip );
117947
+ assert( nEq>=pLoop->nSkip );
116757117948
116758117949
/* If this loop satisfies a sort order (pOrderBy) request that
116759117950
** was passed to this function to implement a "SELECT min(x) ..."
116760117951
** query, then the caller will only allow the loop to run for
116761117952
** a single iteration. This means that the first row returned
@@ -116768,11 +117959,11 @@
116768117959
|| (pWInfo->wctrlFlags&WHERE_ORDERBY_MIN)==0 );
116769117960
if( (pWInfo->wctrlFlags&WHERE_ORDERBY_MIN)!=0
116770117961
&& pWInfo->nOBSat>0
116771117962
&& (pIdx->nKeyCol>nEq)
116772117963
){
116773
- assert( pLoop->u.btree.nSkip==0 );
117964
+ assert( pLoop->nSkip==0 );
116774117965
bSeekPastNull = 1;
116775117966
nExtraReg = 1;
116776117967
}
116777117968
116778117969
/* Find any inequality constraint terms for the start and end
@@ -117081,14 +118272,13 @@
117081118272
int iTerm;
117082118273
for(iTerm=0; iTerm<pWC->nTerm; iTerm++){
117083118274
Expr *pExpr = pWC->a[iTerm].pExpr;
117084118275
if( &pWC->a[iTerm] == pTerm ) continue;
117085118276
if( ExprHasProperty(pExpr, EP_FromJoin) ) continue;
117086
- testcase( pWC->a[iTerm].wtFlags & TERM_ORINFO );
117087
- testcase( pWC->a[iTerm].wtFlags & TERM_VIRTUAL );
117088
- if( pWC->a[iTerm].wtFlags & (TERM_ORINFO|TERM_VIRTUAL) ) continue;
118277
+ if( (pWC->a[iTerm].wtFlags & TERM_VIRTUAL)!=0 ) continue;
117089118278
if( (pWC->a[iTerm].eOperator & WO_ALL)==0 ) continue;
118279
+ testcase( pWC->a[iTerm].wtFlags & TERM_ORINFO );
117090118280
pExpr = sqlite3ExprDup(db, pExpr, 0);
117091118281
pAndExpr = sqlite3ExprAnd(db, pAndExpr, pExpr);
117092118282
}
117093118283
if( pAndExpr ){
117094118284
pAndExpr = sqlite3PExpr(pParse, TK_AND, 0, pAndExpr, 0);
@@ -117117,13 +118307,15 @@
117117118307
pSubWInfo = sqlite3WhereBegin(pParse, pOrTab, pOrExpr, 0, 0,
117118118308
wctrlFlags, iCovCur);
117119118309
assert( pSubWInfo || pParse->nErr || db->mallocFailed );
117120118310
if( pSubWInfo ){
117121118311
WhereLoop *pSubLoop;
117122
- explainOneScan(
118312
+ int addrExplain = explainOneScan(
117123118313
pParse, pOrTab, &pSubWInfo->a[0], iLevel, pLevel->iFrom, 0
117124118314
);
118315
+ addScanStatus(v, pOrTab, &pSubWInfo->a[0], addrExplain);
118316
+
117125118317
/* This is the sub-WHERE clause body. First skip over
117126118318
** duplicate rows from prior sub-WHERE clauses, and record the
117127118319
** rowid (or PRIMARY KEY) for the current row so that the same
117128118320
** row will be skipped in subsequent sub-WHERE clauses.
117129118321
*/
@@ -117249,10 +118441,14 @@
117249118441
VdbeCoverageIf(v, bRev==0);
117250118442
VdbeCoverageIf(v, bRev!=0);
117251118443
pLevel->p5 = SQLITE_STMTSTATUS_FULLSCAN_STEP;
117252118444
}
117253118445
}
118446
+
118447
+#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
118448
+ pLevel->addrVisit = sqlite3VdbeCurrentAddr(v);
118449
+#endif
117254118450
117255118451
/* Insert code to test every subexpression that can be completely
117256118452
** computed using the current set of tables.
117257118453
*/
117258118454
for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){
@@ -117389,11 +118585,11 @@
117389118585
}
117390118586
sqlite3DebugPrintf(" %-19s", z);
117391118587
sqlite3_free(z);
117392118588
}
117393118589
if( p->wsFlags & WHERE_SKIPSCAN ){
117394
- sqlite3DebugPrintf(" f %05x %d-%d", p->wsFlags, p->nLTerm,p->u.btree.nSkip);
118590
+ sqlite3DebugPrintf(" f %05x %d-%d", p->wsFlags, p->nLTerm,p->nSkip);
117395118591
}else{
117396118592
sqlite3DebugPrintf(" f %05x N %d", p->wsFlags, p->nLTerm);
117397118593
}
117398118594
sqlite3DebugPrintf(" cost %d,%d,%d\n", p->rSetup, p->rRun, p->nOut);
117399118595
if( p->nLTerm && (sqlite3WhereTrace & 0x100)!=0 ){
@@ -117500,34 +118696,41 @@
117500118696
sqlite3DbFree(db, pWInfo);
117501118697
}
117502118698
}
117503118699
117504118700
/*
117505
-** Return TRUE if both of the following are true:
118701
+** Return TRUE if all of the following are true:
117506118702
**
117507118703
** (1) X has the same or lower cost that Y
117508118704
** (2) X is a proper subset of Y
118705
+** (3) X skips at least as many columns as Y
117509118706
**
117510118707
** By "proper subset" we mean that X uses fewer WHERE clause terms
117511118708
** than Y and that every WHERE clause term used by X is also used
117512118709
** by Y.
117513118710
**
117514118711
** If X is a proper subset of Y then Y is a better choice and ought
117515118712
** to have a lower cost. This routine returns TRUE when that cost
117516
-** relationship is inverted and needs to be adjusted.
118713
+** relationship is inverted and needs to be adjusted. The third rule
118714
+** was added because if X uses skip-scan less than Y it still might
118715
+** deserve a lower cost even if it is a proper subset of Y.
117517118716
*/
117518118717
static int whereLoopCheaperProperSubset(
117519118718
const WhereLoop *pX, /* First WhereLoop to compare */
117520118719
const WhereLoop *pY /* Compare against this WhereLoop */
117521118720
){
117522118721
int i, j;
117523
- if( pX->nLTerm >= pY->nLTerm ) return 0; /* X is not a subset of Y */
118722
+ if( pX->nLTerm-pX->nSkip >= pY->nLTerm-pY->nSkip ){
118723
+ return 0; /* X is not a subset of Y */
118724
+ }
118725
+ if( pY->nSkip > pX->nSkip ) return 0;
117524118726
if( pX->rRun >= pY->rRun ){
117525118727
if( pX->rRun > pY->rRun ) return 0; /* X costs more than Y */
117526118728
if( pX->nOut > pY->nOut ) return 0; /* X costs more than Y */
117527118729
}
117528118730
for(i=pX->nLTerm-1; i>=0; i--){
118731
+ if( pX->aLTerm[i]==0 ) continue;
117529118732
for(j=pY->nLTerm-1; j>=0; j--){
117530118733
if( pY->aLTerm[j]==pX->aLTerm[i] ) break;
117531118734
}
117532118735
if( j<0 ) return 0; /* X not a subset of Y since term X[i] not used by Y */
117533118736
}
@@ -117545,37 +118748,28 @@
117545118748
** is a proper subset.
117546118749
**
117547118750
** To say "WhereLoop X is a proper subset of Y" means that X uses fewer
117548118751
** WHERE clause terms than Y and that every WHERE clause term used by X is
117549118752
** also used by Y.
117550
-**
117551
-** This adjustment is omitted for SKIPSCAN loops. In a SKIPSCAN loop, the
117552
-** WhereLoop.nLTerm field is not an accurate measure of the number of WHERE
117553
-** clause terms covered, since some of the first nLTerm entries in aLTerm[]
117554
-** will be NULL (because they are skipped). That makes it more difficult
117555
-** to compare the loops. We could add extra code to do the comparison, and
117556
-** perhaps we will someday. But SKIPSCAN is sufficiently uncommon, and this
117557
-** adjustment is sufficient minor, that it is very difficult to construct
117558
-** a test case where the extra code would improve the query plan. Better
117559
-** to avoid the added complexity and just omit cost adjustments to SKIPSCAN
117560
-** loops.
117561118753
*/
117562118754
static void whereLoopAdjustCost(const WhereLoop *p, WhereLoop *pTemplate){
117563118755
if( (pTemplate->wsFlags & WHERE_INDEXED)==0 ) return;
117564
- if( (pTemplate->wsFlags & WHERE_SKIPSCAN)!=0 ) return;
117565118756
for(; p; p=p->pNextLoop){
117566118757
if( p->iTab!=pTemplate->iTab ) continue;
117567118758
if( (p->wsFlags & WHERE_INDEXED)==0 ) continue;
117568
- if( (p->wsFlags & WHERE_SKIPSCAN)!=0 ) continue;
117569118759
if( whereLoopCheaperProperSubset(p, pTemplate) ){
117570118760
/* Adjust pTemplate cost downward so that it is cheaper than its
117571
- ** subset p */
118761
+ ** subset p. */
118762
+ WHERETRACE(0x80,("subset cost adjustment %d,%d to %d,%d\n",
118763
+ pTemplate->rRun, pTemplate->nOut, p->rRun, p->nOut-1));
117572118764
pTemplate->rRun = p->rRun;
117573118765
pTemplate->nOut = p->nOut - 1;
117574118766
}else if( whereLoopCheaperProperSubset(pTemplate, p) ){
117575118767
/* Adjust pTemplate cost upward so that it is costlier than p since
117576118768
** pTemplate is a proper subset of p */
118769
+ WHERETRACE(0x80,("subset cost adjustment %d,%d to %d,%d\n",
118770
+ pTemplate->rRun, pTemplate->nOut, p->rRun, p->nOut+1));
117577118771
pTemplate->rRun = p->rRun;
117578118772
pTemplate->nOut = p->nOut + 1;
117579118773
}
117580118774
}
117581118775
}
@@ -117616,12 +118810,13 @@
117616118810
** rSetup. Call this SETUP-INVARIANT */
117617118811
assert( p->rSetup>=pTemplate->rSetup );
117618118812
117619118813
/* Any loop using an appliation-defined index (or PRIMARY KEY or
117620118814
** UNIQUE constraint) with one or more == constraints is better
117621
- ** than an automatic index. */
118815
+ ** than an automatic index. Unless it is a skip-scan. */
117622118816
if( (p->wsFlags & WHERE_AUTO_INDEX)!=0
118817
+ && (pTemplate->nSkip)==0
117623118818
&& (pTemplate->wsFlags & WHERE_INDEXED)!=0
117624118819
&& (pTemplate->wsFlags & WHERE_COLUMN_EQ)!=0
117625118820
&& (p->prereq & pTemplate->prereq)==pTemplate->prereq
117626118821
){
117627118822
break;
@@ -117776,25 +118971,46 @@
117776118971
117777118972
/*
117778118973
** Adjust the WhereLoop.nOut value downward to account for terms of the
117779118974
** WHERE clause that reference the loop but which are not used by an
117780118975
** index.
118976
+*
118977
+** For every WHERE clause term that is not used by the index
118978
+** and which has a truth probability assigned by one of the likelihood(),
118979
+** likely(), or unlikely() SQL functions, reduce the estimated number
118980
+** of output rows by the probability specified.
117781118981
**
117782
-** In the current implementation, the first extra WHERE clause term reduces
117783
-** the number of output rows by a factor of 10 and each additional term
117784
-** reduces the number of output rows by sqrt(2).
118982
+** TUNING: For every WHERE clause term that is not used by the index
118983
+** and which does not have an assigned truth probability, heuristics
118984
+** described below are used to try to estimate the truth probability.
118985
+** TODO --> Perhaps this is something that could be improved by better
118986
+** table statistics.
118987
+**
118988
+** Heuristic 1: Estimate the truth probability as 93.75%. The 93.75%
118989
+** value corresponds to -1 in LogEst notation, so this means decrement
118990
+** the WhereLoop.nOut field for every such WHERE clause term.
118991
+**
118992
+** Heuristic 2: If there exists one or more WHERE clause terms of the
118993
+** form "x==EXPR" and EXPR is not a constant 0 or 1, then make sure the
118994
+** final output row estimate is no greater than 1/4 of the total number
118995
+** of rows in the table. In other words, assume that x==EXPR will filter
118996
+** out at least 3 out of 4 rows. If EXPR is -1 or 0 or 1, then maybe the
118997
+** "x" column is boolean or else -1 or 0 or 1 is a common default value
118998
+** on the "x" column and so in that case only cap the output row estimate
118999
+** at 1/2 instead of 1/4.
117785119000
*/
117786119001
static void whereLoopOutputAdjust(
117787119002
WhereClause *pWC, /* The WHERE clause */
117788119003
WhereLoop *pLoop, /* The loop to adjust downward */
117789119004
LogEst nRow /* Number of rows in the entire table */
117790119005
){
117791119006
WhereTerm *pTerm, *pX;
117792119007
Bitmask notAllowed = ~(pLoop->prereq|pLoop->maskSelf);
117793
- int i, j;
117794
- int nEq = 0; /* Number of = constraints not within likely()/unlikely() */
119008
+ int i, j, k;
119009
+ LogEst iReduce = 0; /* pLoop->nOut should not exceed nRow-iReduce */
117795119010
119011
+ assert( (pLoop->wsFlags & WHERE_AUTO_INDEX)==0 );
117796119012
for(i=pWC->nTerm, pTerm=pWC->a; i>0; i--, pTerm++){
117797119013
if( (pTerm->wtFlags & TERM_VIRTUAL)!=0 ) break;
117798119014
if( (pTerm->prereqAll & pLoop->maskSelf)==0 ) continue;
117799119015
if( (pTerm->prereqAll & notAllowed)!=0 ) continue;
117800119016
for(j=pLoop->nLTerm-1; j>=0; j--){
@@ -117803,24 +119019,30 @@
117803119019
if( pX==pTerm ) break;
117804119020
if( pX->iParent>=0 && (&pWC->a[pX->iParent])==pTerm ) break;
117805119021
}
117806119022
if( j<0 ){
117807119023
if( pTerm->truthProb<=0 ){
119024
+ /* If a truth probability is specified using the likelihood() hints,
119025
+ ** then use the probability provided by the application. */
117808119026
pLoop->nOut += pTerm->truthProb;
117809119027
}else{
119028
+ /* In the absence of explicit truth probabilities, use heuristics to
119029
+ ** guess a reasonable truth probability. */
117810119030
pLoop->nOut--;
117811
- if( pTerm->eOperator&WO_EQ ) nEq++;
119031
+ if( pTerm->eOperator&WO_EQ ){
119032
+ Expr *pRight = pTerm->pExpr->pRight;
119033
+ if( sqlite3ExprIsInteger(pRight, &k) && k>=(-1) && k<=1 ){
119034
+ k = 10;
119035
+ }else{
119036
+ k = 20;
119037
+ }
119038
+ if( iReduce<k ) iReduce = k;
119039
+ }
117812119040
}
117813119041
}
117814119042
}
117815
- /* TUNING: If there is at least one equality constraint in the WHERE
117816
- ** clause that does not have a likelihood() explicitly assigned to it
117817
- ** then do not let the estimated number of output rows exceed half
117818
- ** the number of rows in the table. */
117819
- if( nEq && pLoop->nOut>nRow-10 ){
117820
- pLoop->nOut = nRow - 10;
117821
- }
119043
+ if( pLoop->nOut > nRow-iReduce ) pLoop->nOut = nRow - iReduce;
117822119044
}
117823119045
117824119046
/*
117825119047
** Adjust the cost C by the costMult facter T. This only occurs if
117826119048
** compiled with -DSQLITE_ENABLE_COSTMULT
@@ -117857,11 +119079,11 @@
117857119079
int opMask; /* Valid operators for constraints */
117858119080
WhereScan scan; /* Iterator for WHERE terms */
117859119081
Bitmask saved_prereq; /* Original value of pNew->prereq */
117860119082
u16 saved_nLTerm; /* Original value of pNew->nLTerm */
117861119083
u16 saved_nEq; /* Original value of pNew->u.btree.nEq */
117862
- u16 saved_nSkip; /* Original value of pNew->u.btree.nSkip */
119084
+ u16 saved_nSkip; /* Original value of pNew->nSkip */
117863119085
u32 saved_wsFlags; /* Original value of pNew->wsFlags */
117864119086
LogEst saved_nOut; /* Original value of pNew->nOut */
117865119087
int iCol; /* Index of the column in the table */
117866119088
int rc = SQLITE_OK; /* Return code */
117867119089
LogEst rSize; /* Number of rows in the table */
@@ -117886,56 +119108,18 @@
117886119108
iCol = pProbe->aiColumn[pNew->u.btree.nEq];
117887119109
117888119110
pTerm = whereScanInit(&scan, pBuilder->pWC, pSrc->iCursor, iCol,
117889119111
opMask, pProbe);
117890119112
saved_nEq = pNew->u.btree.nEq;
117891
- saved_nSkip = pNew->u.btree.nSkip;
119113
+ saved_nSkip = pNew->nSkip;
117892119114
saved_nLTerm = pNew->nLTerm;
117893119115
saved_wsFlags = pNew->wsFlags;
117894119116
saved_prereq = pNew->prereq;
117895119117
saved_nOut = pNew->nOut;
117896119118
pNew->rSetup = 0;
117897119119
rSize = pProbe->aiRowLogEst[0];
117898119120
rLogSize = estLog(rSize);
117899
-
117900
- /* Consider using a skip-scan if there are no WHERE clause constraints
117901
- ** available for the left-most terms of the index, and if the average
117902
- ** number of repeats in the left-most terms is at least 18.
117903
- **
117904
- ** The magic number 18 is selected on the basis that scanning 17 rows
117905
- ** is almost always quicker than an index seek (even though if the index
117906
- ** contains fewer than 2^17 rows we assume otherwise in other parts of
117907
- ** the code). And, even if it is not, it should not be too much slower.
117908
- ** On the other hand, the extra seeks could end up being significantly
117909
- ** more expensive. */
117910
- assert( 42==sqlite3LogEst(18) );
117911
- if( saved_nEq==saved_nSkip
117912
- && saved_nEq+1<pProbe->nKeyCol
117913
- && pProbe->aiRowLogEst[saved_nEq+1]>=42 /* TUNING: Minimum for skip-scan */
117914
- && (rc = whereLoopResize(db, pNew, pNew->nLTerm+1))==SQLITE_OK
117915
- ){
117916
- LogEst nIter;
117917
- pNew->u.btree.nEq++;
117918
- pNew->u.btree.nSkip++;
117919
- pNew->aLTerm[pNew->nLTerm++] = 0;
117920
- pNew->wsFlags |= WHERE_SKIPSCAN;
117921
- nIter = pProbe->aiRowLogEst[saved_nEq] - pProbe->aiRowLogEst[saved_nEq+1];
117922
- if( pTerm ){
117923
- /* TUNING: When estimating skip-scan for a term that is also indexable,
117924
- ** multiply the cost of the skip-scan by 2.0, to make it a little less
117925
- ** desirable than the regular index lookup. */
117926
- nIter += 10; assert( 10==sqlite3LogEst(2) );
117927
- }
117928
- pNew->nOut -= nIter;
117929
- /* TUNING: Because uncertainties in the estimates for skip-scan queries,
117930
- ** add a 1.375 fudge factor to make skip-scan slightly less likely. */
117931
- nIter += 5;
117932
- whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, nIter + nInMul);
117933
- pNew->nOut = saved_nOut;
117934
- pNew->u.btree.nEq = saved_nEq;
117935
- pNew->u.btree.nSkip = saved_nSkip;
117936
- }
117937119121
for(; rc==SQLITE_OK && pTerm!=0; pTerm = whereScanNext(&scan)){
117938119122
u16 eOp = pTerm->eOperator; /* Shorthand for pTerm->eOperator */
117939119123
LogEst rCostIdx;
117940119124
LogEst nOutUnadjusted; /* nOut before IN() and WHERE adjustments */
117941119125
int nIn = 0;
@@ -118026,11 +119210,10 @@
118026119210
#ifdef SQLITE_ENABLE_STAT3_OR_STAT4
118027119211
tRowcnt nOut = 0;
118028119212
if( nInMul==0
118029119213
&& pProbe->nSample
118030119214
&& pNew->u.btree.nEq<=pProbe->nSampleCol
118031
- && OptimizationEnabled(db, SQLITE_Stat3)
118032119215
&& ((eOp & WO_IN)==0 || !ExprHasProperty(pTerm->pExpr, EP_xIsSelect))
118033119216
){
118034119217
Expr *pExpr = pTerm->pExpr;
118035119218
if( (eOp & (WO_EQ|WO_ISNULL))!=0 ){
118036119219
testcase( eOp & WO_EQ );
@@ -118094,14 +119277,49 @@
118094119277
pBuilder->nRecValid = nRecValid;
118095119278
#endif
118096119279
}
118097119280
pNew->prereq = saved_prereq;
118098119281
pNew->u.btree.nEq = saved_nEq;
118099
- pNew->u.btree.nSkip = saved_nSkip;
119282
+ pNew->nSkip = saved_nSkip;
118100119283
pNew->wsFlags = saved_wsFlags;
118101119284
pNew->nOut = saved_nOut;
118102119285
pNew->nLTerm = saved_nLTerm;
119286
+
119287
+ /* Consider using a skip-scan if there are no WHERE clause constraints
119288
+ ** available for the left-most terms of the index, and if the average
119289
+ ** number of repeats in the left-most terms is at least 18.
119290
+ **
119291
+ ** The magic number 18 is selected on the basis that scanning 17 rows
119292
+ ** is almost always quicker than an index seek (even though if the index
119293
+ ** contains fewer than 2^17 rows we assume otherwise in other parts of
119294
+ ** the code). And, even if it is not, it should not be too much slower.
119295
+ ** On the other hand, the extra seeks could end up being significantly
119296
+ ** more expensive. */
119297
+ assert( 42==sqlite3LogEst(18) );
119298
+ if( saved_nEq==saved_nSkip
119299
+ && saved_nEq+1<pProbe->nKeyCol
119300
+ && pProbe->noSkipScan==0
119301
+ && pProbe->aiRowLogEst[saved_nEq+1]>=42 /* TUNING: Minimum for skip-scan */
119302
+ && (rc = whereLoopResize(db, pNew, pNew->nLTerm+1))==SQLITE_OK
119303
+ ){
119304
+ LogEst nIter;
119305
+ pNew->u.btree.nEq++;
119306
+ pNew->nSkip++;
119307
+ pNew->aLTerm[pNew->nLTerm++] = 0;
119308
+ pNew->wsFlags |= WHERE_SKIPSCAN;
119309
+ nIter = pProbe->aiRowLogEst[saved_nEq] - pProbe->aiRowLogEst[saved_nEq+1];
119310
+ pNew->nOut -= nIter;
119311
+ /* TUNING: Because uncertainties in the estimates for skip-scan queries,
119312
+ ** add a 1.375 fudge factor to make skip-scan slightly less likely. */
119313
+ nIter += 5;
119314
+ whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, nIter + nInMul);
119315
+ pNew->nOut = saved_nOut;
119316
+ pNew->u.btree.nEq = saved_nEq;
119317
+ pNew->nSkip = saved_nSkip;
119318
+ pNew->wsFlags = saved_wsFlags;
119319
+ }
119320
+
118103119321
return rc;
118104119322
}
118105119323
118106119324
/*
118107119325
** Return True if it is possible that pIndex might be useful in
@@ -118276,11 +119494,11 @@
118276119494
WhereTerm *pWCEnd = pWC->a + pWC->nTerm;
118277119495
for(pTerm=pWC->a; rc==SQLITE_OK && pTerm<pWCEnd; pTerm++){
118278119496
if( pTerm->prereqRight & pNew->maskSelf ) continue;
118279119497
if( termCanDriveIndex(pTerm, pSrc, 0) ){
118280119498
pNew->u.btree.nEq = 1;
118281
- pNew->u.btree.nSkip = 0;
119499
+ pNew->nSkip = 0;
118282119500
pNew->u.btree.pIndex = 0;
118283119501
pNew->nLTerm = 1;
118284119502
pNew->aLTerm[0] = pTerm;
118285119503
/* TUNING: One-time cost for computing the automatic index is
118286119504
** estimated to be X*N*log2(N) where N is the number of rows in
@@ -118317,11 +119535,11 @@
118317119535
testcase( pNew->iTab!=pSrc->iCursor ); /* See ticket [98d973b8f5] */
118318119536
continue; /* Partial index inappropriate for this query */
118319119537
}
118320119538
rSize = pProbe->aiRowLogEst[0];
118321119539
pNew->u.btree.nEq = 0;
118322
- pNew->u.btree.nSkip = 0;
119540
+ pNew->nSkip = 0;
118323119541
pNew->nLTerm = 0;
118324119542
pNew->iSortIdx = 0;
118325119543
pNew->rSetup = 0;
118326119544
pNew->prereq = mExtra;
118327119545
pNew->nOut = rSize;
@@ -118867,11 +120085,11 @@
118867120085
for(j=0; j<nColumn; j++){
118868120086
u8 bOnce; /* True to run the ORDER BY search loop */
118869120087
118870120088
/* Skip over == and IS NULL terms */
118871120089
if( j<pLoop->u.btree.nEq
118872
- && pLoop->u.btree.nSkip==0
120090
+ && pLoop->nSkip==0
118873120091
&& ((i = pLoop->aLTerm[j]->eOperator) & (WO_EQ|WO_ISNULL))!=0
118874120092
){
118875120093
if( i & WO_ISNULL ){
118876120094
testcase( isOrderDistinct );
118877120095
isOrderDistinct = 0;
@@ -119321,11 +120539,11 @@
119321120539
}
119322120540
}
119323120541
}
119324120542
119325120543
#ifdef WHERETRACE_ENABLED /* >=2 */
119326
- if( sqlite3WhereTrace>=2 ){
120544
+ if( sqlite3WhereTrace & 0x02 ){
119327120545
sqlite3DebugPrintf("---- after round %d ----\n", iLoop);
119328120546
for(ii=0, pTo=aTo; ii<nTo; ii++, pTo++){
119329120547
sqlite3DebugPrintf(" %s cost=%-3d nrow=%-3d order=%c",
119330120548
wherePathName(pTo, iLoop+1, 0), pTo->rCost, pTo->nRow,
119331120549
pTo->isOrdered>=0 ? (pTo->isOrdered+'0') : '?');
@@ -119440,11 +120658,11 @@
119440120658
if( pItem->zIndex ) return 0;
119441120659
iCur = pItem->iCursor;
119442120660
pWC = &pWInfo->sWC;
119443120661
pLoop = pBuilder->pNew;
119444120662
pLoop->wsFlags = 0;
119445
- pLoop->u.btree.nSkip = 0;
120663
+ pLoop->nSkip = 0;
119446120664
pTerm = findTerm(pWC, iCur, -1, 0, WO_EQ, 0);
119447120665
if( pTerm ){
119448120666
pLoop->wsFlags = WHERE_COLUMN_EQ|WHERE_IPK|WHERE_ONEROW;
119449120667
pLoop->aLTerm[0] = pTerm;
119450120668
pLoop->nLTerm = 1;
@@ -119452,11 +120670,10 @@
119452120670
/* TUNING: Cost of a rowid lookup is 10 */
119453120671
pLoop->rRun = 33; /* 33==sqlite3LogEst(10) */
119454120672
}else{
119455120673
for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
119456120674
assert( pLoop->aLTermSpace==pLoop->aLTerm );
119457
- assert( ArraySize(pLoop->aLTermSpace)==4 );
119458120675
if( !IsUniqueIndex(pIdx)
119459120676
|| pIdx->pPartIdxWhere!=0
119460120677
|| pIdx->nKeyCol>ArraySize(pLoop->aLTermSpace)
119461120678
) continue;
119462120679
for(j=0; j<pIdx->nKeyCol; j++){
@@ -119961,22 +121178,30 @@
119961121178
** loop below generates code for a single nested loop of the VM
119962121179
** program.
119963121180
*/
119964121181
notReady = ~(Bitmask)0;
119965121182
for(ii=0; ii<nTabList; ii++){
121183
+ int addrExplain;
121184
+ int wsFlags;
119966121185
pLevel = &pWInfo->a[ii];
121186
+ wsFlags = pLevel->pWLoop->wsFlags;
119967121187
#ifndef SQLITE_OMIT_AUTOMATIC_INDEX
119968121188
if( (pLevel->pWLoop->wsFlags & WHERE_AUTO_INDEX)!=0 ){
119969121189
constructAutomaticIndex(pParse, &pWInfo->sWC,
119970121190
&pTabList->a[pLevel->iFrom], notReady, pLevel);
119971121191
if( db->mallocFailed ) goto whereBeginError;
119972121192
}
119973121193
#endif
119974
- explainOneScan(pParse, pTabList, pLevel, ii, pLevel->iFrom, wctrlFlags);
121194
+ addrExplain = explainOneScan(
121195
+ pParse, pTabList, pLevel, ii, pLevel->iFrom, wctrlFlags
121196
+ );
119975121197
pLevel->addrBody = sqlite3VdbeCurrentAddr(v);
119976121198
notReady = codeOneLoopStart(pWInfo, ii, notReady);
119977121199
pWInfo->iContinue = pLevel->addrCont;
121200
+ if( (wsFlags&WHERE_MULTI_OR)==0 && (wctrlFlags&WHERE_ONETABLE_ONLY)==0 ){
121201
+ addScanStatus(v, pTabList, pLevel, addrExplain);
121202
+ }
119978121203
}
119979121204
119980121205
/* Done. */
119981121206
VdbeModuleComment((v, "Begin WHERE-core"));
119982121207
return pWInfo;
@@ -124640,10 +125865,17 @@
124640125865
** is look for a semicolon that is not part of an string or comment.
124641125866
*/
124642125867
SQLITE_API int sqlite3_complete(const char *zSql){
124643125868
u8 state = 0; /* Current state, using numbers defined in header comment */
124644125869
u8 token; /* Value of the next token */
125870
+
125871
+#ifdef SQLITE_ENABLE_API_ARMOR
125872
+ if( zSql==0 ){
125873
+ (void)SQLITE_MISUSE_BKPT;
125874
+ return 0;
125875
+ }
125876
+#endif
124645125877
124646125878
#ifndef SQLITE_OMIT_TRIGGER
124647125879
/* A complex statement machine used to detect the end of a CREATE TRIGGER
124648125880
** statement. This is the normal case.
124649125881
*/
@@ -125238,74 +126470,106 @@
125238126470
125239126471
va_start(ap, op);
125240126472
switch( op ){
125241126473
125242126474
/* Mutex configuration options are only available in a threadsafe
125243
- ** compile.
126475
+ ** compile.
125244126476
*/
125245
-#if defined(SQLITE_THREADSAFE) && SQLITE_THREADSAFE>0
126477
+#if defined(SQLITE_THREADSAFE) && SQLITE_THREADSAFE>0 /* IMP: R-54466-46756 */
125246126478
case SQLITE_CONFIG_SINGLETHREAD: {
125247126479
/* Disable all mutexing */
125248126480
sqlite3GlobalConfig.bCoreMutex = 0;
125249126481
sqlite3GlobalConfig.bFullMutex = 0;
125250126482
break;
125251126483
}
126484
+#endif
126485
+#if defined(SQLITE_THREADSAFE) && SQLITE_THREADSAFE>0 /* IMP: R-20520-54086 */
125252126486
case SQLITE_CONFIG_MULTITHREAD: {
125253126487
/* Disable mutexing of database connections */
125254126488
/* Enable mutexing of core data structures */
125255126489
sqlite3GlobalConfig.bCoreMutex = 1;
125256126490
sqlite3GlobalConfig.bFullMutex = 0;
125257126491
break;
125258126492
}
126493
+#endif
126494
+#if defined(SQLITE_THREADSAFE) && SQLITE_THREADSAFE>0 /* IMP: R-59593-21810 */
125259126495
case SQLITE_CONFIG_SERIALIZED: {
125260126496
/* Enable all mutexing */
125261126497
sqlite3GlobalConfig.bCoreMutex = 1;
125262126498
sqlite3GlobalConfig.bFullMutex = 1;
125263126499
break;
125264126500
}
126501
+#endif
126502
+#if defined(SQLITE_THREADSAFE) && SQLITE_THREADSAFE>0 /* IMP: R-63666-48755 */
125265126503
case SQLITE_CONFIG_MUTEX: {
125266126504
/* Specify an alternative mutex implementation */
125267126505
sqlite3GlobalConfig.mutex = *va_arg(ap, sqlite3_mutex_methods*);
125268126506
break;
125269126507
}
126508
+#endif
126509
+#if defined(SQLITE_THREADSAFE) && SQLITE_THREADSAFE>0 /* IMP: R-14450-37597 */
125270126510
case SQLITE_CONFIG_GETMUTEX: {
125271126511
/* Retrieve the current mutex implementation */
125272126512
*va_arg(ap, sqlite3_mutex_methods*) = sqlite3GlobalConfig.mutex;
125273126513
break;
125274126514
}
125275126515
#endif
125276126516
125277
-
125278126517
case SQLITE_CONFIG_MALLOC: {
125279
- /* Specify an alternative malloc implementation */
126518
+ /* EVIDENCE-OF: R-55594-21030 The SQLITE_CONFIG_MALLOC option takes a
126519
+ ** single argument which is a pointer to an instance of the
126520
+ ** sqlite3_mem_methods structure. The argument specifies alternative
126521
+ ** low-level memory allocation routines to be used in place of the memory
126522
+ ** allocation routines built into SQLite. */
125280126523
sqlite3GlobalConfig.m = *va_arg(ap, sqlite3_mem_methods*);
125281126524
break;
125282126525
}
125283126526
case SQLITE_CONFIG_GETMALLOC: {
125284
- /* Retrieve the current malloc() implementation */
126527
+ /* EVIDENCE-OF: R-51213-46414 The SQLITE_CONFIG_GETMALLOC option takes a
126528
+ ** single argument which is a pointer to an instance of the
126529
+ ** sqlite3_mem_methods structure. The sqlite3_mem_methods structure is
126530
+ ** filled with the currently defined memory allocation routines. */
125285126531
if( sqlite3GlobalConfig.m.xMalloc==0 ) sqlite3MemSetDefault();
125286126532
*va_arg(ap, sqlite3_mem_methods*) = sqlite3GlobalConfig.m;
125287126533
break;
125288126534
}
125289126535
case SQLITE_CONFIG_MEMSTATUS: {
125290
- /* Enable or disable the malloc status collection */
126536
+ /* EVIDENCE-OF: R-61275-35157 The SQLITE_CONFIG_MEMSTATUS option takes
126537
+ ** single argument of type int, interpreted as a boolean, which enables
126538
+ ** or disables the collection of memory allocation statistics. */
125291126539
sqlite3GlobalConfig.bMemstat = va_arg(ap, int);
125292126540
break;
125293126541
}
125294126542
case SQLITE_CONFIG_SCRATCH: {
125295
- /* Designate a buffer for scratch memory space */
126543
+ /* EVIDENCE-OF: R-08404-60887 There are three arguments to
126544
+ ** SQLITE_CONFIG_SCRATCH: A pointer an 8-byte aligned memory buffer from
126545
+ ** which the scratch allocations will be drawn, the size of each scratch
126546
+ ** allocation (sz), and the maximum number of scratch allocations (N). */
125296126547
sqlite3GlobalConfig.pScratch = va_arg(ap, void*);
125297126548
sqlite3GlobalConfig.szScratch = va_arg(ap, int);
125298126549
sqlite3GlobalConfig.nScratch = va_arg(ap, int);
125299126550
break;
125300126551
}
125301126552
case SQLITE_CONFIG_PAGECACHE: {
125302
- /* Designate a buffer for page cache memory space */
126553
+ /* EVIDENCE-OF: R-31408-40510 There are three arguments to
126554
+ ** SQLITE_CONFIG_PAGECACHE: A pointer to 8-byte aligned memory, the size
126555
+ ** of each page buffer (sz), and the number of pages (N). */
125303126556
sqlite3GlobalConfig.pPage = va_arg(ap, void*);
125304126557
sqlite3GlobalConfig.szPage = va_arg(ap, int);
125305126558
sqlite3GlobalConfig.nPage = va_arg(ap, int);
125306126559
break;
126560
+ }
126561
+ case SQLITE_CONFIG_PCACHE_HDRSZ: {
126562
+ /* EVIDENCE-OF: R-39100-27317 The SQLITE_CONFIG_PCACHE_HDRSZ option takes
126563
+ ** a single parameter which is a pointer to an integer and writes into
126564
+ ** that integer the number of extra bytes per page required for each page
126565
+ ** in SQLITE_CONFIG_PAGECACHE. */
126566
+ *va_arg(ap, int*) =
126567
+ sqlite3HeaderSizeBtree() +
126568
+ sqlite3HeaderSizePcache() +
126569
+ sqlite3HeaderSizePcache1();
126570
+ break;
125307126571
}
125308126572
125309126573
case SQLITE_CONFIG_PCACHE: {
125310126574
/* no-op */
125311126575
break;
@@ -125315,25 +126579,37 @@
125315126579
rc = SQLITE_ERROR;
125316126580
break;
125317126581
}
125318126582
125319126583
case SQLITE_CONFIG_PCACHE2: {
125320
- /* Specify an alternative page cache implementation */
126584
+ /* EVIDENCE-OF: R-63325-48378 The SQLITE_CONFIG_PCACHE2 option takes a
126585
+ ** single argument which is a pointer to an sqlite3_pcache_methods2
126586
+ ** object. This object specifies the interface to a custom page cache
126587
+ ** implementation. */
125321126588
sqlite3GlobalConfig.pcache2 = *va_arg(ap, sqlite3_pcache_methods2*);
125322126589
break;
125323126590
}
125324126591
case SQLITE_CONFIG_GETPCACHE2: {
126592
+ /* EVIDENCE-OF: R-22035-46182 The SQLITE_CONFIG_GETPCACHE2 option takes a
126593
+ ** single argument which is a pointer to an sqlite3_pcache_methods2
126594
+ ** object. SQLite copies of the current page cache implementation into
126595
+ ** that object. */
125325126596
if( sqlite3GlobalConfig.pcache2.xInit==0 ){
125326126597
sqlite3PCacheSetDefault();
125327126598
}
125328126599
*va_arg(ap, sqlite3_pcache_methods2*) = sqlite3GlobalConfig.pcache2;
125329126600
break;
125330126601
}
125331126602
126603
+/* EVIDENCE-OF: R-06626-12911 The SQLITE_CONFIG_HEAP option is only
126604
+** available if SQLite is compiled with either SQLITE_ENABLE_MEMSYS3 or
126605
+** SQLITE_ENABLE_MEMSYS5 and returns SQLITE_ERROR if invoked otherwise. */
125332126606
#if defined(SQLITE_ENABLE_MEMSYS3) || defined(SQLITE_ENABLE_MEMSYS5)
125333126607
case SQLITE_CONFIG_HEAP: {
125334
- /* Designate a buffer for heap memory space */
126608
+ /* EVIDENCE-OF: R-19854-42126 There are three arguments to
126609
+ ** SQLITE_CONFIG_HEAP: An 8-byte aligned pointer to the memory, the
126610
+ ** number of bytes in the memory buffer, and the minimum allocation size. */
125335126611
sqlite3GlobalConfig.pHeap = va_arg(ap, void*);
125336126612
sqlite3GlobalConfig.nHeap = va_arg(ap, int);
125337126613
sqlite3GlobalConfig.mnReq = va_arg(ap, int);
125338126614
125339126615
if( sqlite3GlobalConfig.mnReq<1 ){
@@ -125342,21 +126618,23 @@
125342126618
/* cap min request size at 2^12 */
125343126619
sqlite3GlobalConfig.mnReq = (1<<12);
125344126620
}
125345126621
125346126622
if( sqlite3GlobalConfig.pHeap==0 ){
125347
- /* If the heap pointer is NULL, then restore the malloc implementation
125348
- ** back to NULL pointers too. This will cause the malloc to go
125349
- ** back to its default implementation when sqlite3_initialize() is
125350
- ** run.
126623
+ /* EVIDENCE-OF: R-49920-60189 If the first pointer (the memory pointer)
126624
+ ** is NULL, then SQLite reverts to using its default memory allocator
126625
+ ** (the system malloc() implementation), undoing any prior invocation of
126626
+ ** SQLITE_CONFIG_MALLOC.
126627
+ **
126628
+ ** Setting sqlite3GlobalConfig.m to all zeros will cause malloc to
126629
+ ** revert to its default implementation when sqlite3_initialize() is run
125351126630
*/
125352126631
memset(&sqlite3GlobalConfig.m, 0, sizeof(sqlite3GlobalConfig.m));
125353126632
}else{
125354
- /* The heap pointer is not NULL, then install one of the
125355
- ** mem5.c/mem3.c methods. The enclosing #if guarantees at
125356
- ** least one of these methods is currently enabled.
125357
- */
126633
+ /* EVIDENCE-OF: R-61006-08918 If the memory pointer is not NULL then the
126634
+ ** alternative memory allocator is engaged to handle all of SQLites
126635
+ ** memory allocation needs. */
125358126636
#ifdef SQLITE_ENABLE_MEMSYS3
125359126637
sqlite3GlobalConfig.m = *sqlite3MemGetMemsys3();
125360126638
#endif
125361126639
#ifdef SQLITE_ENABLE_MEMSYS5
125362126640
sqlite3GlobalConfig.m = *sqlite3MemGetMemsys5();
@@ -125391,15 +126669,23 @@
125391126669
** can be changed at start-time using the
125392126670
** sqlite3_config(SQLITE_CONFIG_URI,1) or
125393126671
** sqlite3_config(SQLITE_CONFIG_URI,0) configuration calls.
125394126672
*/
125395126673
case SQLITE_CONFIG_URI: {
126674
+ /* EVIDENCE-OF: R-25451-61125 The SQLITE_CONFIG_URI option takes a single
126675
+ ** argument of type int. If non-zero, then URI handling is globally
126676
+ ** enabled. If the parameter is zero, then URI handling is globally
126677
+ ** disabled. */
125396126678
sqlite3GlobalConfig.bOpenUri = va_arg(ap, int);
125397126679
break;
125398126680
}
125399126681
125400126682
case SQLITE_CONFIG_COVERING_INDEX_SCAN: {
126683
+ /* EVIDENCE-OF: R-36592-02772 The SQLITE_CONFIG_COVERING_INDEX_SCAN
126684
+ ** option takes a single integer argument which is interpreted as a
126685
+ ** boolean in order to enable or disable the use of covering indices for
126686
+ ** full table scans in the query optimizer. */
125401126687
sqlite3GlobalConfig.bUseCis = va_arg(ap, int);
125402126688
break;
125403126689
}
125404126690
125405126691
#ifdef SQLITE_ENABLE_SQLLOG
@@ -125410,24 +126696,37 @@
125410126696
break;
125411126697
}
125412126698
#endif
125413126699
125414126700
case SQLITE_CONFIG_MMAP_SIZE: {
126701
+ /* EVIDENCE-OF: R-58063-38258 SQLITE_CONFIG_MMAP_SIZE takes two 64-bit
126702
+ ** integer (sqlite3_int64) values that are the default mmap size limit
126703
+ ** (the default setting for PRAGMA mmap_size) and the maximum allowed
126704
+ ** mmap size limit. */
125415126705
sqlite3_int64 szMmap = va_arg(ap, sqlite3_int64);
125416126706
sqlite3_int64 mxMmap = va_arg(ap, sqlite3_int64);
125417
- if( mxMmap<0 || mxMmap>SQLITE_MAX_MMAP_SIZE ){
125418
- mxMmap = SQLITE_MAX_MMAP_SIZE;
125419
- }
125420
- sqlite3GlobalConfig.mxMmap = mxMmap;
126707
+ /* EVIDENCE-OF: R-53367-43190 If either argument to this option is
126708
+ ** negative, then that argument is changed to its compile-time default.
126709
+ **
126710
+ ** EVIDENCE-OF: R-34993-45031 The maximum allowed mmap size will be
126711
+ ** silently truncated if necessary so that it does not exceed the
126712
+ ** compile-time maximum mmap size set by the SQLITE_MAX_MMAP_SIZE
126713
+ ** compile-time option.
126714
+ */
126715
+ if( mxMmap<0 || mxMmap>SQLITE_MAX_MMAP_SIZE ) mxMmap = SQLITE_MAX_MMAP_SIZE;
125421126716
if( szMmap<0 ) szMmap = SQLITE_DEFAULT_MMAP_SIZE;
125422126717
if( szMmap>mxMmap) szMmap = mxMmap;
126718
+ sqlite3GlobalConfig.mxMmap = mxMmap;
125423126719
sqlite3GlobalConfig.szMmap = szMmap;
125424126720
break;
125425126721
}
125426126722
125427
-#if SQLITE_OS_WIN && defined(SQLITE_WIN32_MALLOC)
126723
+#if SQLITE_OS_WIN && defined(SQLITE_WIN32_MALLOC) /* IMP: R-04780-55815 */
125428126724
case SQLITE_CONFIG_WIN32_HEAPSIZE: {
126725
+ /* EVIDENCE-OF: R-34926-03360 SQLITE_CONFIG_WIN32_HEAPSIZE takes a 32-bit
126726
+ ** unsigned integer value that specifies the maximum size of the created
126727
+ ** heap. */
125429126728
sqlite3GlobalConfig.nHeap = va_arg(ap, int);
125430126729
break;
125431126730
}
125432126731
#endif
125433126732
@@ -125507,19 +126806,29 @@
125507126806
125508126807
/*
125509126808
** Return the mutex associated with a database connection.
125510126809
*/
125511126810
SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3 *db){
126811
+#ifdef SQLITE_ENABLE_API_ARMOR
126812
+ if( !sqlite3SafetyCheckOk(db) ){
126813
+ (void)SQLITE_MISUSE_BKPT;
126814
+ return 0;
126815
+ }
126816
+#endif
125512126817
return db->mutex;
125513126818
}
125514126819
125515126820
/*
125516126821
** Free up as much memory as we can from the given database
125517126822
** connection.
125518126823
*/
125519126824
SQLITE_API int sqlite3_db_release_memory(sqlite3 *db){
125520126825
int i;
126826
+
126827
+#ifdef SQLITE_ENABLE_API_ARMOR
126828
+ if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
126829
+#endif
125521126830
sqlite3_mutex_enter(db->mutex);
125522126831
sqlite3BtreeEnterAll(db);
125523126832
for(i=0; i<db->nDb; i++){
125524126833
Btree *pBt = db->aDb[i].pBt;
125525126834
if( pBt ){
@@ -125605,17 +126914,24 @@
125605126914
int nKey1, const void *pKey1,
125606126915
int nKey2, const void *pKey2
125607126916
){
125608126917
int rc, n;
125609126918
n = nKey1<nKey2 ? nKey1 : nKey2;
126919
+ /* EVIDENCE-OF: R-65033-28449 The built-in BINARY collation compares
126920
+ ** strings byte by byte using the memcmp() function from the standard C
126921
+ ** library. */
125610126922
rc = memcmp(pKey1, pKey2, n);
125611126923
if( rc==0 ){
125612126924
if( padFlag
125613126925
&& allSpaces(((char*)pKey1)+n, nKey1-n)
125614126926
&& allSpaces(((char*)pKey2)+n, nKey2-n)
125615126927
){
125616
- /* Leave rc unchanged at 0 */
126928
+ /* EVIDENCE-OF: R-31624-24737 RTRIM is like BINARY except that extra
126929
+ ** spaces at the end of either string do not change the result. In other
126930
+ ** words, strings will compare equal to one another as long as they
126931
+ ** differ only in the number of spaces at the end.
126932
+ */
125617126933
}else{
125618126934
rc = nKey1 - nKey2;
125619126935
}
125620126936
}
125621126937
return rc;
@@ -125646,24 +126962,42 @@
125646126962
125647126963
/*
125648126964
** Return the ROWID of the most recent insert
125649126965
*/
125650126966
SQLITE_API sqlite_int64 sqlite3_last_insert_rowid(sqlite3 *db){
126967
+#ifdef SQLITE_ENABLE_API_ARMOR
126968
+ if( !sqlite3SafetyCheckOk(db) ){
126969
+ (void)SQLITE_MISUSE_BKPT;
126970
+ return 0;
126971
+ }
126972
+#endif
125651126973
return db->lastRowid;
125652126974
}
125653126975
125654126976
/*
125655126977
** Return the number of changes in the most recent call to sqlite3_exec().
125656126978
*/
125657126979
SQLITE_API int sqlite3_changes(sqlite3 *db){
126980
+#ifdef SQLITE_ENABLE_API_ARMOR
126981
+ if( !sqlite3SafetyCheckOk(db) ){
126982
+ (void)SQLITE_MISUSE_BKPT;
126983
+ return 0;
126984
+ }
126985
+#endif
125658126986
return db->nChange;
125659126987
}
125660126988
125661126989
/*
125662126990
** Return the number of changes since the database handle was opened.
125663126991
*/
125664126992
SQLITE_API int sqlite3_total_changes(sqlite3 *db){
126993
+#ifdef SQLITE_ENABLE_API_ARMOR
126994
+ if( !sqlite3SafetyCheckOk(db) ){
126995
+ (void)SQLITE_MISUSE_BKPT;
126996
+ return 0;
126997
+ }
126998
+#endif
125665126999
return db->nTotalChange;
125666127000
}
125667127001
125668127002
/*
125669127003
** Close all open savepoints. This function only manipulates fields of the
@@ -125839,10 +127173,18 @@
125839127173
125840127174
/* Close all database connections */
125841127175
for(j=0; j<db->nDb; j++){
125842127176
struct Db *pDb = &db->aDb[j];
125843127177
if( pDb->pBt ){
127178
+ if( pDb->pSchema ){
127179
+ /* Must clear the KeyInfo cache. See ticket [e4a18565a36884b00edf] */
127180
+ for(i=sqliteHashFirst(&pDb->pSchema->idxHash); i; i=sqliteHashNext(i)){
127181
+ Index *pIdx = sqliteHashData(i);
127182
+ sqlite3KeyInfoUnref(pIdx->pKeyInfo);
127183
+ pIdx->pKeyInfo = 0;
127184
+ }
127185
+ }
125844127186
sqlite3BtreeClose(pDb->pBt);
125845127187
pDb->pBt = 0;
125846127188
if( j!=1 ){
125847127189
pDb->pSchema = 0;
125848127190
}
@@ -125925,17 +127267,19 @@
125925127267
sqlite3_free(db);
125926127268
}
125927127269
125928127270
/*
125929127271
** Rollback all database files. If tripCode is not SQLITE_OK, then
125930
-** any open cursors are invalidated ("tripped" - as in "tripping a circuit
127272
+** any write cursors are invalidated ("tripped" - as in "tripping a circuit
125931127273
** breaker") and made to return tripCode if there are any further
125932
-** attempts to use that cursor.
127274
+** attempts to use that cursor. Read cursors remain open and valid
127275
+** but are "saved" in case the table pages are moved around.
125933127276
*/
125934127277
SQLITE_PRIVATE void sqlite3RollbackAll(sqlite3 *db, int tripCode){
125935127278
int i;
125936127279
int inTrans = 0;
127280
+ int schemaChange;
125937127281
assert( sqlite3_mutex_held(db->mutex) );
125938127282
sqlite3BeginBenignMalloc();
125939127283
125940127284
/* Obtain all b-tree mutexes before making any calls to BtreeRollback().
125941127285
** This is important in case the transaction being rolled back has
@@ -125942,18 +127286,19 @@
125942127286
** modified the database schema. If the b-tree mutexes are not taken
125943127287
** here, then another shared-cache connection might sneak in between
125944127288
** the database rollback and schema reset, which can cause false
125945127289
** corruption reports in some cases. */
125946127290
sqlite3BtreeEnterAll(db);
127291
+ schemaChange = (db->flags & SQLITE_InternChanges)!=0 && db->init.busy==0;
125947127292
125948127293
for(i=0; i<db->nDb; i++){
125949127294
Btree *p = db->aDb[i].pBt;
125950127295
if( p ){
125951127296
if( sqlite3BtreeIsInTrans(p) ){
125952127297
inTrans = 1;
125953127298
}
125954
- sqlite3BtreeRollback(p, tripCode);
127299
+ sqlite3BtreeRollback(p, tripCode, !schemaChange);
125955127300
}
125956127301
}
125957127302
sqlite3VtabRollback(db);
125958127303
sqlite3EndBenignMalloc();
125959127304
@@ -126205,10 +127550,13 @@
126205127550
SQLITE_API int sqlite3_busy_handler(
126206127551
sqlite3 *db,
126207127552
int (*xBusy)(void*,int),
126208127553
void *pArg
126209127554
){
127555
+#ifdef SQLITE_ENABLE_API_ARMOR
127556
+ if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE;
127557
+#endif
126210127558
sqlite3_mutex_enter(db->mutex);
126211127559
db->busyHandler.xFunc = xBusy;
126212127560
db->busyHandler.pArg = pArg;
126213127561
db->busyHandler.nBusy = 0;
126214127562
db->busyTimeout = 0;
@@ -126226,10 +127574,16 @@
126226127574
sqlite3 *db,
126227127575
int nOps,
126228127576
int (*xProgress)(void*),
126229127577
void *pArg
126230127578
){
127579
+#ifdef SQLITE_ENABLE_API_ARMOR
127580
+ if( !sqlite3SafetyCheckOk(db) ){
127581
+ (void)SQLITE_MISUSE_BKPT;
127582
+ return;
127583
+ }
127584
+#endif
126231127585
sqlite3_mutex_enter(db->mutex);
126232127586
if( nOps>0 ){
126233127587
db->xProgress = xProgress;
126234127588
db->nProgressOps = (unsigned)nOps;
126235127589
db->pProgressArg = pArg;
@@ -126246,10 +127600,13 @@
126246127600
/*
126247127601
** This routine installs a default busy handler that waits for the
126248127602
** specified number of milliseconds before returning 0.
126249127603
*/
126250127604
SQLITE_API int sqlite3_busy_timeout(sqlite3 *db, int ms){
127605
+#ifdef SQLITE_ENABLE_API_ARMOR
127606
+ if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
127607
+#endif
126251127608
if( ms>0 ){
126252127609
sqlite3_busy_handler(db, sqliteDefaultBusyCallback, (void*)db);
126253127610
db->busyTimeout = ms;
126254127611
}else{
126255127612
sqlite3_busy_handler(db, 0, 0);
@@ -126259,10 +127616,16 @@
126259127616
126260127617
/*
126261127618
** Cause any pending operation to stop at its earliest opportunity.
126262127619
*/
126263127620
SQLITE_API void sqlite3_interrupt(sqlite3 *db){
127621
+#ifdef SQLITE_ENABLE_API_ARMOR
127622
+ if( !sqlite3SafetyCheckOk(db) ){
127623
+ (void)SQLITE_MISUSE_BKPT;
127624
+ return;
127625
+ }
127626
+#endif
126264127627
db->u1.isInterrupted = 1;
126265127628
}
126266127629
126267127630
126268127631
/*
@@ -126396,10 +127759,16 @@
126396127759
void (*xFinal)(sqlite3_context*),
126397127760
void (*xDestroy)(void *)
126398127761
){
126399127762
int rc = SQLITE_ERROR;
126400127763
FuncDestructor *pArg = 0;
127764
+
127765
+#ifdef SQLITE_ENABLE_API_ARMOR
127766
+ if( !sqlite3SafetyCheckOk(db) ){
127767
+ return SQLITE_MISUSE_BKPT;
127768
+ }
127769
+#endif
126401127770
sqlite3_mutex_enter(db->mutex);
126402127771
if( xDestroy ){
126403127772
pArg = (FuncDestructor *)sqlite3DbMallocZero(db, sizeof(FuncDestructor));
126404127773
if( !pArg ){
126405127774
xDestroy(p);
@@ -126432,10 +127801,14 @@
126432127801
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
126433127802
void (*xFinal)(sqlite3_context*)
126434127803
){
126435127804
int rc;
126436127805
char *zFunc8;
127806
+
127807
+#ifdef SQLITE_ENABLE_API_ARMOR
127808
+ if( !sqlite3SafetyCheckOk(db) || zFunctionName==0 ) return SQLITE_MISUSE_BKPT;
127809
+#endif
126437127810
sqlite3_mutex_enter(db->mutex);
126438127811
assert( !db->mallocFailed );
126439127812
zFunc8 = sqlite3Utf16to8(db, zFunctionName, -1, SQLITE_UTF16NATIVE);
126440127813
rc = sqlite3CreateFunc(db, zFunc8, nArg, eTextRep, p, xFunc, xStep, xFinal,0);
126441127814
sqlite3DbFree(db, zFunc8);
@@ -126463,10 +127836,16 @@
126463127836
const char *zName,
126464127837
int nArg
126465127838
){
126466127839
int nName = sqlite3Strlen30(zName);
126467127840
int rc = SQLITE_OK;
127841
+
127842
+#ifdef SQLITE_ENABLE_API_ARMOR
127843
+ if( !sqlite3SafetyCheckOk(db) || zName==0 || nArg<-2 ){
127844
+ return SQLITE_MISUSE_BKPT;
127845
+ }
127846
+#endif
126468127847
sqlite3_mutex_enter(db->mutex);
126469127848
if( sqlite3FindFunction(db, zName, nName, nArg, SQLITE_UTF8, 0)==0 ){
126470127849
rc = sqlite3CreateFunc(db, zName, nArg, SQLITE_UTF8,
126471127850
0, sqlite3InvalidFunction, 0, 0, 0);
126472127851
}
@@ -126484,10 +127863,17 @@
126484127863
** trace is a pointer to a function that is invoked at the start of each
126485127864
** SQL statement.
126486127865
*/
126487127866
SQLITE_API void *sqlite3_trace(sqlite3 *db, void (*xTrace)(void*,const char*), void *pArg){
126488127867
void *pOld;
127868
+
127869
+#ifdef SQLITE_ENABLE_API_ARMOR
127870
+ if( !sqlite3SafetyCheckOk(db) ){
127871
+ (void)SQLITE_MISUSE_BKPT;
127872
+ return 0;
127873
+ }
127874
+#endif
126489127875
sqlite3_mutex_enter(db->mutex);
126490127876
pOld = db->pTraceArg;
126491127877
db->xTrace = xTrace;
126492127878
db->pTraceArg = pArg;
126493127879
sqlite3_mutex_leave(db->mutex);
@@ -126505,10 +127891,17 @@
126505127891
sqlite3 *db,
126506127892
void (*xProfile)(void*,const char*,sqlite_uint64),
126507127893
void *pArg
126508127894
){
126509127895
void *pOld;
127896
+
127897
+#ifdef SQLITE_ENABLE_API_ARMOR
127898
+ if( !sqlite3SafetyCheckOk(db) ){
127899
+ (void)SQLITE_MISUSE_BKPT;
127900
+ return 0;
127901
+ }
127902
+#endif
126510127903
sqlite3_mutex_enter(db->mutex);
126511127904
pOld = db->pProfileArg;
126512127905
db->xProfile = xProfile;
126513127906
db->pProfileArg = pArg;
126514127907
sqlite3_mutex_leave(db->mutex);
@@ -126525,10 +127918,17 @@
126525127918
sqlite3 *db, /* Attach the hook to this database */
126526127919
int (*xCallback)(void*), /* Function to invoke on each commit */
126527127920
void *pArg /* Argument to the function */
126528127921
){
126529127922
void *pOld;
127923
+
127924
+#ifdef SQLITE_ENABLE_API_ARMOR
127925
+ if( !sqlite3SafetyCheckOk(db) ){
127926
+ (void)SQLITE_MISUSE_BKPT;
127927
+ return 0;
127928
+ }
127929
+#endif
126530127930
sqlite3_mutex_enter(db->mutex);
126531127931
pOld = db->pCommitArg;
126532127932
db->xCommitCallback = xCallback;
126533127933
db->pCommitArg = pArg;
126534127934
sqlite3_mutex_leave(db->mutex);
@@ -126543,10 +127943,17 @@
126543127943
sqlite3 *db, /* Attach the hook to this database */
126544127944
void (*xCallback)(void*,int,char const *,char const *,sqlite_int64),
126545127945
void *pArg /* Argument to the function */
126546127946
){
126547127947
void *pRet;
127948
+
127949
+#ifdef SQLITE_ENABLE_API_ARMOR
127950
+ if( !sqlite3SafetyCheckOk(db) ){
127951
+ (void)SQLITE_MISUSE_BKPT;
127952
+ return 0;
127953
+ }
127954
+#endif
126548127955
sqlite3_mutex_enter(db->mutex);
126549127956
pRet = db->pUpdateArg;
126550127957
db->xUpdateCallback = xCallback;
126551127958
db->pUpdateArg = pArg;
126552127959
sqlite3_mutex_leave(db->mutex);
@@ -126561,10 +127968,17 @@
126561127968
sqlite3 *db, /* Attach the hook to this database */
126562127969
void (*xCallback)(void*), /* Callback function */
126563127970
void *pArg /* Argument to the function */
126564127971
){
126565127972
void *pRet;
127973
+
127974
+#ifdef SQLITE_ENABLE_API_ARMOR
127975
+ if( !sqlite3SafetyCheckOk(db) ){
127976
+ (void)SQLITE_MISUSE_BKPT;
127977
+ return 0;
127978
+ }
127979
+#endif
126566127980
sqlite3_mutex_enter(db->mutex);
126567127981
pRet = db->pRollbackArg;
126568127982
db->xRollbackCallback = xCallback;
126569127983
db->pRollbackArg = pArg;
126570127984
sqlite3_mutex_leave(db->mutex);
@@ -126607,10 +128021,13 @@
126607128021
SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int nFrame){
126608128022
#ifdef SQLITE_OMIT_WAL
126609128023
UNUSED_PARAMETER(db);
126610128024
UNUSED_PARAMETER(nFrame);
126611128025
#else
128026
+#ifdef SQLITE_ENABLE_API_ARMOR
128027
+ if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
128028
+#endif
126612128029
if( nFrame>0 ){
126613128030
sqlite3_wal_hook(db, sqlite3WalDefaultHook, SQLITE_INT_TO_PTR(nFrame));
126614128031
}else{
126615128032
sqlite3_wal_hook(db, 0, 0);
126616128033
}
@@ -126627,10 +128044,16 @@
126627128044
int(*xCallback)(void *, sqlite3*, const char*, int),
126628128045
void *pArg /* First argument passed to xCallback() */
126629128046
){
126630128047
#ifndef SQLITE_OMIT_WAL
126631128048
void *pRet;
128049
+#ifdef SQLITE_ENABLE_API_ARMOR
128050
+ if( !sqlite3SafetyCheckOk(db) ){
128051
+ (void)SQLITE_MISUSE_BKPT;
128052
+ return 0;
128053
+ }
128054
+#endif
126632128055
sqlite3_mutex_enter(db->mutex);
126633128056
pRet = db->pWalArg;
126634128057
db->xWalCallback = xCallback;
126635128058
db->pWalArg = pArg;
126636128059
sqlite3_mutex_leave(db->mutex);
@@ -126653,19 +128076,26 @@
126653128076
#ifdef SQLITE_OMIT_WAL
126654128077
return SQLITE_OK;
126655128078
#else
126656128079
int rc; /* Return code */
126657128080
int iDb = SQLITE_MAX_ATTACHED; /* sqlite3.aDb[] index of db to checkpoint */
128081
+
128082
+#ifdef SQLITE_ENABLE_API_ARMOR
128083
+ if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
128084
+#endif
126658128085
126659128086
/* Initialize the output variables to -1 in case an error occurs. */
126660128087
if( pnLog ) *pnLog = -1;
126661128088
if( pnCkpt ) *pnCkpt = -1;
126662128089
126663
- assert( SQLITE_CHECKPOINT_FULL>SQLITE_CHECKPOINT_PASSIVE );
126664
- assert( SQLITE_CHECKPOINT_FULL<SQLITE_CHECKPOINT_RESTART );
126665
- assert( SQLITE_CHECKPOINT_PASSIVE+2==SQLITE_CHECKPOINT_RESTART );
126666
- if( eMode<SQLITE_CHECKPOINT_PASSIVE || eMode>SQLITE_CHECKPOINT_RESTART ){
128090
+ assert( SQLITE_CHECKPOINT_PASSIVE==0 );
128091
+ assert( SQLITE_CHECKPOINT_FULL==1 );
128092
+ assert( SQLITE_CHECKPOINT_RESTART==2 );
128093
+ assert( SQLITE_CHECKPOINT_TRUNCATE==3 );
128094
+ if( eMode<SQLITE_CHECKPOINT_PASSIVE || eMode>SQLITE_CHECKPOINT_TRUNCATE ){
128095
+ /* EVIDENCE-OF: R-03996-12088 The M parameter must be a valid checkpoint
128096
+ ** mode: */
126667128097
return SQLITE_MISUSE;
126668128098
}
126669128099
126670128100
sqlite3_mutex_enter(db->mutex);
126671128101
if( zDb && zDb[0] ){
@@ -126689,11 +128119,13 @@
126689128119
** Checkpoint database zDb. If zDb is NULL, or if the buffer zDb points
126690128120
** to contains a zero-length string, all attached databases are
126691128121
** checkpointed.
126692128122
*/
126693128123
SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb){
126694
- return sqlite3_wal_checkpoint_v2(db, zDb, SQLITE_CHECKPOINT_PASSIVE, 0, 0);
128124
+ /* EVIDENCE-OF: R-41613-20553 The sqlite3_wal_checkpoint(D,X) is equivalent to
128125
+ ** sqlite3_wal_checkpoint_v2(D,X,SQLITE_CHECKPOINT_PASSIVE,0,0). */
128126
+ return sqlite3_wal_checkpoint_v2(db,zDb,SQLITE_CHECKPOINT_PASSIVE,0,0);
126695128127
}
126696128128
126697128129
#ifndef SQLITE_OMIT_WAL
126698128130
/*
126699128131
** Run a checkpoint on database iDb. This is a no-op if database iDb is
@@ -127050,10 +128482,16 @@
127050128482
** from forming.
127051128483
*/
127052128484
SQLITE_API int sqlite3_limit(sqlite3 *db, int limitId, int newLimit){
127053128485
int oldLimit;
127054128486
128487
+#ifdef SQLITE_ENABLE_API_ARMOR
128488
+ if( !sqlite3SafetyCheckOk(db) ){
128489
+ (void)SQLITE_MISUSE_BKPT;
128490
+ return -1;
128491
+ }
128492
+#endif
127055128493
127056128494
/* EVIDENCE-OF: R-30189-54097 For each limit category SQLITE_LIMIT_NAME
127057128495
** there is a hard upper bound set at compile-time by a C preprocessor
127058128496
** macro called SQLITE_MAX_NAME. (The "_LIMIT_" in the name is changed to
127059128497
** "_MAX_".)
@@ -127126,11 +128564,12 @@
127126128564
char c;
127127128565
int nUri = sqlite3Strlen30(zUri);
127128128566
127129128567
assert( *pzErrMsg==0 );
127130128568
127131
- if( ((flags & SQLITE_OPEN_URI) || sqlite3GlobalConfig.bOpenUri)
128569
+ if( ((flags & SQLITE_OPEN_URI) /* IMP: R-48725-32206 */
128570
+ || sqlite3GlobalConfig.bOpenUri) /* IMP: R-51689-46548 */
127132128571
&& nUri>=5 && memcmp(zUri, "file:", 5)==0 /* IMP: R-57884-37496 */
127133128572
){
127134128573
char *zOpt;
127135128574
int eState; /* Parser state when parsing URI */
127136128575
int iIn; /* Input character index */
@@ -127335,10 +128774,13 @@
127335128774
int rc; /* Return code */
127336128775
int isThreadsafe; /* True for threadsafe connections */
127337128776
char *zOpen = 0; /* Filename argument to pass to BtreeOpen() */
127338128777
char *zErrMsg = 0; /* Error message from sqlite3ParseUri() */
127339128778
128779
+#ifdef SQLITE_ENABLE_API_ARMOR
128780
+ if( ppDb==0 ) return SQLITE_MISUSE_BKPT;
128781
+#endif
127340128782
*ppDb = 0;
127341128783
#ifndef SQLITE_OMIT_AUTOINIT
127342128784
rc = sqlite3_initialize();
127343128785
if( rc ) return rc;
127344128786
#endif
@@ -127449,24 +128891,28 @@
127449128891
#endif
127450128892
127451128893
/* Add the default collation sequence BINARY. BINARY works for both UTF-8
127452128894
** and UTF-16, so add a version for each to avoid any unnecessary
127453128895
** conversions. The only error that can occur here is a malloc() failure.
128896
+ **
128897
+ ** EVIDENCE-OF: R-52786-44878 SQLite defines three built-in collating
128898
+ ** functions:
127454128899
*/
127455128900
createCollation(db, "BINARY", SQLITE_UTF8, 0, binCollFunc, 0);
127456128901
createCollation(db, "BINARY", SQLITE_UTF16BE, 0, binCollFunc, 0);
127457128902
createCollation(db, "BINARY", SQLITE_UTF16LE, 0, binCollFunc, 0);
128903
+ createCollation(db, "NOCASE", SQLITE_UTF8, 0, nocaseCollatingFunc, 0);
127458128904
createCollation(db, "RTRIM", SQLITE_UTF8, (void*)1, binCollFunc, 0);
127459128905
if( db->mallocFailed ){
127460128906
goto opendb_out;
127461128907
}
128908
+ /* EVIDENCE-OF: R-08308-17224 The default collating function for all
128909
+ ** strings is BINARY.
128910
+ */
127462128911
db->pDfltColl = sqlite3FindCollSeq(db, SQLITE_UTF8, "BINARY", 0);
127463128912
assert( db->pDfltColl!=0 );
127464128913
127465
- /* Also add a UTF-8 case-insensitive collation sequence. */
127466
- createCollation(db, "NOCASE", SQLITE_UTF8, 0, nocaseCollatingFunc, 0);
127467
-
127468128914
/* Parse the filename/URI argument. */
127469128915
db->openFlags = flags;
127470128916
rc = sqlite3ParseUri(zVfs, zFilename, &flags, &db->pVfs, &zOpen, &zErrMsg);
127471128917
if( rc!=SQLITE_OK ){
127472128918
if( rc==SQLITE_NOMEM ) db->mallocFailed = 1;
@@ -127624,17 +129070,19 @@
127624129070
){
127625129071
char const *zFilename8; /* zFilename encoded in UTF-8 instead of UTF-16 */
127626129072
sqlite3_value *pVal;
127627129073
int rc;
127628129074
127629
- assert( zFilename );
127630
- assert( ppDb );
129075
+#ifdef SQLITE_ENABLE_API_ARMOR
129076
+ if( ppDb==0 ) return SQLITE_MISUSE_BKPT;
129077
+#endif
127631129078
*ppDb = 0;
127632129079
#ifndef SQLITE_OMIT_AUTOINIT
127633129080
rc = sqlite3_initialize();
127634129081
if( rc ) return rc;
127635129082
#endif
129083
+ if( zFilename==0 ) zFilename = "\000\000";
127636129084
pVal = sqlite3ValueNew(0);
127637129085
sqlite3ValueSetStr(pVal, -1, zFilename, SQLITE_UTF16NATIVE, SQLITE_STATIC);
127638129086
zFilename8 = sqlite3ValueText(pVal, SQLITE_UTF8);
127639129087
if( zFilename8 ){
127640129088
rc = openDatabase(zFilename8, ppDb,
@@ -127660,17 +129108,11 @@
127660129108
const char *zName,
127661129109
int enc,
127662129110
void* pCtx,
127663129111
int(*xCompare)(void*,int,const void*,int,const void*)
127664129112
){
127665
- int rc;
127666
- sqlite3_mutex_enter(db->mutex);
127667
- assert( !db->mallocFailed );
127668
- rc = createCollation(db, zName, (u8)enc, pCtx, xCompare, 0);
127669
- rc = sqlite3ApiExit(db, rc);
127670
- sqlite3_mutex_leave(db->mutex);
127671
- return rc;
129113
+ return sqlite3_create_collation_v2(db, zName, enc, pCtx, xCompare, 0);
127672129114
}
127673129115
127674129116
/*
127675129117
** Register a new collation sequence with the database handle db.
127676129118
*/
@@ -127681,10 +129123,14 @@
127681129123
void* pCtx,
127682129124
int(*xCompare)(void*,int,const void*,int,const void*),
127683129125
void(*xDel)(void*)
127684129126
){
127685129127
int rc;
129128
+
129129
+#ifdef SQLITE_ENABLE_API_ARMOR
129130
+ if( !sqlite3SafetyCheckOk(db) || zName==0 ) return SQLITE_MISUSE_BKPT;
129131
+#endif
127686129132
sqlite3_mutex_enter(db->mutex);
127687129133
assert( !db->mallocFailed );
127688129134
rc = createCollation(db, zName, (u8)enc, pCtx, xCompare, xDel);
127689129135
rc = sqlite3ApiExit(db, rc);
127690129136
sqlite3_mutex_leave(db->mutex);
@@ -127702,10 +129148,14 @@
127702129148
void* pCtx,
127703129149
int(*xCompare)(void*,int,const void*,int,const void*)
127704129150
){
127705129151
int rc = SQLITE_OK;
127706129152
char *zName8;
129153
+
129154
+#ifdef SQLITE_ENABLE_API_ARMOR
129155
+ if( !sqlite3SafetyCheckOk(db) || zName==0 ) return SQLITE_MISUSE_BKPT;
129156
+#endif
127707129157
sqlite3_mutex_enter(db->mutex);
127708129158
assert( !db->mallocFailed );
127709129159
zName8 = sqlite3Utf16to8(db, zName, -1, SQLITE_UTF16NATIVE);
127710129160
if( zName8 ){
127711129161
rc = createCollation(db, zName8, (u8)enc, pCtx, xCompare, 0);
@@ -127724,10 +129174,13 @@
127724129174
SQLITE_API int sqlite3_collation_needed(
127725129175
sqlite3 *db,
127726129176
void *pCollNeededArg,
127727129177
void(*xCollNeeded)(void*,sqlite3*,int eTextRep,const char*)
127728129178
){
129179
+#ifdef SQLITE_ENABLE_API_ARMOR
129180
+ if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
129181
+#endif
127729129182
sqlite3_mutex_enter(db->mutex);
127730129183
db->xCollNeeded = xCollNeeded;
127731129184
db->xCollNeeded16 = 0;
127732129185
db->pCollNeededArg = pCollNeededArg;
127733129186
sqlite3_mutex_leave(db->mutex);
@@ -127742,10 +129195,13 @@
127742129195
SQLITE_API int sqlite3_collation_needed16(
127743129196
sqlite3 *db,
127744129197
void *pCollNeededArg,
127745129198
void(*xCollNeeded16)(void*,sqlite3*,int eTextRep,const void*)
127746129199
){
129200
+#ifdef SQLITE_ENABLE_API_ARMOR
129201
+ if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
129202
+#endif
127747129203
sqlite3_mutex_enter(db->mutex);
127748129204
db->xCollNeeded = 0;
127749129205
db->xCollNeeded16 = xCollNeeded16;
127750129206
db->pCollNeededArg = pCollNeededArg;
127751129207
sqlite3_mutex_leave(db->mutex);
@@ -127768,10 +129224,16 @@
127768129224
** mode. Return TRUE if it is and FALSE if not. Autocommit mode is on
127769129225
** by default. Autocommit is disabled by a BEGIN statement and reenabled
127770129226
** by the next COMMIT or ROLLBACK.
127771129227
*/
127772129228
SQLITE_API int sqlite3_get_autocommit(sqlite3 *db){
129229
+#ifdef SQLITE_ENABLE_API_ARMOR
129230
+ if( !sqlite3SafetyCheckOk(db) ){
129231
+ (void)SQLITE_MISUSE_BKPT;
129232
+ return 0;
129233
+ }
129234
+#endif
127773129235
return db->autoCommit;
127774129236
}
127775129237
127776129238
/*
127777129239
** The following routines are substitutes for constants SQLITE_CORRUPT,
@@ -127950,10 +129412,13 @@
127950129412
127951129413
/*
127952129414
** Enable or disable the extended result codes.
127953129415
*/
127954129416
SQLITE_API int sqlite3_extended_result_codes(sqlite3 *db, int onoff){
129417
+#ifdef SQLITE_ENABLE_API_ARMOR
129418
+ if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
129419
+#endif
127955129420
sqlite3_mutex_enter(db->mutex);
127956129421
db->errMask = onoff ? 0xffffffff : 0xff;
127957129422
sqlite3_mutex_leave(db->mutex);
127958129423
return SQLITE_OK;
127959129424
}
@@ -127963,10 +129428,13 @@
127963129428
*/
127964129429
SQLITE_API int sqlite3_file_control(sqlite3 *db, const char *zDbName, int op, void *pArg){
127965129430
int rc = SQLITE_ERROR;
127966129431
Btree *pBtree;
127967129432
129433
+#ifdef SQLITE_ENABLE_API_ARMOR
129434
+ if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
129435
+#endif
127968129436
sqlite3_mutex_enter(db->mutex);
127969129437
pBtree = sqlite3DbNameToBtree(db, zDbName);
127970129438
if( pBtree ){
127971129439
Pager *pPager;
127972129440
sqlite3_file *fd;
@@ -128305,11 +129773,11 @@
128305129773
** query parameter we seek. This routine returns the value of the zParam
128306129774
** parameter if it exists. If the parameter does not exist, this routine
128307129775
** returns a NULL pointer.
128308129776
*/
128309129777
SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam){
128310
- if( zFilename==0 ) return 0;
129778
+ if( zFilename==0 || zParam==0 ) return 0;
128311129779
zFilename += sqlite3Strlen30(zFilename) + 1;
128312129780
while( zFilename[0] ){
128313129781
int x = strcmp(zFilename, zParam);
128314129782
zFilename += sqlite3Strlen30(zFilename) + 1;
128315129783
if( x==0 ) return zFilename;
@@ -128361,19 +129829,31 @@
128361129829
/*
128362129830
** Return the filename of the database associated with a database
128363129831
** connection.
128364129832
*/
128365129833
SQLITE_API const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName){
129834
+#ifdef SQLITE_ENABLE_API_ARMOR
129835
+ if( !sqlite3SafetyCheckOk(db) ){
129836
+ (void)SQLITE_MISUSE_BKPT;
129837
+ return 0;
129838
+ }
129839
+#endif
128366129840
Btree *pBt = sqlite3DbNameToBtree(db, zDbName);
128367129841
return pBt ? sqlite3BtreeGetFilename(pBt) : 0;
128368129842
}
128369129843
128370129844
/*
128371129845
** Return 1 if database is read-only or 0 if read/write. Return -1 if
128372129846
** no such database exists.
128373129847
*/
128374129848
SQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName){
129849
+#ifdef SQLITE_ENABLE_API_ARMOR
129850
+ if( !sqlite3SafetyCheckOk(db) ){
129851
+ (void)SQLITE_MISUSE_BKPT;
129852
+ return -1;
129853
+ }
129854
+#endif
128375129855
Btree *pBt = sqlite3DbNameToBtree(db, zDbName);
128376129856
return pBt ? sqlite3BtreeIsReadonly(pBt) : -1;
128377129857
}
128378129858
128379129859
/************** End of main.c ************************************************/
@@ -137791,11 +139271,11 @@
137791139271
** Return true if the m-value for z is 1 or more. In other words,
137792139272
** return true if z contains at least one vowel that is followed
137793139273
** by a consonant.
137794139274
**
137795139275
** In this routine z[] is in reverse order. So we are really looking
137796
-** for an instance of of a consonant followed by a vowel.
139276
+** for an instance of a consonant followed by a vowel.
137797139277
*/
137798139278
static int m_gt_0(const char *z){
137799139279
while( isVowel(z) ){ z++; }
137800139280
if( *z==0 ) return 0;
137801139281
while( isConsonant(z) ){ z++; }
137802139282
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1,8 +1,8 @@
1 /******************************************************************************
2 ** This file is an amalgamation of many separate C source files from SQLite
3 ** version 3.8.7.1. By combining all the individual C code files into this
4 ** single large file, the entire code can be compiled as a single translation
5 ** unit. This allows many compilers to do optimizations that would not be
6 ** possible if the files were compiled separately. Performance improvements
7 ** of 5% or more are commonly seen when SQLite is compiled as a single
8 ** translation unit.
@@ -179,11 +179,11 @@
179
180
181 /*
182 ** These no-op macros are used in front of interfaces to mark those
183 ** interfaces as either deprecated or experimental. New applications
184 ** should not use deprecated interfaces - they are support for backwards
185 ** compatibility only. Application writers should be aware that
186 ** experimental interfaces are subject to change in point releases.
187 **
188 ** These macros used to resolve to various kinds of compiler magic that
189 ** would generate warning messages when they were used. But that
@@ -229,13 +229,13 @@
229 **
230 ** See also: [sqlite3_libversion()],
231 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
232 ** [sqlite_version()] and [sqlite_source_id()].
233 */
234 #define SQLITE_VERSION "3.8.7.1"
235 #define SQLITE_VERSION_NUMBER 3008007
236 #define SQLITE_SOURCE_ID "2014-10-29 01:27:43 83afe23e553e802c0947c80d0ffdd120423e7c52"
237
238 /*
239 ** CAPI3REF: Run-Time Library Version Numbers
240 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
241 **
@@ -1343,11 +1343,11 @@
1343 ** <li> SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED
1344 ** <li> SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE
1345 ** </ul>
1346 **
1347 ** When unlocking, the same SHARED or EXCLUSIVE flag must be supplied as
1348 ** was given no the corresponding lock.
1349 **
1350 ** The xShmLock method can transition between unlocked and SHARED or
1351 ** between unlocked and EXCLUSIVE. It cannot transition between SHARED
1352 ** and EXCLUSIVE.
1353 */
@@ -1626,30 +1626,32 @@
1626 ** it is not possible to set the Serialized [threading mode] and
1627 ** [sqlite3_config()] will return [SQLITE_ERROR] if called with the
1628 ** SQLITE_CONFIG_SERIALIZED configuration option.</dd>
1629 **
1630 ** [[SQLITE_CONFIG_MALLOC]] <dt>SQLITE_CONFIG_MALLOC</dt>
1631 ** <dd> ^(This option takes a single argument which is a pointer to an
1632 ** instance of the [sqlite3_mem_methods] structure. The argument specifies
 
1633 ** alternative low-level memory allocation routines to be used in place of
1634 ** the memory allocation routines built into SQLite.)^ ^SQLite makes
1635 ** its own private copy of the content of the [sqlite3_mem_methods] structure
1636 ** before the [sqlite3_config()] call returns.</dd>
1637 **
1638 ** [[SQLITE_CONFIG_GETMALLOC]] <dt>SQLITE_CONFIG_GETMALLOC</dt>
1639 ** <dd> ^(This option takes a single argument which is a pointer to an
1640 ** instance of the [sqlite3_mem_methods] structure. The [sqlite3_mem_methods]
 
1641 ** structure is filled with the currently defined memory allocation routines.)^
1642 ** This option can be used to overload the default memory allocation
1643 ** routines with a wrapper that simulations memory allocation failure or
1644 ** tracks memory usage, for example. </dd>
1645 **
1646 ** [[SQLITE_CONFIG_MEMSTATUS]] <dt>SQLITE_CONFIG_MEMSTATUS</dt>
1647 ** <dd> ^This option takes single argument of type int, interpreted as a
1648 ** boolean, which enables or disables the collection of memory allocation
1649 ** statistics. ^(When memory allocation statistics are disabled, the
1650 ** following SQLite interfaces become non-operational:
1651 ** <ul>
1652 ** <li> [sqlite3_memory_used()]
1653 ** <li> [sqlite3_memory_highwater()]
1654 ** <li> [sqlite3_soft_heap_limit64()]
1655 ** <li> [sqlite3_status()]
@@ -1658,78 +1660,92 @@
1658 ** compiled with [SQLITE_DEFAULT_MEMSTATUS]=0 in which case memory
1659 ** allocation statistics are disabled by default.
1660 ** </dd>
1661 **
1662 ** [[SQLITE_CONFIG_SCRATCH]] <dt>SQLITE_CONFIG_SCRATCH</dt>
1663 ** <dd> ^This option specifies a static memory buffer that SQLite can use for
1664 ** scratch memory. There are three arguments: A pointer an 8-byte
 
1665 ** aligned memory buffer from which the scratch allocations will be
1666 ** drawn, the size of each scratch allocation (sz),
1667 ** and the maximum number of scratch allocations (N). The sz
1668 ** argument must be a multiple of 16.
1669 ** The first argument must be a pointer to an 8-byte aligned buffer
1670 ** of at least sz*N bytes of memory.
1671 ** ^SQLite will use no more than two scratch buffers per thread. So
1672 ** N should be set to twice the expected maximum number of threads.
1673 ** ^SQLite will never require a scratch buffer that is more than 6
1674 ** times the database page size. ^If SQLite needs needs additional
1675 ** scratch memory beyond what is provided by this configuration option, then
1676 ** [sqlite3_malloc()] will be used to obtain the memory needed.</dd>
 
 
 
 
 
 
1677 **
1678 ** [[SQLITE_CONFIG_PAGECACHE]] <dt>SQLITE_CONFIG_PAGECACHE</dt>
1679 ** <dd> ^This option specifies a static memory buffer that SQLite can use for
1680 ** the database page cache with the default page cache implementation.
 
1681 ** This configuration should not be used if an application-define page
1682 ** cache implementation is loaded using the SQLITE_CONFIG_PCACHE2 option.
1683 ** There are three arguments to this option: A pointer to 8-byte aligned
 
 
1684 ** memory, the size of each page buffer (sz), and the number of pages (N).
1685 ** The sz argument should be the size of the largest database page
1686 ** (a power of two between 512 and 32768) plus a little extra for each
1687 ** page header. ^The page header size is 20 to 40 bytes depending on
1688 ** the host architecture. ^It is harmless, apart from the wasted memory,
1689 ** to make sz a little too large. The first
1690 ** argument should point to an allocation of at least sz*N bytes of memory.
 
 
 
 
1691 ** ^SQLite will use the memory provided by the first argument to satisfy its
1692 ** memory needs for the first N pages that it adds to cache. ^If additional
1693 ** page cache memory is needed beyond what is provided by this option, then
1694 ** SQLite goes to [sqlite3_malloc()] for the additional storage space.
1695 ** The pointer in the first argument must
1696 ** be aligned to an 8-byte boundary or subsequent behavior of SQLite
1697 ** will be undefined.</dd>
1698 **
1699 ** [[SQLITE_CONFIG_HEAP]] <dt>SQLITE_CONFIG_HEAP</dt>
1700 ** <dd> ^This option specifies a static memory buffer that SQLite will use
1701 ** for all of its dynamic memory allocation needs beyond those provided
1702 ** for by [SQLITE_CONFIG_SCRATCH] and [SQLITE_CONFIG_PAGECACHE].
1703 ** There are three arguments: An 8-byte aligned pointer to the memory,
 
 
 
 
 
1704 ** the number of bytes in the memory buffer, and the minimum allocation size.
1705 ** ^If the first pointer (the memory pointer) is NULL, then SQLite reverts
1706 ** to using its default memory allocator (the system malloc() implementation),
1707 ** undoing any prior invocation of [SQLITE_CONFIG_MALLOC]. ^If the
1708 ** memory pointer is not NULL and either [SQLITE_ENABLE_MEMSYS3] or
1709 ** [SQLITE_ENABLE_MEMSYS5] are defined, then the alternative memory
1710 ** allocator is engaged to handle all of SQLites memory allocation needs.
1711 ** The first pointer (the memory pointer) must be aligned to an 8-byte
1712 ** boundary or subsequent behavior of SQLite will be undefined.
1713 ** The minimum allocation size is capped at 2**12. Reasonable values
1714 ** for the minimum allocation size are 2**5 through 2**8.</dd>
1715 **
1716 ** [[SQLITE_CONFIG_MUTEX]] <dt>SQLITE_CONFIG_MUTEX</dt>
1717 ** <dd> ^(This option takes a single argument which is a pointer to an
1718 ** instance of the [sqlite3_mutex_methods] structure. The argument specifies
1719 ** alternative low-level mutex routines to be used in place
1720 ** the mutex routines built into SQLite.)^ ^SQLite makes a copy of the
1721 ** content of the [sqlite3_mutex_methods] structure before the call to
1722 ** [sqlite3_config()] returns. ^If SQLite is compiled with
1723 ** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
1724 ** the entire mutexing subsystem is omitted from the build and hence calls to
1725 ** [sqlite3_config()] with the SQLITE_CONFIG_MUTEX configuration option will
1726 ** return [SQLITE_ERROR].</dd>
1727 **
1728 ** [[SQLITE_CONFIG_GETMUTEX]] <dt>SQLITE_CONFIG_GETMUTEX</dt>
1729 ** <dd> ^(This option takes a single argument which is a pointer to an
1730 ** instance of the [sqlite3_mutex_methods] structure. The
1731 ** [sqlite3_mutex_methods]
1732 ** structure is filled with the currently defined mutex routines.)^
1733 ** This option can be used to overload the default mutex allocation
1734 ** routines with a wrapper used to track mutex usage for performance
1735 ** profiling or testing, for example. ^If SQLite is compiled with
@@ -1737,29 +1753,29 @@
1737 ** the entire mutexing subsystem is omitted from the build and hence calls to
1738 ** [sqlite3_config()] with the SQLITE_CONFIG_GETMUTEX configuration option will
1739 ** return [SQLITE_ERROR].</dd>
1740 **
1741 ** [[SQLITE_CONFIG_LOOKASIDE]] <dt>SQLITE_CONFIG_LOOKASIDE</dt>
1742 ** <dd> ^(This option takes two arguments that determine the default
1743 ** memory allocation for the lookaside memory allocator on each
1744 ** [database connection]. The first argument is the
1745 ** size of each lookaside buffer slot and the second is the number of
1746 ** slots allocated to each database connection.)^ ^(This option sets the
1747 ** <i>default</i> lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE]
1748 ** verb to [sqlite3_db_config()] can be used to change the lookaside
1749 ** configuration on individual connections.)^ </dd>
1750 **
1751 ** [[SQLITE_CONFIG_PCACHE2]] <dt>SQLITE_CONFIG_PCACHE2</dt>
1752 ** <dd> ^(This option takes a single argument which is a pointer to
1753 ** an [sqlite3_pcache_methods2] object. This object specifies the interface
1754 ** to a custom page cache implementation.)^ ^SQLite makes a copy of the
1755 ** object and uses it for page cache memory allocations.</dd>
1756 **
1757 ** [[SQLITE_CONFIG_GETPCACHE2]] <dt>SQLITE_CONFIG_GETPCACHE2</dt>
1758 ** <dd> ^(This option takes a single argument which is a pointer to an
1759 ** [sqlite3_pcache_methods2] object. SQLite copies of the current
1760 ** page cache implementation into that object.)^ </dd>
1761 **
1762 ** [[SQLITE_CONFIG_LOG]] <dt>SQLITE_CONFIG_LOG</dt>
1763 ** <dd> The SQLITE_CONFIG_LOG option is used to configure the SQLite
1764 ** global [error log].
1765 ** (^The SQLITE_CONFIG_LOG option takes two arguments: a pointer to a
@@ -1778,26 +1794,28 @@
1778 ** supplied by the application must not invoke any SQLite interface.
1779 ** In a multi-threaded application, the application-defined logger
1780 ** function must be threadsafe. </dd>
1781 **
1782 ** [[SQLITE_CONFIG_URI]] <dt>SQLITE_CONFIG_URI
1783 ** <dd>^(This option takes a single argument of type int. If non-zero, then
1784 ** URI handling is globally enabled. If the parameter is zero, then URI handling
1785 ** is globally disabled.)^ ^If URI handling is globally enabled, all filenames
1786 ** passed to [sqlite3_open()], [sqlite3_open_v2()], [sqlite3_open16()] or
 
1787 ** specified as part of [ATTACH] commands are interpreted as URIs, regardless
1788 ** of whether or not the [SQLITE_OPEN_URI] flag is set when the database
1789 ** connection is opened. ^If it is globally disabled, filenames are
1790 ** only interpreted as URIs if the SQLITE_OPEN_URI flag is set when the
1791 ** database connection is opened. ^(By default, URI handling is globally
1792 ** disabled. The default value may be changed by compiling with the
1793 ** [SQLITE_USE_URI] symbol defined.)^
1794 **
1795 ** [[SQLITE_CONFIG_COVERING_INDEX_SCAN]] <dt>SQLITE_CONFIG_COVERING_INDEX_SCAN
1796 ** <dd>^This option takes a single integer argument which is interpreted as
1797 ** a boolean in order to enable or disable the use of covering indices for
1798 ** full table scans in the query optimizer. ^The default setting is determined
 
1799 ** by the [SQLITE_ALLOW_COVERING_INDEX_SCAN] compile-time option, or is "on"
1800 ** if that compile-time option is omitted.
1801 ** The ability to disable the use of covering indices for full table scans
1802 ** is because some incorrectly coded legacy applications might malfunction
1803 ** when the optimization is enabled. Providing the ability to
@@ -1833,23 +1851,32 @@
1833 ** that are the default mmap size limit (the default setting for
1834 ** [PRAGMA mmap_size]) and the maximum allowed mmap size limit.
1835 ** ^The default setting can be overridden by each database connection using
1836 ** either the [PRAGMA mmap_size] command, or by using the
1837 ** [SQLITE_FCNTL_MMAP_SIZE] file control. ^(The maximum allowed mmap size
1838 ** cannot be changed at run-time. Nor may the maximum allowed mmap size
1839 ** exceed the compile-time maximum mmap size set by the
1840 ** [SQLITE_MAX_MMAP_SIZE] compile-time option.)^
1841 ** ^If either argument to this option is negative, then that argument is
1842 ** changed to its compile-time default.
1843 **
1844 ** [[SQLITE_CONFIG_WIN32_HEAPSIZE]]
1845 ** <dt>SQLITE_CONFIG_WIN32_HEAPSIZE
1846 ** <dd>^This option is only available if SQLite is compiled for Windows
1847 ** with the [SQLITE_WIN32_MALLOC] pre-processor macro defined.
1848 ** SQLITE_CONFIG_WIN32_HEAPSIZE takes a 32-bit unsigned integer value
1849 ** that specifies the maximum size of the created heap.
1850 ** </dl>
 
 
 
 
 
 
 
 
 
1851 */
1852 #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
1853 #define SQLITE_CONFIG_MULTITHREAD 2 /* nil */
1854 #define SQLITE_CONFIG_SERIALIZED 3 /* nil */
1855 #define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */
@@ -1870,10 +1897,11 @@
1870 #define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */
1871 #define SQLITE_CONFIG_COVERING_INDEX_SCAN 20 /* int */
1872 #define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */
1873 #define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */
1874 #define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */
 
1875
1876 /*
1877 ** CAPI3REF: Database Connection Configuration Options
1878 **
1879 ** These constants are the available integer configuration options that
@@ -1997,51 +2025,49 @@
1997 SQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*);
1998
1999 /*
2000 ** CAPI3REF: Count The Number Of Rows Modified
2001 **
2002 ** ^This function returns the number of database rows that were changed
2003 ** or inserted or deleted by the most recently completed SQL statement
2004 ** on the [database connection] specified by the first parameter.
2005 ** ^(Only changes that are directly specified by the [INSERT], [UPDATE],
2006 ** or [DELETE] statement are counted. Auxiliary changes caused by
2007 ** triggers or [foreign key actions] are not counted.)^ Use the
2008 ** [sqlite3_total_changes()] function to find the total number of changes
2009 ** including changes caused by triggers and foreign key actions.
2010 **
2011 ** ^Changes to a view that are simulated by an [INSTEAD OF trigger]
2012 ** are not counted. Only real table changes are counted.
2013 **
2014 ** ^(A "row change" is a change to a single row of a single table
2015 ** caused by an INSERT, DELETE, or UPDATE statement. Rows that
2016 ** are changed as side effects of [REPLACE] constraint resolution,
2017 ** rollback, ABORT processing, [DROP TABLE], or by any other
2018 ** mechanisms do not count as direct row changes.)^
2019 **
2020 ** A "trigger context" is a scope of execution that begins and
2021 ** ends with the script of a [CREATE TRIGGER | trigger].
2022 ** Most SQL statements are
2023 ** evaluated outside of any trigger. This is the "top level"
2024 ** trigger context. If a trigger fires from the top level, a
2025 ** new trigger context is entered for the duration of that one
2026 ** trigger. Subtriggers create subcontexts for their duration.
2027 **
2028 ** ^Calling [sqlite3_exec()] or [sqlite3_step()] recursively does
2029 ** not create a new trigger context.
2030 **
2031 ** ^This function returns the number of direct row changes in the
2032 ** most recent INSERT, UPDATE, or DELETE statement within the same
2033 ** trigger context.
2034 **
2035 ** ^Thus, when called from the top level, this function returns the
2036 ** number of changes in the most recent INSERT, UPDATE, or DELETE
2037 ** that also occurred at the top level. ^(Within the body of a trigger,
2038 ** the sqlite3_changes() interface can be called to find the number of
2039 ** changes in the most recently completed INSERT, UPDATE, or DELETE
2040 ** statement within the body of the same trigger.
2041 ** However, the number returned does not include changes
2042 ** caused by subtriggers since those have their own context.)^
2043 **
2044 ** See also the [sqlite3_total_changes()] interface, the
2045 ** [count_changes pragma], and the [changes() SQL function].
2046 **
2047 ** If a separate thread makes changes on the same database connection
@@ -2051,24 +2077,21 @@
2051 SQLITE_API int sqlite3_changes(sqlite3*);
2052
2053 /*
2054 ** CAPI3REF: Total Number Of Rows Modified
2055 **
2056 ** ^This function returns the number of row changes caused by [INSERT],
2057 ** [UPDATE] or [DELETE] statements since the [database connection] was opened.
2058 ** ^(The count returned by sqlite3_total_changes() includes all changes
2059 ** from all [CREATE TRIGGER | trigger] contexts and changes made by
2060 ** [foreign key actions]. However,
2061 ** the count does not include changes used to implement [REPLACE] constraints,
2062 ** do rollbacks or ABORT processing, or [DROP TABLE] processing. The
2063 ** count does not include rows of views that fire an [INSTEAD OF trigger],
2064 ** though if the INSTEAD OF trigger makes changes of its own, those changes
2065 ** are counted.)^
2066 ** ^The sqlite3_total_changes() function counts the changes as soon as
2067 ** the statement that makes them is completed (when the statement handle
2068 ** is passed to [sqlite3_reset()] or [sqlite3_finalize()]).
2069 **
2070 ** See also the [sqlite3_changes()] interface, the
2071 ** [count_changes pragma], and the [total_changes() SQL function].
2072 **
2073 ** If a separate thread makes changes on the same database connection
2074 ** while [sqlite3_total_changes()] is running then the value
@@ -2151,10 +2174,11 @@
2151 SQLITE_API int sqlite3_complete(const char *sql);
2152 SQLITE_API int sqlite3_complete16(const void *sql);
2153
2154 /*
2155 ** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors
 
2156 **
2157 ** ^The sqlite3_busy_handler(D,X,P) routine sets a callback function X
2158 ** that might be invoked with argument P whenever
2159 ** an attempt is made to access a database table associated with
2160 ** [database connection] D when another thread
@@ -2167,11 +2191,11 @@
2167 ** is not NULL, then the callback might be invoked with two arguments.
2168 **
2169 ** ^The first argument to the busy handler is a copy of the void* pointer which
2170 ** is the third argument to sqlite3_busy_handler(). ^The second argument to
2171 ** the busy handler callback is the number of times that the busy handler has
2172 ** been invoked for the same locking event. ^If the
2173 ** busy callback returns 0, then no additional attempts are made to
2174 ** access the database and [SQLITE_BUSY] is returned
2175 ** to the application.
2176 ** ^If the callback returns non-zero, then another attempt
2177 ** is made to access the database and the cycle repeats.
@@ -2542,17 +2566,18 @@
2542 ** already uses the largest possible [ROWID]. The PRNG is also used for
2543 ** the build-in random() and randomblob() SQL functions. This interface allows
2544 ** applications to access the same PRNG for other purposes.
2545 **
2546 ** ^A call to this routine stores N bytes of randomness into buffer P.
2547 ** ^If N is less than one, then P can be a NULL pointer.
2548 **
2549 ** ^If this routine has not been previously called or if the previous
2550 ** call had N less than one, then the PRNG is seeded using randomness
2551 ** obtained from the xRandomness method of the default [sqlite3_vfs] object.
2552 ** ^If the previous call to this routine had an N of 1 or more then
2553 ** the pseudo-randomness is generated
 
2554 ** internally and without recourse to the [sqlite3_vfs] xRandomness
2555 ** method.
2556 */
2557 SQLITE_API void sqlite3_randomness(int N, void *P);
2558
@@ -4270,13 +4295,13 @@
4270 ** CAPI3REF: Text Encodings
4271 **
4272 ** These constant define integer codes that represent the various
4273 ** text encodings supported by SQLite.
4274 */
4275 #define SQLITE_UTF8 1
4276 #define SQLITE_UTF16LE 2
4277 #define SQLITE_UTF16BE 3
4278 #define SQLITE_UTF16 4 /* Use native byte order */
4279 #define SQLITE_ANY 5 /* Deprecated */
4280 #define SQLITE_UTF16_ALIGNED 8 /* sqlite3_create_collation only */
4281
4282 /*
@@ -4621,11 +4646,12 @@
4621 ** If these routines are called from within the different thread
4622 ** than the one containing the application-defined function that received
4623 ** the [sqlite3_context] pointer, the results are undefined.
4624 */
4625 SQLITE_API void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));
4626 SQLITE_API void sqlite3_result_blob64(sqlite3_context*,const void*,sqlite3_uint64,void(*)(void*));
 
4627 SQLITE_API void sqlite3_result_double(sqlite3_context*, double);
4628 SQLITE_API void sqlite3_result_error(sqlite3_context*, const char*, int);
4629 SQLITE_API void sqlite3_result_error16(sqlite3_context*, const void*, int);
4630 SQLITE_API void sqlite3_result_error_toobig(sqlite3_context*);
4631 SQLITE_API void sqlite3_result_error_nomem(sqlite3_context*);
@@ -5762,31 +5788,47 @@
5762 ** in other words, the same BLOB that would be selected by:
5763 **
5764 ** <pre>
5765 ** SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow;
5766 ** </pre>)^
 
 
 
 
 
 
5767 **
5768 ** ^If the flags parameter is non-zero, then the BLOB is opened for read
5769 ** and write access. ^If it is zero, the BLOB is opened for read access.
5770 ** ^It is not possible to open a column that is part of an index or primary
5771 ** key for writing. ^If [foreign key constraints] are enabled, it is
5772 ** not possible to open a column that is part of a [child key] for writing.
5773 **
5774 ** ^Note that the database name is not the filename that contains
5775 ** the database but rather the symbolic name of the database that
5776 ** appears after the AS keyword when the database is connected using [ATTACH].
5777 ** ^For the main database file, the database name is "main".
5778 ** ^For TEMP tables, the database name is "temp".
5779 **
5780 ** ^(On success, [SQLITE_OK] is returned and the new [BLOB handle] is written
5781 ** to *ppBlob. Otherwise an [error code] is returned and *ppBlob is set
5782 ** to be a null pointer.)^
5783 ** ^This function sets the [database connection] error code and message
5784 ** accessible via [sqlite3_errcode()] and [sqlite3_errmsg()] and related
5785 ** functions. ^Note that the *ppBlob variable is always initialized in a
5786 ** way that makes it safe to invoke [sqlite3_blob_close()] on *ppBlob
5787 ** regardless of the success or failure of this routine.
 
 
 
 
 
 
 
 
 
 
5788 **
5789 ** ^(If the row that a BLOB handle points to is modified by an
5790 ** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects
5791 ** then the BLOB handle is marked as "expired".
5792 ** This is true if any column of the row is changed, even a column
@@ -5800,17 +5842,13 @@
5800 ** ^Use the [sqlite3_blob_bytes()] interface to determine the size of
5801 ** the opened blob. ^The size of a blob may not be changed by this
5802 ** interface. Use the [UPDATE] SQL command to change the size of a
5803 ** blob.
5804 **
5805 ** ^The [sqlite3_blob_open()] interface will fail for a [WITHOUT ROWID]
5806 ** table. Incremental BLOB I/O is not possible on [WITHOUT ROWID] tables.
5807 **
5808 ** ^The [sqlite3_bind_zeroblob()] and [sqlite3_result_zeroblob()] interfaces
5809 ** and the built-in [zeroblob] SQL function can be used, if desired,
5810 ** to create an empty, zero-filled blob in which to read or write using
5811 ** this interface.
5812 **
5813 ** To avoid a resource leak, every open [BLOB handle] should eventually
5814 ** be released by a call to [sqlite3_blob_close()].
5815 */
5816 SQLITE_API int sqlite3_blob_open(
@@ -5848,28 +5886,26 @@
5848 SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64);
5849
5850 /*
5851 ** CAPI3REF: Close A BLOB Handle
5852 **
5853 ** ^Closes an open [BLOB handle].
5854 **
5855 ** ^Closing a BLOB shall cause the current transaction to commit
5856 ** if there are no other BLOBs, no pending prepared statements, and the
5857 ** database connection is in [autocommit mode].
5858 ** ^If any writes were made to the BLOB, they might be held in cache
5859 ** until the close operation if they will fit.
5860 **
5861 ** ^(Closing the BLOB often forces the changes
5862 ** out to disk and so if any I/O errors occur, they will likely occur
5863 ** at the time when the BLOB is closed. Any errors that occur during
5864 ** closing are reported as a non-zero return value.)^
5865 **
5866 ** ^(The BLOB is closed unconditionally. Even if this routine returns
5867 ** an error code, the BLOB is still closed.)^
5868 **
5869 ** ^Calling this routine with a null pointer (such as would be returned
5870 ** by a failed call to [sqlite3_blob_open()]) is a harmless no-op.
5871 */
5872 SQLITE_API int sqlite3_blob_close(sqlite3_blob *);
5873
5874 /*
5875 ** CAPI3REF: Return The Size Of An Open BLOB
@@ -5915,36 +5951,39 @@
5915 SQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);
5916
5917 /*
5918 ** CAPI3REF: Write Data Into A BLOB Incrementally
5919 **
5920 ** ^This function is used to write data into an open [BLOB handle] from a
5921 ** caller-supplied buffer. ^N bytes of data are copied from the buffer Z
5922 ** into the open BLOB, starting at offset iOffset.
 
 
 
 
 
 
5923 **
5924 ** ^If the [BLOB handle] passed as the first argument was not opened for
5925 ** writing (the flags parameter to [sqlite3_blob_open()] was zero),
5926 ** this function returns [SQLITE_READONLY].
5927 **
5928 ** ^This function may only modify the contents of the BLOB; it is
5929 ** not possible to increase the size of a BLOB using this API.
5930 ** ^If offset iOffset is less than N bytes from the end of the BLOB,
5931 ** [SQLITE_ERROR] is returned and no data is written. ^If N is
5932 ** less than zero [SQLITE_ERROR] is returned and no data is written.
5933 ** The size of the BLOB (and hence the maximum value of N+iOffset)
5934 ** can be determined using the [sqlite3_blob_bytes()] interface.
5935 **
5936 ** ^An attempt to write to an expired [BLOB handle] fails with an
5937 ** error code of [SQLITE_ABORT]. ^Writes to the BLOB that occurred
5938 ** before the [BLOB handle] expired are not rolled back by the
5939 ** expiration of the handle, though of course those changes might
5940 ** have been overwritten by the statement that expired the BLOB handle
5941 ** or by other independent statements.
5942 **
5943 ** ^(On success, sqlite3_blob_write() returns SQLITE_OK.
5944 ** Otherwise, an [error code] or an [extended error code] is returned.)^
5945 **
5946 ** This routine only works on a [BLOB handle] which has been created
5947 ** by a prior successful call to [sqlite3_blob_open()] and which has not
5948 ** been closed by [sqlite3_blob_close()]. Passing any other pointer in
5949 ** to this routine results in undefined and probably undesirable behavior.
5950 **
@@ -5993,38 +6032,38 @@
5993 ** use by SQLite, code that links against SQLite is
5994 ** permitted to use any of these routines.
5995 **
5996 ** The SQLite source code contains multiple implementations
5997 ** of these mutex routines. An appropriate implementation
5998 ** is selected automatically at compile-time. ^(The following
5999 ** implementations are available in the SQLite core:
6000 **
6001 ** <ul>
6002 ** <li> SQLITE_MUTEX_PTHREADS
6003 ** <li> SQLITE_MUTEX_W32
6004 ** <li> SQLITE_MUTEX_NOOP
6005 ** </ul>)^
6006 **
6007 ** ^The SQLITE_MUTEX_NOOP implementation is a set of routines
6008 ** that does no real locking and is appropriate for use in
6009 ** a single-threaded application. ^The SQLITE_MUTEX_PTHREADS and
6010 ** SQLITE_MUTEX_W32 implementations are appropriate for use on Unix
6011 ** and Windows.
6012 **
6013 ** ^(If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor
6014 ** macro defined (with "-DSQLITE_MUTEX_APPDEF=1"), then no mutex
6015 ** implementation is included with the library. In this case the
6016 ** application must supply a custom mutex implementation using the
6017 ** [SQLITE_CONFIG_MUTEX] option of the sqlite3_config() function
6018 ** before calling sqlite3_initialize() or any other public sqlite3_
6019 ** function that calls sqlite3_initialize().)^
6020 **
6021 ** ^The sqlite3_mutex_alloc() routine allocates a new
6022 ** mutex and returns a pointer to it. ^If it returns NULL
6023 ** that means that a mutex could not be allocated. ^SQLite
6024 ** will unwind its stack and return an error. ^(The argument
6025 ** to sqlite3_mutex_alloc() is one of these integer constants:
6026 **
6027 ** <ul>
6028 ** <li> SQLITE_MUTEX_FAST
6029 ** <li> SQLITE_MUTEX_RECURSIVE
6030 ** <li> SQLITE_MUTEX_STATIC_MASTER
@@ -6033,68 +6072,64 @@
6033 ** <li> SQLITE_MUTEX_STATIC_PRNG
6034 ** <li> SQLITE_MUTEX_STATIC_LRU
6035 ** <li> SQLITE_MUTEX_STATIC_PMEM
6036 ** <li> SQLITE_MUTEX_STATIC_APP1
6037 ** <li> SQLITE_MUTEX_STATIC_APP2
6038 ** </ul>)^
 
6039 **
6040 ** ^The first two constants (SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE)
6041 ** cause sqlite3_mutex_alloc() to create
6042 ** a new mutex. ^The new mutex is recursive when SQLITE_MUTEX_RECURSIVE
6043 ** is used but not necessarily so when SQLITE_MUTEX_FAST is used.
6044 ** The mutex implementation does not need to make a distinction
6045 ** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does
6046 ** not want to. ^SQLite will only request a recursive mutex in
6047 ** cases where it really needs one. ^If a faster non-recursive mutex
6048 ** implementation is available on the host platform, the mutex subsystem
6049 ** might return such a mutex in response to SQLITE_MUTEX_FAST.
6050 **
6051 ** ^The other allowed parameters to sqlite3_mutex_alloc() (anything other
6052 ** than SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) each return
6053 ** a pointer to a static preexisting mutex. ^Six static mutexes are
6054 ** used by the current version of SQLite. Future versions of SQLite
6055 ** may add additional static mutexes. Static mutexes are for internal
6056 ** use by SQLite only. Applications that use SQLite mutexes should
6057 ** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or
6058 ** SQLITE_MUTEX_RECURSIVE.
6059 **
6060 ** ^Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST
6061 ** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc()
6062 ** returns a different mutex on every call. ^But for the static
6063 ** mutex types, the same mutex is returned on every call that has
6064 ** the same type number.
6065 **
6066 ** ^The sqlite3_mutex_free() routine deallocates a previously
6067 ** allocated dynamic mutex. ^SQLite is careful to deallocate every
6068 ** dynamic mutex that it allocates. The dynamic mutexes must not be in
6069 ** use when they are deallocated. Attempting to deallocate a static
6070 ** mutex results in undefined behavior. ^SQLite never deallocates
6071 ** a static mutex.
6072 **
6073 ** ^The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt
6074 ** to enter a mutex. ^If another thread is already within the mutex,
6075 ** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return
6076 ** SQLITE_BUSY. ^The sqlite3_mutex_try() interface returns [SQLITE_OK]
6077 ** upon successful entry. ^(Mutexes created using
6078 ** SQLITE_MUTEX_RECURSIVE can be entered multiple times by the same thread.
6079 ** In such cases the,
6080 ** mutex must be exited an equal number of times before another thread
6081 ** can enter.)^ ^(If the same thread tries to enter any other
6082 ** kind of mutex more than once, the behavior is undefined.
6083 ** SQLite will never exhibit
6084 ** such behavior in its own use of mutexes.)^
6085 **
6086 ** ^(Some systems (for example, Windows 95) do not support the operation
6087 ** implemented by sqlite3_mutex_try(). On those systems, sqlite3_mutex_try()
6088 ** will always return SQLITE_BUSY. The SQLite core only ever uses
6089 ** sqlite3_mutex_try() as an optimization so this is acceptable behavior.)^
 
6090 **
6091 ** ^The sqlite3_mutex_leave() routine exits a mutex that was
6092 ** previously entered by the same thread. ^(The behavior
6093 ** is undefined if the mutex is not currently entered by the
6094 ** calling thread or is not currently allocated. SQLite will
6095 ** never do either.)^
6096 **
6097 ** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(), or
6098 ** sqlite3_mutex_leave() is a NULL pointer, then all three routines
6099 ** behave as no-ops.
6100 **
@@ -6111,13 +6146,13 @@
6111 **
6112 ** An instance of this structure defines the low-level routines
6113 ** used to allocate and use mutexes.
6114 **
6115 ** Usually, the default mutex implementations provided by SQLite are
6116 ** sufficient, however the user has the option of substituting a custom
6117 ** implementation for specialized deployments or systems for which SQLite
6118 ** does not provide a suitable implementation. In this case, the user
6119 ** creates and populates an instance of this structure to pass
6120 ** to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option.
6121 ** Additionally, an instance of this structure can be used as an
6122 ** output variable when querying the system for the current mutex
6123 ** implementation, using the [SQLITE_CONFIG_GETMUTEX] option.
@@ -6154,17 +6189,17 @@
6154 ** by this structure are not required to handle this case, the results
6155 ** of passing a NULL pointer instead of a valid mutex handle are undefined
6156 ** (i.e. it is acceptable to provide an implementation that segfaults if
6157 ** it is passed a NULL pointer).
6158 **
6159 ** The xMutexInit() method must be threadsafe. ^It must be harmless to
6160 ** invoke xMutexInit() multiple times within the same process and without
6161 ** intervening calls to xMutexEnd(). Second and subsequent calls to
6162 ** xMutexInit() must be no-ops.
6163 **
6164 ** ^xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()]
6165 ** and its associates). ^Similarly, xMutexAlloc() must not use SQLite memory
6166 ** allocation for a static mutex. ^However xMutexAlloc() may use SQLite
6167 ** memory allocation for a fast or recursive mutex.
6168 **
6169 ** ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is
6170 ** called, but only if the prior call to xMutexInit returned SQLITE_OK.
@@ -6186,33 +6221,33 @@
6186
6187 /*
6188 ** CAPI3REF: Mutex Verification Routines
6189 **
6190 ** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routines
6191 ** are intended for use inside assert() statements. ^The SQLite core
6192 ** never uses these routines except inside an assert() and applications
6193 ** are advised to follow the lead of the core. ^The SQLite core only
6194 ** provides implementations for these routines when it is compiled
6195 ** with the SQLITE_DEBUG flag. ^External mutex implementations
6196 ** are only required to provide these routines if SQLITE_DEBUG is
6197 ** defined and if NDEBUG is not defined.
6198 **
6199 ** ^These routines should return true if the mutex in their argument
6200 ** is held or not held, respectively, by the calling thread.
6201 **
6202 ** ^The implementation is not required to provide versions of these
6203 ** routines that actually work. If the implementation does not provide working
6204 ** versions of these routines, it should at least provide stubs that always
6205 ** return true so that one does not get spurious assertion failures.
6206 **
6207 ** ^If the argument to sqlite3_mutex_held() is a NULL pointer then
6208 ** the routine should return 1. This seems counter-intuitive since
6209 ** clearly the mutex cannot be held if it does not exist. But
6210 ** the reason the mutex does not exist is because the build is not
6211 ** using mutexes. And we do not want the assert() containing the
6212 ** call to sqlite3_mutex_held() to fail, so a non-zero return is
6213 ** the appropriate thing to do. ^The sqlite3_mutex_notheld()
6214 ** interface should also return 1 when given a NULL pointer.
6215 */
6216 #ifndef NDEBUG
6217 SQLITE_API int sqlite3_mutex_held(sqlite3_mutex*);
6218 SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*);
@@ -6940,10 +6975,14 @@
6940 ** sqlite3_backup_init(D,N,S,M) identify the [database connection]
6941 ** and database name of the source database, respectively.
6942 ** ^The source and destination [database connections] (parameters S and D)
6943 ** must be different or else sqlite3_backup_init(D,N,S,M) will fail with
6944 ** an error.
 
 
 
 
6945 **
6946 ** ^If an error occurs within sqlite3_backup_init(D,N,S,M), then NULL is
6947 ** returned and an error code and error message are stored in the
6948 ** destination [database connection] D.
6949 ** ^The error code and message for the failed call to sqlite3_backup_init()
@@ -7334,101 +7373,118 @@
7334 SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
7335
7336 /*
7337 ** CAPI3REF: Checkpoint a database
7338 **
7339 ** ^The [sqlite3_wal_checkpoint(D,X)] interface causes database named X
7340 ** on [database connection] D to be [checkpointed]. ^If X is NULL or an
7341 ** empty string, then a checkpoint is run on all databases of
7342 ** connection D. ^If the database connection D is not in
7343 ** [WAL | write-ahead log mode] then this interface is a harmless no-op.
7344 ** ^The [sqlite3_wal_checkpoint(D,X)] interface initiates a
7345 ** [sqlite3_wal_checkpoint_v2|PASSIVE] checkpoint.
7346 ** Use the [sqlite3_wal_checkpoint_v2()] interface to get a FULL
7347 ** or RESET checkpoint.
7348 **
7349 ** ^The [wal_checkpoint pragma] can be used to invoke this interface
7350 ** from SQL. ^The [sqlite3_wal_autocheckpoint()] interface and the
7351 ** [wal_autocheckpoint pragma] can be used to cause this interface to be
7352 ** run whenever the WAL reaches a certain size threshold.
7353 **
7354 ** See also: [sqlite3_wal_checkpoint_v2()]
7355 */
7356 SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);
7357
7358 /*
7359 ** CAPI3REF: Checkpoint a database
7360 **
7361 ** Run a checkpoint operation on WAL database zDb attached to database
7362 ** handle db. The specific operation is determined by the value of the
7363 ** eMode parameter:
 
7364 **
7365 ** <dl>
7366 ** <dt>SQLITE_CHECKPOINT_PASSIVE<dd>
7367 ** Checkpoint as many frames as possible without waiting for any database
7368 ** readers or writers to finish. Sync the db file if all frames in the log
7369 ** are checkpointed. This mode is the same as calling
7370 ** sqlite3_wal_checkpoint(). The [sqlite3_busy_handler|busy-handler callback]
7371 ** is never invoked.
 
7372 **
7373 ** <dt>SQLITE_CHECKPOINT_FULL<dd>
7374 ** This mode blocks (it invokes the
7375 ** [sqlite3_busy_handler|busy-handler callback]) until there is no
7376 ** database writer and all readers are reading from the most recent database
7377 ** snapshot. It then checkpoints all frames in the log file and syncs the
7378 ** database file. This call blocks database writers while it is running,
7379 ** but not database readers.
7380 **
7381 ** <dt>SQLITE_CHECKPOINT_RESTART<dd>
7382 ** This mode works the same way as SQLITE_CHECKPOINT_FULL, except after
7383 ** checkpointing the log file it blocks (calls the
7384 ** [sqlite3_busy_handler|busy-handler callback])
7385 ** until all readers are reading from the database file only. This ensures
7386 ** that the next client to write to the database file restarts the log file
7387 ** from the beginning. This call blocks database writers while it is running,
7388 ** but not database readers.
 
 
 
 
 
7389 ** </dl>
7390 **
7391 ** If pnLog is not NULL, then *pnLog is set to the total number of frames in
7392 ** the log file before returning. If pnCkpt is not NULL, then *pnCkpt is set to
7393 ** the total number of checkpointed frames (including any that were already
7394 ** checkpointed when this function is called). *pnLog and *pnCkpt may be
7395 ** populated even if sqlite3_wal_checkpoint_v2() returns other than SQLITE_OK.
7396 ** If no values are available because of an error, they are both set to -1
7397 ** before returning to communicate this to the caller.
 
 
7398 **
7399 ** All calls obtain an exclusive "checkpoint" lock on the database file. If
7400 ** any other process is running a checkpoint operation at the same time, the
7401 ** lock cannot be obtained and SQLITE_BUSY is returned. Even if there is a
7402 ** busy-handler configured, it will not be invoked in this case.
7403 **
7404 ** The SQLITE_CHECKPOINT_FULL and RESTART modes also obtain the exclusive
7405 ** "writer" lock on the database file. If the writer lock cannot be obtained
7406 ** immediately, and a busy-handler is configured, it is invoked and the writer
7407 ** lock retried until either the busy-handler returns 0 or the lock is
7408 ** successfully obtained. The busy-handler is also invoked while waiting for
7409 ** database readers as described above. If the busy-handler returns 0 before
7410 ** the writer lock is obtained or while waiting for database readers, the
7411 ** checkpoint operation proceeds from that point in the same way as
7412 ** SQLITE_CHECKPOINT_PASSIVE - checkpointing as many frames as possible
7413 ** without blocking any further. SQLITE_BUSY is returned in this case.
7414 **
7415 ** If parameter zDb is NULL or points to a zero length string, then the
7416 ** specified operation is attempted on all WAL databases. In this case the
7417 ** values written to output parameters *pnLog and *pnCkpt are undefined. If
 
7418 ** an SQLITE_BUSY error is encountered when processing one or more of the
7419 ** attached WAL databases, the operation is still attempted on any remaining
7420 ** attached databases and SQLITE_BUSY is returned to the caller. If any other
7421 ** error occurs while processing an attached database, processing is abandoned
7422 ** and the error code returned to the caller immediately. If no error
7423 ** (SQLITE_BUSY or otherwise) is encountered while processing the attached
7424 ** databases, SQLITE_OK is returned.
7425 **
7426 ** If database zDb is the name of an attached database that is not in WAL
7427 ** mode, SQLITE_OK is returned and both *pnLog and *pnCkpt set to -1. If
7428 ** zDb is not NULL (or a zero length string) and is not the name of any
7429 ** attached database, SQLITE_ERROR is returned to the caller.
 
 
 
 
 
 
 
 
7430 */
7431 SQLITE_API int sqlite3_wal_checkpoint_v2(
7432 sqlite3 *db, /* Database handle */
7433 const char *zDb, /* Name of attached database (or NULL) */
7434 int eMode, /* SQLITE_CHECKPOINT_* value */
@@ -7435,20 +7491,22 @@
7435 int *pnLog, /* OUT: Size of WAL log in frames */
7436 int *pnCkpt /* OUT: Total number of frames checkpointed */
7437 );
7438
7439 /*
7440 ** CAPI3REF: Checkpoint operation parameters
 
7441 **
7442 ** These constants can be used as the 3rd parameter to
7443 ** [sqlite3_wal_checkpoint_v2()]. See the [sqlite3_wal_checkpoint_v2()]
7444 ** documentation for additional information about the meaning and use of
7445 ** each of these values.
7446 */
7447 #define SQLITE_CHECKPOINT_PASSIVE 0
7448 #define SQLITE_CHECKPOINT_FULL 1
7449 #define SQLITE_CHECKPOINT_RESTART 2
 
7450
7451 /*
7452 ** CAPI3REF: Virtual Table Interface Configuration
7453 **
7454 ** This function may be called by either the [xConnect] or [xCreate] method
@@ -7533,10 +7591,102 @@
7533 /* #define SQLITE_IGNORE 2 // Also used by sqlite3_authorizer() callback */
7534 #define SQLITE_FAIL 3
7535 /* #define SQLITE_ABORT 4 // Also an error code */
7536 #define SQLITE_REPLACE 5
7537
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7538
7539
7540 /*
7541 ** Undo the hack that converts floating point types to integer for
7542 ** builds on processors without floating point support.
@@ -7978,14 +8128,13 @@
7978 #ifndef SQLITE_POWERSAFE_OVERWRITE
7979 # define SQLITE_POWERSAFE_OVERWRITE 1
7980 #endif
7981
7982 /*
7983 ** The SQLITE_DEFAULT_MEMSTATUS macro must be defined as either 0 or 1.
7984 ** It determines whether or not the features related to
7985 ** SQLITE_CONFIG_MEMSTATUS are available by default or not. This value can
7986 ** be overridden at runtime using the sqlite3_config() API.
7987 */
7988 #if !defined(SQLITE_DEFAULT_MEMSTATUS)
7989 # define SQLITE_DEFAULT_MEMSTATUS 1
7990 #endif
7991
@@ -8611,11 +8760,11 @@
8611 ** Estimated quantities used for query planning are stored as 16-bit
8612 ** logarithms. For quantity X, the value stored is 10*log2(X). This
8613 ** gives a possible range of values of approximately 1.0e986 to 1e-986.
8614 ** But the allowed values are "grainy". Not every value is representable.
8615 ** For example, quantities 16 and 17 are both represented by a LogEst
8616 ** of 40. However, since LogEst quantaties are suppose to be estimates,
8617 ** not exact values, this imprecision is not a problem.
8618 **
8619 ** "LogEst" is short for "Logarithmic Estimate".
8620 **
8621 ** Examples:
@@ -9011,11 +9160,11 @@
9011 SQLITE_PRIVATE int sqlite3BtreeGetAutoVacuum(Btree *);
9012 SQLITE_PRIVATE int sqlite3BtreeBeginTrans(Btree*,int);
9013 SQLITE_PRIVATE int sqlite3BtreeCommitPhaseOne(Btree*, const char *zMaster);
9014 SQLITE_PRIVATE int sqlite3BtreeCommitPhaseTwo(Btree*, int);
9015 SQLITE_PRIVATE int sqlite3BtreeCommit(Btree*);
9016 SQLITE_PRIVATE int sqlite3BtreeRollback(Btree*,int);
9017 SQLITE_PRIVATE int sqlite3BtreeBeginStmt(Btree*,int);
9018 SQLITE_PRIVATE int sqlite3BtreeCreateTable(Btree*, int*, int flags);
9019 SQLITE_PRIVATE int sqlite3BtreeIsInTrans(Btree*);
9020 SQLITE_PRIVATE int sqlite3BtreeIsInReadTrans(Btree*);
9021 SQLITE_PRIVATE int sqlite3BtreeIsInBackup(Btree*);
@@ -9044,11 +9193,11 @@
9044 #define BTREE_BLOBKEY 2 /* Table has keys only - no data */
9045
9046 SQLITE_PRIVATE int sqlite3BtreeDropTable(Btree*, int, int*);
9047 SQLITE_PRIVATE int sqlite3BtreeClearTable(Btree*, int, int*);
9048 SQLITE_PRIVATE int sqlite3BtreeClearTableOfCursor(BtCursor*);
9049 SQLITE_PRIVATE void sqlite3BtreeTripAllCursors(Btree*, int);
9050
9051 SQLITE_PRIVATE void sqlite3BtreeGetMeta(Btree *pBtree, int idx, u32 *pValue);
9052 SQLITE_PRIVATE int sqlite3BtreeUpdateMeta(Btree*, int idx, u32 value);
9053
9054 SQLITE_PRIVATE int sqlite3BtreeNewDb(Btree *p);
@@ -9124,10 +9273,11 @@
9124 SQLITE_PRIVATE void sqlite3BtreeIncrblobCursor(BtCursor *);
9125 SQLITE_PRIVATE void sqlite3BtreeClearCursor(BtCursor *);
9126 SQLITE_PRIVATE int sqlite3BtreeSetVersion(Btree *pBt, int iVersion);
9127 SQLITE_PRIVATE void sqlite3BtreeCursorHints(BtCursor *, unsigned int mask);
9128 SQLITE_PRIVATE int sqlite3BtreeIsReadonly(Btree *pBt);
 
9129
9130 #ifndef NDEBUG
9131 SQLITE_PRIVATE int sqlite3BtreeCursorIsValid(BtCursor*);
9132 #endif
9133
@@ -9666,10 +9816,16 @@
9666 # define VdbeCoverageAlwaysTaken(v)
9667 # define VdbeCoverageNeverTaken(v)
9668 # define VDBE_OFFSET_LINENO(x) 0
9669 #endif
9670
 
 
 
 
 
 
9671 #endif
9672
9673 /************** End of vdbe.h ************************************************/
9674 /************** Continuing where we left off in sqliteInt.h ******************/
9675 /************** Include pager.h in the middle of sqliteInt.h *****************/
@@ -9862,10 +10018,12 @@
9862 SQLITE_PRIVATE int sqlite3SectorSize(sqlite3_file *);
9863
9864 /* Functions used to truncate the database file. */
9865 SQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager*,Pgno);
9866
 
 
9867 #if defined(SQLITE_HAS_CODEC) && !defined(SQLITE_OMIT_WAL)
9868 SQLITE_PRIVATE void *sqlite3PagerCodec(DbPage *);
9869 #endif
9870
9871 /* Functions to support testing and debugging. */
@@ -10049,10 +10207,14 @@
10049 SQLITE_PRIVATE void sqlite3PcacheStats(int*,int*,int*,int*);
10050 #endif
10051
10052 SQLITE_PRIVATE void sqlite3PCacheSetDefault(void);
10053
 
 
 
 
10054 #endif /* _PCACHE_H_ */
10055
10056 /************** End of pcache.h **********************************************/
10057 /************** Continuing where we left off in sqliteInt.h ******************/
10058
@@ -10735,11 +10897,11 @@
10735 #define SQLITE_CoverIdxScan 0x0040 /* Covering index scans */
10736 #define SQLITE_OrderByIdxJoin 0x0080 /* ORDER BY of joins via index */
10737 #define SQLITE_SubqCoroutine 0x0100 /* Evaluate subqueries as coroutines */
10738 #define SQLITE_Transitive 0x0200 /* Transitive constraints */
10739 #define SQLITE_OmitNoopJoin 0x0400 /* Omit unused tables in joins */
10740 #define SQLITE_Stat3 0x0800 /* Use the SQLITE_STAT3 table */
10741 #define SQLITE_AllOpts 0xffff /* All optimizations */
10742
10743 /*
10744 ** Macros for testing whether or not optimizations are enabled or disabled.
10745 */
@@ -11317,16 +11479,18 @@
11317 unsigned idxType:2; /* 1==UNIQUE, 2==PRIMARY KEY, 0==CREATE INDEX */
11318 unsigned bUnordered:1; /* Use this index for == or IN queries only */
11319 unsigned uniqNotNull:1; /* True if UNIQUE and NOT NULL for all columns */
11320 unsigned isResized:1; /* True if resizeIndexObject() has been called */
11321 unsigned isCovering:1; /* True if this is a covering index */
 
11322 #ifdef SQLITE_ENABLE_STAT3_OR_STAT4
11323 int nSample; /* Number of elements in aSample[] */
11324 int nSampleCol; /* Size of IndexSample.anEq[] and so on */
11325 tRowcnt *aAvgEq; /* Average nEq values for keys not in aSample */
11326 IndexSample *aSample; /* Samples of the left-most key */
11327 tRowcnt *aiRowEst; /* Non-logarithmic stat1 data for this table */
 
11328 #endif
11329 };
11330
11331 /*
11332 ** Allowed values for Index.idxType
@@ -11520,11 +11684,11 @@
11520 int nHeight; /* Height of the tree headed by this node */
11521 #endif
11522 int iTable; /* TK_COLUMN: cursor number of table holding column
11523 ** TK_REGISTER: register number
11524 ** TK_TRIGGER: 1 -> new, 0 -> old
11525 ** EP_Unlikely: 1000 times likelihood */
11526 ynVar iColumn; /* TK_COLUMN: column index. -1 for rowid.
11527 ** TK_VARIABLE: variable number (always >= 1). */
11528 i16 iAgg; /* Which entry in pAggInfo->aCol[] or ->aFunc[] */
11529 i16 iRightJoinTable; /* If EP_FromJoin, the right table of the join */
11530 u8 op2; /* TK_REGISTER: original value of Expr.op
@@ -11535,11 +11699,11 @@
11535 };
11536
11537 /*
11538 ** The following are the meanings of bits in the Expr.flags field.
11539 */
11540 #define EP_FromJoin 0x000001 /* Originated in ON or USING clause of a join */
11541 #define EP_Agg 0x000002 /* Contains one or more aggregate functions */
11542 #define EP_Resolved 0x000004 /* IDs have been resolved to COLUMNs */
11543 #define EP_Error 0x000008 /* Expression contains one or more errors */
11544 #define EP_Distinct 0x000010 /* Aggregate function with DISTINCT keyword */
11545 #define EP_VarSelect 0x000020 /* pSelect is correlated, not constant */
@@ -11555,10 +11719,11 @@
11555 #define EP_Static 0x008000 /* Held in memory not obtained from malloc() */
11556 #define EP_MemToken 0x010000 /* Need to sqlite3DbFree() Expr.zToken */
11557 #define EP_NoReduce 0x020000 /* Cannot EXPRDUP_REDUCE this Expr */
11558 #define EP_Unlikely 0x040000 /* unlikely() or likelihood() function */
11559 #define EP_Constant 0x080000 /* Node is a constant */
 
11560
11561 /*
11562 ** These macros can be used to test, set, or clear bits in the
11563 ** Expr.flags field.
11564 */
@@ -12412,13 +12577,15 @@
12412 int (*xExprCallback)(Walker*, Expr*); /* Callback for expressions */
12413 int (*xSelectCallback)(Walker*,Select*); /* Callback for SELECTs */
12414 void (*xSelectCallback2)(Walker*,Select*);/* Second callback for SELECTs */
12415 Parse *pParse; /* Parser context. */
12416 int walkerDepth; /* Number of subqueries */
 
12417 union { /* Extra data for callback */
12418 NameContext *pNC; /* Naming context */
12419 int i; /* Integer value */
 
12420 SrcList *pSrcList; /* FROM clause */
12421 struct SrcCount *pSrcCount; /* Counting column references */
12422 } u;
12423 };
12424
@@ -12815,10 +12982,11 @@
12815 SQLITE_PRIVATE void sqlite3CloseSavepoints(sqlite3 *);
12816 SQLITE_PRIVATE void sqlite3LeaveMutexAndCloseZombie(sqlite3*);
12817 SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr*);
12818 SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr*);
12819 SQLITE_PRIVATE int sqlite3ExprIsConstantOrFunction(Expr*, u8);
 
12820 SQLITE_PRIVATE int sqlite3ExprIsInteger(Expr*, int*);
12821 SQLITE_PRIVATE int sqlite3ExprCanBeNull(const Expr*);
12822 SQLITE_PRIVATE int sqlite3ExprNeedsNoAffinityChange(const Expr*, char);
12823 SQLITE_PRIVATE int sqlite3IsRowid(const char*);
12824 SQLITE_PRIVATE void sqlite3GenerateRowDelete(Parse*,Table*,Trigger*,int,int,int,i16,u8,u8,u8);
@@ -13060,11 +13228,11 @@
13060 SQLITE_PRIVATE int sqlite3OpenTempDatabase(Parse *);
13061
13062 SQLITE_PRIVATE void sqlite3StrAccumInit(StrAccum*, char*, int, int);
13063 SQLITE_PRIVATE void sqlite3StrAccumAppend(StrAccum*,const char*,int);
13064 SQLITE_PRIVATE void sqlite3StrAccumAppendAll(StrAccum*,const char*);
13065 SQLITE_PRIVATE void sqlite3AppendSpace(StrAccum*,int);
13066 SQLITE_PRIVATE char *sqlite3StrAccumFinish(StrAccum*);
13067 SQLITE_PRIVATE void sqlite3StrAccumReset(StrAccum*);
13068 SQLITE_PRIVATE void sqlite3SelectDestInit(SelectDest*,int,int);
13069 SQLITE_PRIVATE Expr *sqlite3CreateColumnExpr(sqlite3 *, SrcList *, int, int);
13070
@@ -13472,15 +13640,23 @@
13472 ** compatibility for legacy applications, the URI filename capability is
13473 ** disabled by default.
13474 **
13475 ** EVIDENCE-OF: R-38799-08373 URI filenames can be enabled or disabled
13476 ** using the SQLITE_USE_URI=1 or SQLITE_USE_URI=0 compile-time options.
 
 
 
 
13477 */
13478 #ifndef SQLITE_USE_URI
13479 # define SQLITE_USE_URI 0
13480 #endif
13481
 
 
 
 
13482 #ifndef SQLITE_ALLOW_COVERING_INDEX_SCAN
13483 # define SQLITE_ALLOW_COVERING_INDEX_SCAN 1
13484 #endif
13485
13486 /*
@@ -13566,12 +13742,12 @@
13566 ** than 1 GiB. The sqlite3_test_control() interface can be used to
13567 ** move the pending byte.
13568 **
13569 ** IMPORTANT: Changing the pending byte to any value other than
13570 ** 0x40000000 results in an incompatible database file format!
13571 ** Changing the pending byte during operating results in undefined
13572 ** and dileterious behavior.
13573 */
13574 #ifndef SQLITE_OMIT_WSD
13575 SQLITE_PRIVATE int sqlite3PendingByte = 0x40000000;
13576 #endif
13577
@@ -13646,10 +13822,13 @@
13646 #ifdef SQLITE_DISABLE_DIRSYNC
13647 "DISABLE_DIRSYNC",
13648 #endif
13649 #ifdef SQLITE_DISABLE_LFS
13650 "DISABLE_LFS",
 
 
 
13651 #endif
13652 #ifdef SQLITE_ENABLE_ATOMIC_WRITE
13653 "ENABLE_ATOMIC_WRITE",
13654 #endif
13655 #ifdef SQLITE_ENABLE_CEROD
@@ -13972,10 +14151,17 @@
13972 ** The name can optionally begin with "SQLITE_" but the "SQLITE_" prefix
13973 ** is not required for a match.
13974 */
13975 SQLITE_API int sqlite3_compileoption_used(const char *zOptName){
13976 int i, n;
 
 
 
 
 
 
 
13977 if( sqlite3StrNICmp(zOptName, "SQLITE_", 7)==0 ) zOptName += 7;
13978 n = sqlite3Strlen30(zOptName);
13979
13980 /* Since ArraySize(azCompileOpt) is normally in single digits, a
13981 ** linear search is adequate. No need for a binary search. */
@@ -14153,10 +14339,11 @@
14153 typedef struct VdbeFrame VdbeFrame;
14154 struct VdbeFrame {
14155 Vdbe *v; /* VM this frame belongs to */
14156 VdbeFrame *pParent; /* Parent of this frame, or NULL if parent is main */
14157 Op *aOp; /* Program instructions for parent frame */
 
14158 Mem *aMem; /* Array of memory cells for parent frame */
14159 u8 *aOnceFlag; /* Array of OP_Once flags for parent frame */
14160 VdbeCursor **apCsr; /* Array of Vdbe cursors for parent frame */
14161 void *token; /* Copy of SubProgram.token */
14162 i64 lastRowid; /* Last insert rowid (sqlite3.lastRowid) */
@@ -14165,11 +14352,12 @@
14165 int nOp; /* Size of aOp array */
14166 int nMem; /* Number of entries in aMem */
14167 int nOnceFlag; /* Number of entries in aOnceFlag */
14168 int nChildMem; /* Number of memory cells for child frame */
14169 int nChildCsr; /* Number of cursors for child frame */
14170 int nChange; /* Statement changes (Vdbe.nChanges) */
 
14171 };
14172
14173 #define VdbeFrameMem(p) ((Mem *)&((u8 *)p)[ROUND8(sizeof(VdbeFrame))])
14174
14175 /*
@@ -14316,10 +14504,20 @@
14316 /* A bitfield type for use inside of structures. Always follow with :N where
14317 ** N is the number of bits.
14318 */
14319 typedef unsigned bft; /* Bit Field Type */
14320
 
 
 
 
 
 
 
 
 
 
14321 /*
14322 ** An instance of the virtual machine. This structure contains the complete
14323 ** state of the virtual machine.
14324 **
14325 ** The "sqlite3_stmt" structure pointer that is returned by sqlite3_prepare()
@@ -14388,10 +14586,15 @@
14388 u32 expmask; /* Binding to these vars invalidates VM */
14389 SubProgram *pProgram; /* Linked list of all sub-programs used by VM */
14390 int nOnceFlag; /* Size of array aOnceFlag[] */
14391 u8 *aOnceFlag; /* Flags for OP_Once */
14392 AuxData *pAuxData; /* Linked list of auxdata allocations */
 
 
 
 
 
14393 };
14394
14395 /*
14396 ** The following are allowed values for Vdbe.magic
14397 */
@@ -14577,10 +14780,13 @@
14577 SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag){
14578 wsdStatInit;
14579 if( op<0 || op>=ArraySize(wsdStat.nowValue) ){
14580 return SQLITE_MISUSE_BKPT;
14581 }
 
 
 
14582 *pCurrent = wsdStat.nowValue[op];
14583 *pHighwater = wsdStat.mxValue[op];
14584 if( resetFlag ){
14585 wsdStat.mxValue[op] = wsdStat.nowValue[op];
14586 }
@@ -14596,10 +14802,15 @@
14596 int *pCurrent, /* Write current value here */
14597 int *pHighwater, /* Write high-water mark here */
14598 int resetFlag /* Reset high-water mark if true */
14599 ){
14600 int rc = SQLITE_OK; /* Return code */
 
 
 
 
 
14601 sqlite3_mutex_enter(db->mutex);
14602 switch( op ){
14603 case SQLITE_DBSTATUS_LOOKASIDE_USED: {
14604 *pCurrent = db->lookaside.nOut;
14605 *pHighwater = db->lookaside.mxOut;
@@ -14774,11 +14985,11 @@
14774 **
14775 ** There is only one exported symbol in this file - the function
14776 ** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
14777 ** All other code has file scope.
14778 **
14779 ** SQLite processes all times and dates as Julian Day numbers. The
14780 ** dates and times are stored as the number of days since noon
14781 ** in Greenwich on November 24, 4714 B.C. according to the Gregorian
14782 ** calendar system.
14783 **
14784 ** 1970-01-01 00:00:00 is JD 2440587.5
@@ -14789,11 +15000,11 @@
14789 ** be represented, even though julian day numbers allow a much wider
14790 ** range of dates.
14791 **
14792 ** The Gregorian calendar system is used for all dates and times,
14793 ** even those that predate the Gregorian calendar. Historians usually
14794 ** use the Julian calendar for dates prior to 1582-10-15 and for some
14795 ** dates afterwards, depending on locale. Beware of this difference.
14796 **
14797 ** The conversion algorithms are implemented based on descriptions
14798 ** in the following text:
14799 **
@@ -15061,11 +15272,11 @@
15061 return 1;
15062 }
15063 }
15064
15065 /*
15066 ** Attempt to parse the given string into a Julian Day Number. Return
15067 ** the number of errors.
15068 **
15069 ** The following are acceptable forms for the input string:
15070 **
15071 ** YYYY-MM-DD HH:MM:SS.FFF +/-HH:MM
@@ -15632,11 +15843,11 @@
15632 **
15633 ** %d day of month
15634 ** %f ** fractional seconds SS.SSS
15635 ** %H hour 00-24
15636 ** %j day of year 000-366
15637 ** %J ** Julian day number
15638 ** %m month 01-12
15639 ** %M minute 00-59
15640 ** %s seconds since 1970-01-01
15641 ** %S seconds 00-59
15642 ** %w day of week 0-6 sunday==0
@@ -16257,10 +16468,14 @@
16257 MUTEX_LOGIC(sqlite3_mutex *mutex;)
16258 #ifndef SQLITE_OMIT_AUTOINIT
16259 int rc = sqlite3_initialize();
16260 if( rc ) return rc;
16261 #endif
 
 
 
 
16262 MUTEX_LOGIC( mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); )
16263 sqlite3_mutex_enter(mutex);
16264 vfsUnlink(pVfs);
16265 if( makeDflt || vfsList==0 ){
16266 pVfs->pNext = vfsList;
@@ -18614,10 +18829,11 @@
18614 ** Retrieve a pointer to a static mutex or allocate a new dynamic one.
18615 */
18616 SQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int id){
18617 #ifndef SQLITE_OMIT_AUTOINIT
18618 if( id<=SQLITE_MUTEX_RECURSIVE && sqlite3_initialize() ) return 0;
 
18619 #endif
18620 return sqlite3GlobalConfig.mutex.xMutexAlloc(id);
18621 }
18622
18623 SQLITE_PRIVATE sqlite3_mutex *sqlite3MutexAlloc(int id){
@@ -19070,12 +19286,16 @@
19070 pthread_mutex_init(&p->mutex, 0);
19071 }
19072 break;
19073 }
19074 default: {
19075 assert( iType-2 >= 0 );
19076 assert( iType-2 < ArraySize(staticMutexes) );
 
 
 
 
19077 p = &staticMutexes[iType-2];
19078 #if SQLITE_MUTEX_NREF
19079 p->id = iType;
19080 #endif
19081 break;
@@ -20293,15 +20513,16 @@
20293 }
20294 assert( sqlite3_mutex_notheld(mem0.mutex) );
20295
20296
20297 #if SQLITE_THREADSAFE==0 && !defined(NDEBUG)
20298 /* Verify that no more than two scratch allocations per thread
20299 ** are outstanding at one time. (This is only checked in the
20300 ** single-threaded case since checking in the multi-threaded case
20301 ** would be much more complicated.) */
20302 assert( scratchAllocOut<=1 );
 
20303 if( p ) scratchAllocOut++;
20304 #endif
20305
20306 return p;
20307 }
@@ -20945,11 +21166,11 @@
20945 sqlite_uint64 longvalue; /* Value for integer types */
20946 LONGDOUBLE_TYPE realvalue; /* Value for real types */
20947 const et_info *infop; /* Pointer to the appropriate info structure */
20948 char *zOut; /* Rendering buffer */
20949 int nOut; /* Size of the rendering buffer */
20950 char *zExtra; /* Malloced memory used by some conversion */
20951 #ifndef SQLITE_OMIT_FLOATING_POINT
20952 int exp, e2; /* exponent of real numbers */
20953 int nsd; /* Number of significant digits returned */
20954 double rounder; /* Used for rounding floating point values */
20955 etByte flag_dp; /* True if decimal point should be shown */
@@ -20956,10 +21177,17 @@
20956 etByte flag_rtz; /* True if trailing zeros should be removed */
20957 #endif
20958 PrintfArguments *pArgList = 0; /* Arguments for SQLITE_PRINTF_SQLFUNC */
20959 char buf[etBUFSIZE]; /* Conversion buffer */
20960
 
 
 
 
 
 
 
20961 bufpt = 0;
20962 if( bFlags ){
20963 if( (bArgList = (bFlags & SQLITE_PRINTF_SQLFUNC))!=0 ){
20964 pArgList = va_arg(ap, PrintfArguments*);
20965 }
@@ -21062,11 +21290,10 @@
21062 return;
21063 }
21064 break;
21065 }
21066 }
21067 zExtra = 0;
21068
21069 /*
21070 ** At this point, variables are initialized as follows:
21071 **
21072 ** flag_alternateform TRUE if a '#' is present.
@@ -21353,17 +21580,20 @@
21353 bufpt = getTextArg(pArgList);
21354 c = bufpt ? bufpt[0] : 0;
21355 }else{
21356 c = va_arg(ap,int);
21357 }
21358 buf[0] = (char)c;
21359 if( precision>=0 ){
21360 for(idx=1; idx<precision; idx++) buf[idx] = (char)c;
21361 length = precision;
21362 }else{
21363 length =1;
 
21364 }
 
 
21365 bufpt = buf;
21366 break;
21367 case etSTRING:
21368 case etDYNSTRING:
21369 if( bArgList ){
@@ -21460,15 +21690,18 @@
21460 ** The text of the conversion is pointed to by "bufpt" and is
21461 ** "length" characters long. The field width is "width". Do
21462 ** the output.
21463 */
21464 width -= length;
21465 if( width>0 && !flag_leftjustify ) sqlite3AppendSpace(pAccum, width);
21466 sqlite3StrAccumAppend(pAccum, bufpt, length);
21467 if( width>0 && flag_leftjustify ) sqlite3AppendSpace(pAccum, width);
21468
21469 if( zExtra ) sqlite3_free(zExtra);
 
 
 
21470 }/* End for loop over the format string */
21471 } /* End of function */
21472
21473 /*
21474 ** Enlarge the memory allocation on a StrAccum object so that it is
@@ -21491,10 +21724,15 @@
21491 return N;
21492 }else{
21493 char *zOld = (p->zText==p->zBase ? 0 : p->zText);
21494 i64 szNew = p->nChar;
21495 szNew += N + 1;
 
 
 
 
 
21496 if( szNew > p->mxAlloc ){
21497 sqlite3StrAccumReset(p);
21498 setStrAccumError(p, STRACCUM_TOOBIG);
21499 return 0;
21500 }else{
@@ -21507,10 +21745,11 @@
21507 }
21508 if( zNew ){
21509 assert( p->zText!=0 || p->nChar==0 );
21510 if( zOld==0 && p->nChar>0 ) memcpy(zNew, p->zText, p->nChar);
21511 p->zText = zNew;
 
21512 }else{
21513 sqlite3StrAccumReset(p);
21514 setStrAccumError(p, STRACCUM_NOMEM);
21515 return 0;
21516 }
@@ -21517,15 +21756,15 @@
21517 }
21518 return N;
21519 }
21520
21521 /*
21522 ** Append N space characters to the given string buffer.
21523 */
21524 SQLITE_PRIVATE void sqlite3AppendSpace(StrAccum *p, int N){
21525 if( p->nChar+N >= p->nAlloc && (N = sqlite3StrAccumEnlarge(p, N))<=0 ) return;
21526 while( (N--)>0 ) p->zText[p->nChar++] = ' ';
21527 }
21528
21529 /*
21530 ** The StrAccum "p" is not large enough to accept N new bytes of z[].
21531 ** So enlarge if first, then do the append.
@@ -21676,10 +21915,17 @@
21676 */
21677 SQLITE_API char *sqlite3_vmprintf(const char *zFormat, va_list ap){
21678 char *z;
21679 char zBase[SQLITE_PRINT_BUF_SIZE];
21680 StrAccum acc;
 
 
 
 
 
 
 
21681 #ifndef SQLITE_OMIT_AUTOINIT
21682 if( sqlite3_initialize() ) return 0;
21683 #endif
21684 sqlite3StrAccumInit(&acc, zBase, sizeof(zBase), SQLITE_MAX_LENGTH);
21685 acc.useMalloc = 2;
@@ -21718,10 +21964,17 @@
21718 ** sqlite3_vsnprintf() is the varargs version.
21719 */
21720 SQLITE_API char *sqlite3_vsnprintf(int n, char *zBuf, const char *zFormat, va_list ap){
21721 StrAccum acc;
21722 if( n<=0 ) return zBuf;
 
 
 
 
 
 
 
21723 sqlite3StrAccumInit(&acc, zBuf, n, 0);
21724 acc.useMalloc = 0;
21725 sqlite3VXPrintf(&acc, 0, zFormat, ap);
21726 return sqlite3StrAccumFinish(&acc);
21727 }
@@ -21909,15 +22162,23 @@
21909 #else
21910 # define wsdPrng sqlite3Prng
21911 #endif
21912
21913 #if SQLITE_THREADSAFE
21914 sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_PRNG);
 
 
 
 
 
 
 
 
 
 
21915 sqlite3_mutex_enter(mutex);
21916 #endif
21917
21918 if( N<=0 ){
21919 wsdPrng.isInit = 0;
21920 sqlite3_mutex_leave(mutex);
21921 return;
21922 }
21923
@@ -23035,17 +23296,27 @@
23035 ** case-independent fashion, using the same definition of "case
23036 ** independence" that SQLite uses internally when comparing identifiers.
23037 */
23038 SQLITE_API int sqlite3_stricmp(const char *zLeft, const char *zRight){
23039 register unsigned char *a, *b;
 
 
 
 
 
23040 a = (unsigned char *)zLeft;
23041 b = (unsigned char *)zRight;
23042 while( *a!=0 && UpperToLower[*a]==UpperToLower[*b]){ a++; b++; }
23043 return UpperToLower[*a] - UpperToLower[*b];
23044 }
23045 SQLITE_API int sqlite3_strnicmp(const char *zLeft, const char *zRight, int N){
23046 register unsigned char *a, *b;
 
 
 
 
 
23047 a = (unsigned char *)zLeft;
23048 b = (unsigned char *)zRight;
23049 while( N-- > 0 && *a!=0 && UpperToLower[*a]==UpperToLower[*b]){ a++; b++; }
23050 return N<0 ? 0 : UpperToLower[*a] - UpperToLower[*b];
23051 }
@@ -32574,10 +32845,15 @@
32574 #if !SQLITE_OS_WINNT && !defined(SQLITE_OMIT_WAL)
32575 # error "WAL mode requires support from the Windows NT kernel, compile\
32576 with SQLITE_OMIT_WAL."
32577 #endif
32578
 
 
 
 
 
32579 /*
32580 ** Are most of the Win32 ANSI APIs available (i.e. with certain exceptions
32581 ** based on the sub-platform)?
32582 */
32583 #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && !defined(SQLITE_WIN32_NO_ANSI)
@@ -32703,14 +32979,15 @@
32703 # define winGetDirSep() '\\'
32704 #endif
32705
32706 /*
32707 ** Do we need to manually define the Win32 file mapping APIs for use with WAL
32708 ** mode (e.g. these APIs are available in the Windows CE SDK; however, they
32709 ** are not present in the header file)?
32710 */
32711 #if SQLITE_WIN32_FILEMAPPING_API && !defined(SQLITE_OMIT_WAL)
 
32712 /*
32713 ** Two of the file mapping APIs are different under WinRT. Figure out which
32714 ** set we need.
32715 */
32716 #if SQLITE_OS_WINRT
@@ -32734,11 +33011,11 @@
32734
32735 /*
32736 ** This file mapping API is common to both Win32 and WinRT.
32737 */
32738 WINBASEAPI BOOL WINAPI UnmapViewOfFile(LPCVOID);
32739 #endif /* SQLITE_WIN32_FILEMAPPING_API && !defined(SQLITE_OMIT_WAL) */
32740
32741 /*
32742 ** Some Microsoft compilers lack this definition.
32743 */
32744 #ifndef INVALID_FILE_ATTRIBUTES
@@ -33027,21 +33304,21 @@
33027
33028 #define osCreateFileW ((HANDLE(WINAPI*)(LPCWSTR,DWORD,DWORD, \
33029 LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE))aSyscall[5].pCurrent)
33030
33031 #if (!SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_ANSI) && \
33032 !defined(SQLITE_OMIT_WAL))
33033 { "CreateFileMappingA", (SYSCALL)CreateFileMappingA, 0 },
33034 #else
33035 { "CreateFileMappingA", (SYSCALL)0, 0 },
33036 #endif
33037
33038 #define osCreateFileMappingA ((HANDLE(WINAPI*)(HANDLE,LPSECURITY_ATTRIBUTES, \
33039 DWORD,DWORD,DWORD,LPCSTR))aSyscall[6].pCurrent)
33040
33041 #if SQLITE_OS_WINCE || (!SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) && \
33042 !defined(SQLITE_OMIT_WAL))
33043 { "CreateFileMappingW", (SYSCALL)CreateFileMappingW, 0 },
33044 #else
33045 { "CreateFileMappingW", (SYSCALL)0, 0 },
33046 #endif
33047
@@ -33377,11 +33654,12 @@
33377 #ifndef osLockFileEx
33378 #define osLockFileEx ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD,DWORD, \
33379 LPOVERLAPPED))aSyscall[48].pCurrent)
33380 #endif
33381
33382 #if SQLITE_OS_WINCE || (!SQLITE_OS_WINRT && !defined(SQLITE_OMIT_WAL))
 
33383 { "MapViewOfFile", (SYSCALL)MapViewOfFile, 0 },
33384 #else
33385 { "MapViewOfFile", (SYSCALL)0, 0 },
33386 #endif
33387
@@ -33447,11 +33725,11 @@
33447 #endif
33448
33449 #define osUnlockFileEx ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \
33450 LPOVERLAPPED))aSyscall[58].pCurrent)
33451
33452 #if SQLITE_OS_WINCE || !defined(SQLITE_OMIT_WAL)
33453 { "UnmapViewOfFile", (SYSCALL)UnmapViewOfFile, 0 },
33454 #else
33455 { "UnmapViewOfFile", (SYSCALL)0, 0 },
33456 #endif
33457
@@ -33510,11 +33788,11 @@
33510 #endif
33511
33512 #define osGetFileInformationByHandleEx ((BOOL(WINAPI*)(HANDLE, \
33513 FILE_INFO_BY_HANDLE_CLASS,LPVOID,DWORD))aSyscall[66].pCurrent)
33514
33515 #if SQLITE_OS_WINRT && !defined(SQLITE_OMIT_WAL)
33516 { "MapViewOfFileFromApp", (SYSCALL)MapViewOfFileFromApp, 0 },
33517 #else
33518 { "MapViewOfFileFromApp", (SYSCALL)0, 0 },
33519 #endif
33520
@@ -33574,11 +33852,11 @@
33574
33575 { "GetProcessHeap", (SYSCALL)GetProcessHeap, 0 },
33576
33577 #define osGetProcessHeap ((HANDLE(WINAPI*)(VOID))aSyscall[74].pCurrent)
33578
33579 #if SQLITE_OS_WINRT && !defined(SQLITE_OMIT_WAL)
33580 { "CreateFileMappingFromApp", (SYSCALL)CreateFileMappingFromApp, 0 },
33581 #else
33582 { "CreateFileMappingFromApp", (SYSCALL)0, 0 },
33583 #endif
33584
@@ -39150,10 +39428,17 @@
39150 */
39151 SQLITE_PRIVATE void sqlite3PcacheShrink(PCache *pCache){
39152 assert( pCache->pCache!=0 );
39153 sqlite3GlobalConfig.pcache2.xShrink(pCache->pCache);
39154 }
 
 
 
 
 
 
 
39155
39156 #if defined(SQLITE_CHECK_PAGES) || defined(SQLITE_DEBUG)
39157 /*
39158 ** For all dirty pages currently in the cache, invoke the specified
39159 ** callback. This is only used if the SQLITE_CHECK_PAGES macro is
@@ -40149,10 +40434,15 @@
40149 pcache1Shrink /* xShrink */
40150 };
40151 sqlite3_config(SQLITE_CONFIG_PCACHE2, &defaultMethods);
40152 }
40153
 
 
 
 
 
40154 #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
40155 /*
40156 ** This function is called to free superfluous dynamically allocated memory
40157 ** held by the pager system. Memory in use by any SQLite pager allocated
40158 ** by the current thread may be sqlite3_free()ed.
@@ -43758,11 +44048,11 @@
43758 ** should be page numbers which are never 0xffffffff. So filling
43759 ** pPager->dbFileVers[] with all 0xff bytes should suffice.
43760 **
43761 ** For an encrypted database, the situation is more complex: bytes
43762 ** 24..39 of the database are white noise. But the probability of
43763 ** white noising equaling 16 bytes of 0xff is vanishingly small so
43764 ** we should still be ok.
43765 */
43766 memset(pPager->dbFileVers, 0xff, sizeof(pPager->dbFileVers));
43767 }else{
43768 u8 *dbFileVers = &((u8*)pPg->pData)[24];
@@ -47705,10 +47995,22 @@
47705 }
47706
47707 return SQLITE_OK;
47708 }
47709 #endif
 
 
 
 
 
 
 
 
 
 
 
 
47710
47711 /*
47712 ** Return a pointer to the data for the specified page.
47713 */
47714 SQLITE_PRIVATE void *sqlite3PagerGetData(DbPage *pPg){
@@ -47922,11 +48224,12 @@
47922 */
47923 SQLITE_PRIVATE int sqlite3PagerCheckpoint(Pager *pPager, int eMode, int *pnLog, int *pnCkpt){
47924 int rc = SQLITE_OK;
47925 if( pPager->pWal ){
47926 rc = sqlite3WalCheckpoint(pPager->pWal, eMode,
47927 pPager->xBusyHandler, pPager->pBusyHandlerArg,
 
47928 pPager->ckptSyncFlags, pPager->pageSize, (u8 *)pPager->pTmpSpace,
47929 pnLog, pnCkpt
47930 );
47931 }
47932 return rc;
@@ -48103,10 +48406,11 @@
48103 SQLITE_PRIVATE int sqlite3PagerWalFramesize(Pager *pPager){
48104 assert( pPager->eState>=PAGER_READER );
48105 return sqlite3WalFramesize(pPager->pWal);
48106 }
48107 #endif
 
48108
48109 #endif /* SQLITE_OMIT_DISKIO */
48110
48111 /************** End of pager.c ***********************************************/
48112 /************** Begin file wal.c *********************************************/
@@ -49613,11 +49917,11 @@
49613
49614 /*
49615 ** Free an iterator allocated by walIteratorInit().
49616 */
49617 static void walIteratorFree(WalIterator *p){
49618 sqlite3ScratchFree(p);
49619 }
49620
49621 /*
49622 ** Construct a WalInterator object that can be used to loop over all
49623 ** pages in the WAL in ascending order. The caller must hold the checkpoint
@@ -49648,21 +49952,21 @@
49648 /* Allocate space for the WalIterator object. */
49649 nSegment = walFramePage(iLast) + 1;
49650 nByte = sizeof(WalIterator)
49651 + (nSegment-1)*sizeof(struct WalSegment)
49652 + iLast*sizeof(ht_slot);
49653 p = (WalIterator *)sqlite3ScratchMalloc(nByte);
49654 if( !p ){
49655 return SQLITE_NOMEM;
49656 }
49657 memset(p, 0, nByte);
49658 p->nSegment = nSegment;
49659
49660 /* Allocate temporary space used by the merge-sort routine. This block
49661 ** of memory will be freed before this function returns.
49662 */
49663 aTmp = (ht_slot *)sqlite3ScratchMalloc(
49664 sizeof(ht_slot) * (iLast>HASHTABLE_NPAGE?HASHTABLE_NPAGE:iLast)
49665 );
49666 if( !aTmp ){
49667 rc = SQLITE_NOMEM;
49668 }
@@ -49695,11 +49999,11 @@
49695 p->aSegment[i].nEntry = nEntry;
49696 p->aSegment[i].aIndex = aIndex;
49697 p->aSegment[i].aPgno = (u32 *)aPgno;
49698 }
49699 }
49700 sqlite3ScratchFree(aTmp);
49701
49702 if( rc!=SQLITE_OK ){
49703 walIteratorFree(p);
49704 }
49705 *pp = p;
@@ -49731,10 +50035,42 @@
49731 ** Return the page-size in bytes used by the database.
49732 */
49733 static int walPagesize(Wal *pWal){
49734 return (pWal->hdr.szPage&0xfe00) + ((pWal->hdr.szPage&0x0001)<<16);
49735 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49736
49737 /*
49738 ** Copy as much content as we can from the WAL back into the database file
49739 ** in response to an sqlite3_wal_checkpoint() request or the equivalent.
49740 **
@@ -49766,11 +50102,11 @@
49766 ** time.
49767 */
49768 static int walCheckpoint(
49769 Wal *pWal, /* Wal connection */
49770 int eMode, /* One of PASSIVE, FULL or RESTART */
49771 int (*xBusyCall)(void*), /* Function to call when busy */
49772 void *pBusyArg, /* Context argument for xBusyHandler */
49773 int sync_flags, /* Flags for OsSync() (or 0) */
49774 u8 *zBuf /* Temporary buffer to use */
49775 ){
49776 int rc; /* Return code */
@@ -49780,11 +50116,10 @@
49780 u32 iFrame = 0; /* Wal frame containing data for iDbpage */
49781 u32 mxSafeFrame; /* Max frame that can be backfilled */
49782 u32 mxPage; /* Max database page to write */
49783 int i; /* Loop counter */
49784 volatile WalCkptInfo *pInfo; /* The checkpoint status information */
49785 int (*xBusy)(void*) = 0; /* Function to call when waiting for locks */
49786
49787 szPage = walPagesize(pWal);
49788 testcase( szPage<=32768 );
49789 testcase( szPage>=65536 );
49790 pInfo = walCkptInfo(pWal);
@@ -49795,11 +50130,13 @@
49795 if( rc!=SQLITE_OK ){
49796 return rc;
49797 }
49798 assert( pIter );
49799
49800 if( eMode!=SQLITE_CHECKPOINT_PASSIVE ) xBusy = xBusyCall;
 
 
49801
49802 /* Compute in mxSafeFrame the index of the last frame of the WAL that is
49803 ** safe to write into the database. Frames beyond mxSafeFrame might
49804 ** overwrite database pages that are in use by active readers and thus
49805 ** cannot be backfilled from the WAL.
@@ -49884,23 +50221,42 @@
49884 /* Reset the return code so as not to report a checkpoint failure
49885 ** just because there are active readers. */
49886 rc = SQLITE_OK;
49887 }
49888
49889 /* If this is an SQLITE_CHECKPOINT_RESTART operation, and the entire wal
49890 ** file has been copied into the database file, then block until all
49891 ** readers have finished using the wal file. This ensures that the next
49892 ** process to write to the database restarts the wal file.
49893 */
49894 if( rc==SQLITE_OK && eMode!=SQLITE_CHECKPOINT_PASSIVE ){
49895 assert( pWal->writeLock );
49896 if( pInfo->nBackfill<pWal->hdr.mxFrame ){
49897 rc = SQLITE_BUSY;
49898 }else if( eMode==SQLITE_CHECKPOINT_RESTART ){
 
 
49899 assert( mxSafeFrame==pWal->hdr.mxFrame );
49900 rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_READ_LOCK(1), WAL_NREADER-1);
49901 if( rc==SQLITE_OK ){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49902 walUnlockExclusive(pWal, WAL_READ_LOCK(1), WAL_NREADER-1);
49903 }
49904 }
49905 }
49906
@@ -50634,11 +50990,10 @@
50634 assert( walFramePgno(pWal, iFrame)!=1 );
50635 rc = xUndo(pUndoCtx, walFramePgno(pWal, iFrame));
50636 }
50637 if( iMax!=pWal->hdr.mxFrame ) walCleanupHash(pWal);
50638 }
50639 assert( rc==SQLITE_OK );
50640 return rc;
50641 }
50642
50643 /*
50644 ** Argument aWalData must point to an array of WAL_SAVEPOINT_NDATA u32
@@ -50683,11 +51038,10 @@
50683 }
50684
50685 return rc;
50686 }
50687
50688
50689 /*
50690 ** This function is called just before writing a set of frames to the log
50691 ** file (see sqlite3WalFrames()). It checks to see if, instead of appending
50692 ** to the current log file, it is possible to overwrite the start of the
50693 ** existing log file with the new frames (i.e. "reset" the log). If so,
@@ -50716,24 +51070,12 @@
50716 ** wal-index header to reflect this.
50717 **
50718 ** In theory it would be Ok to update the cache of the header only
50719 ** at this point. But updating the actual wal-index header is also
50720 ** safe and means there is no special case for sqlite3WalUndo()
50721 ** to handle if this transaction is rolled back.
50722 */
50723 int i; /* Loop counter */
50724 u32 *aSalt = pWal->hdr.aSalt; /* Big-endian salt values */
50725
50726 pWal->nCkpt++;
50727 pWal->hdr.mxFrame = 0;
50728 sqlite3Put4byte((u8*)&aSalt[0], 1 + sqlite3Get4byte((u8*)&aSalt[0]));
50729 aSalt[1] = salt1;
50730 walIndexWriteHdr(pWal);
50731 pInfo->nBackfill = 0;
50732 pInfo->aReadMark[1] = 0;
50733 for(i=2; i<WAL_NREADER; i++) pInfo->aReadMark[i] = READMARK_NOT_USED;
50734 assert( pInfo->aReadMark[0]==0 );
50735 walUnlockExclusive(pWal, WAL_READ_LOCK(1), WAL_NREADER-1);
50736 }else if( rc!=SQLITE_BUSY ){
50737 return rc;
50738 }
50739 }
@@ -51017,11 +51359,11 @@
51017 ** If parameter xBusy is not NULL, it is a pointer to a busy-handler
51018 ** callback. In this case this function runs a blocking checkpoint.
51019 */
51020 SQLITE_PRIVATE int sqlite3WalCheckpoint(
51021 Wal *pWal, /* Wal connection */
51022 int eMode, /* PASSIVE, FULL or RESTART */
51023 int (*xBusy)(void*), /* Function to call when busy */
51024 void *pBusyArg, /* Context argument for xBusyHandler */
51025 int sync_flags, /* Flags to sync db file with (or 0) */
51026 int nBuf, /* Size of temporary buffer */
51027 u8 *zBuf, /* Temporary buffer to use */
@@ -51029,40 +51371,54 @@
51029 int *pnCkpt /* OUT: Number of backfilled frames in WAL */
51030 ){
51031 int rc; /* Return code */
51032 int isChanged = 0; /* True if a new wal-index header is loaded */
51033 int eMode2 = eMode; /* Mode to pass to walCheckpoint() */
 
51034
51035 assert( pWal->ckptLock==0 );
51036 assert( pWal->writeLock==0 );
51037
 
 
 
 
51038 if( pWal->readOnly ) return SQLITE_READONLY;
51039 WALTRACE(("WAL%p: checkpoint begins\n", pWal));
 
 
 
51040 rc = walLockExclusive(pWal, WAL_CKPT_LOCK, 1);
51041 if( rc ){
51042 /* Usually this is SQLITE_BUSY meaning that another thread or process
51043 ** is already running a checkpoint, or maybe a recovery. But it might
51044 ** also be SQLITE_IOERR. */
 
 
 
 
 
51045 return rc;
51046 }
51047 pWal->ckptLock = 1;
51048
51049 /* If this is a blocking-checkpoint, then obtain the write-lock as well
51050 ** to prevent any writers from running while the checkpoint is underway.
51051 ** This has to be done before the call to walIndexReadHdr() below.
51052 **
51053 ** If the writer lock cannot be obtained, then a passive checkpoint is
51054 ** run instead. Since the checkpointer is not holding the writer lock,
51055 ** there is no point in blocking waiting for any readers. Assuming no
51056 ** other error occurs, this function will return SQLITE_BUSY to the caller.
51057 */
51058 if( eMode!=SQLITE_CHECKPOINT_PASSIVE ){
51059 rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_WRITE_LOCK, 1);
51060 if( rc==SQLITE_OK ){
51061 pWal->writeLock = 1;
51062 }else if( rc==SQLITE_BUSY ){
51063 eMode2 = SQLITE_CHECKPOINT_PASSIVE;
 
51064 rc = SQLITE_OK;
51065 }
51066 }
51067
51068 /* Read the wal-index header. */
@@ -51076,11 +51432,11 @@
51076 /* Copy data from the log to the database file. */
51077 if( rc==SQLITE_OK ){
51078 if( pWal->hdr.mxFrame && walPagesize(pWal)!=nBuf ){
51079 rc = SQLITE_CORRUPT_BKPT;
51080 }else{
51081 rc = walCheckpoint(pWal, eMode2, xBusy, pBusyArg, sync_flags, zBuf);
51082 }
51083
51084 /* If no error occurred, set the output variables. */
51085 if( rc==SQLITE_OK || rc==SQLITE_BUSY ){
51086 if( pnLog ) *pnLog = (int)pWal->hdr.mxFrame;
@@ -51713,10 +52069,15 @@
51713 ** but cursors cannot be shared. Each cursor is associated with a
51714 ** particular database connection identified BtCursor.pBtree.db.
51715 **
51716 ** Fields in this structure are accessed under the BtShared.mutex
51717 ** found at self->pBt->mutex.
 
 
 
 
 
51718 */
51719 struct BtCursor {
51720 Btree *pBtree; /* The Btree to which this cursor belongs */
51721 BtShared *pBt; /* The BtShared this cursor points to */
51722 BtCursor *pNext, *pPrev; /* Forms a linked list of all cursors */
@@ -51725,11 +52086,12 @@
51725 CellInfo info; /* A parse of the cell we are pointing at */
51726 i64 nKey; /* Size of pKey, or last integer key */
51727 void *pKey; /* Saved key that was cursor last known position */
51728 Pgno pgnoRoot; /* The root page of this tree */
51729 int nOvflAlloc; /* Allocated size of aOverflow[] array */
51730 int skipNext; /* Prev() is noop if negative. Next() is noop if positive */
 
51731 u8 curFlags; /* zero or more BTCF_* flags defined below */
51732 u8 eState; /* One of the CURSOR_XXX constants (see below) */
51733 u8 hints; /* As configured by CursorSetHints() */
51734 i16 iPage; /* Index of current page in apPage */
51735 u16 aiIdx[BTCURSOR_MAX_DEPTH]; /* Current index in apPage[i] */
@@ -51771,11 +52133,11 @@
51771 ** CURSOR_FAULT:
51772 ** An unrecoverable error (an I/O error or a malloc failure) has occurred
51773 ** on a different connection that shares the BtShared cache with this
51774 ** cursor. The error has left the cache in an inconsistent state.
51775 ** Do nothing else with this cursor. Any attempt to use the cursor
51776 ** should return the error code stored in BtCursor.skip
51777 */
51778 #define CURSOR_INVALID 0
51779 #define CURSOR_VALID 1
51780 #define CURSOR_SKIPNEXT 2
51781 #define CURSOR_REQUIRESEEK 3
@@ -53321,10 +53683,15 @@
53321 /*
53322 ** Defragment the page given. All Cells are moved to the
53323 ** end of the page and all free space is collected into one
53324 ** big FreeBlk that occurs in between the header and cell
53325 ** pointer array and the cell content area.
 
 
 
 
 
53326 */
53327 static int defragmentPage(MemPage *pPage){
53328 int i; /* Loop counter */
53329 int pc; /* Address of the i-th cell */
53330 int hdr; /* Offset to the page header */
@@ -53333,28 +53700,27 @@
53333 int cellOffset; /* Offset to the cell pointer array */
53334 int cbrk; /* Offset to the cell content area */
53335 int nCell; /* Number of cells on the page */
53336 unsigned char *data; /* The page data */
53337 unsigned char *temp; /* Temp area for cell content */
 
53338 int iCellFirst; /* First allowable cell index */
53339 int iCellLast; /* Last possible cell index */
53340
53341
53342 assert( sqlite3PagerIswriteable(pPage->pDbPage) );
53343 assert( pPage->pBt!=0 );
53344 assert( pPage->pBt->usableSize <= SQLITE_MAX_PAGE_SIZE );
53345 assert( pPage->nOverflow==0 );
53346 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
53347 temp = sqlite3PagerTempSpace(pPage->pBt->pPager);
53348 data = pPage->aData;
53349 hdr = pPage->hdrOffset;
53350 cellOffset = pPage->cellOffset;
53351 nCell = pPage->nCell;
53352 assert( nCell==get2byte(&data[hdr+3]) );
53353 usableSize = pPage->pBt->usableSize;
53354 cbrk = get2byte(&data[hdr+5]);
53355 memcpy(&temp[cbrk], &data[cbrk], usableSize - cbrk);
53356 cbrk = usableSize;
53357 iCellFirst = cellOffset + 2*nCell;
53358 iCellLast = usableSize - 4;
53359 for(i=0; i<nCell; i++){
53360 u8 *pAddr; /* The i-th cell pointer */
@@ -53369,11 +53735,11 @@
53369 if( pc<iCellFirst || pc>iCellLast ){
53370 return SQLITE_CORRUPT_BKPT;
53371 }
53372 #endif
53373 assert( pc>=iCellFirst && pc<=iCellLast );
53374 size = cellSizePtr(pPage, &temp[pc]);
53375 cbrk -= size;
53376 #if defined(SQLITE_ENABLE_OVERSIZE_CELL_CHECK)
53377 if( cbrk<iCellFirst ){
53378 return SQLITE_CORRUPT_BKPT;
53379 }
@@ -53383,12 +53749,20 @@
53383 }
53384 #endif
53385 assert( cbrk+size<=usableSize && cbrk>=iCellFirst );
53386 testcase( cbrk+size==usableSize );
53387 testcase( pc+size==usableSize );
53388 memcpy(&data[cbrk], &temp[pc], size);
53389 put2byte(pAddr, cbrk);
 
 
 
 
 
 
 
 
 
53390 }
53391 assert( cbrk>=iCellFirst );
53392 put2byte(&data[hdr+5], cbrk);
53393 data[hdr+1] = 0;
53394 data[hdr+2] = 0;
@@ -53398,10 +53772,73 @@
53398 if( cbrk-iCellFirst!=pPage->nFree ){
53399 return SQLITE_CORRUPT_BKPT;
53400 }
53401 return SQLITE_OK;
53402 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53403
53404 /*
53405 ** Allocate nByte bytes of space from within the B-Tree page passed
53406 ** as the first argument. Write into *pIdx the index into pPage->aData[]
53407 ** of the first byte of allocated space. Return either SQLITE_OK or
@@ -53416,80 +53853,58 @@
53416 */
53417 static int allocateSpace(MemPage *pPage, int nByte, int *pIdx){
53418 const int hdr = pPage->hdrOffset; /* Local cache of pPage->hdrOffset */
53419 u8 * const data = pPage->aData; /* Local cache of pPage->aData */
53420 int top; /* First byte of cell content area */
 
53421 int gap; /* First byte of gap between cell pointers and cell content */
53422 int rc; /* Integer return code */
53423 int usableSize; /* Usable size of the page */
53424
53425 assert( sqlite3PagerIswriteable(pPage->pDbPage) );
53426 assert( pPage->pBt );
53427 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
53428 assert( nByte>=0 ); /* Minimum cell size is 4 */
53429 assert( pPage->nFree>=nByte );
53430 assert( pPage->nOverflow==0 );
53431 usableSize = pPage->pBt->usableSize;
53432 assert( nByte < usableSize-8 );
53433
53434 assert( pPage->cellOffset == hdr + 12 - 4*pPage->leaf );
53435 gap = pPage->cellOffset + 2*pPage->nCell;
53436 assert( gap<=65536 );
53437 top = get2byte(&data[hdr+5]);
53438 if( gap>top ){
53439 if( top==0 ){
53440 top = 65536;
53441 }else{
53442 return SQLITE_CORRUPT_BKPT;
53443 }
53444 }
53445
53446 /* If there is enough space between gap and top for one more cell pointer
53447 ** array entry offset, and if the freelist is not empty, then search the
53448 ** freelist looking for a free slot big enough to satisfy the request.
53449 */
53450 testcase( gap+2==top );
53451 testcase( gap+1==top );
53452 testcase( gap==top );
53453 if( gap+2<=top && (data[hdr+1] || data[hdr+2]) ){
53454 int pc, addr;
53455 for(addr=hdr+1; (pc = get2byte(&data[addr]))>0; addr=pc){
53456 int size; /* Size of the free slot */
53457 if( pc>usableSize-4 || pc<addr+4 ){
53458 return SQLITE_CORRUPT_BKPT;
53459 }
53460 size = get2byte(&data[pc+2]);
53461 if( size>=nByte ){
53462 int x = size - nByte;
53463 testcase( x==4 );
53464 testcase( x==3 );
53465 if( x<4 ){
53466 if( data[hdr+7]>=60 ) goto defragment_page;
53467 /* Remove the slot from the free-list. Update the number of
53468 ** fragmented bytes within the page. */
53469 memcpy(&data[addr], &data[pc], 2);
53470 data[hdr+7] += (u8)x;
53471 }else if( size+pc > usableSize ){
53472 return SQLITE_CORRUPT_BKPT;
53473 }else{
53474 /* The slot remains on the free-list. Reduce its size to account
53475 ** for the portion used by the new allocation. */
53476 put2byte(&data[pc+2], x);
53477 }
53478 *pIdx = pc + x;
53479 return SQLITE_OK;
53480 }
53481 }
53482 }
53483
53484 /* The request could not be fulfilled using a freelist slot. Check
53485 ** to see if defragmentation is necessary.
53486 */
53487 testcase( gap+2+nByte==top );
53488 if( gap+2+nByte>top ){
53489 defragment_page:
53490 testcase( pPage->nCell==0 );
53491 rc = defragmentPage(pPage);
53492 if( rc ) return rc;
53493 top = get2byteNotZero(&data[hdr+5]);
53494 assert( gap+nByte<=top );
53495 }
@@ -53532,11 +53947,11 @@
53532 unsigned char *data = pPage->aData; /* Page content */
53533
53534 assert( pPage->pBt!=0 );
53535 assert( sqlite3PagerIswriteable(pPage->pDbPage) );
53536 assert( iStart>=pPage->hdrOffset+6+pPage->childPtrSize );
53537 assert( iEnd <= pPage->pBt->usableSize );
53538 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
53539 assert( iSize>=4 ); /* Minimum cell size is 4 */
53540 assert( iStart<=iLast );
53541
53542 /* Overwrite deleted information with zeros when the secure_delete
@@ -53627,22 +54042,36 @@
53627 pPage->leaf = (u8)(flagByte>>3); assert( PTF_LEAF == 1<<3 );
53628 flagByte &= ~PTF_LEAF;
53629 pPage->childPtrSize = 4-4*pPage->leaf;
53630 pBt = pPage->pBt;
53631 if( flagByte==(PTF_LEAFDATA | PTF_INTKEY) ){
 
 
 
 
 
 
53632 pPage->intKey = 1;
53633 pPage->intKeyLeaf = pPage->leaf;
53634 pPage->noPayload = !pPage->leaf;
53635 pPage->maxLocal = pBt->maxLeaf;
53636 pPage->minLocal = pBt->minLeaf;
53637 }else if( flagByte==PTF_ZERODATA ){
 
 
 
 
 
 
53638 pPage->intKey = 0;
53639 pPage->intKeyLeaf = 0;
53640 pPage->noPayload = 0;
53641 pPage->maxLocal = pBt->maxLocal;
53642 pPage->minLocal = pBt->minLocal;
53643 }else{
 
 
53644 return SQLITE_CORRUPT_BKPT;
53645 }
53646 pPage->max1bytePayload = pBt->max1bytePayload;
53647 return SQLITE_OK;
53648 }
@@ -53678,25 +54107,37 @@
53678
53679 pBt = pPage->pBt;
53680
53681 hdr = pPage->hdrOffset;
53682 data = pPage->aData;
 
 
53683 if( decodeFlags(pPage, data[hdr]) ) return SQLITE_CORRUPT_BKPT;
53684 assert( pBt->pageSize>=512 && pBt->pageSize<=65536 );
53685 pPage->maskPage = (u16)(pBt->pageSize - 1);
53686 pPage->nOverflow = 0;
53687 usableSize = pBt->usableSize;
53688 pPage->cellOffset = cellOffset = hdr + 12 - 4*pPage->leaf;
53689 pPage->aDataEnd = &data[usableSize];
53690 pPage->aCellIdx = &data[cellOffset];
 
 
 
53691 top = get2byteNotZero(&data[hdr+5]);
 
 
53692 pPage->nCell = get2byte(&data[hdr+3]);
53693 if( pPage->nCell>MX_CELL(pBt) ){
53694 /* To many cells for a single page. The page must be corrupt */
53695 return SQLITE_CORRUPT_BKPT;
53696 }
53697 testcase( pPage->nCell==MX_CELL(pBt) );
 
 
 
 
 
53698
53699 /* A malformed database page might cause us to read past the end
53700 ** of page when parsing a cell.
53701 **
53702 ** The following block of code checks early to see if a cell extends
@@ -53726,17 +54167,24 @@
53726 }
53727 if( !pPage->leaf ) iCellLast++;
53728 }
53729 #endif
53730
53731 /* Compute the total free space on the page */
 
 
 
53732 pc = get2byte(&data[hdr+1]);
53733 nFree = data[hdr+7] + top;
53734 while( pc>0 ){
53735 u16 next, size;
53736 if( pc<iCellFirst || pc>iCellLast ){
53737 /* Start of free block is off the page */
 
 
 
 
53738 return SQLITE_CORRUPT_BKPT;
53739 }
53740 next = get2byte(&data[pc]);
53741 size = get2byte(&data[pc+2]);
53742 if( (next>0 && next<=pc+size+3) || pc+size>usableSize ){
@@ -54138,10 +54586,13 @@
54138 pBt->pPage1 = 0;
54139 if( sqlite3PagerIsreadonly(pBt->pPager) ) pBt->btsFlags |= BTS_READ_ONLY;
54140 #ifdef SQLITE_SECURE_DELETE
54141 pBt->btsFlags |= BTS_SECURE_DELETE;
54142 #endif
 
 
 
54143 pBt->pageSize = (zDbHeader[16]<<8) | (zDbHeader[17]<<16);
54144 if( pBt->pageSize<512 || pBt->pageSize>SQLITE_MAX_PAGE_SIZE
54145 || ((pBt->pageSize-1)&pBt->pageSize)!=0 ){
54146 pBt->pageSize = 0;
54147 #ifndef SQLITE_OMIT_AUTOVACUUM
@@ -54156,10 +54607,13 @@
54156 pBt->incrVacuum = (SQLITE_DEFAULT_AUTOVACUUM==2 ? 1 : 0);
54157 }
54158 #endif
54159 nReserve = 0;
54160 }else{
 
 
 
54161 nReserve = zDbHeader[20];
54162 pBt->btsFlags |= BTS_PAGESIZE_FIXED;
54163 #ifndef SQLITE_OMIT_AUTOVACUUM
54164 pBt->autoVacuum = (get4byte(&zDbHeader[36 + 4*4])?1:0);
54165 pBt->incrVacuum = (get4byte(&zDbHeader[36 + 7*4])?1:0);
@@ -54353,11 +54807,11 @@
54353
54354 /* Rollback any active transaction and free the handle structure.
54355 ** The call to sqlite3BtreeRollback() drops any table-locks held by
54356 ** this handle.
54357 */
54358 sqlite3BtreeRollback(p, SQLITE_OK);
54359 sqlite3BtreeLeave(p);
54360
54361 /* If there are still other outstanding references to the shared-btree
54362 ** structure, return now. The remainder of this procedure cleans
54363 ** up the shared-btree.
@@ -54665,10 +55119,13 @@
54665 if( nPage>0 ){
54666 u32 pageSize;
54667 u32 usableSize;
54668 u8 *page1 = pPage1->aData;
54669 rc = SQLITE_NOTADB;
 
 
 
54670 if( memcmp(page1, zMagicHeader, 16)!=0 ){
54671 goto page1_init_failed;
54672 }
54673
54674 #ifdef SQLITE_OMIT_WAL
@@ -54705,26 +55162,39 @@
54705 }
54706 rc = SQLITE_NOTADB;
54707 }
54708 #endif
54709
54710 /* The maximum embedded fraction must be exactly 25%. And the minimum
54711 ** embedded fraction must be 12.5% for both leaf-data and non-leaf-data.
 
54712 ** The original design allowed these amounts to vary, but as of
54713 ** version 3.6.0, we require them to be fixed.
54714 */
54715 if( memcmp(&page1[21], "\100\040\040",3)!=0 ){
54716 goto page1_init_failed;
54717 }
 
 
 
54718 pageSize = (page1[16]<<8) | (page1[17]<<16);
 
 
54719 if( ((pageSize-1)&pageSize)!=0
54720 || pageSize>SQLITE_MAX_PAGE_SIZE
54721 || pageSize<=256
54722 ){
54723 goto page1_init_failed;
54724 }
54725 assert( (pageSize & 7)==0 );
 
 
 
 
 
 
 
54726 usableSize = pageSize - page1[20];
54727 if( (u32)pageSize!=pBt->pageSize ){
54728 /* After reading the first page of the database assuming a page size
54729 ** of BtShared.pageSize, we have discovered that the page-size is
54730 ** actually pageSize. Unlock the database, leave pBt->pPage1 at
@@ -54741,10 +55211,13 @@
54741 }
54742 if( (pBt->db->flags & SQLITE_RecoveryMode)==0 && nPage>nPageFile ){
54743 rc = SQLITE_CORRUPT_BKPT;
54744 goto page1_init_failed;
54745 }
 
 
 
54746 if( usableSize<480 ){
54747 goto page1_init_failed;
54748 }
54749 pBt->pageSize = pageSize;
54750 pBt->usableSize = usableSize;
@@ -55646,64 +56119,95 @@
55646 return rc;
55647 }
55648
55649 /*
55650 ** This routine sets the state to CURSOR_FAULT and the error
55651 ** code to errCode for every cursor on BtShared that pBtree
55652 ** references.
55653 **
55654 ** Every cursor is tripped, including cursors that belong
55655 ** to other database connections that happen to be sharing
55656 ** the cache with pBtree.
55657 **
55658 ** This routine gets called when a rollback occurs.
55659 ** All cursors using the same cache must be tripped
55660 ** to prevent them from trying to use the btree after
55661 ** the rollback. The rollback may have deleted tables
55662 ** or moved root pages, so it is not sufficient to
55663 ** save the state of the cursor. The cursor must be
55664 ** invalidated.
55665 */
55666 SQLITE_PRIVATE void sqlite3BtreeTripAllCursors(Btree *pBtree, int errCode){
 
 
 
 
 
 
 
 
 
55667 BtCursor *p;
55668 if( pBtree==0 ) return;
55669 sqlite3BtreeEnter(pBtree);
55670 for(p=pBtree->pBt->pCursor; p; p=p->pNext){
55671 int i;
55672 sqlite3BtreeClearCursor(p);
55673 p->eState = CURSOR_FAULT;
55674 p->skipNext = errCode;
55675 for(i=0; i<=p->iPage; i++){
55676 releasePage(p->apPage[i]);
55677 p->apPage[i] = 0;
55678 }
55679 }
55680 sqlite3BtreeLeave(pBtree);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55681 }
55682
55683 /*
55684 ** Rollback the transaction in progress. All cursors will be
55685 ** invalided by this operation. Any attempt to use a cursor
55686 ** that was open at the beginning of this operation will result
55687 ** in an error.
 
 
55688 **
55689 ** This will release the write lock on the database file. If there
55690 ** are no active cursors, it also releases the read lock.
55691 */
55692 SQLITE_PRIVATE int sqlite3BtreeRollback(Btree *p, int tripCode){
55693 int rc;
55694 BtShared *pBt = p->pBt;
55695 MemPage *pPage1;
55696
 
 
55697 sqlite3BtreeEnter(p);
55698 if( tripCode==SQLITE_OK ){
55699 rc = tripCode = saveAllCursors(pBt, 0, 0);
 
55700 }else{
55701 rc = SQLITE_OK;
55702 }
55703 if( tripCode ){
55704 sqlite3BtreeTripAllCursors(p, tripCode);
 
 
55705 }
55706 btreeIntegrity(p);
55707
55708 if( p->inTrans==TRANS_WRITE ){
55709 int rc2;
@@ -56034,17 +56538,13 @@
56034 **
56035 ** This routine cannot fail. It always returns SQLITE_OK.
56036 */
56037 SQLITE_PRIVATE int sqlite3BtreeKeySize(BtCursor *pCur, i64 *pSize){
56038 assert( cursorHoldsMutex(pCur) );
56039 assert( pCur->eState==CURSOR_INVALID || pCur->eState==CURSOR_VALID );
56040 if( pCur->eState!=CURSOR_VALID ){
56041 *pSize = 0;
56042 }else{
56043 getCellInfo(pCur);
56044 *pSize = pCur->info.nKey;
56045 }
56046 return SQLITE_OK;
56047 }
56048
56049 /*
56050 ** Set *pSize to the number of bytes of data in the entry the
@@ -57291,10 +57791,12 @@
57291
57292 assert( sqlite3_mutex_held(pBt->mutex) );
57293 assert( eMode==BTALLOC_ANY || (nearby>0 && IfNotOmitAV(pBt->autoVacuum)) );
57294 pPage1 = pBt->pPage1;
57295 mxPage = btreePagecount(pBt);
 
 
57296 n = get4byte(&pPage1->aData[36]);
57297 testcase( n==mxPage-1 );
57298 if( n>=mxPage ){
57299 return SQLITE_CORRUPT_BKPT;
57300 }
@@ -57337,12 +57839,18 @@
57337 ** or until a page less than 'nearby' is located (eMode==BTALLOC_LT)
57338 */
57339 do {
57340 pPrevTrunk = pTrunk;
57341 if( pPrevTrunk ){
 
 
 
57342 iTrunk = get4byte(&pPrevTrunk->aData[0]);
57343 }else{
 
 
 
57344 iTrunk = get4byte(&pPage1->aData[32]);
57345 }
57346 testcase( iTrunk==mxPage );
57347 if( iTrunk>mxPage ){
57348 rc = SQLITE_CORRUPT_BKPT;
@@ -57353,12 +57861,13 @@
57353 pTrunk = 0;
57354 goto end_allocate_page;
57355 }
57356 assert( pTrunk!=0 );
57357 assert( pTrunk->aData!=0 );
57358
57359 k = get4byte(&pTrunk->aData[4]); /* # of leaves on this trunk page */
 
57360 if( k==0 && !searchList ){
57361 /* The trunk has no leaves and the list is not being searched.
57362 ** So extract the trunk page itself and use it as the newly
57363 ** allocated page */
57364 assert( pPrevTrunk==0 );
@@ -57672,10 +58181,15 @@
57672 ** to maintain backwards compatibility with older versions of SQLite,
57673 ** we will continue to restrict the number of entries to usableSize/4 - 8
57674 ** for now. At some point in the future (once everyone has upgraded
57675 ** to 3.6.0 or later) we should consider fixing the conditional above
57676 ** to read "usableSize/4-2" instead of "usableSize/4-8".
 
 
 
 
 
57677 */
57678 rc = sqlite3PagerWrite(pTrunk->pDbPage);
57679 if( rc==SQLITE_OK ){
57680 put4byte(&pTrunk->aData[4], nLeaf+1);
57681 put4byte(&pTrunk->aData[8+nLeaf*4], iPage);
@@ -58023,13 +58537,21 @@
58023 if( rc ){
58024 *pRC = rc;
58025 return;
58026 }
58027 pPage->nCell--;
58028 memmove(ptr, ptr+2, 2*(pPage->nCell - idx));
58029 put2byte(&data[hdr+3], pPage->nCell);
58030 pPage->nFree += 2;
 
 
 
 
 
 
 
 
58031 }
58032
58033 /*
58034 ** Insert a new cell on pPage at cell index "i". pCell points to the
58035 ** content of the cell.
@@ -58120,49 +58642,275 @@
58120 #endif
58121 }
58122 }
58123
58124 /*
58125 ** Add a list of cells to a page. The page should be initially empty.
58126 ** The cells are guaranteed to fit on the page.
58127 */
58128 static void assemblePage(
58129 MemPage *pPage, /* The page to be assembled */
58130 int nCell, /* The number of cells to add to this page */
58131 u8 **apCell, /* Pointers to cell bodies */
58132 u16 *aSize /* Sizes of the cells */
58133 ){
58134 int i; /* Loop counter */
58135 u8 *pCellptr; /* Address of next cell pointer */
58136 int cellbody; /* Address of next cell body */
58137 u8 * const data = pPage->aData; /* Pointer to data for pPage */
58138 const int hdr = pPage->hdrOffset; /* Offset of header on pPage */
58139 const int nUsable = pPage->pBt->usableSize; /* Usable size of page */
58140
58141 assert( pPage->nOverflow==0 );
58142 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
58143 assert( nCell>=0 && nCell<=(int)MX_CELL(pPage->pBt)
58144 && (int)MX_CELL(pPage->pBt)<=10921);
58145 assert( sqlite3PagerIswriteable(pPage->pDbPage) );
58146
58147 /* Check that the page has just been zeroed by zeroPage() */
58148 assert( pPage->nCell==0 );
58149 assert( get2byteNotZero(&data[hdr+5])==nUsable );
58150
58151 pCellptr = &pPage->aCellIdx[nCell*2];
58152 cellbody = nUsable;
58153 for(i=nCell-1; i>=0; i--){
58154 u16 sz = aSize[i];
58155 pCellptr -= 2;
58156 cellbody -= sz;
58157 put2byte(pCellptr, cellbody);
58158 memcpy(&data[cellbody], apCell[i], sz);
58159 }
58160 put2byte(&data[hdr+3], nCell);
58161 put2byte(&data[hdr+5], cellbody);
58162 pPage->nFree -= (nCell*2 + nUsable - cellbody);
58163 pPage->nCell = (u16)nCell;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58164 }
58165
58166 /*
58167 ** The following parameters determine how many adjacent pages get involved
58168 ** in a balancing operation. NN is the number of neighbors on either side
@@ -58212,11 +58960,11 @@
58212 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
58213 assert( sqlite3PagerIswriteable(pParent->pDbPage) );
58214 assert( pPage->nOverflow==1 );
58215
58216 /* This error condition is now caught prior to reaching this function */
58217 if( pPage->nCell==0 ) return SQLITE_CORRUPT_BKPT;
58218
58219 /* Allocate a new page. This page will become the right-sibling of
58220 ** pPage. Make the parent page writable, so that the new divider cell
58221 ** may be inserted. If both these operations are successful, proceed.
58222 */
@@ -58230,11 +58978,12 @@
58230 u8 *pStop;
58231
58232 assert( sqlite3PagerIswriteable(pNew->pDbPage) );
58233 assert( pPage->aData[0]==(PTF_INTKEY|PTF_LEAFDATA|PTF_LEAF) );
58234 zeroPage(pNew, PTF_INTKEY|PTF_LEAFDATA|PTF_LEAF);
58235 assemblePage(pNew, 1, &pCell, &szCell);
 
58236
58237 /* If this is an auto-vacuum database, update the pointer map
58238 ** with entries for the new page, and any pointer from the
58239 ** cell on the page to an overflow page. If either of these
58240 ** operations fails, the return code is set, but the contents
@@ -58449,21 +59198,26 @@
58449 int subtotal; /* Subtotal of bytes in cells on one page */
58450 int iSpace1 = 0; /* First unused byte of aSpace1[] */
58451 int iOvflSpace = 0; /* First unused byte of aOvflSpace[] */
58452 int szScratch; /* Size of scratch memory requested */
58453 MemPage *apOld[NB]; /* pPage and up to two siblings */
58454 MemPage *apCopy[NB]; /* Private copies of apOld[] pages */
58455 MemPage *apNew[NB+2]; /* pPage and up to NB siblings after balancing */
58456 u8 *pRight; /* Location in parent of right-sibling pointer */
58457 u8 *apDiv[NB-1]; /* Divider cells in pParent */
58458 int cntNew[NB+2]; /* Index in aCell[] of cell after i-th page */
58459 int szNew[NB+2]; /* Combined size of cells place on i-th page */
 
58460 u8 **apCell = 0; /* All cells begin balanced */
58461 u16 *szCell; /* Local size of all cells in apCell[] */
58462 u8 *aSpace1; /* Space for copies of dividers cells */
58463 Pgno pgno; /* Temp var to store a page number in */
 
 
 
 
58464
 
58465 pBt = pParent->pBt;
58466 assert( sqlite3_mutex_held(pBt->mutex) );
58467 assert( sqlite3PagerIswriteable(pParent->pDbPage) );
58468
58469 #if 0
@@ -58568,16 +59322,18 @@
58568 nMaxCells = (nMaxCells + 3)&~3;
58569
58570 /*
58571 ** Allocate space for memory structures
58572 */
58573 k = pBt->pageSize + ROUND8(sizeof(MemPage));
58574 szScratch =
58575 nMaxCells*sizeof(u8*) /* apCell */
58576 + nMaxCells*sizeof(u16) /* szCell */
58577 + pBt->pageSize /* aSpace1 */
58578 + k*nOld; /* Page copies (apCopy) */
 
 
 
58579 apCell = sqlite3ScratchMalloc( szScratch );
58580 if( apCell==0 ){
58581 rc = SQLITE_NOMEM;
58582 goto balance_cleanup;
58583 }
@@ -58586,12 +59342,12 @@
58586 assert( EIGHT_BYTE_ALIGNMENT(aSpace1) );
58587
58588 /*
58589 ** Load pointers to all cells on sibling pages and the divider cells
58590 ** into the local apCell[] array. Make copies of the divider cells
58591 ** into space obtained from aSpace1[] and remove the divider cells
58592 ** from pParent.
58593 **
58594 ** If the siblings are on leaf pages, then the child pointers of the
58595 ** divider cells are stripped from the cells before they are copied
58596 ** into aSpace1[]. In this way, all cells in apCell[] are without
58597 ** child pointers. If siblings are not leaves, then all cell in
@@ -58603,19 +59359,11 @@
58603 */
58604 leafCorrection = apOld[0]->leaf*4;
58605 leafData = apOld[0]->intKeyLeaf;
58606 for(i=0; i<nOld; i++){
58607 int limit;
58608
58609 /* Before doing anything else, take a copy of the i'th original sibling
58610 ** The rest of this function will use data from the copies rather
58611 ** that the original pages since the original pages will be in the
58612 ** process of being overwritten. */
58613 MemPage *pOld = apCopy[i] = (MemPage*)&aSpace1[pBt->pageSize + k*i];
58614 memcpy(pOld, apOld[i], sizeof(MemPage));
58615 pOld->aData = (void*)&pOld[1];
58616 memcpy(pOld->aData, apOld[i]->aData, pBt->pageSize);
58617
58618 limit = pOld->nCell+pOld->nOverflow;
58619 if( pOld->nOverflow>0 ){
58620 for(j=0; j<limit; j++){
58621 assert( nCell<nMaxCells );
@@ -58632,10 +59380,11 @@
58632 apCell[nCell] = findCellv2(aData, maskPage, cellOffset, j);
58633 szCell[nCell] = cellSizePtr(pOld, apCell[nCell]);
58634 nCell++;
58635 }
58636 }
 
58637 if( i<nOld-1 && !leafData){
58638 u16 sz = (u16)szNew[i];
58639 u8 *pTemp;
58640 assert( nCell<nMaxCells );
58641 szCell[nCell] = sz;
@@ -58654,11 +59403,15 @@
58654 ** pointer of the divider cell */
58655 memcpy(apCell[nCell], &pOld->aData[8], 4);
58656 }else{
58657 assert( leafCorrection==4 );
58658 if( szCell[nCell]<4 ){
58659 /* Do not allow any cells smaller than 4 bytes. */
 
 
 
 
58660 szCell[nCell] = 4;
58661 }
58662 }
58663 nCell++;
58664 }
@@ -58683,11 +59436,11 @@
58683 usableSpace = pBt->usableSize - 12 + leafCorrection;
58684 for(subtotal=k=i=0; i<nCell; i++){
58685 assert( i<nMaxCells );
58686 subtotal += szCell[i] + 2;
58687 if( subtotal > usableSpace ){
58688 szNew[k] = subtotal - szCell[i];
58689 cntNew[k] = i;
58690 if( leafData ){ i--; }
58691 subtotal = 0;
58692 k++;
58693 if( k>NB+1 ){ rc = SQLITE_CORRUPT_BKPT; goto balance_cleanup; }
@@ -58697,13 +59450,14 @@
58697 cntNew[k] = nCell;
58698 k++;
58699
58700 /*
58701 ** The packing computed by the previous block is biased toward the siblings
58702 ** on the left side. The left siblings are always nearly full, while the
58703 ** right-most sibling might be nearly empty. This block of code attempts
58704 ** to adjust the packing of siblings to get a better balance.
 
58705 **
58706 ** This adjustment is more than an optimization. The packing above might
58707 ** be so out of balance as to be illegal. For example, the right-most
58708 ** sibling might be completely empty. This adjustment is not optional.
58709 */
@@ -58728,26 +59482,22 @@
58728 }
58729 szNew[i] = szRight;
58730 szNew[i-1] = szLeft;
58731 }
58732
58733 /* Either we found one or more cells (cntnew[0])>0) or pPage is
58734 ** a virtual root page. A virtual root page is when the real root
58735 ** page is page 1 and we are the only child of that page.
58736 **
58737 ** UPDATE: The assert() below is not necessarily true if the database
58738 ** file is corrupt. The corruption will be detected and reported later
58739 ** in this procedure so there is no need to act upon it now.
58740 */
58741 #if 0
58742 assert( cntNew[0]>0 || (pParent->pgno==1 && pParent->nCell==0) );
58743 #endif
58744
58745 TRACE(("BALANCE: old: %d %d %d ",
58746 apOld[0]->pgno,
58747 nOld>=2 ? apOld[1]->pgno : 0,
58748 nOld>=3 ? apOld[2]->pgno : 0
58749 ));
58750
58751 /*
58752 ** Allocate k new pages. Reuse old pages where possible.
58753 */
@@ -58766,12 +59516,14 @@
58766 if( rc ) goto balance_cleanup;
58767 }else{
58768 assert( i>0 );
58769 rc = allocateBtreePage(pBt, &pNew, &pgno, (bBulk ? 1 : pgno), 0);
58770 if( rc ) goto balance_cleanup;
 
58771 apNew[i] = pNew;
58772 nNew++;
 
58773
58774 /* Set the pointer-map entry for the new sibling page. */
58775 if( ISAUTOVACUUM ){
58776 ptrmapPut(pBt, pNew->pgno, PTRMAP_BTREE, pParent->pgno, &rc);
58777 if( rc!=SQLITE_OK ){
@@ -58779,139 +59531,251 @@
58779 }
58780 }
58781 }
58782 }
58783
58784 /* Free any old pages that were not reused as new pages.
58785 */
58786 while( i<nOld ){
58787 freePage(apOld[i], &rc);
58788 if( rc ) goto balance_cleanup;
58789 releasePage(apOld[i]);
58790 apOld[i] = 0;
58791 i++;
58792 }
58793
58794 /*
58795 ** Put the new pages in ascending order. This helps to
58796 ** keep entries in the disk file in order so that a scan
58797 ** of the table is a linear scan through the file. That
58798 ** in turn helps the operating system to deliver pages
58799 ** from the disk more rapidly.
58800 **
58801 ** An O(n^2) insertion sort algorithm is used, but since
58802 ** n is never more than NB (a small constant), that should
58803 ** not be a problem.
58804 **
58805 ** When NB==3, this one optimization makes the database
58806 ** about 25% faster for large insertions and deletions.
58807 */
58808 for(i=0; i<k-1; i++){
58809 int minV = apNew[i]->pgno;
58810 int minI = i;
58811 for(j=i+1; j<k; j++){
58812 if( apNew[j]->pgno<(unsigned)minV ){
58813 minI = j;
58814 minV = apNew[j]->pgno;
58815 }
58816 }
58817 if( minI>i ){
58818 MemPage *pT;
58819 pT = apNew[i];
58820 apNew[i] = apNew[minI];
58821 apNew[minI] = pT;
58822 }
58823 }
58824 TRACE(("new: %d(%d) %d(%d) %d(%d) %d(%d) %d(%d)\n",
58825 apNew[0]->pgno, szNew[0],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58826 nNew>=2 ? apNew[1]->pgno : 0, nNew>=2 ? szNew[1] : 0,
 
58827 nNew>=3 ? apNew[2]->pgno : 0, nNew>=3 ? szNew[2] : 0,
 
58828 nNew>=4 ? apNew[3]->pgno : 0, nNew>=4 ? szNew[3] : 0,
58829 nNew>=5 ? apNew[4]->pgno : 0, nNew>=5 ? szNew[4] : 0));
 
 
 
58830
58831 assert( sqlite3PagerIswriteable(pParent->pDbPage) );
58832 put4byte(pRight, apNew[nNew-1]->pgno);
58833
58834 /*
58835 ** Evenly distribute the data in apCell[] across the new pages.
58836 ** Insert divider cells into pParent as necessary.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58837 */
58838 j = 0;
58839 for(i=0; i<nNew; i++){
58840 /* Assemble the new sibling page. */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58841 MemPage *pNew = apNew[i];
58842 assert( j<nMaxCells );
58843 zeroPage(pNew, pageFlags);
58844 assemblePage(pNew, cntNew[i]-j, &apCell[j], &szCell[j]);
58845 assert( pNew->nCell>0 || (nNew==1 && cntNew[0]==0) );
58846 assert( pNew->nOverflow==0 );
58847
58848 j = cntNew[i];
58849
58850 /* If the sibling page assembled above was not the right-most sibling,
58851 ** insert a divider cell into the parent page.
58852 */
58853 assert( i<nNew-1 || j==nCell );
58854 if( j<nCell ){
58855 u8 *pCell;
58856 u8 *pTemp;
58857 int sz;
58858
58859 assert( j<nMaxCells );
58860 pCell = apCell[j];
58861 sz = szCell[j] + leafCorrection;
58862 pTemp = &aOvflSpace[iOvflSpace];
58863 if( !pNew->leaf ){
58864 memcpy(&pNew->aData[8], pCell, 4);
58865 }else if( leafData ){
58866 /* If the tree is a leaf-data tree, and the siblings are leaves,
58867 ** then there is no divider cell in apCell[]. Instead, the divider
58868 ** cell consists of the integer key for the right-most cell of
58869 ** the sibling-page assembled above only.
58870 */
58871 CellInfo info;
58872 j--;
58873 btreeParseCellPtr(pNew, apCell[j], &info);
58874 pCell = pTemp;
58875 sz = 4 + putVarint(&pCell[4], info.nKey);
58876 pTemp = 0;
58877 }else{
58878 pCell -= 4;
58879 /* Obscure case for non-leaf-data trees: If the cell at pCell was
58880 ** previously stored on a leaf node, and its reported size was 4
58881 ** bytes, then it may actually be smaller than this
58882 ** (see btreeParseCellPtr(), 4 bytes is the minimum size of
58883 ** any cell). But it is important to pass the correct size to
58884 ** insertCell(), so reparse the cell now.
58885 **
58886 ** Note that this can never happen in an SQLite data file, as all
58887 ** cells are at least 4 bytes. It only happens in b-trees used
58888 ** to evaluate "IN (SELECT ...)" and similar clauses.
58889 */
58890 if( szCell[j]==4 ){
58891 assert(leafCorrection==4);
58892 sz = cellSizePtr(pParent, pCell);
58893 }
58894 }
58895 iOvflSpace += sz;
58896 assert( sz<=pBt->maxLocal+23 );
58897 assert( iOvflSpace <= (int)pBt->pageSize );
58898 insertCell(pParent, nxDiv, pCell, sz, pTemp, pNew->pgno, &rc);
58899 if( rc!=SQLITE_OK ) goto balance_cleanup;
58900 assert( sqlite3PagerIswriteable(pParent->pDbPage) );
58901
58902 j++;
58903 nxDiv++;
58904 }
58905 }
58906 assert( j==nCell );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58907 assert( nOld>0 );
58908 assert( nNew>0 );
58909 if( (pageFlags & PTF_LEAF)==0 ){
58910 u8 *zChild = &apCopy[nOld-1]->aData[8];
58911 memcpy(&apNew[nNew-1]->aData[8], zChild, 4);
58912 }
58913
58914 if( isRoot && pParent->nCell==0 && pParent->hdrOffset<=apNew[0]->nFree ){
58915 /* The root page of the b-tree now contains no cells. The only sibling
58916 ** page is the right-child of the parent. Copy the contents of the
58917 ** child page into the parent, decreasing the overall height of the
@@ -58920,130 +59784,54 @@
58920 **
58921 ** If this is an auto-vacuum database, the call to copyNodeContent()
58922 ** sets all pointer-map entries corresponding to database image pages
58923 ** for which the pointer is stored within the content being copied.
58924 **
58925 ** The second assert below verifies that the child page is defragmented
58926 ** (it must be, as it was just reconstructed using assemblePage()). This
58927 ** is important if the parent page happens to be page 1 of the database
58928 ** image. */
 
58929 assert( nNew==1 );
 
 
58930 assert( apNew[0]->nFree ==
58931 (get2byte(&apNew[0]->aData[5])-apNew[0]->cellOffset-apNew[0]->nCell*2)
 
58932 );
58933 copyNodeContent(apNew[0], pParent, &rc);
58934 freePage(apNew[0], &rc);
58935 }else if( ISAUTOVACUUM ){
58936 /* Fix the pointer-map entries for all the cells that were shifted around.
58937 ** There are several different types of pointer-map entries that need to
58938 ** be dealt with by this routine. Some of these have been set already, but
58939 ** many have not. The following is a summary:
58940 **
58941 ** 1) The entries associated with new sibling pages that were not
58942 ** siblings when this function was called. These have already
58943 ** been set. We don't need to worry about old siblings that were
58944 ** moved to the free-list - the freePage() code has taken care
58945 ** of those.
58946 **
58947 ** 2) The pointer-map entries associated with the first overflow
58948 ** page in any overflow chains used by new divider cells. These
58949 ** have also already been taken care of by the insertCell() code.
58950 **
58951 ** 3) If the sibling pages are not leaves, then the child pages of
58952 ** cells stored on the sibling pages may need to be updated.
58953 **
58954 ** 4) If the sibling pages are not internal intkey nodes, then any
58955 ** overflow pages used by these cells may need to be updated
58956 ** (internal intkey nodes never contain pointers to overflow pages).
58957 **
58958 ** 5) If the sibling pages are not leaves, then the pointer-map
58959 ** entries for the right-child pages of each sibling may need
58960 ** to be updated.
58961 **
58962 ** Cases 1 and 2 are dealt with above by other code. The next
58963 ** block deals with cases 3 and 4 and the one after that, case 5. Since
58964 ** setting a pointer map entry is a relatively expensive operation, this
58965 ** code only sets pointer map entries for child or overflow pages that have
58966 ** actually moved between pages. */
58967 MemPage *pNew = apNew[0];
58968 MemPage *pOld = apCopy[0];
58969 int nOverflow = pOld->nOverflow;
58970 int iNextOld = pOld->nCell + nOverflow;
58971 int iOverflow = (nOverflow ? pOld->aiOvfl[0] : -1);
58972 j = 0; /* Current 'old' sibling page */
58973 k = 0; /* Current 'new' sibling page */
58974 for(i=0; i<nCell; i++){
58975 int isDivider = 0;
58976 while( i==iNextOld ){
58977 /* Cell i is the cell immediately following the last cell on old
58978 ** sibling page j. If the siblings are not leaf pages of an
58979 ** intkey b-tree, then cell i was a divider cell. */
58980 assert( j+1 < ArraySize(apCopy) );
58981 assert( j+1 < nOld );
58982 pOld = apCopy[++j];
58983 iNextOld = i + !leafData + pOld->nCell + pOld->nOverflow;
58984 if( pOld->nOverflow ){
58985 nOverflow = pOld->nOverflow;
58986 iOverflow = i + !leafData + pOld->aiOvfl[0];
58987 }
58988 isDivider = !leafData;
58989 }
58990
58991 assert(nOverflow>0 || iOverflow<i );
58992 assert(nOverflow<2 || pOld->aiOvfl[0]==pOld->aiOvfl[1]-1);
58993 assert(nOverflow<3 || pOld->aiOvfl[1]==pOld->aiOvfl[2]-1);
58994 if( i==iOverflow ){
58995 isDivider = 1;
58996 if( (--nOverflow)>0 ){
58997 iOverflow++;
58998 }
58999 }
59000
59001 if( i==cntNew[k] ){
59002 /* Cell i is the cell immediately following the last cell on new
59003 ** sibling page k. If the siblings are not leaf pages of an
59004 ** intkey b-tree, then cell i is a divider cell. */
59005 pNew = apNew[++k];
59006 if( !leafData ) continue;
59007 }
59008 assert( j<nOld );
59009 assert( k<nNew );
59010
59011 /* If the cell was originally divider cell (and is not now) or
59012 ** an overflow cell, or if the cell was located on a different sibling
59013 ** page before the balancing, then the pointer map entries associated
59014 ** with any child or overflow pages need to be updated. */
59015 if( isDivider || pOld->pgno!=pNew->pgno ){
59016 if( !leafCorrection ){
59017 ptrmapPut(pBt, get4byte(apCell[i]), PTRMAP_BTREE, pNew->pgno, &rc);
59018 }
59019 if( szCell[i]>pNew->minLocal ){
59020 ptrmapPutOvflPtr(pNew, apCell[i], &rc);
59021 }
59022 }
59023 }
59024
59025 if( !leafCorrection ){
59026 for(i=0; i<nNew; i++){
59027 u32 key = get4byte(&apNew[i]->aData[8]);
59028 ptrmapPut(pBt, key, PTRMAP_BTREE, apNew[i]->pgno, &rc);
59029 }
59030 }
59031
59032 #if 0
 
59033 /* The ptrmapCheckPages() contains assert() statements that verify that
59034 ** all pointer map pages are set correctly. This is helpful while
59035 ** debugging. This is usually disabled because a corrupt database may
59036 ** cause an assert() statement to fail. */
59037 ptrmapCheckPages(apNew, nNew);
59038 ptrmapCheckPages(&pParent, 1);
 
59039 #endif
59040 }
59041
59042 assert( pParent->isInit );
59043 TRACE(("BALANCE: finished: old=%d new=%d cells=%d\n",
59044 nOld, nNew, nCell));
59045
59046 /*
59047 ** Cleanup before returning.
59048 */
59049 balance_cleanup:
@@ -60424,12 +61212,18 @@
60424 }else{
60425 int contentOffset = get2byteNotZero(&data[hdr+5]);
60426 assert( contentOffset<=usableSize ); /* Enforced by btreeInitPage() */
60427 memset(hit+contentOffset, 0, usableSize-contentOffset);
60428 memset(hit, 1, contentOffset);
 
 
60429 nCell = get2byte(&data[hdr+3]);
 
 
60430 cellStart = hdr + 12 - 4*pPage->leaf;
 
 
60431 for(i=0; i<nCell; i++){
60432 int pc = get2byte(&data[cellStart+i*2]);
60433 u32 size = 65536;
60434 int j;
60435 if( pc<=usableSize-4 ){
@@ -60441,18 +61235,27 @@
60441 "Corruption detected in cell %d on page %d",i,iPage);
60442 }else{
60443 for(j=pc+size-1; j>=pc; j--) hit[j]++;
60444 }
60445 }
 
 
 
60446 i = get2byte(&data[hdr+1]);
60447 while( i>0 ){
60448 int size, j;
60449 assert( i<=usableSize-4 ); /* Enforced by btreeInitPage() */
60450 size = get2byte(&data[i+2]);
60451 assert( i+size<=usableSize ); /* Enforced by btreeInitPage() */
60452 for(j=i+size-1; j>=i; j--) hit[j]++;
 
 
 
 
60453 j = get2byte(&data[i]);
 
 
60454 assert( j==0 || j>i+size ); /* Enforced by btreeInitPage() */
60455 assert( j<=usableSize-4 ); /* Enforced by btreeInitPage() */
60456 i = j;
60457 }
60458 for(i=cnt=0; i<usableSize; i++){
@@ -60462,10 +61265,15 @@
60462 checkAppendMsg(pCheck,
60463 "Multiple uses for byte %d of page %d", i, iPage);
60464 break;
60465 }
60466 }
 
 
 
 
 
60467 if( cnt!=data[hdr+7] ){
60468 checkAppendMsg(pCheck,
60469 "Fragmentation of %d bytes reported as %d on page %d",
60470 cnt, data[hdr+7], iPage);
60471 }
@@ -60865,10 +61673,15 @@
60865 */
60866 SQLITE_PRIVATE int sqlite3BtreeIsReadonly(Btree *p){
60867 return (p->pBt->btsFlags & BTS_READ_ONLY)!=0;
60868 }
60869
 
 
 
 
 
60870 /************** End of btree.c ***********************************************/
60871 /************** Begin file backup.c ******************************************/
60872 /*
60873 ** 2009 January 28
60874 **
@@ -60988,10 +61801,24 @@
60988 static int setDestPgsz(sqlite3_backup *p){
60989 int rc;
60990 rc = sqlite3BtreeSetPageSize(p->pDest,sqlite3BtreeGetPageSize(p->pSrc),-1,0);
60991 return rc;
60992 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60993
60994 /*
60995 ** Create an sqlite3_backup process to copy the contents of zSrcDb from
60996 ** connection handle pSrcDb to zDestDb in pDestDb. If successful, return
60997 ** a pointer to the new sqlite3_backup object.
@@ -61004,10 +61831,17 @@
61004 const char *zDestDb, /* Name of database within pDestDb */
61005 sqlite3* pSrcDb, /* Database connection to read from */
61006 const char *zSrcDb /* Name of database within pSrcDb */
61007 ){
61008 sqlite3_backup *p; /* Value to return */
 
 
 
 
 
 
 
61009
61010 /* Lock the source database handle. The destination database
61011 ** handle is not locked in this routine, but it is locked in
61012 ** sqlite3_backup_step(). The user is required to ensure that no
61013 ** other thread accesses the destination handle for the duration
@@ -61041,16 +61875,19 @@
61041 p->pDestDb = pDestDb;
61042 p->pSrcDb = pSrcDb;
61043 p->iNext = 1;
61044 p->isAttached = 0;
61045
61046 if( 0==p->pSrc || 0==p->pDest || setDestPgsz(p)==SQLITE_NOMEM ){
 
 
 
61047 /* One (or both) of the named databases did not exist or an OOM
61048 ** error was hit. The error has already been written into the
61049 ** pDestDb handle. All that is left to do here is free the
61050 ** sqlite3_backup structure.
61051 */
61052 sqlite3_free(p);
61053 p = 0;
61054 }
61055 }
61056 if( p ){
@@ -61201,10 +62038,13 @@
61201 int rc;
61202 int destMode; /* Destination journal mode */
61203 int pgszSrc = 0; /* Source page size */
61204 int pgszDest = 0; /* Destination page size */
61205
 
 
 
61206 sqlite3_mutex_enter(p->pSrcDb->mutex);
61207 sqlite3BtreeEnter(p->pSrc);
61208 if( p->pDestDb ){
61209 sqlite3_mutex_enter(p->pDestDb->mutex);
61210 }
@@ -61464,11 +62304,11 @@
61464 }
61465 *pp = p->pNext;
61466 }
61467
61468 /* If a transaction is still open on the Btree, roll it back. */
61469 sqlite3BtreeRollback(p->pDest, SQLITE_OK);
61470
61471 /* Set the error code of the destination database handle. */
61472 rc = (p->rc==SQLITE_DONE) ? SQLITE_OK : p->rc;
61473 if( p->pDestDb ){
61474 sqlite3Error(p->pDestDb, rc);
@@ -61490,18 +62330,30 @@
61490 /*
61491 ** Return the number of pages still to be backed up as of the most recent
61492 ** call to sqlite3_backup_step().
61493 */
61494 SQLITE_API int sqlite3_backup_remaining(sqlite3_backup *p){
 
 
 
 
 
 
61495 return p->nRemaining;
61496 }
61497
61498 /*
61499 ** Return the total number of pages in the source database as of the most
61500 ** recent call to sqlite3_backup_step().
61501 */
61502 SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p){
 
 
 
 
 
 
61503 return p->nPagecount;
61504 }
61505
61506 /*
61507 ** This function is called after the contents of page iPage of the
@@ -63788,10 +64640,38 @@
63788 }
63789 p->nOp += nOp;
63790 }
63791 return addr;
63792 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63793
63794 /*
63795 ** Change the value of the P1 operand for a specific instruction.
63796 ** This routine is useful when a large program is loaded from a
63797 ** static array using sqlite3VdbeAddOpList but we want to make a
@@ -64887,10 +65767,13 @@
64887 p->apArg = allocSpace(p->apArg, nArg*sizeof(Mem*), &zCsr, zEnd, &nByte);
64888 p->azVar = allocSpace(p->azVar, nVar*sizeof(char*), &zCsr, zEnd, &nByte);
64889 p->apCsr = allocSpace(p->apCsr, nCursor*sizeof(VdbeCursor*),
64890 &zCsr, zEnd, &nByte);
64891 p->aOnceFlag = allocSpace(p->aOnceFlag, nOnce, &zCsr, zEnd, &nByte);
 
 
 
64892 if( nByte ){
64893 p->pFree = sqlite3DbMallocZero(db, nByte);
64894 }
64895 zCsr = p->pFree;
64896 zEnd = &zCsr[nByte];
@@ -64903,11 +65786,11 @@
64903 for(n=0; n<nVar; n++){
64904 p->aVar[n].flags = MEM_Null;
64905 p->aVar[n].db = db;
64906 }
64907 }
64908 if( p->azVar ){
64909 p->nzVar = pParse->nzVar;
64910 memcpy(p->azVar, pParse->azVar, p->nzVar*sizeof(p->azVar[0]));
64911 memset(pParse->azVar, 0, pParse->nzVar*sizeof(pParse->azVar[0]));
64912 }
64913 if( p->aMem ){
@@ -64954,10 +65837,13 @@
64954 ** is used, for example, when a trigger sub-program is halted to restore
64955 ** control to the main program.
64956 */
64957 SQLITE_PRIVATE int sqlite3VdbeFrameRestore(VdbeFrame *pFrame){
64958 Vdbe *v = pFrame->v;
 
 
 
64959 v->aOnceFlag = pFrame->aOnceFlag;
64960 v->nOnceFlag = pFrame->nOnceFlag;
64961 v->aOp = pFrame->aOp;
64962 v->nOp = pFrame->nOp;
64963 v->aMem = pFrame->aMem;
@@ -64964,10 +65850,11 @@
64964 v->nMem = pFrame->nMem;
64965 v->apCsr = pFrame->apCsr;
64966 v->nCursor = pFrame->nCursor;
64967 v->db->lastRowid = pFrame->lastRowid;
64968 v->nChange = pFrame->nChange;
 
64969 return pFrame->pc;
64970 }
64971
64972 /*
64973 ** Close all cursors.
@@ -65531,10 +66418,11 @@
65531 ** so, abort any other statements this handle currently has active.
65532 */
65533 sqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK);
65534 sqlite3CloseSavepoints(db);
65535 db->autoCommit = 1;
 
65536 }
65537 }
65538 }
65539
65540 /* Check for immediate foreign key violations. */
@@ -65571,18 +66459,20 @@
65571 sqlite3VdbeLeave(p);
65572 return SQLITE_BUSY;
65573 }else if( rc!=SQLITE_OK ){
65574 p->rc = rc;
65575 sqlite3RollbackAll(db, SQLITE_OK);
 
65576 }else{
65577 db->nDeferredCons = 0;
65578 db->nDeferredImmCons = 0;
65579 db->flags &= ~SQLITE_DeferFKs;
65580 sqlite3CommitInternalChanges(db);
65581 }
65582 }else{
65583 sqlite3RollbackAll(db, SQLITE_OK);
 
65584 }
65585 db->nStatement = 0;
65586 }else if( eStatementOp==0 ){
65587 if( p->rc==SQLITE_OK || p->errorAction==OE_Fail ){
65588 eStatementOp = SAVEPOINT_RELEASE;
@@ -65590,10 +66480,11 @@
65590 eStatementOp = SAVEPOINT_ROLLBACK;
65591 }else{
65592 sqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK);
65593 sqlite3CloseSavepoints(db);
65594 db->autoCommit = 1;
 
65595 }
65596 }
65597
65598 /* If eStatementOp is non-zero, then a statement transaction needs to
65599 ** be committed or rolled back. Call sqlite3VdbeCloseStatement() to
@@ -65610,10 +66501,11 @@
65610 p->zErrMsg = 0;
65611 }
65612 sqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK);
65613 sqlite3CloseSavepoints(db);
65614 db->autoCommit = 1;
 
65615 }
65616 }
65617
65618 /* If this was an INSERT, UPDATE or DELETE and no statement transaction
65619 ** has been rolled back, update the database connection change-counter.
@@ -65871,10 +66763,16 @@
65871 for(i=p->nzVar-1; i>=0; i--) sqlite3DbFree(db, p->azVar[i]);
65872 vdbeFreeOpArray(db, p->aOp, p->nOp);
65873 sqlite3DbFree(db, p->aColName);
65874 sqlite3DbFree(db, p->zSql);
65875 sqlite3DbFree(db, p->pFree);
 
 
 
 
 
 
65876 }
65877
65878 /*
65879 ** Delete an entire VDBE.
65880 */
@@ -66029,13 +66927,11 @@
66029 /* Figure out whether to use 1, 2, 4, 6 or 8 bytes. */
66030 # define MAX_6BYTE ((((i64)0x00008000)<<32)-1)
66031 i64 i = pMem->u.i;
66032 u64 u;
66033 if( i<0 ){
66034 if( i<(-MAX_6BYTE) ) return 6;
66035 /* Previous test prevents: u = -(-9223372036854775808) */
66036 u = -i;
66037 }else{
66038 u = i;
66039 }
66040 if( u<=127 ){
66041 return ((i&1)==i && file_format>=4) ? 8+(u32)u : 1;
@@ -66197,14 +67093,18 @@
66197 ){
66198 u64 x = FOUR_BYTE_UINT(buf);
66199 u32 y = FOUR_BYTE_UINT(buf+4);
66200 x = (x<<32) + y;
66201 if( serial_type==6 ){
 
 
66202 pMem->u.i = *(i64*)&x;
66203 pMem->flags = MEM_Int;
66204 testcase( pMem->u.i<0 );
66205 }else{
 
 
66206 #if !defined(NDEBUG) && !defined(SQLITE_OMIT_FLOATING_POINT)
66207 /* Verify that integers and floating point values use the same
66208 ** byte order. Or, that if SQLITE_MIXED_ENDIAN_64BIT_FLOAT is
66209 ** defined that 64-bit floating point values really are mixed
66210 ** endian.
@@ -66228,39 +67128,50 @@
66228 Mem *pMem /* Memory cell to write value into */
66229 ){
66230 switch( serial_type ){
66231 case 10: /* Reserved for future use */
66232 case 11: /* Reserved for future use */
66233 case 0: { /* NULL */
 
66234 pMem->flags = MEM_Null;
66235 break;
66236 }
66237 case 1: { /* 1-byte signed integer */
 
 
66238 pMem->u.i = ONE_BYTE_INT(buf);
66239 pMem->flags = MEM_Int;
66240 testcase( pMem->u.i<0 );
66241 return 1;
66242 }
66243 case 2: { /* 2-byte signed integer */
 
 
66244 pMem->u.i = TWO_BYTE_INT(buf);
66245 pMem->flags = MEM_Int;
66246 testcase( pMem->u.i<0 );
66247 return 2;
66248 }
66249 case 3: { /* 3-byte signed integer */
 
 
66250 pMem->u.i = THREE_BYTE_INT(buf);
66251 pMem->flags = MEM_Int;
66252 testcase( pMem->u.i<0 );
66253 return 3;
66254 }
66255 case 4: { /* 4-byte signed integer */
 
 
66256 pMem->u.i = FOUR_BYTE_INT(buf);
66257 pMem->flags = MEM_Int;
66258 testcase( pMem->u.i<0 );
66259 return 4;
66260 }
66261 case 5: { /* 6-byte signed integer */
 
 
66262 pMem->u.i = FOUR_BYTE_UINT(buf+2) + (((i64)1)<<32)*TWO_BYTE_INT(buf);
66263 pMem->flags = MEM_Int;
66264 testcase( pMem->u.i<0 );
66265 return 6;
66266 }
@@ -66270,15 +67181,21 @@
66270 ** to avoid having to move the frame pointer in the common case */
66271 return serialGet(buf,serial_type,pMem);
66272 }
66273 case 8: /* Integer 0 */
66274 case 9: { /* Integer 1 */
 
 
66275 pMem->u.i = serial_type-8;
66276 pMem->flags = MEM_Int;
66277 return 0;
66278 }
66279 default: {
 
 
 
 
66280 static const u16 aFlag[] = { MEM_Blob|MEM_Ephem, MEM_Str|MEM_Ephem };
66281 pMem->z = (char *)buf;
66282 pMem->n = (serial_type-12)/2;
66283 pMem->flags = aFlag[serial_type&1];
66284 return pMem->n;
@@ -68238,15 +69155,23 @@
68238 sqlite3_stmt *pStmt,
68239 int N,
68240 const void *(*xFunc)(Mem*),
68241 int useType
68242 ){
68243 const void *ret = 0;
68244 Vdbe *p = (Vdbe *)pStmt;
68245 int n;
68246 sqlite3 *db = p->db;
68247
 
 
 
 
 
 
 
 
68248 assert( db!=0 );
68249 n = sqlite3_column_count(pStmt);
68250 if( N<n && N>=0 ){
68251 N += useType*n;
68252 sqlite3_mutex_enter(db->mutex);
@@ -68707,10 +69632,16 @@
68707 ** prepared statement for the database connection. Return NULL if there
68708 ** are no more.
68709 */
68710 SQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt){
68711 sqlite3_stmt *pNext;
 
 
 
 
 
 
68712 sqlite3_mutex_enter(pDb->mutex);
68713 if( pStmt==0 ){
68714 pNext = (sqlite3_stmt*)pDb->pVdbe;
68715 }else{
68716 pNext = (sqlite3_stmt*)((Vdbe*)pStmt)->pNext;
@@ -68722,15 +69653,91 @@
68722 /*
68723 ** Return the value of a status counter for a prepared statement
68724 */
68725 SQLITE_API int sqlite3_stmt_status(sqlite3_stmt *pStmt, int op, int resetFlag){
68726 Vdbe *pVdbe = (Vdbe*)pStmt;
68727 u32 v = pVdbe->aCounter[op];
 
 
 
 
 
 
 
68728 if( resetFlag ) pVdbe->aCounter[op] = 0;
68729 return (int)v;
68730 }
68731
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68732 /************** End of vdbeapi.c *********************************************/
68733 /************** Begin file vdbetrace.c ***************************************/
68734 /*
68735 ** 2009 November 25
68736 **
@@ -69612,10 +70619,13 @@
69612 #ifdef VDBE_PROFILE
69613 start = sqlite3Hwtime();
69614 #endif
69615 nVmStep++;
69616 pOp = &aOp[pc];
 
 
 
69617
69618 /* Only allow tracing if SQLITE_DEBUG is defined.
69619 */
69620 #ifdef SQLITE_DEBUG
69621 if( db->flags & SQLITE_VdbeTrace ){
@@ -71302,11 +72312,11 @@
71302 assert( pReg->flags & MEM_Blob );
71303 assert( memIsValid(pReg) );
71304 pC->payloadSize = pC->szRow = avail = pReg->n;
71305 pC->aRow = (u8*)pReg->z;
71306 }else{
71307 MemSetTypeFlag(pDest, MEM_Null);
71308 goto op_column_out;
71309 }
71310 }else{
71311 assert( pCrsr );
71312 if( pC->isTable==0 ){
@@ -71637,11 +72647,14 @@
71637 testcase( serial_type==127 );
71638 testcase( serial_type==128 );
71639 nHdr += serial_type<=127 ? 1 : sqlite3VarintLen(serial_type);
71640 }while( (--pRec)>=pData0 );
71641
71642 /* Add the initial header varint and total the size */
 
 
 
71643 testcase( nHdr==126 );
71644 testcase( nHdr==127 );
71645 if( nHdr<=126 ){
71646 /* The common case */
71647 nHdr += 1;
@@ -71671,11 +72684,15 @@
71671 j = nHdr;
71672 assert( pData0<=pLast );
71673 pRec = pData0;
71674 do{
71675 serial_type = pRec->uTemp;
 
 
71676 i += putVarint32(&zNewRecord[i], serial_type); /* serial type */
 
 
71677 j += sqlite3VdbeSerialPut(&zNewRecord[j], pRec, serial_type); /* content */
71678 }while( (++pRec)<=pLast );
71679 assert( i==nHdr );
71680 assert( j==nByte );
71681
@@ -71826,23 +72843,30 @@
71826 goto vdbe_return;
71827 }
71828 db->isTransactionSavepoint = 0;
71829 rc = p->rc;
71830 }else{
 
71831 iSavepoint = db->nSavepoint - iSavepoint - 1;
71832 if( p1==SAVEPOINT_ROLLBACK ){
 
71833 for(ii=0; ii<db->nDb; ii++){
71834 sqlite3BtreeTripAllCursors(db->aDb[ii].pBt, SQLITE_ABORT);
 
 
 
71835 }
 
 
71836 }
71837 for(ii=0; ii<db->nDb; ii++){
71838 rc = sqlite3BtreeSavepoint(db->aDb[ii].pBt, p1, iSavepoint);
71839 if( rc!=SQLITE_OK ){
71840 goto abort_due_to_error;
71841 }
71842 }
71843 if( p1==SAVEPOINT_ROLLBACK && (db->flags&SQLITE_InternChanges)!=0 ){
71844 sqlite3ExpirePreparedStatements(db);
71845 sqlite3ResetAllSchemasOfConnection(db);
71846 db->flags = (db->flags | SQLITE_InternChanges);
71847 }
71848 }
@@ -72235,11 +73259,11 @@
72235 assert( p->bIsReader );
72236 assert( pOp->opcode==OP_OpenRead || pOp->opcode==OP_ReopenIdx
72237 || p->readOnly==0 );
72238
72239 if( p->expired ){
72240 rc = SQLITE_ABORT;
72241 break;
72242 }
72243
72244 nField = 0;
72245 pKeyInfo = 0;
@@ -72799,14 +73823,14 @@
72799 }
72800 pIdxKey = &r;
72801 }else{
72802 pIdxKey = sqlite3VdbeAllocUnpackedRecord(
72803 pC->pKeyInfo, aTempRec, sizeof(aTempRec), &pFree
72804 );
72805 if( pIdxKey==0 ) goto no_mem;
72806 assert( pIn3->flags & MEM_Blob );
72807 assert( (pIn3->flags & MEM_Zero)==0 ); /* zeroblobs already expanded */
72808 sqlite3VdbeRecordUnpack(pC->pKeyInfo, pIn3->n, pIn3->z, pIdxKey);
72809 }
72810 pIdxKey->default_rc = 0;
72811 if( pOp->opcode==OP_NoConflict ){
72812 /* For the OP_NoConflict opcode, take the jump if any of the
@@ -73402,10 +74426,14 @@
73402 #endif /* SQLITE_OMIT_VIRTUALTABLE */
73403 }else{
73404 assert( pC->pCursor!=0 );
73405 rc = sqlite3VdbeCursorRestore(pC);
73406 if( rc ) goto abort_due_to_error;
 
 
 
 
73407 rc = sqlite3BtreeKeySize(pC->pCursor, &v);
73408 assert( rc==SQLITE_OK ); /* Always so because of CursorRestore() above */
73409 }
73410 pOut->u.i = v;
73411 break;
@@ -73492,13 +74520,13 @@
73492 }
73493 /* Opcode: Rewind P1 P2 * * *
73494 **
73495 ** The next use of the Rowid or Column or Next instruction for P1
73496 ** will refer to the first entry in the database table or index.
73497 ** If the table or index is empty and P2>0, then jump immediately to P2.
73498 ** If P2 is 0 or if the table or index is not empty, fall through
73499 ** to the following instruction.
73500 **
73501 ** This opcode leaves the cursor configured to move in forward order,
73502 ** from the beginning toward the end. In other words, the cursor is
73503 ** configured to use Next, not Prev.
73504 */
@@ -74410,10 +75438,13 @@
74410 pFrame->aOp = p->aOp;
74411 pFrame->nOp = p->nOp;
74412 pFrame->token = pProgram->token;
74413 pFrame->aOnceFlag = p->aOnceFlag;
74414 pFrame->nOnceFlag = p->nOnceFlag;
 
 
 
74415
74416 pEnd = &VdbeFrameMem(pFrame)[pFrame->nChildMem];
74417 for(pMem=VdbeFrameMem(pFrame); pMem!=pEnd; pMem++){
74418 pMem->flags = MEM_Undefined;
74419 pMem->db = db;
@@ -74427,10 +75458,11 @@
74427
74428 p->nFrame++;
74429 pFrame->pParent = p->pFrame;
74430 pFrame->lastRowid = lastRowid;
74431 pFrame->nChange = p->nChange;
 
74432 p->nChange = 0;
74433 p->pFrame = pFrame;
74434 p->aMem = aMem = &VdbeFrameMem(pFrame)[-1];
74435 p->nMem = pFrame->nChildMem;
74436 p->nCursor = (u16)pFrame->nChildCsr;
@@ -74437,10 +75469,13 @@
74437 p->apCsr = (VdbeCursor **)&aMem[p->nMem+1];
74438 p->aOp = aOp = pProgram->aOp;
74439 p->nOp = pProgram->nOp;
74440 p->aOnceFlag = (u8 *)&p->apCsr[p->nCursor];
74441 p->nOnceFlag = pProgram->nOnce;
 
 
 
74442 pc = -1;
74443 memset(p->aOnceFlag, 0, p->nOnceFlag);
74444
74445 break;
74446 }
@@ -74681,12 +75716,12 @@
74681
74682 #ifndef SQLITE_OMIT_WAL
74683 /* Opcode: Checkpoint P1 P2 P3 * *
74684 **
74685 ** Checkpoint database P1. This is a no-op if P1 is not currently in
74686 ** WAL mode. Parameter P2 is one of SQLITE_CHECKPOINT_PASSIVE, FULL
74687 ** or RESTART. Write 1 or 0 into mem[P3] if the checkpoint returns
74688 ** SQLITE_BUSY or not, respectively. Write the number of pages in the
74689 ** WAL after the checkpoint into mem[P3+1] and the number of pages
74690 ** in the WAL that have been checkpointed after the checkpoint
74691 ** completes into mem[P3+2]. However on an error, mem[P3+1] and
74692 ** mem[P3+2] are initialized to -1.
@@ -74700,10 +75735,11 @@
74700 aRes[0] = 0;
74701 aRes[1] = aRes[2] = -1;
74702 assert( pOp->p2==SQLITE_CHECKPOINT_PASSIVE
74703 || pOp->p2==SQLITE_CHECKPOINT_FULL
74704 || pOp->p2==SQLITE_CHECKPOINT_RESTART
 
74705 );
74706 rc = sqlite3Checkpoint(db, pOp->p1, pOp->p2, &aRes[1], &aRes[2]);
74707 if( rc==SQLITE_BUSY ){
74708 rc = SQLITE_OK;
74709 aRes[0] = 1;
@@ -75625,10 +76661,15 @@
75625 char *zErr = 0;
75626 Table *pTab;
75627 Parse *pParse = 0;
75628 Incrblob *pBlob = 0;
75629
 
 
 
 
 
75630 flags = !!flags; /* flags = (flags ? 1 : 0); */
75631 *ppBlob = 0;
75632
75633 sqlite3_mutex_enter(db->mutex);
75634
@@ -75843,11 +76884,10 @@
75843 v = (Vdbe*)p->pStmt;
75844
75845 if( n<0 || iOffset<0 || (iOffset+n)>p->nByte ){
75846 /* Request is out of range. Return a transient error. */
75847 rc = SQLITE_ERROR;
75848 sqlite3Error(db, SQLITE_ERROR);
75849 }else if( v==0 ){
75850 /* If there is no statement handle, then the blob-handle has
75851 ** already been invalidated. Return SQLITE_ABORT in this case.
75852 */
75853 rc = SQLITE_ABORT;
@@ -75861,14 +76901,14 @@
75861 sqlite3BtreeLeaveCursor(p->pCsr);
75862 if( rc==SQLITE_ABORT ){
75863 sqlite3VdbeFinalize(v);
75864 p->pStmt = 0;
75865 }else{
75866 db->errCode = rc;
75867 v->rc = rc;
75868 }
75869 }
 
75870 rc = sqlite3ApiExit(db, rc);
75871 sqlite3_mutex_leave(db->mutex);
75872 return rc;
75873 }
75874
@@ -76041,11 +77081,11 @@
76041 ** itself.
76042 **
76043 ** The sorter is running in multi-threaded mode if (a) the library was built
76044 ** with pre-processor symbol SQLITE_MAX_WORKER_THREADS set to a value greater
76045 ** than zero, and (b) worker threads have been enabled at runtime by calling
76046 ** sqlite3_config(SQLITE_CONFIG_WORKER_THREADS, ...).
76047 **
76048 ** When Rewind() is called, any data remaining in memory is flushed to a
76049 ** final PMA. So at this point the data is stored in some number of sorted
76050 ** PMAs within temporary files on disk.
76051 **
@@ -76086,10 +77126,17 @@
76086 */
76087 #if 0
76088 # define SQLITE_DEBUG_SORTER_THREADS 1
76089 #endif
76090
 
 
 
 
 
 
 
76091 /*
76092 ** Private objects used by the sorter
76093 */
76094 typedef struct MergeEngine MergeEngine; /* Merge PMAs together */
76095 typedef struct PmaReader PmaReader; /* Incrementally read one PMA */
@@ -76784,17 +77831,15 @@
76784
76785 if( !sqlite3TempInMemory(db) ){
76786 pSorter->mnPmaSize = SORTER_MIN_WORKING * pgsz;
76787 mxCache = db->aDb[0].pSchema->cache_size;
76788 if( mxCache<SORTER_MIN_WORKING ) mxCache = SORTER_MIN_WORKING;
76789 pSorter->mxPmaSize = mxCache * pgsz;
76790
76791 /* If the application has not configure scratch memory using
76792 ** SQLITE_CONFIG_SCRATCH then we assume it is OK to do large memory
76793 ** allocations. If scratch memory has been configured, then assume
76794 ** large memory allocations should be avoided to prevent heap
76795 ** fragmentation.
76796 */
76797 if( sqlite3GlobalConfig.pScratch==0 ){
76798 assert( pSorter->iMemory==0 );
76799 pSorter->nMemory = pgsz;
76800 pSorter->list.aMemory = (u8*)sqlite3Malloc(pgsz);
@@ -79162,19 +80207,19 @@
79162 **
79163 ** incrAggFunctionDepth(pExpr,n) is the main routine. incrAggDepth(..)
79164 ** is a helper function - a callback for the tree walker.
79165 */
79166 static int incrAggDepth(Walker *pWalker, Expr *pExpr){
79167 if( pExpr->op==TK_AGG_FUNCTION ) pExpr->op2 += pWalker->u.i;
79168 return WRC_Continue;
79169 }
79170 static void incrAggFunctionDepth(Expr *pExpr, int N){
79171 if( N>0 ){
79172 Walker w;
79173 memset(&w, 0, sizeof(w));
79174 w.xExprCallback = incrAggDepth;
79175 w.u.i = N;
79176 sqlite3WalkExpr(&w, pExpr);
79177 }
79178 }
79179
79180 /*
@@ -79454,10 +80499,14 @@
79454 }
79455 }
79456 if( pMatch ){
79457 pExpr->iTable = pMatch->iCursor;
79458 pExpr->pTab = pMatch->pTab;
 
 
 
 
79459 pSchema = pExpr->pTab->pSchema;
79460 }
79461 } /* if( pSrcList ) */
79462
79463 #ifndef SQLITE_OMIT_TRIGGER
@@ -79718,11 +80767,11 @@
79718 double r = -1.0;
79719 if( p->op!=TK_FLOAT ) return -1;
79720 sqlite3AtoF(p->u.zToken, &r, sqlite3Strlen30(p->u.zToken), SQLITE_UTF8);
79721 assert( r>=0.0 );
79722 if( r>1.0 ) return -1;
79723 return (int)(r*1000.0);
79724 }
79725
79726 /*
79727 ** This routine is callback for sqlite3WalkExpr().
79728 **
@@ -79850,11 +80899,11 @@
79850 ** EVIDENCE-OF: R-36850-34127 The likely(X) function is short-hand for
79851 ** likelihood(X,0.9375).
79852 ** EVIDENCE-OF: R-53436-40973 The likely(X) function is equivalent to
79853 ** likelihood(X,0.9375). */
79854 /* TUNING: unlikely() probability is 0.0625. likely() is 0.9375 */
79855 pExpr->iTable = pDef->zName[0]=='u' ? 62 : 938;
79856 }
79857 }
79858 #ifndef SQLITE_OMIT_AUTHORIZATION
79859 auth = sqlite3AuthCheck(pParse, SQLITE_FUNCTION, 0, pDef->zName, 0);
79860 if( auth!=SQLITE_OK ){
@@ -81807,69 +82856,79 @@
81807 sqlite3DbFree(db, pList->a);
81808 sqlite3DbFree(db, pList);
81809 }
81810
81811 /*
81812 ** These routines are Walker callbacks. Walker.u.pi is a pointer
81813 ** to an integer. These routines are checking an expression to see
81814 ** if it is a constant. Set *Walker.u.i to 0 if the expression is
81815 ** not constant.
81816 **
81817 ** These callback routines are used to implement the following:
81818 **
81819 ** sqlite3ExprIsConstant() pWalker->u.i==1
81820 ** sqlite3ExprIsConstantNotJoin() pWalker->u.i==2
81821 ** sqlite3ExprIsConstantOrFunction() pWalker->u.i==3 or 4
 
 
 
 
81822 **
81823 ** The sqlite3ExprIsConstantOrFunction() is used for evaluating expressions
81824 ** in a CREATE TABLE statement. The Walker.u.i value is 4 when parsing
81825 ** an existing schema and 3 when processing a new statement. A bound
81826 ** parameter raises an error for new statements, but is silently converted
81827 ** to NULL for existing schemas. This allows sqlite_master tables that
81828 ** contain a bound parameter because they were generated by older versions
81829 ** of SQLite to be parsed by newer versions of SQLite without raising a
81830 ** malformed schema error.
81831 */
81832 static int exprNodeIsConstant(Walker *pWalker, Expr *pExpr){
81833
81834 /* If pWalker->u.i is 2 then any term of the expression that comes from
81835 ** the ON or USING clauses of a join disqualifies the expression
81836 ** from being considered constant. */
81837 if( pWalker->u.i==2 && ExprHasProperty(pExpr, EP_FromJoin) ){
81838 pWalker->u.i = 0;
81839 return WRC_Abort;
81840 }
81841
81842 switch( pExpr->op ){
81843 /* Consider functions to be constant if all their arguments are constant
81844 ** and either pWalker->u.i==3 or 4 or the function as the SQLITE_FUNC_CONST
81845 ** flag. */
81846 case TK_FUNCTION:
81847 if( pWalker->u.i>=3 || ExprHasProperty(pExpr,EP_Constant) ){
81848 return WRC_Continue;
 
 
 
81849 }
81850 /* Fall through */
81851 case TK_ID:
81852 case TK_COLUMN:
81853 case TK_AGG_FUNCTION:
81854 case TK_AGG_COLUMN:
81855 testcase( pExpr->op==TK_ID );
81856 testcase( pExpr->op==TK_COLUMN );
81857 testcase( pExpr->op==TK_AGG_FUNCTION );
81858 testcase( pExpr->op==TK_AGG_COLUMN );
81859 pWalker->u.i = 0;
81860 return WRC_Abort;
 
 
 
 
81861 case TK_VARIABLE:
81862 if( pWalker->u.i==4 ){
81863 /* Silently convert bound parameters that appear inside of CREATE
81864 ** statements into a NULL when parsing the CREATE statement text out
81865 ** of the sqlite_master table */
81866 pExpr->op = TK_NULL;
81867 }else if( pWalker->u.i==3 ){
81868 /* A bound parameter in a CREATE statement that originates from
81869 ** sqlite3_prepare() causes an error */
81870 pWalker->u.i = 0;
81871 return WRC_Abort;
81872 }
81873 /* Fall through */
81874 default:
81875 testcase( pExpr->op==TK_SELECT ); /* selectNodeIsConstant will disallow */
@@ -81877,57 +82936,68 @@
81877 return WRC_Continue;
81878 }
81879 }
81880 static int selectNodeIsConstant(Walker *pWalker, Select *NotUsed){
81881 UNUSED_PARAMETER(NotUsed);
81882 pWalker->u.i = 0;
81883 return WRC_Abort;
81884 }
81885 static int exprIsConst(Expr *p, int initFlag){
81886 Walker w;
81887 memset(&w, 0, sizeof(w));
81888 w.u.i = initFlag;
81889 w.xExprCallback = exprNodeIsConstant;
81890 w.xSelectCallback = selectNodeIsConstant;
 
81891 sqlite3WalkExpr(&w, p);
81892 return w.u.i;
81893 }
81894
81895 /*
81896 ** Walk an expression tree. Return 1 if the expression is constant
81897 ** and 0 if it involves variables or function calls.
81898 **
81899 ** For the purposes of this function, a double-quoted string (ex: "abc")
81900 ** is considered a variable but a single-quoted string (ex: 'abc') is
81901 ** a constant.
81902 */
81903 SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr *p){
81904 return exprIsConst(p, 1);
81905 }
81906
81907 /*
81908 ** Walk an expression tree. Return 1 if the expression is constant
81909 ** that does no originate from the ON or USING clauses of a join.
81910 ** Return 0 if it involves variables or function calls or terms from
81911 ** an ON or USING clause.
81912 */
81913 SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr *p){
81914 return exprIsConst(p, 2);
81915 }
81916
81917 /*
81918 ** Walk an expression tree. Return 1 if the expression is constant
 
 
 
 
 
 
 
 
 
 
81919 ** or a function call with constant arguments. Return and 0 if there
81920 ** are any variables.
81921 **
81922 ** For the purposes of this function, a double-quoted string (ex: "abc")
81923 ** is considered a variable but a single-quoted string (ex: 'abc') is
81924 ** a constant.
81925 */
81926 SQLITE_PRIVATE int sqlite3ExprIsConstantOrFunction(Expr *p, u8 isInit){
81927 assert( isInit==0 || isInit==1 );
81928 return exprIsConst(p, 3+isInit);
81929 }
81930
81931 /*
81932 ** If the expression p codes a constant integer that is small enough
81933 ** to fit in a 32-bit integer, return 1 and put the value of the integer
@@ -81990,11 +83060,12 @@
81990 case TK_FLOAT:
81991 case TK_BLOB:
81992 return 0;
81993 case TK_COLUMN:
81994 assert( p->pTab!=0 );
81995 return p->iColumn>=0 && p->pTab->aCol[p->iColumn].notNull==0;
 
81996 default:
81997 return 1;
81998 }
81999 }
82000
@@ -82433,11 +83504,10 @@
82433 sqlite3SelectDestInit(&dest, SRT_Set, pExpr->iTable);
82434 dest.affSdst = (u8)affinity;
82435 assert( (pExpr->iTable&0x0000FFFF)==pExpr->iTable );
82436 pSelect->iLimit = 0;
82437 testcase( pSelect->selFlags & SF_Distinct );
82438 pSelect->selFlags &= ~SF_Distinct;
82439 testcase( pKeyInfo==0 ); /* Caused by OOM in sqlite3KeyInfoAlloc() */
82440 if( sqlite3Select(pParse, pSelect, &dest) ){
82441 sqlite3KeyInfoUnref(pKeyInfo);
82442 return 0;
82443 }
@@ -83580,11 +84650,14 @@
83580 target
83581 ));
83582
83583 #ifndef SQLITE_OMIT_FLOATING_POINT
83584 /* If the column has REAL affinity, it may currently be stored as an
83585 ** integer. Use OP_RealAffinity to make sure it is really real. */
 
 
 
83586 if( pExpr->iColumn>=0
83587 && pTab->aCol[pExpr->iColumn].affinity==SQLITE_AFF_REAL
83588 ){
83589 sqlite3VdbeAddOp1(v, OP_RealAffinity, target);
83590 }
@@ -87232,27 +88305,32 @@
87232 aLog[i] = sqlite3LogEst(v);
87233 #endif
87234 if( *z==' ' ) z++;
87235 }
87236 #ifndef SQLITE_ENABLE_STAT3_OR_STAT4
87237 assert( pIndex!=0 );
87238 #else
87239 if( pIndex )
87240 #endif
87241 while( z[0] ){
87242 if( sqlite3_strglob("unordered*", z)==0 ){
87243 pIndex->bUnordered = 1;
87244 }else if( sqlite3_strglob("sz=[0-9]*", z)==0 ){
87245 pIndex->szIdxRow = sqlite3LogEst(sqlite3Atoi(z+3));
87246 }
 
 
 
 
87247 #ifdef SQLITE_ENABLE_COSTMULT
87248 else if( sqlite3_strglob("costmult=[0-9]*",z)==0 ){
87249 pIndex->pTable->costMult = sqlite3LogEst(sqlite3Atoi(z+9));
 
 
 
 
87250 }
87251 #endif
87252 while( z[0]!=0 && z[0]!=' ' ) z++;
87253 while( z[0]==' ' ) z++;
87254 }
87255 }
87256
87257 /*
87258 ** This callback is invoked once for each index when reading the
@@ -87366,18 +88444,19 @@
87366 tRowcnt avgEq = 0;
87367 tRowcnt nRow; /* Number of rows in index */
87368 i64 nSum100 = 0; /* Number of terms contributing to sumEq */
87369 i64 nDist100; /* Number of distinct values in index */
87370
87371 if( pIdx->aiRowEst==0 || pIdx->aiRowEst[iCol+1]==0 ){
87372 nRow = pFinal->anLt[iCol];
87373 nDist100 = (i64)100 * pFinal->anDLt[iCol];
87374 nSample--;
87375 }else{
87376 nRow = pIdx->aiRowEst[0];
87377 nDist100 = ((i64)100 * pIdx->aiRowEst[0]) / pIdx->aiRowEst[iCol+1];
87378 }
 
87379
87380 /* Set nSum to the number of distinct (iCol+1) field prefixes that
87381 ** occur in the stat4 table for this index. Set sumEq to the sum of
87382 ** the nEq values for column iCol for the same set (adding the value
87383 ** only once where there exist duplicate prefixes). */
@@ -87635,11 +88714,11 @@
87635 }
87636
87637
87638 /* Load the statistics from the sqlite_stat4 table. */
87639 #ifdef SQLITE_ENABLE_STAT3_OR_STAT4
87640 if( rc==SQLITE_OK ){
87641 int lookasideEnabled = db->lookaside.bEnabled;
87642 db->lookaside.bEnabled = 0;
87643 rc = loadStat4(db, sInfo.zDatabase);
87644 db->lookaside.bEnabled = lookasideEnabled;
87645 }
@@ -88317,10 +89396,13 @@
88317 SQLITE_API int sqlite3_set_authorizer(
88318 sqlite3 *db,
88319 int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),
88320 void *pArg
88321 ){
 
 
 
88322 sqlite3_mutex_enter(db->mutex);
88323 db->xAuth = (sqlite3_xauth)xAuth;
88324 db->pAuthArg = pArg;
88325 sqlite3ExpirePreparedStatements(db);
88326 sqlite3_mutex_leave(db->mutex);
@@ -88811,11 +89893,15 @@
88811 ** See also sqlite3LocateTable().
88812 */
88813 SQLITE_PRIVATE Table *sqlite3FindTable(sqlite3 *db, const char *zName, const char *zDatabase){
88814 Table *p = 0;
88815 int i;
88816 assert( zName!=0 );
 
 
 
 
88817 /* All mutexes are required for schema access. Make sure we hold them. */
88818 assert( zDatabase!=0 || sqlite3BtreeHoldsAllMutexes(db) );
88819 #if SQLITE_USER_AUTHENTICATION
88820 /* Only the admin user is allowed to know that the sqlite_user table
88821 ** exists */
@@ -94275,12 +95361,12 @@
94275 break;
94276 }
94277 default: {
94278 /* Because sqlite3_value_double() returns 0.0 if the argument is not
94279 ** something that can be converted into a number, we have:
94280 ** IMP: R-57326-31541 Abs(X) return 0.0 if X is a string or blob that
94281 ** cannot be converted to a numeric value.
94282 */
94283 double rVal = sqlite3_value_double(argv[0]);
94284 if( rVal<0 ) rVal = -rVal;
94285 sqlite3_result_double(context, rVal);
94286 break;
@@ -102928,11 +104014,11 @@
102928 break;
102929 #endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
102930
102931 #ifndef SQLITE_OMIT_WAL
102932 /*
102933 ** PRAGMA [database.]wal_checkpoint = passive|full|restart
102934 **
102935 ** Checkpoint the database.
102936 */
102937 case PragTyp_WAL_CHECKPOINT: {
102938 int iBt = (pId2->z?iDb:SQLITE_MAX_ATTACHED);
@@ -102940,10 +104026,12 @@
102940 if( zRight ){
102941 if( sqlite3StrICmp(zRight, "full")==0 ){
102942 eMode = SQLITE_CHECKPOINT_FULL;
102943 }else if( sqlite3StrICmp(zRight, "restart")==0 ){
102944 eMode = SQLITE_CHECKPOINT_RESTART;
 
 
102945 }
102946 }
102947 sqlite3VdbeSetNumCols(v, 3);
102948 pParse->nMem = 3;
102949 sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "busy", SQLITE_STATIC);
@@ -103834,13 +104922,16 @@
103834 Vdbe *pOld, /* VM being reprepared */
103835 sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
103836 const char **pzTail /* OUT: End of parsed string */
103837 ){
103838 int rc;
103839 assert( ppStmt!=0 );
 
 
 
103840 *ppStmt = 0;
103841 if( !sqlite3SafetyCheckOk(db) ){
103842 return SQLITE_MISUSE_BKPT;
103843 }
103844 sqlite3_mutex_enter(db->mutex);
103845 sqlite3BtreeEnterAll(db);
103846 rc = sqlite3Prepare(db, zSql, nBytes, saveSqlFlag, pOld, ppStmt, pzTail);
@@ -103943,13 +105034,15 @@
103943 */
103944 char *zSql8;
103945 const char *zTail8 = 0;
103946 int rc = SQLITE_OK;
103947
103948 assert( ppStmt );
 
 
103949 *ppStmt = 0;
103950 if( !sqlite3SafetyCheckOk(db) ){
103951 return SQLITE_MISUSE_BKPT;
103952 }
103953 if( nBytes>=0 ){
103954 int sz;
103955 const char *z = (const char*)zSql;
@@ -108842,11 +109935,11 @@
108842 **
108843 ** SELECT DISTINCT xyz FROM ... ORDER BY xyz
108844 **
108845 ** is transformed to:
108846 **
108847 ** SELECT xyz FROM ... GROUP BY xyz
108848 **
108849 ** The second form is preferred as a single index (or temp-table) may be
108850 ** used for both the ORDER BY and DISTINCT processing. As originally
108851 ** written the query must use a temp-table for at least one of the ORDER
108852 ** BY and DISTINCT, and an index or separate temp-table for the other.
@@ -108855,11 +109948,10 @@
108855 && sqlite3ExprListCompare(sSort.pOrderBy, p->pEList, -1)==0
108856 ){
108857 p->selFlags &= ~SF_Distinct;
108858 p->pGroupBy = sqlite3ExprListDup(db, p->pEList, 0);
108859 pGroupBy = p->pGroupBy;
108860 sSort.pOrderBy = 0;
108861 /* Notice that even thought SF_Distinct has been cleared from p->selFlags,
108862 ** the sDistinct.isTnct is still set. Hence, isTnct represents the
108863 ** original setting of the SF_Distinct flag, not the current setting */
108864 assert( sDistinct.isTnct );
108865 }
@@ -109658,10 +110750,13 @@
109658 char **pzErrMsg /* Write error messages here */
109659 ){
109660 int rc;
109661 TabResult res;
109662
 
 
 
109663 *pazResult = 0;
109664 if( pnColumn ) *pnColumn = 0;
109665 if( pnRow ) *pnRow = 0;
109666 if( pzErrMsg ) *pzErrMsg = 0;
109667 res.zErrMsg = 0;
@@ -111721,11 +112816,11 @@
111721 ** Two writes per page are required in step (3) because the original
111722 ** database content must be written into the rollback journal prior to
111723 ** overwriting the database with the vacuumed content.
111724 **
111725 ** Only 1x temporary space and only 1x writes would be required if
111726 ** the copy of step (3) were replace by deleting the original database
111727 ** and renaming the transient database as the original. But that will
111728 ** not work if other processes are attached to the original database.
111729 ** And a power loss in between deleting the original and renaming the
111730 ** transient would cause the database file to appear to be deleted
111731 ** following reboot.
@@ -112079,10 +113174,13 @@
112079 sqlite3 *db, /* Database in which module is registered */
112080 const char *zName, /* Name assigned to this module */
112081 const sqlite3_module *pModule, /* The definition of the module */
112082 void *pAux /* Context pointer for xCreate/xConnect */
112083 ){
 
 
 
112084 return createModule(db, zName, pModule, pAux, 0);
112085 }
112086
112087 /*
112088 ** External API function used to create a new virtual-table module.
@@ -112092,10 +113190,13 @@
112092 const char *zName, /* Name assigned to this module */
112093 const sqlite3_module *pModule, /* The definition of the module */
112094 void *pAux, /* Context pointer for xCreate/xConnect */
112095 void (*xDestroy)(void *) /* Module destructor function */
112096 ){
 
 
 
112097 return createModule(db, zName, pModule, pAux, xDestroy);
112098 }
112099
112100 /*
112101 ** Lock the virtual table so that it cannot be disconnected.
@@ -112324,11 +113425,16 @@
112324 pTable->tabFlags |= TF_Virtual;
112325 pTable->nModuleArg = 0;
112326 addModuleArgument(db, pTable, sqlite3NameFromToken(db, pModuleName));
112327 addModuleArgument(db, pTable, 0);
112328 addModuleArgument(db, pTable, sqlite3DbStrDup(db, pTable->zName));
112329 pParse->sNameToken.n = (int)(&pModuleName->z[pModuleName->n] - pName1->z);
 
 
 
 
 
112330
112331 #ifndef SQLITE_OMIT_AUTHORIZATION
112332 /* Creating a virtual table invokes the authorization callback twice.
112333 ** The first invocation, to obtain permission to INSERT a row into the
112334 ** sqlite_master table, has already been made by sqlite3StartTable().
@@ -112696,10 +113802,13 @@
112696
112697 int rc = SQLITE_OK;
112698 Table *pTab;
112699 char *zErr = 0;
112700
 
 
 
112701 sqlite3_mutex_enter(db->mutex);
112702 if( !db->pVtabCtx || !(pTab = db->pVtabCtx->pTab) ){
112703 sqlite3Error(db, SQLITE_MISUSE);
112704 sqlite3_mutex_leave(db->mutex);
112705 return SQLITE_MISUSE_BKPT;
@@ -113052,10 +114161,13 @@
113052 */
113053 SQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *db){
113054 static const unsigned char aMap[] = {
113055 SQLITE_ROLLBACK, SQLITE_ABORT, SQLITE_FAIL, SQLITE_IGNORE, SQLITE_REPLACE
113056 };
 
 
 
113057 assert( OE_Rollback==1 && OE_Abort==2 && OE_Fail==3 );
113058 assert( OE_Ignore==4 && OE_Replace==5 );
113059 assert( db->vtabOnConflict>=1 && db->vtabOnConflict<=5 );
113060 return (int)aMap[db->vtabOnConflict-1];
113061 }
@@ -113067,12 +114179,14 @@
113067 */
113068 SQLITE_API int sqlite3_vtab_config(sqlite3 *db, int op, ...){
113069 va_list ap;
113070 int rc = SQLITE_OK;
113071
 
 
 
113072 sqlite3_mutex_enter(db->mutex);
113073
113074 va_start(ap, op);
113075 switch( op ){
113076 case SQLITE_VTAB_CONSTRAINT_SUPPORT: {
113077 VtabCtx *p = db->pVtabCtx;
113078 if( !p ){
@@ -113203,10 +114317,13 @@
113203 } in; /* Used when pWLoop->wsFlags&WHERE_IN_ABLE */
113204 Index *pCovidx; /* Possible covering index for WHERE_MULTI_OR */
113205 } u;
113206 struct WhereLoop *pWLoop; /* The selected WhereLoop object */
113207 Bitmask notReady; /* FROM entries not usable at this level */
 
 
 
113208 };
113209
113210 /*
113211 ** Each instance of this object represents an algorithm for evaluating one
113212 ** term of a join. Every term of the FROM clause will have at least
@@ -113233,11 +114350,10 @@
113233 LogEst rRun; /* Cost of running each loop */
113234 LogEst nOut; /* Estimated number of output rows */
113235 union {
113236 struct { /* Information for internal btree tables */
113237 u16 nEq; /* Number of equality constraints */
113238 u16 nSkip; /* Number of initial index columns to skip */
113239 Index *pIndex; /* Index used, or NULL */
113240 } btree;
113241 struct { /* Information for virtual tables */
113242 int idxNum; /* Index number */
113243 u8 needFree; /* True if sqlite3_free(idxStr) is needed */
@@ -113246,16 +114362,17 @@
113246 char *idxStr; /* Index identifier string */
113247 } vtab;
113248 } u;
113249 u32 wsFlags; /* WHERE_* flags describing the plan */
113250 u16 nLTerm; /* Number of entries in aLTerm[] */
 
113251 /**** whereLoopXfer() copies fields above ***********************/
113252 # define WHERE_LOOP_XFER_SZ offsetof(WhereLoop,nLSlot)
113253 u16 nLSlot; /* Number of slots allocated for aLTerm[] */
113254 WhereTerm **aLTerm; /* WhereTerms used */
113255 WhereLoop *pNextLoop; /* Next WhereLoop object in the WhereClause */
113256 WhereTerm *aLTermSpace[4]; /* Initial aLTerm[] space */
113257 };
113258
113259 /* This object holds the prerequisites and the cost of running a
113260 ** subquery on one operand of an OR operator in the WHERE clause.
113261 ** See WhereOrSet for additional information
@@ -113577,10 +114694,11 @@
113577 #define WHERE_ONEROW 0x00001000 /* Selects no more than one row */
113578 #define WHERE_MULTI_OR 0x00002000 /* OR using multiple indices */
113579 #define WHERE_AUTO_INDEX 0x00004000 /* Uses an ephemeral index */
113580 #define WHERE_SKIPSCAN 0x00008000 /* Uses the skip-scan algorithm */
113581 #define WHERE_UNQ_WANTED 0x00010000 /* WHERE_ONEROW would have been helpful*/
 
113582
113583 /************** End of whereInt.h ********************************************/
113584 /************** Continuing where we left off in where.c **********************/
113585
113586 /*
@@ -113784,14 +114902,15 @@
113784 memcpy(pWC->a, pOld, sizeof(pWC->a[0])*pWC->nTerm);
113785 if( pOld!=pWC->aStatic ){
113786 sqlite3DbFree(db, pOld);
113787 }
113788 pWC->nSlot = sqlite3DbMallocSize(db, pWC->a)/sizeof(pWC->a[0]);
 
113789 }
113790 pTerm = &pWC->a[idx = pWC->nTerm++];
113791 if( p && ExprHasProperty(p, EP_Unlikely) ){
113792 pTerm->truthProb = sqlite3LogEst(p->iTable) - 99;
113793 }else{
113794 pTerm->truthProb = 1;
113795 }
113796 pTerm->pExpr = sqlite3ExprSkipCollate(p);
113797 pTerm->wtFlags = wtFlags;
@@ -114317,10 +115436,19 @@
114317 if( pDerived ){
114318 pDerived->flags |= pBase->flags & EP_FromJoin;
114319 pDerived->iRightJoinTable = pBase->iRightJoinTable;
114320 }
114321 }
 
 
 
 
 
 
 
 
 
114322
114323 #if !defined(SQLITE_OMIT_OR_OPTIMIZATION) && !defined(SQLITE_OMIT_SUBQUERY)
114324 /*
114325 ** Analyze a term that consists of two or more OR-connected
114326 ** subterms. So in:
@@ -114615,12 +115743,11 @@
114615 pNew->x.pList = pList;
114616 idxNew = whereClauseInsert(pWC, pNew, TERM_VIRTUAL|TERM_DYNAMIC);
114617 testcase( idxNew==0 );
114618 exprAnalyze(pSrc, pWC, idxNew);
114619 pTerm = &pWC->a[idxTerm];
114620 pWC->a[idxNew].iParent = idxTerm;
114621 pTerm->nChild = 1;
114622 }else{
114623 sqlite3ExprListDelete(db, pList);
114624 }
114625 pTerm->eOperator = WO_NOOP; /* case 1 trumps case 2 */
114626 }
@@ -114718,13 +115845,12 @@
114718 return;
114719 }
114720 idxNew = whereClauseInsert(pWC, pDup, TERM_VIRTUAL|TERM_DYNAMIC);
114721 if( idxNew==0 ) return;
114722 pNew = &pWC->a[idxNew];
114723 pNew->iParent = idxTerm;
114724 pTerm = &pWC->a[idxTerm];
114725 pTerm->nChild = 1;
114726 pTerm->wtFlags |= TERM_COPIED;
114727 if( pExpr->op==TK_EQ
114728 && !ExprHasProperty(pExpr, EP_FromJoin)
114729 && OptimizationEnabled(db, SQLITE_Transitive)
114730 ){
@@ -114777,13 +115903,12 @@
114777 transferJoinMarkings(pNewExpr, pExpr);
114778 idxNew = whereClauseInsert(pWC, pNewExpr, TERM_VIRTUAL|TERM_DYNAMIC);
114779 testcase( idxNew==0 );
114780 exprAnalyze(pSrc, pWC, idxNew);
114781 pTerm = &pWC->a[idxTerm];
114782 pWC->a[idxNew].iParent = idxTerm;
114783 }
114784 pTerm->nChild = 2;
114785 }
114786 #endif /* SQLITE_OMIT_BETWEEN_OPTIMIZATION */
114787
114788 #if !defined(SQLITE_OMIT_OR_OPTIMIZATION) && !defined(SQLITE_OMIT_SUBQUERY)
114789 /* Analyze a term that is composed of two or more subterms connected by
@@ -114854,13 +115979,12 @@
114854 idxNew2 = whereClauseInsert(pWC, pNewExpr2, TERM_VIRTUAL|TERM_DYNAMIC);
114855 testcase( idxNew2==0 );
114856 exprAnalyze(pSrc, pWC, idxNew2);
114857 pTerm = &pWC->a[idxTerm];
114858 if( isComplete ){
114859 pWC->a[idxNew1].iParent = idxTerm;
114860 pWC->a[idxNew2].iParent = idxTerm;
114861 pTerm->nChild = 2;
114862 }
114863 }
114864 #endif /* SQLITE_OMIT_LIKE_OPTIMIZATION */
114865
114866 #ifndef SQLITE_OMIT_VIRTUALTABLE
@@ -114889,13 +116013,12 @@
114889 pNewTerm = &pWC->a[idxNew];
114890 pNewTerm->prereqRight = prereqExpr;
114891 pNewTerm->leftCursor = pLeft->iTable;
114892 pNewTerm->u.leftColumn = pLeft->iColumn;
114893 pNewTerm->eOperator = WO_MATCH;
114894 pNewTerm->iParent = idxTerm;
114895 pTerm = &pWC->a[idxTerm];
114896 pTerm->nChild = 1;
114897 pTerm->wtFlags |= TERM_COPIED;
114898 pNewTerm->prereqAll = pTerm->prereqAll;
114899 }
114900 }
114901 #endif /* SQLITE_OMIT_VIRTUALTABLE */
@@ -114912,11 +116035,11 @@
114912 ** the start of the loop will prevent any results from being returned.
114913 */
114914 if( pExpr->op==TK_NOTNULL
114915 && pExpr->pLeft->op==TK_COLUMN
114916 && pExpr->pLeft->iColumn>=0
114917 && OptimizationEnabled(db, SQLITE_Stat3)
114918 ){
114919 Expr *pNewExpr;
114920 Expr *pLeft = pExpr->pLeft;
114921 int idxNew;
114922 WhereTerm *pNewTerm;
@@ -114931,13 +116054,12 @@
114931 pNewTerm = &pWC->a[idxNew];
114932 pNewTerm->prereqRight = 0;
114933 pNewTerm->leftCursor = pLeft->iTable;
114934 pNewTerm->u.leftColumn = pLeft->iColumn;
114935 pNewTerm->eOperator = WO_GT;
114936 pNewTerm->iParent = idxTerm;
114937 pTerm = &pWC->a[idxTerm];
114938 pTerm->nChild = 1;
114939 pTerm->wtFlags |= TERM_COPIED;
114940 pNewTerm->prereqAll = pTerm->prereqAll;
114941 }
114942 }
114943 #endif /* SQLITE_ENABLE_STAT3_OR_STAT4 */
@@ -115153,10 +116275,12 @@
115153 WhereLoop *pLoop; /* The Loop object */
115154 char *zNotUsed; /* Extra space on the end of pIdx */
115155 Bitmask idxCols; /* Bitmap of columns used for indexing */
115156 Bitmask extraCols; /* Bitmap of additional columns */
115157 u8 sentWarning = 0; /* True if a warnning has been issued */
 
 
115158
115159 /* Generate code to skip over the creation and initialization of the
115160 ** transient index on 2nd and subsequent iterations of the loop. */
115161 v = pParse->pVdbe;
115162 assert( v!=0 );
@@ -115168,10 +116292,16 @@
115168 pTable = pSrc->pTab;
115169 pWCEnd = &pWC->a[pWC->nTerm];
115170 pLoop = pLevel->pWLoop;
115171 idxCols = 0;
115172 for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){
 
 
 
 
 
 
115173 if( termCanDriveIndex(pTerm, pSrc, notReady) ){
115174 int iCol = pTerm->u.leftColumn;
115175 Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol);
115176 testcase( iCol==BMS );
115177 testcase( iCol==BMS-1 );
@@ -115180,11 +116310,13 @@
115180 "automatic index on %s(%s)", pTable->zName,
115181 pTable->aCol[iCol].zName);
115182 sentWarning = 1;
115183 }
115184 if( (idxCols & cMask)==0 ){
115185 if( whereLoopResize(pParse->db, pLoop, nKeyCol+1) ) return;
 
 
115186 pLoop->aLTerm[nKeyCol++] = pTerm;
115187 idxCols |= cMask;
115188 }
115189 }
115190 }
@@ -115200,24 +116332,23 @@
115200 ** be a covering index because the index will not be updated if the
115201 ** original table changes and the index and table cannot both be used
115202 ** if they go out of sync.
115203 */
115204 extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1));
115205 mxBitCol = (pTable->nCol >= BMS-1) ? BMS-1 : pTable->nCol;
115206 testcase( pTable->nCol==BMS-1 );
115207 testcase( pTable->nCol==BMS-2 );
115208 for(i=0; i<mxBitCol; i++){
115209 if( extraCols & MASKBIT(i) ) nKeyCol++;
115210 }
115211 if( pSrc->colUsed & MASKBIT(BMS-1) ){
115212 nKeyCol += pTable->nCol - BMS + 1;
115213 }
115214 pLoop->wsFlags |= WHERE_COLUMN_EQ | WHERE_IDX_ONLY;
115215
115216 /* Construct the Index object to describe this index */
115217 pIdx = sqlite3AllocateIndexObject(pParse->db, nKeyCol+1, 0, &zNotUsed);
115218 if( pIdx==0 ) return;
115219 pLoop->u.btree.pIndex = pIdx;
115220 pIdx->zName = "auto-index";
115221 pIdx->pTable = pTable;
115222 n = 0;
115223 idxCols = 0;
@@ -115265,22 +116396,33 @@
115265 sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1);
115266 sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
115267 VdbeComment((v, "for %s", pTable->zName));
115268
115269 /* Fill the automatic index with content */
 
115270 addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, pLevel->iTabCur); VdbeCoverage(v);
 
 
 
 
 
115271 regRecord = sqlite3GetTempReg(pParse);
115272 sqlite3GenerateIndexKey(pParse, pIdx, pLevel->iTabCur, regRecord, 0, 0, 0, 0);
115273 sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord);
115274 sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
 
115275 sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v);
115276 sqlite3VdbeChangeP5(v, SQLITE_STMTSTATUS_AUTOINDEX);
115277 sqlite3VdbeJumpHere(v, addrTop);
115278 sqlite3ReleaseTempReg(pParse, regRecord);
 
115279
115280 /* Jump here when skipping the initialization */
115281 sqlite3VdbeJumpHere(v, addrInit);
 
 
 
115282 }
115283 #endif /* SQLITE_OMIT_AUTOMATIC_INDEX */
115284
115285 #ifndef SQLITE_OMIT_VIRTUALTABLE
115286 /*
@@ -115436,22 +116578,22 @@
115436
115437 return pParse->nErr;
115438 }
115439 #endif /* !defined(SQLITE_OMIT_VIRTUALTABLE) */
115440
115441
115442 #ifdef SQLITE_ENABLE_STAT3_OR_STAT4
115443 /*
115444 ** Estimate the location of a particular key among all keys in an
115445 ** index. Store the results in aStat as follows:
115446 **
115447 ** aStat[0] Est. number of rows less than pVal
115448 ** aStat[1] Est. number of rows equal to pVal
115449 **
115450 ** Return SQLITE_OK on success.
 
115451 */
115452 static void whereKeyStats(
115453 Parse *pParse, /* Database connection */
115454 Index *pIdx, /* Index to consider domain of */
115455 UnpackedRecord *pRec, /* Vector of values to consider */
115456 int roundUp, /* Round up if true. Round down if false */
115457 tRowcnt *aStat /* OUT: stats written here */
@@ -115529,10 +116671,11 @@
115529 }else{
115530 iGap = iGap/3;
115531 }
115532 aStat[0] = iLower + iGap;
115533 }
 
115534 }
115535 #endif /* SQLITE_ENABLE_STAT3_OR_STAT4 */
115536
115537 /*
115538 ** If it is not NULL, pTerm is a term that provides an upper or lower
@@ -115679,11 +116822,11 @@
115679 ** pLower pUpper
115680 **
115681 ** If either of the upper or lower bound is not present, then NULL is passed in
115682 ** place of the corresponding WhereTerm.
115683 **
115684 ** The value in (pBuilder->pNew->u.btree.nEq) is the index of the index
115685 ** column subject to the range constraint. Or, equivalently, the number of
115686 ** equality constraints optimized by the proposed index scan. For example,
115687 ** assuming index p is on t1(a, b), and the SQL query is:
115688 **
115689 ** ... FROM t1 WHERE a = ? AND b > ? AND b < ? ...
@@ -115695,11 +116838,11 @@
115695 **
115696 ** then nEq is set to 0.
115697 **
115698 ** When this function is called, *pnOut is set to the sqlite3LogEst() of the
115699 ** number of rows that the index scan is expected to visit without
115700 ** considering the range constraints. If nEq is 0, this is the number of
115701 ** rows in the index. Assuming no error occurs, *pnOut is adjusted (reduced)
115702 ** to account for the range constraints pLower and pUpper.
115703 **
115704 ** In the absence of sqlite_stat4 ANALYZE data, or if such data cannot be
115705 ** used, a single range inequality reduces the search space by a factor of 4.
@@ -115719,14 +116862,11 @@
115719
115720 #ifdef SQLITE_ENABLE_STAT3_OR_STAT4
115721 Index *p = pLoop->u.btree.pIndex;
115722 int nEq = pLoop->u.btree.nEq;
115723
115724 if( p->nSample>0
115725 && nEq<p->nSampleCol
115726 && OptimizationEnabled(pParse->db, SQLITE_Stat3)
115727 ){
115728 if( nEq==pBuilder->nRecValid ){
115729 UnpackedRecord *pRec = pBuilder->pRec;
115730 tRowcnt a[2];
115731 u8 aff;
115732
@@ -115738,19 +116878,23 @@
115738 **
115739 ** Or, if pLower is NULL or $L cannot be extracted from it (because it
115740 ** is not a simple variable or literal value), the lower bound of the
115741 ** range is $P. Due to a quirk in the way whereKeyStats() works, even
115742 ** if $L is available, whereKeyStats() is called for both ($P) and
115743 ** ($P:$L) and the larger of the two returned values used.
115744 **
115745 ** Similarly, iUpper is to be set to the estimate of the number of rows
115746 ** less than the upper bound of the range query. Where the upper bound
115747 ** is either ($P) or ($P:$U). Again, even if $U is available, both values
115748 ** of iUpper are requested of whereKeyStats() and the smaller used.
 
 
115749 */
115750 tRowcnt iLower;
115751 tRowcnt iUpper;
 
 
115752
115753 if( pRec ){
115754 testcase( pRec->nField!=pBuilder->nRecValid );
115755 pRec->nField = pBuilder->nRecValid;
115756 }
@@ -115760,11 +116904,11 @@
115760 aff = p->pTable->aCol[p->aiColumn[nEq]].affinity;
115761 }
115762 /* Determine iLower and iUpper using ($P) only. */
115763 if( nEq==0 ){
115764 iLower = 0;
115765 iUpper = sqlite3LogEstToInt(p->aiRowLogEst[0]);
115766 }else{
115767 /* Note: this call could be optimized away - since the same values must
115768 ** have been requested when testing key $P in whereEqualScanEst(). */
115769 whereKeyStats(pParse, p, pRec, 0, a);
115770 iLower = a[0];
@@ -115784,11 +116928,11 @@
115784 int bOk; /* True if value is extracted from pExpr */
115785 Expr *pExpr = pLower->pExpr->pRight;
115786 rc = sqlite3Stat4ProbeSetValue(pParse, p, &pRec, pExpr, aff, nEq, &bOk);
115787 if( rc==SQLITE_OK && bOk ){
115788 tRowcnt iNew;
115789 whereKeyStats(pParse, p, pRec, 0, a);
115790 iNew = a[0] + ((pLower->eOperator & (WO_GT|WO_LE)) ? a[1] : 0);
115791 if( iNew>iLower ) iLower = iNew;
115792 nOut--;
115793 pLower = 0;
115794 }
@@ -115799,11 +116943,11 @@
115799 int bOk; /* True if value is extracted from pExpr */
115800 Expr *pExpr = pUpper->pExpr->pRight;
115801 rc = sqlite3Stat4ProbeSetValue(pParse, p, &pRec, pExpr, aff, nEq, &bOk);
115802 if( rc==SQLITE_OK && bOk ){
115803 tRowcnt iNew;
115804 whereKeyStats(pParse, p, pRec, 1, a);
115805 iNew = a[0] + ((pUpper->eOperator & (WO_GT|WO_LE)) ? a[1] : 0);
115806 if( iNew<iUpper ) iUpper = iNew;
115807 nOut--;
115808 pUpper = 0;
115809 }
@@ -115811,10 +116955,15 @@
115811
115812 pBuilder->pRec = pRec;
115813 if( rc==SQLITE_OK ){
115814 if( iUpper>iLower ){
115815 nNew = sqlite3LogEst(iUpper - iLower);
 
 
 
 
 
115816 }else{
115817 nNew = 10; assert( 10==sqlite3LogEst(2) );
115818 }
115819 if( nNew<nOut ){
115820 nOut = nNew;
@@ -115835,16 +116984,19 @@
115835 #endif
115836 assert( pUpper==0 || (pUpper->wtFlags & TERM_VNULL)==0 );
115837 nNew = whereRangeAdjust(pLower, nOut);
115838 nNew = whereRangeAdjust(pUpper, nNew);
115839
115840 /* TUNING: If there is both an upper and lower limit, assume the range is
 
115841 ** reduced by an additional 75%. This means that, by default, an open-ended
115842 ** range query (e.g. col > ?) is assumed to match 1/4 of the rows in the
115843 ** index. While a closed range (e.g. col BETWEEN ? AND ?) is estimated to
115844 ** match 1/64 of the index. */
115845 if( pLower && pUpper ) nNew -= 20;
 
 
115846
115847 nOut -= (pLower!=0) + (pUpper!=0);
115848 if( nNew<10 ) nNew = 10;
115849 if( nNew<nOut ) nOut = nNew;
115850 #if defined(WHERETRACE_ENABLED)
@@ -116200,11 +117352,11 @@
116200
116201 /* This module is only called on query plans that use an index. */
116202 pLoop = pLevel->pWLoop;
116203 assert( (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 );
116204 nEq = pLoop->u.btree.nEq;
116205 nSkip = pLoop->u.btree.nSkip;
116206 pIdx = pLoop->u.btree.pIndex;
116207 assert( pIdx!=0 );
116208
116209 /* Figure out how many memory cells we will need then allocate them.
116210 */
@@ -116314,11 +117466,11 @@
116314 ** "a=? AND b>?"
116315 */
116316 static void explainIndexRange(StrAccum *pStr, WhereLoop *pLoop, Table *pTab){
116317 Index *pIndex = pLoop->u.btree.pIndex;
116318 u16 nEq = pLoop->u.btree.nEq;
116319 u16 nSkip = pLoop->u.btree.nSkip;
116320 int i, j;
116321 Column *aCol = pTab->aCol;
116322 i16 *aiColumn = pIndex->aiColumn;
116323
116324 if( nEq==0 && (pLoop->wsFlags&(WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))==0 ) return;
@@ -116345,23 +117497,27 @@
116345 sqlite3StrAccumAppend(pStr, ")", 1);
116346 }
116347
116348 /*
116349 ** This function is a no-op unless currently processing an EXPLAIN QUERY PLAN
116350 ** command. If the query being compiled is an EXPLAIN QUERY PLAN, a single
116351 ** record is added to the output to describe the table scan strategy in
116352 ** pLevel.
 
 
 
116353 */
116354 static void explainOneScan(
116355 Parse *pParse, /* Parse context */
116356 SrcList *pTabList, /* Table list this loop refers to */
116357 WhereLevel *pLevel, /* Scan to write OP_Explain opcode for */
116358 int iLevel, /* Value for "level" column of output */
116359 int iFrom, /* Value for "from" column of output */
116360 u16 wctrlFlags /* Flags passed to sqlite3WhereBegin() */
116361 ){
116362 #ifndef SQLITE_DEBUG
 
116363 if( pParse->explain==2 )
116364 #endif
116365 {
116366 struct SrcList_item *pItem = &pTabList->a[pLevel->iFrom];
116367 Vdbe *v = pParse->pVdbe; /* VM being constructed */
@@ -116374,11 +117530,11 @@
116374 StrAccum str; /* EQP output string */
116375 char zBuf[100]; /* Initial space for EQP output string */
116376
116377 pLoop = pLevel->pWLoop;
116378 flags = pLoop->wsFlags;
116379 if( (flags&WHERE_MULTI_OR) || (wctrlFlags&WHERE_ONETABLE_ONLY) ) return;
116380
116381 isSearch = (flags&(WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))!=0
116382 || ((flags&WHERE_VIRTUALTABLE)==0 && (pLoop->u.btree.nEq>0))
116383 || (wctrlFlags&(WHERE_ORDERBY_MIN|WHERE_ORDERBY_MAX));
116384
@@ -116403,10 +117559,12 @@
116403 assert( !(flags&WHERE_AUTO_INDEX) || (flags&WHERE_IDX_ONLY) );
116404 if( !HasRowid(pItem->pTab) && IsPrimaryKeyIndex(pIdx) ){
116405 if( isSearch ){
116406 zFmt = "PRIMARY KEY";
116407 }
 
 
116408 }else if( flags & WHERE_AUTO_INDEX ){
116409 zFmt = "AUTOMATIC COVERING INDEX";
116410 }else if( flags & WHERE_IDX_ONLY ){
116411 zFmt = "COVERING INDEX %s";
116412 }else{
@@ -116444,16 +117602,49 @@
116444 }else{
116445 sqlite3StrAccumAppend(&str, " (~1 row)", 9);
116446 }
116447 #endif
116448 zMsg = sqlite3StrAccumFinish(&str);
116449 sqlite3VdbeAddOp4(v, OP_Explain, iId, iLevel, iFrom, zMsg, P4_DYNAMIC);
116450 }
 
116451 }
116452 #else
116453 # define explainOneScan(u,v,w,x,y,z)
116454 #endif /* SQLITE_OMIT_EXPLAIN */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116455
116456
116457 /*
116458 ** Generate code for the start of the iLevel-th loop in the WHERE clause
116459 ** implementation described by pWInfo.
@@ -116751,11 +117942,11 @@
116751 u8 bSeekPastNull = 0; /* True to seek past initial nulls */
116752 u8 bStopAtNull = 0; /* Add condition to terminate at NULLs */
116753
116754 pIdx = pLoop->u.btree.pIndex;
116755 iIdxCur = pLevel->iIdxCur;
116756 assert( nEq>=pLoop->u.btree.nSkip );
116757
116758 /* If this loop satisfies a sort order (pOrderBy) request that
116759 ** was passed to this function to implement a "SELECT min(x) ..."
116760 ** query, then the caller will only allow the loop to run for
116761 ** a single iteration. This means that the first row returned
@@ -116768,11 +117959,11 @@
116768 || (pWInfo->wctrlFlags&WHERE_ORDERBY_MIN)==0 );
116769 if( (pWInfo->wctrlFlags&WHERE_ORDERBY_MIN)!=0
116770 && pWInfo->nOBSat>0
116771 && (pIdx->nKeyCol>nEq)
116772 ){
116773 assert( pLoop->u.btree.nSkip==0 );
116774 bSeekPastNull = 1;
116775 nExtraReg = 1;
116776 }
116777
116778 /* Find any inequality constraint terms for the start and end
@@ -117081,14 +118272,13 @@
117081 int iTerm;
117082 for(iTerm=0; iTerm<pWC->nTerm; iTerm++){
117083 Expr *pExpr = pWC->a[iTerm].pExpr;
117084 if( &pWC->a[iTerm] == pTerm ) continue;
117085 if( ExprHasProperty(pExpr, EP_FromJoin) ) continue;
117086 testcase( pWC->a[iTerm].wtFlags & TERM_ORINFO );
117087 testcase( pWC->a[iTerm].wtFlags & TERM_VIRTUAL );
117088 if( pWC->a[iTerm].wtFlags & (TERM_ORINFO|TERM_VIRTUAL) ) continue;
117089 if( (pWC->a[iTerm].eOperator & WO_ALL)==0 ) continue;
 
117090 pExpr = sqlite3ExprDup(db, pExpr, 0);
117091 pAndExpr = sqlite3ExprAnd(db, pAndExpr, pExpr);
117092 }
117093 if( pAndExpr ){
117094 pAndExpr = sqlite3PExpr(pParse, TK_AND, 0, pAndExpr, 0);
@@ -117117,13 +118307,15 @@
117117 pSubWInfo = sqlite3WhereBegin(pParse, pOrTab, pOrExpr, 0, 0,
117118 wctrlFlags, iCovCur);
117119 assert( pSubWInfo || pParse->nErr || db->mallocFailed );
117120 if( pSubWInfo ){
117121 WhereLoop *pSubLoop;
117122 explainOneScan(
117123 pParse, pOrTab, &pSubWInfo->a[0], iLevel, pLevel->iFrom, 0
117124 );
 
 
117125 /* This is the sub-WHERE clause body. First skip over
117126 ** duplicate rows from prior sub-WHERE clauses, and record the
117127 ** rowid (or PRIMARY KEY) for the current row so that the same
117128 ** row will be skipped in subsequent sub-WHERE clauses.
117129 */
@@ -117249,10 +118441,14 @@
117249 VdbeCoverageIf(v, bRev==0);
117250 VdbeCoverageIf(v, bRev!=0);
117251 pLevel->p5 = SQLITE_STMTSTATUS_FULLSCAN_STEP;
117252 }
117253 }
 
 
 
 
117254
117255 /* Insert code to test every subexpression that can be completely
117256 ** computed using the current set of tables.
117257 */
117258 for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){
@@ -117389,11 +118585,11 @@
117389 }
117390 sqlite3DebugPrintf(" %-19s", z);
117391 sqlite3_free(z);
117392 }
117393 if( p->wsFlags & WHERE_SKIPSCAN ){
117394 sqlite3DebugPrintf(" f %05x %d-%d", p->wsFlags, p->nLTerm,p->u.btree.nSkip);
117395 }else{
117396 sqlite3DebugPrintf(" f %05x N %d", p->wsFlags, p->nLTerm);
117397 }
117398 sqlite3DebugPrintf(" cost %d,%d,%d\n", p->rSetup, p->rRun, p->nOut);
117399 if( p->nLTerm && (sqlite3WhereTrace & 0x100)!=0 ){
@@ -117500,34 +118696,41 @@
117500 sqlite3DbFree(db, pWInfo);
117501 }
117502 }
117503
117504 /*
117505 ** Return TRUE if both of the following are true:
117506 **
117507 ** (1) X has the same or lower cost that Y
117508 ** (2) X is a proper subset of Y
 
117509 **
117510 ** By "proper subset" we mean that X uses fewer WHERE clause terms
117511 ** than Y and that every WHERE clause term used by X is also used
117512 ** by Y.
117513 **
117514 ** If X is a proper subset of Y then Y is a better choice and ought
117515 ** to have a lower cost. This routine returns TRUE when that cost
117516 ** relationship is inverted and needs to be adjusted.
 
 
117517 */
117518 static int whereLoopCheaperProperSubset(
117519 const WhereLoop *pX, /* First WhereLoop to compare */
117520 const WhereLoop *pY /* Compare against this WhereLoop */
117521 ){
117522 int i, j;
117523 if( pX->nLTerm >= pY->nLTerm ) return 0; /* X is not a subset of Y */
 
 
 
117524 if( pX->rRun >= pY->rRun ){
117525 if( pX->rRun > pY->rRun ) return 0; /* X costs more than Y */
117526 if( pX->nOut > pY->nOut ) return 0; /* X costs more than Y */
117527 }
117528 for(i=pX->nLTerm-1; i>=0; i--){
 
117529 for(j=pY->nLTerm-1; j>=0; j--){
117530 if( pY->aLTerm[j]==pX->aLTerm[i] ) break;
117531 }
117532 if( j<0 ) return 0; /* X not a subset of Y since term X[i] not used by Y */
117533 }
@@ -117545,37 +118748,28 @@
117545 ** is a proper subset.
117546 **
117547 ** To say "WhereLoop X is a proper subset of Y" means that X uses fewer
117548 ** WHERE clause terms than Y and that every WHERE clause term used by X is
117549 ** also used by Y.
117550 **
117551 ** This adjustment is omitted for SKIPSCAN loops. In a SKIPSCAN loop, the
117552 ** WhereLoop.nLTerm field is not an accurate measure of the number of WHERE
117553 ** clause terms covered, since some of the first nLTerm entries in aLTerm[]
117554 ** will be NULL (because they are skipped). That makes it more difficult
117555 ** to compare the loops. We could add extra code to do the comparison, and
117556 ** perhaps we will someday. But SKIPSCAN is sufficiently uncommon, and this
117557 ** adjustment is sufficient minor, that it is very difficult to construct
117558 ** a test case where the extra code would improve the query plan. Better
117559 ** to avoid the added complexity and just omit cost adjustments to SKIPSCAN
117560 ** loops.
117561 */
117562 static void whereLoopAdjustCost(const WhereLoop *p, WhereLoop *pTemplate){
117563 if( (pTemplate->wsFlags & WHERE_INDEXED)==0 ) return;
117564 if( (pTemplate->wsFlags & WHERE_SKIPSCAN)!=0 ) return;
117565 for(; p; p=p->pNextLoop){
117566 if( p->iTab!=pTemplate->iTab ) continue;
117567 if( (p->wsFlags & WHERE_INDEXED)==0 ) continue;
117568 if( (p->wsFlags & WHERE_SKIPSCAN)!=0 ) continue;
117569 if( whereLoopCheaperProperSubset(p, pTemplate) ){
117570 /* Adjust pTemplate cost downward so that it is cheaper than its
117571 ** subset p */
 
 
117572 pTemplate->rRun = p->rRun;
117573 pTemplate->nOut = p->nOut - 1;
117574 }else if( whereLoopCheaperProperSubset(pTemplate, p) ){
117575 /* Adjust pTemplate cost upward so that it is costlier than p since
117576 ** pTemplate is a proper subset of p */
 
 
117577 pTemplate->rRun = p->rRun;
117578 pTemplate->nOut = p->nOut + 1;
117579 }
117580 }
117581 }
@@ -117616,12 +118810,13 @@
117616 ** rSetup. Call this SETUP-INVARIANT */
117617 assert( p->rSetup>=pTemplate->rSetup );
117618
117619 /* Any loop using an appliation-defined index (or PRIMARY KEY or
117620 ** UNIQUE constraint) with one or more == constraints is better
117621 ** than an automatic index. */
117622 if( (p->wsFlags & WHERE_AUTO_INDEX)!=0
 
117623 && (pTemplate->wsFlags & WHERE_INDEXED)!=0
117624 && (pTemplate->wsFlags & WHERE_COLUMN_EQ)!=0
117625 && (p->prereq & pTemplate->prereq)==pTemplate->prereq
117626 ){
117627 break;
@@ -117776,25 +118971,46 @@
117776
117777 /*
117778 ** Adjust the WhereLoop.nOut value downward to account for terms of the
117779 ** WHERE clause that reference the loop but which are not used by an
117780 ** index.
 
 
 
 
 
117781 **
117782 ** In the current implementation, the first extra WHERE clause term reduces
117783 ** the number of output rows by a factor of 10 and each additional term
117784 ** reduces the number of output rows by sqrt(2).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117785 */
117786 static void whereLoopOutputAdjust(
117787 WhereClause *pWC, /* The WHERE clause */
117788 WhereLoop *pLoop, /* The loop to adjust downward */
117789 LogEst nRow /* Number of rows in the entire table */
117790 ){
117791 WhereTerm *pTerm, *pX;
117792 Bitmask notAllowed = ~(pLoop->prereq|pLoop->maskSelf);
117793 int i, j;
117794 int nEq = 0; /* Number of = constraints not within likely()/unlikely() */
117795
 
117796 for(i=pWC->nTerm, pTerm=pWC->a; i>0; i--, pTerm++){
117797 if( (pTerm->wtFlags & TERM_VIRTUAL)!=0 ) break;
117798 if( (pTerm->prereqAll & pLoop->maskSelf)==0 ) continue;
117799 if( (pTerm->prereqAll & notAllowed)!=0 ) continue;
117800 for(j=pLoop->nLTerm-1; j>=0; j--){
@@ -117803,24 +119019,30 @@
117803 if( pX==pTerm ) break;
117804 if( pX->iParent>=0 && (&pWC->a[pX->iParent])==pTerm ) break;
117805 }
117806 if( j<0 ){
117807 if( pTerm->truthProb<=0 ){
 
 
117808 pLoop->nOut += pTerm->truthProb;
117809 }else{
 
 
117810 pLoop->nOut--;
117811 if( pTerm->eOperator&WO_EQ ) nEq++;
 
 
 
 
 
 
 
 
117812 }
117813 }
117814 }
117815 /* TUNING: If there is at least one equality constraint in the WHERE
117816 ** clause that does not have a likelihood() explicitly assigned to it
117817 ** then do not let the estimated number of output rows exceed half
117818 ** the number of rows in the table. */
117819 if( nEq && pLoop->nOut>nRow-10 ){
117820 pLoop->nOut = nRow - 10;
117821 }
117822 }
117823
117824 /*
117825 ** Adjust the cost C by the costMult facter T. This only occurs if
117826 ** compiled with -DSQLITE_ENABLE_COSTMULT
@@ -117857,11 +119079,11 @@
117857 int opMask; /* Valid operators for constraints */
117858 WhereScan scan; /* Iterator for WHERE terms */
117859 Bitmask saved_prereq; /* Original value of pNew->prereq */
117860 u16 saved_nLTerm; /* Original value of pNew->nLTerm */
117861 u16 saved_nEq; /* Original value of pNew->u.btree.nEq */
117862 u16 saved_nSkip; /* Original value of pNew->u.btree.nSkip */
117863 u32 saved_wsFlags; /* Original value of pNew->wsFlags */
117864 LogEst saved_nOut; /* Original value of pNew->nOut */
117865 int iCol; /* Index of the column in the table */
117866 int rc = SQLITE_OK; /* Return code */
117867 LogEst rSize; /* Number of rows in the table */
@@ -117886,56 +119108,18 @@
117886 iCol = pProbe->aiColumn[pNew->u.btree.nEq];
117887
117888 pTerm = whereScanInit(&scan, pBuilder->pWC, pSrc->iCursor, iCol,
117889 opMask, pProbe);
117890 saved_nEq = pNew->u.btree.nEq;
117891 saved_nSkip = pNew->u.btree.nSkip;
117892 saved_nLTerm = pNew->nLTerm;
117893 saved_wsFlags = pNew->wsFlags;
117894 saved_prereq = pNew->prereq;
117895 saved_nOut = pNew->nOut;
117896 pNew->rSetup = 0;
117897 rSize = pProbe->aiRowLogEst[0];
117898 rLogSize = estLog(rSize);
117899
117900 /* Consider using a skip-scan if there are no WHERE clause constraints
117901 ** available for the left-most terms of the index, and if the average
117902 ** number of repeats in the left-most terms is at least 18.
117903 **
117904 ** The magic number 18 is selected on the basis that scanning 17 rows
117905 ** is almost always quicker than an index seek (even though if the index
117906 ** contains fewer than 2^17 rows we assume otherwise in other parts of
117907 ** the code). And, even if it is not, it should not be too much slower.
117908 ** On the other hand, the extra seeks could end up being significantly
117909 ** more expensive. */
117910 assert( 42==sqlite3LogEst(18) );
117911 if( saved_nEq==saved_nSkip
117912 && saved_nEq+1<pProbe->nKeyCol
117913 && pProbe->aiRowLogEst[saved_nEq+1]>=42 /* TUNING: Minimum for skip-scan */
117914 && (rc = whereLoopResize(db, pNew, pNew->nLTerm+1))==SQLITE_OK
117915 ){
117916 LogEst nIter;
117917 pNew->u.btree.nEq++;
117918 pNew->u.btree.nSkip++;
117919 pNew->aLTerm[pNew->nLTerm++] = 0;
117920 pNew->wsFlags |= WHERE_SKIPSCAN;
117921 nIter = pProbe->aiRowLogEst[saved_nEq] - pProbe->aiRowLogEst[saved_nEq+1];
117922 if( pTerm ){
117923 /* TUNING: When estimating skip-scan for a term that is also indexable,
117924 ** multiply the cost of the skip-scan by 2.0, to make it a little less
117925 ** desirable than the regular index lookup. */
117926 nIter += 10; assert( 10==sqlite3LogEst(2) );
117927 }
117928 pNew->nOut -= nIter;
117929 /* TUNING: Because uncertainties in the estimates for skip-scan queries,
117930 ** add a 1.375 fudge factor to make skip-scan slightly less likely. */
117931 nIter += 5;
117932 whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, nIter + nInMul);
117933 pNew->nOut = saved_nOut;
117934 pNew->u.btree.nEq = saved_nEq;
117935 pNew->u.btree.nSkip = saved_nSkip;
117936 }
117937 for(; rc==SQLITE_OK && pTerm!=0; pTerm = whereScanNext(&scan)){
117938 u16 eOp = pTerm->eOperator; /* Shorthand for pTerm->eOperator */
117939 LogEst rCostIdx;
117940 LogEst nOutUnadjusted; /* nOut before IN() and WHERE adjustments */
117941 int nIn = 0;
@@ -118026,11 +119210,10 @@
118026 #ifdef SQLITE_ENABLE_STAT3_OR_STAT4
118027 tRowcnt nOut = 0;
118028 if( nInMul==0
118029 && pProbe->nSample
118030 && pNew->u.btree.nEq<=pProbe->nSampleCol
118031 && OptimizationEnabled(db, SQLITE_Stat3)
118032 && ((eOp & WO_IN)==0 || !ExprHasProperty(pTerm->pExpr, EP_xIsSelect))
118033 ){
118034 Expr *pExpr = pTerm->pExpr;
118035 if( (eOp & (WO_EQ|WO_ISNULL))!=0 ){
118036 testcase( eOp & WO_EQ );
@@ -118094,14 +119277,49 @@
118094 pBuilder->nRecValid = nRecValid;
118095 #endif
118096 }
118097 pNew->prereq = saved_prereq;
118098 pNew->u.btree.nEq = saved_nEq;
118099 pNew->u.btree.nSkip = saved_nSkip;
118100 pNew->wsFlags = saved_wsFlags;
118101 pNew->nOut = saved_nOut;
118102 pNew->nLTerm = saved_nLTerm;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118103 return rc;
118104 }
118105
118106 /*
118107 ** Return True if it is possible that pIndex might be useful in
@@ -118276,11 +119494,11 @@
118276 WhereTerm *pWCEnd = pWC->a + pWC->nTerm;
118277 for(pTerm=pWC->a; rc==SQLITE_OK && pTerm<pWCEnd; pTerm++){
118278 if( pTerm->prereqRight & pNew->maskSelf ) continue;
118279 if( termCanDriveIndex(pTerm, pSrc, 0) ){
118280 pNew->u.btree.nEq = 1;
118281 pNew->u.btree.nSkip = 0;
118282 pNew->u.btree.pIndex = 0;
118283 pNew->nLTerm = 1;
118284 pNew->aLTerm[0] = pTerm;
118285 /* TUNING: One-time cost for computing the automatic index is
118286 ** estimated to be X*N*log2(N) where N is the number of rows in
@@ -118317,11 +119535,11 @@
118317 testcase( pNew->iTab!=pSrc->iCursor ); /* See ticket [98d973b8f5] */
118318 continue; /* Partial index inappropriate for this query */
118319 }
118320 rSize = pProbe->aiRowLogEst[0];
118321 pNew->u.btree.nEq = 0;
118322 pNew->u.btree.nSkip = 0;
118323 pNew->nLTerm = 0;
118324 pNew->iSortIdx = 0;
118325 pNew->rSetup = 0;
118326 pNew->prereq = mExtra;
118327 pNew->nOut = rSize;
@@ -118867,11 +120085,11 @@
118867 for(j=0; j<nColumn; j++){
118868 u8 bOnce; /* True to run the ORDER BY search loop */
118869
118870 /* Skip over == and IS NULL terms */
118871 if( j<pLoop->u.btree.nEq
118872 && pLoop->u.btree.nSkip==0
118873 && ((i = pLoop->aLTerm[j]->eOperator) & (WO_EQ|WO_ISNULL))!=0
118874 ){
118875 if( i & WO_ISNULL ){
118876 testcase( isOrderDistinct );
118877 isOrderDistinct = 0;
@@ -119321,11 +120539,11 @@
119321 }
119322 }
119323 }
119324
119325 #ifdef WHERETRACE_ENABLED /* >=2 */
119326 if( sqlite3WhereTrace>=2 ){
119327 sqlite3DebugPrintf("---- after round %d ----\n", iLoop);
119328 for(ii=0, pTo=aTo; ii<nTo; ii++, pTo++){
119329 sqlite3DebugPrintf(" %s cost=%-3d nrow=%-3d order=%c",
119330 wherePathName(pTo, iLoop+1, 0), pTo->rCost, pTo->nRow,
119331 pTo->isOrdered>=0 ? (pTo->isOrdered+'0') : '?');
@@ -119440,11 +120658,11 @@
119440 if( pItem->zIndex ) return 0;
119441 iCur = pItem->iCursor;
119442 pWC = &pWInfo->sWC;
119443 pLoop = pBuilder->pNew;
119444 pLoop->wsFlags = 0;
119445 pLoop->u.btree.nSkip = 0;
119446 pTerm = findTerm(pWC, iCur, -1, 0, WO_EQ, 0);
119447 if( pTerm ){
119448 pLoop->wsFlags = WHERE_COLUMN_EQ|WHERE_IPK|WHERE_ONEROW;
119449 pLoop->aLTerm[0] = pTerm;
119450 pLoop->nLTerm = 1;
@@ -119452,11 +120670,10 @@
119452 /* TUNING: Cost of a rowid lookup is 10 */
119453 pLoop->rRun = 33; /* 33==sqlite3LogEst(10) */
119454 }else{
119455 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
119456 assert( pLoop->aLTermSpace==pLoop->aLTerm );
119457 assert( ArraySize(pLoop->aLTermSpace)==4 );
119458 if( !IsUniqueIndex(pIdx)
119459 || pIdx->pPartIdxWhere!=0
119460 || pIdx->nKeyCol>ArraySize(pLoop->aLTermSpace)
119461 ) continue;
119462 for(j=0; j<pIdx->nKeyCol; j++){
@@ -119961,22 +121178,30 @@
119961 ** loop below generates code for a single nested loop of the VM
119962 ** program.
119963 */
119964 notReady = ~(Bitmask)0;
119965 for(ii=0; ii<nTabList; ii++){
 
 
119966 pLevel = &pWInfo->a[ii];
 
119967 #ifndef SQLITE_OMIT_AUTOMATIC_INDEX
119968 if( (pLevel->pWLoop->wsFlags & WHERE_AUTO_INDEX)!=0 ){
119969 constructAutomaticIndex(pParse, &pWInfo->sWC,
119970 &pTabList->a[pLevel->iFrom], notReady, pLevel);
119971 if( db->mallocFailed ) goto whereBeginError;
119972 }
119973 #endif
119974 explainOneScan(pParse, pTabList, pLevel, ii, pLevel->iFrom, wctrlFlags);
 
 
119975 pLevel->addrBody = sqlite3VdbeCurrentAddr(v);
119976 notReady = codeOneLoopStart(pWInfo, ii, notReady);
119977 pWInfo->iContinue = pLevel->addrCont;
 
 
 
119978 }
119979
119980 /* Done. */
119981 VdbeModuleComment((v, "Begin WHERE-core"));
119982 return pWInfo;
@@ -124640,10 +125865,17 @@
124640 ** is look for a semicolon that is not part of an string or comment.
124641 */
124642 SQLITE_API int sqlite3_complete(const char *zSql){
124643 u8 state = 0; /* Current state, using numbers defined in header comment */
124644 u8 token; /* Value of the next token */
 
 
 
 
 
 
 
124645
124646 #ifndef SQLITE_OMIT_TRIGGER
124647 /* A complex statement machine used to detect the end of a CREATE TRIGGER
124648 ** statement. This is the normal case.
124649 */
@@ -125238,74 +126470,106 @@
125238
125239 va_start(ap, op);
125240 switch( op ){
125241
125242 /* Mutex configuration options are only available in a threadsafe
125243 ** compile.
125244 */
125245 #if defined(SQLITE_THREADSAFE) && SQLITE_THREADSAFE>0
125246 case SQLITE_CONFIG_SINGLETHREAD: {
125247 /* Disable all mutexing */
125248 sqlite3GlobalConfig.bCoreMutex = 0;
125249 sqlite3GlobalConfig.bFullMutex = 0;
125250 break;
125251 }
 
 
125252 case SQLITE_CONFIG_MULTITHREAD: {
125253 /* Disable mutexing of database connections */
125254 /* Enable mutexing of core data structures */
125255 sqlite3GlobalConfig.bCoreMutex = 1;
125256 sqlite3GlobalConfig.bFullMutex = 0;
125257 break;
125258 }
 
 
125259 case SQLITE_CONFIG_SERIALIZED: {
125260 /* Enable all mutexing */
125261 sqlite3GlobalConfig.bCoreMutex = 1;
125262 sqlite3GlobalConfig.bFullMutex = 1;
125263 break;
125264 }
 
 
125265 case SQLITE_CONFIG_MUTEX: {
125266 /* Specify an alternative mutex implementation */
125267 sqlite3GlobalConfig.mutex = *va_arg(ap, sqlite3_mutex_methods*);
125268 break;
125269 }
 
 
125270 case SQLITE_CONFIG_GETMUTEX: {
125271 /* Retrieve the current mutex implementation */
125272 *va_arg(ap, sqlite3_mutex_methods*) = sqlite3GlobalConfig.mutex;
125273 break;
125274 }
125275 #endif
125276
125277
125278 case SQLITE_CONFIG_MALLOC: {
125279 /* Specify an alternative malloc implementation */
 
 
 
 
125280 sqlite3GlobalConfig.m = *va_arg(ap, sqlite3_mem_methods*);
125281 break;
125282 }
125283 case SQLITE_CONFIG_GETMALLOC: {
125284 /* Retrieve the current malloc() implementation */
 
 
 
125285 if( sqlite3GlobalConfig.m.xMalloc==0 ) sqlite3MemSetDefault();
125286 *va_arg(ap, sqlite3_mem_methods*) = sqlite3GlobalConfig.m;
125287 break;
125288 }
125289 case SQLITE_CONFIG_MEMSTATUS: {
125290 /* Enable or disable the malloc status collection */
 
 
125291 sqlite3GlobalConfig.bMemstat = va_arg(ap, int);
125292 break;
125293 }
125294 case SQLITE_CONFIG_SCRATCH: {
125295 /* Designate a buffer for scratch memory space */
 
 
 
125296 sqlite3GlobalConfig.pScratch = va_arg(ap, void*);
125297 sqlite3GlobalConfig.szScratch = va_arg(ap, int);
125298 sqlite3GlobalConfig.nScratch = va_arg(ap, int);
125299 break;
125300 }
125301 case SQLITE_CONFIG_PAGECACHE: {
125302 /* Designate a buffer for page cache memory space */
 
 
125303 sqlite3GlobalConfig.pPage = va_arg(ap, void*);
125304 sqlite3GlobalConfig.szPage = va_arg(ap, int);
125305 sqlite3GlobalConfig.nPage = va_arg(ap, int);
125306 break;
 
 
 
 
 
 
 
 
 
 
 
125307 }
125308
125309 case SQLITE_CONFIG_PCACHE: {
125310 /* no-op */
125311 break;
@@ -125315,25 +126579,37 @@
125315 rc = SQLITE_ERROR;
125316 break;
125317 }
125318
125319 case SQLITE_CONFIG_PCACHE2: {
125320 /* Specify an alternative page cache implementation */
 
 
 
125321 sqlite3GlobalConfig.pcache2 = *va_arg(ap, sqlite3_pcache_methods2*);
125322 break;
125323 }
125324 case SQLITE_CONFIG_GETPCACHE2: {
 
 
 
 
125325 if( sqlite3GlobalConfig.pcache2.xInit==0 ){
125326 sqlite3PCacheSetDefault();
125327 }
125328 *va_arg(ap, sqlite3_pcache_methods2*) = sqlite3GlobalConfig.pcache2;
125329 break;
125330 }
125331
 
 
 
125332 #if defined(SQLITE_ENABLE_MEMSYS3) || defined(SQLITE_ENABLE_MEMSYS5)
125333 case SQLITE_CONFIG_HEAP: {
125334 /* Designate a buffer for heap memory space */
 
 
125335 sqlite3GlobalConfig.pHeap = va_arg(ap, void*);
125336 sqlite3GlobalConfig.nHeap = va_arg(ap, int);
125337 sqlite3GlobalConfig.mnReq = va_arg(ap, int);
125338
125339 if( sqlite3GlobalConfig.mnReq<1 ){
@@ -125342,21 +126618,23 @@
125342 /* cap min request size at 2^12 */
125343 sqlite3GlobalConfig.mnReq = (1<<12);
125344 }
125345
125346 if( sqlite3GlobalConfig.pHeap==0 ){
125347 /* If the heap pointer is NULL, then restore the malloc implementation
125348 ** back to NULL pointers too. This will cause the malloc to go
125349 ** back to its default implementation when sqlite3_initialize() is
125350 ** run.
 
 
 
125351 */
125352 memset(&sqlite3GlobalConfig.m, 0, sizeof(sqlite3GlobalConfig.m));
125353 }else{
125354 /* The heap pointer is not NULL, then install one of the
125355 ** mem5.c/mem3.c methods. The enclosing #if guarantees at
125356 ** least one of these methods is currently enabled.
125357 */
125358 #ifdef SQLITE_ENABLE_MEMSYS3
125359 sqlite3GlobalConfig.m = *sqlite3MemGetMemsys3();
125360 #endif
125361 #ifdef SQLITE_ENABLE_MEMSYS5
125362 sqlite3GlobalConfig.m = *sqlite3MemGetMemsys5();
@@ -125391,15 +126669,23 @@
125391 ** can be changed at start-time using the
125392 ** sqlite3_config(SQLITE_CONFIG_URI,1) or
125393 ** sqlite3_config(SQLITE_CONFIG_URI,0) configuration calls.
125394 */
125395 case SQLITE_CONFIG_URI: {
 
 
 
 
125396 sqlite3GlobalConfig.bOpenUri = va_arg(ap, int);
125397 break;
125398 }
125399
125400 case SQLITE_CONFIG_COVERING_INDEX_SCAN: {
 
 
 
 
125401 sqlite3GlobalConfig.bUseCis = va_arg(ap, int);
125402 break;
125403 }
125404
125405 #ifdef SQLITE_ENABLE_SQLLOG
@@ -125410,24 +126696,37 @@
125410 break;
125411 }
125412 #endif
125413
125414 case SQLITE_CONFIG_MMAP_SIZE: {
 
 
 
 
125415 sqlite3_int64 szMmap = va_arg(ap, sqlite3_int64);
125416 sqlite3_int64 mxMmap = va_arg(ap, sqlite3_int64);
125417 if( mxMmap<0 || mxMmap>SQLITE_MAX_MMAP_SIZE ){
125418 mxMmap = SQLITE_MAX_MMAP_SIZE;
125419 }
125420 sqlite3GlobalConfig.mxMmap = mxMmap;
 
 
 
 
 
125421 if( szMmap<0 ) szMmap = SQLITE_DEFAULT_MMAP_SIZE;
125422 if( szMmap>mxMmap) szMmap = mxMmap;
 
125423 sqlite3GlobalConfig.szMmap = szMmap;
125424 break;
125425 }
125426
125427 #if SQLITE_OS_WIN && defined(SQLITE_WIN32_MALLOC)
125428 case SQLITE_CONFIG_WIN32_HEAPSIZE: {
 
 
 
125429 sqlite3GlobalConfig.nHeap = va_arg(ap, int);
125430 break;
125431 }
125432 #endif
125433
@@ -125507,19 +126806,29 @@
125507
125508 /*
125509 ** Return the mutex associated with a database connection.
125510 */
125511 SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3 *db){
 
 
 
 
 
 
125512 return db->mutex;
125513 }
125514
125515 /*
125516 ** Free up as much memory as we can from the given database
125517 ** connection.
125518 */
125519 SQLITE_API int sqlite3_db_release_memory(sqlite3 *db){
125520 int i;
 
 
 
 
125521 sqlite3_mutex_enter(db->mutex);
125522 sqlite3BtreeEnterAll(db);
125523 for(i=0; i<db->nDb; i++){
125524 Btree *pBt = db->aDb[i].pBt;
125525 if( pBt ){
@@ -125605,17 +126914,24 @@
125605 int nKey1, const void *pKey1,
125606 int nKey2, const void *pKey2
125607 ){
125608 int rc, n;
125609 n = nKey1<nKey2 ? nKey1 : nKey2;
 
 
 
125610 rc = memcmp(pKey1, pKey2, n);
125611 if( rc==0 ){
125612 if( padFlag
125613 && allSpaces(((char*)pKey1)+n, nKey1-n)
125614 && allSpaces(((char*)pKey2)+n, nKey2-n)
125615 ){
125616 /* Leave rc unchanged at 0 */
 
 
 
 
125617 }else{
125618 rc = nKey1 - nKey2;
125619 }
125620 }
125621 return rc;
@@ -125646,24 +126962,42 @@
125646
125647 /*
125648 ** Return the ROWID of the most recent insert
125649 */
125650 SQLITE_API sqlite_int64 sqlite3_last_insert_rowid(sqlite3 *db){
 
 
 
 
 
 
125651 return db->lastRowid;
125652 }
125653
125654 /*
125655 ** Return the number of changes in the most recent call to sqlite3_exec().
125656 */
125657 SQLITE_API int sqlite3_changes(sqlite3 *db){
 
 
 
 
 
 
125658 return db->nChange;
125659 }
125660
125661 /*
125662 ** Return the number of changes since the database handle was opened.
125663 */
125664 SQLITE_API int sqlite3_total_changes(sqlite3 *db){
 
 
 
 
 
 
125665 return db->nTotalChange;
125666 }
125667
125668 /*
125669 ** Close all open savepoints. This function only manipulates fields of the
@@ -125839,10 +127173,18 @@
125839
125840 /* Close all database connections */
125841 for(j=0; j<db->nDb; j++){
125842 struct Db *pDb = &db->aDb[j];
125843 if( pDb->pBt ){
 
 
 
 
 
 
 
 
125844 sqlite3BtreeClose(pDb->pBt);
125845 pDb->pBt = 0;
125846 if( j!=1 ){
125847 pDb->pSchema = 0;
125848 }
@@ -125925,17 +127267,19 @@
125925 sqlite3_free(db);
125926 }
125927
125928 /*
125929 ** Rollback all database files. If tripCode is not SQLITE_OK, then
125930 ** any open cursors are invalidated ("tripped" - as in "tripping a circuit
125931 ** breaker") and made to return tripCode if there are any further
125932 ** attempts to use that cursor.
 
125933 */
125934 SQLITE_PRIVATE void sqlite3RollbackAll(sqlite3 *db, int tripCode){
125935 int i;
125936 int inTrans = 0;
 
125937 assert( sqlite3_mutex_held(db->mutex) );
125938 sqlite3BeginBenignMalloc();
125939
125940 /* Obtain all b-tree mutexes before making any calls to BtreeRollback().
125941 ** This is important in case the transaction being rolled back has
@@ -125942,18 +127286,19 @@
125942 ** modified the database schema. If the b-tree mutexes are not taken
125943 ** here, then another shared-cache connection might sneak in between
125944 ** the database rollback and schema reset, which can cause false
125945 ** corruption reports in some cases. */
125946 sqlite3BtreeEnterAll(db);
 
125947
125948 for(i=0; i<db->nDb; i++){
125949 Btree *p = db->aDb[i].pBt;
125950 if( p ){
125951 if( sqlite3BtreeIsInTrans(p) ){
125952 inTrans = 1;
125953 }
125954 sqlite3BtreeRollback(p, tripCode);
125955 }
125956 }
125957 sqlite3VtabRollback(db);
125958 sqlite3EndBenignMalloc();
125959
@@ -126205,10 +127550,13 @@
126205 SQLITE_API int sqlite3_busy_handler(
126206 sqlite3 *db,
126207 int (*xBusy)(void*,int),
126208 void *pArg
126209 ){
 
 
 
126210 sqlite3_mutex_enter(db->mutex);
126211 db->busyHandler.xFunc = xBusy;
126212 db->busyHandler.pArg = pArg;
126213 db->busyHandler.nBusy = 0;
126214 db->busyTimeout = 0;
@@ -126226,10 +127574,16 @@
126226 sqlite3 *db,
126227 int nOps,
126228 int (*xProgress)(void*),
126229 void *pArg
126230 ){
 
 
 
 
 
 
126231 sqlite3_mutex_enter(db->mutex);
126232 if( nOps>0 ){
126233 db->xProgress = xProgress;
126234 db->nProgressOps = (unsigned)nOps;
126235 db->pProgressArg = pArg;
@@ -126246,10 +127600,13 @@
126246 /*
126247 ** This routine installs a default busy handler that waits for the
126248 ** specified number of milliseconds before returning 0.
126249 */
126250 SQLITE_API int sqlite3_busy_timeout(sqlite3 *db, int ms){
 
 
 
126251 if( ms>0 ){
126252 sqlite3_busy_handler(db, sqliteDefaultBusyCallback, (void*)db);
126253 db->busyTimeout = ms;
126254 }else{
126255 sqlite3_busy_handler(db, 0, 0);
@@ -126259,10 +127616,16 @@
126259
126260 /*
126261 ** Cause any pending operation to stop at its earliest opportunity.
126262 */
126263 SQLITE_API void sqlite3_interrupt(sqlite3 *db){
 
 
 
 
 
 
126264 db->u1.isInterrupted = 1;
126265 }
126266
126267
126268 /*
@@ -126396,10 +127759,16 @@
126396 void (*xFinal)(sqlite3_context*),
126397 void (*xDestroy)(void *)
126398 ){
126399 int rc = SQLITE_ERROR;
126400 FuncDestructor *pArg = 0;
 
 
 
 
 
 
126401 sqlite3_mutex_enter(db->mutex);
126402 if( xDestroy ){
126403 pArg = (FuncDestructor *)sqlite3DbMallocZero(db, sizeof(FuncDestructor));
126404 if( !pArg ){
126405 xDestroy(p);
@@ -126432,10 +127801,14 @@
126432 void (*xStep)(sqlite3_context*,int,sqlite3_value**),
126433 void (*xFinal)(sqlite3_context*)
126434 ){
126435 int rc;
126436 char *zFunc8;
 
 
 
 
126437 sqlite3_mutex_enter(db->mutex);
126438 assert( !db->mallocFailed );
126439 zFunc8 = sqlite3Utf16to8(db, zFunctionName, -1, SQLITE_UTF16NATIVE);
126440 rc = sqlite3CreateFunc(db, zFunc8, nArg, eTextRep, p, xFunc, xStep, xFinal,0);
126441 sqlite3DbFree(db, zFunc8);
@@ -126463,10 +127836,16 @@
126463 const char *zName,
126464 int nArg
126465 ){
126466 int nName = sqlite3Strlen30(zName);
126467 int rc = SQLITE_OK;
 
 
 
 
 
 
126468 sqlite3_mutex_enter(db->mutex);
126469 if( sqlite3FindFunction(db, zName, nName, nArg, SQLITE_UTF8, 0)==0 ){
126470 rc = sqlite3CreateFunc(db, zName, nArg, SQLITE_UTF8,
126471 0, sqlite3InvalidFunction, 0, 0, 0);
126472 }
@@ -126484,10 +127863,17 @@
126484 ** trace is a pointer to a function that is invoked at the start of each
126485 ** SQL statement.
126486 */
126487 SQLITE_API void *sqlite3_trace(sqlite3 *db, void (*xTrace)(void*,const char*), void *pArg){
126488 void *pOld;
 
 
 
 
 
 
 
126489 sqlite3_mutex_enter(db->mutex);
126490 pOld = db->pTraceArg;
126491 db->xTrace = xTrace;
126492 db->pTraceArg = pArg;
126493 sqlite3_mutex_leave(db->mutex);
@@ -126505,10 +127891,17 @@
126505 sqlite3 *db,
126506 void (*xProfile)(void*,const char*,sqlite_uint64),
126507 void *pArg
126508 ){
126509 void *pOld;
 
 
 
 
 
 
 
126510 sqlite3_mutex_enter(db->mutex);
126511 pOld = db->pProfileArg;
126512 db->xProfile = xProfile;
126513 db->pProfileArg = pArg;
126514 sqlite3_mutex_leave(db->mutex);
@@ -126525,10 +127918,17 @@
126525 sqlite3 *db, /* Attach the hook to this database */
126526 int (*xCallback)(void*), /* Function to invoke on each commit */
126527 void *pArg /* Argument to the function */
126528 ){
126529 void *pOld;
 
 
 
 
 
 
 
126530 sqlite3_mutex_enter(db->mutex);
126531 pOld = db->pCommitArg;
126532 db->xCommitCallback = xCallback;
126533 db->pCommitArg = pArg;
126534 sqlite3_mutex_leave(db->mutex);
@@ -126543,10 +127943,17 @@
126543 sqlite3 *db, /* Attach the hook to this database */
126544 void (*xCallback)(void*,int,char const *,char const *,sqlite_int64),
126545 void *pArg /* Argument to the function */
126546 ){
126547 void *pRet;
 
 
 
 
 
 
 
126548 sqlite3_mutex_enter(db->mutex);
126549 pRet = db->pUpdateArg;
126550 db->xUpdateCallback = xCallback;
126551 db->pUpdateArg = pArg;
126552 sqlite3_mutex_leave(db->mutex);
@@ -126561,10 +127968,17 @@
126561 sqlite3 *db, /* Attach the hook to this database */
126562 void (*xCallback)(void*), /* Callback function */
126563 void *pArg /* Argument to the function */
126564 ){
126565 void *pRet;
 
 
 
 
 
 
 
126566 sqlite3_mutex_enter(db->mutex);
126567 pRet = db->pRollbackArg;
126568 db->xRollbackCallback = xCallback;
126569 db->pRollbackArg = pArg;
126570 sqlite3_mutex_leave(db->mutex);
@@ -126607,10 +128021,13 @@
126607 SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int nFrame){
126608 #ifdef SQLITE_OMIT_WAL
126609 UNUSED_PARAMETER(db);
126610 UNUSED_PARAMETER(nFrame);
126611 #else
 
 
 
126612 if( nFrame>0 ){
126613 sqlite3_wal_hook(db, sqlite3WalDefaultHook, SQLITE_INT_TO_PTR(nFrame));
126614 }else{
126615 sqlite3_wal_hook(db, 0, 0);
126616 }
@@ -126627,10 +128044,16 @@
126627 int(*xCallback)(void *, sqlite3*, const char*, int),
126628 void *pArg /* First argument passed to xCallback() */
126629 ){
126630 #ifndef SQLITE_OMIT_WAL
126631 void *pRet;
 
 
 
 
 
 
126632 sqlite3_mutex_enter(db->mutex);
126633 pRet = db->pWalArg;
126634 db->xWalCallback = xCallback;
126635 db->pWalArg = pArg;
126636 sqlite3_mutex_leave(db->mutex);
@@ -126653,19 +128076,26 @@
126653 #ifdef SQLITE_OMIT_WAL
126654 return SQLITE_OK;
126655 #else
126656 int rc; /* Return code */
126657 int iDb = SQLITE_MAX_ATTACHED; /* sqlite3.aDb[] index of db to checkpoint */
 
 
 
 
126658
126659 /* Initialize the output variables to -1 in case an error occurs. */
126660 if( pnLog ) *pnLog = -1;
126661 if( pnCkpt ) *pnCkpt = -1;
126662
126663 assert( SQLITE_CHECKPOINT_FULL>SQLITE_CHECKPOINT_PASSIVE );
126664 assert( SQLITE_CHECKPOINT_FULL<SQLITE_CHECKPOINT_RESTART );
126665 assert( SQLITE_CHECKPOINT_PASSIVE+2==SQLITE_CHECKPOINT_RESTART );
126666 if( eMode<SQLITE_CHECKPOINT_PASSIVE || eMode>SQLITE_CHECKPOINT_RESTART ){
 
 
 
126667 return SQLITE_MISUSE;
126668 }
126669
126670 sqlite3_mutex_enter(db->mutex);
126671 if( zDb && zDb[0] ){
@@ -126689,11 +128119,13 @@
126689 ** Checkpoint database zDb. If zDb is NULL, or if the buffer zDb points
126690 ** to contains a zero-length string, all attached databases are
126691 ** checkpointed.
126692 */
126693 SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb){
126694 return sqlite3_wal_checkpoint_v2(db, zDb, SQLITE_CHECKPOINT_PASSIVE, 0, 0);
 
 
126695 }
126696
126697 #ifndef SQLITE_OMIT_WAL
126698 /*
126699 ** Run a checkpoint on database iDb. This is a no-op if database iDb is
@@ -127050,10 +128482,16 @@
127050 ** from forming.
127051 */
127052 SQLITE_API int sqlite3_limit(sqlite3 *db, int limitId, int newLimit){
127053 int oldLimit;
127054
 
 
 
 
 
 
127055
127056 /* EVIDENCE-OF: R-30189-54097 For each limit category SQLITE_LIMIT_NAME
127057 ** there is a hard upper bound set at compile-time by a C preprocessor
127058 ** macro called SQLITE_MAX_NAME. (The "_LIMIT_" in the name is changed to
127059 ** "_MAX_".)
@@ -127126,11 +128564,12 @@
127126 char c;
127127 int nUri = sqlite3Strlen30(zUri);
127128
127129 assert( *pzErrMsg==0 );
127130
127131 if( ((flags & SQLITE_OPEN_URI) || sqlite3GlobalConfig.bOpenUri)
 
127132 && nUri>=5 && memcmp(zUri, "file:", 5)==0 /* IMP: R-57884-37496 */
127133 ){
127134 char *zOpt;
127135 int eState; /* Parser state when parsing URI */
127136 int iIn; /* Input character index */
@@ -127335,10 +128774,13 @@
127335 int rc; /* Return code */
127336 int isThreadsafe; /* True for threadsafe connections */
127337 char *zOpen = 0; /* Filename argument to pass to BtreeOpen() */
127338 char *zErrMsg = 0; /* Error message from sqlite3ParseUri() */
127339
 
 
 
127340 *ppDb = 0;
127341 #ifndef SQLITE_OMIT_AUTOINIT
127342 rc = sqlite3_initialize();
127343 if( rc ) return rc;
127344 #endif
@@ -127449,24 +128891,28 @@
127449 #endif
127450
127451 /* Add the default collation sequence BINARY. BINARY works for both UTF-8
127452 ** and UTF-16, so add a version for each to avoid any unnecessary
127453 ** conversions. The only error that can occur here is a malloc() failure.
 
 
 
127454 */
127455 createCollation(db, "BINARY", SQLITE_UTF8, 0, binCollFunc, 0);
127456 createCollation(db, "BINARY", SQLITE_UTF16BE, 0, binCollFunc, 0);
127457 createCollation(db, "BINARY", SQLITE_UTF16LE, 0, binCollFunc, 0);
 
127458 createCollation(db, "RTRIM", SQLITE_UTF8, (void*)1, binCollFunc, 0);
127459 if( db->mallocFailed ){
127460 goto opendb_out;
127461 }
 
 
 
127462 db->pDfltColl = sqlite3FindCollSeq(db, SQLITE_UTF8, "BINARY", 0);
127463 assert( db->pDfltColl!=0 );
127464
127465 /* Also add a UTF-8 case-insensitive collation sequence. */
127466 createCollation(db, "NOCASE", SQLITE_UTF8, 0, nocaseCollatingFunc, 0);
127467
127468 /* Parse the filename/URI argument. */
127469 db->openFlags = flags;
127470 rc = sqlite3ParseUri(zVfs, zFilename, &flags, &db->pVfs, &zOpen, &zErrMsg);
127471 if( rc!=SQLITE_OK ){
127472 if( rc==SQLITE_NOMEM ) db->mallocFailed = 1;
@@ -127624,17 +129070,19 @@
127624 ){
127625 char const *zFilename8; /* zFilename encoded in UTF-8 instead of UTF-16 */
127626 sqlite3_value *pVal;
127627 int rc;
127628
127629 assert( zFilename );
127630 assert( ppDb );
 
127631 *ppDb = 0;
127632 #ifndef SQLITE_OMIT_AUTOINIT
127633 rc = sqlite3_initialize();
127634 if( rc ) return rc;
127635 #endif
 
127636 pVal = sqlite3ValueNew(0);
127637 sqlite3ValueSetStr(pVal, -1, zFilename, SQLITE_UTF16NATIVE, SQLITE_STATIC);
127638 zFilename8 = sqlite3ValueText(pVal, SQLITE_UTF8);
127639 if( zFilename8 ){
127640 rc = openDatabase(zFilename8, ppDb,
@@ -127660,17 +129108,11 @@
127660 const char *zName,
127661 int enc,
127662 void* pCtx,
127663 int(*xCompare)(void*,int,const void*,int,const void*)
127664 ){
127665 int rc;
127666 sqlite3_mutex_enter(db->mutex);
127667 assert( !db->mallocFailed );
127668 rc = createCollation(db, zName, (u8)enc, pCtx, xCompare, 0);
127669 rc = sqlite3ApiExit(db, rc);
127670 sqlite3_mutex_leave(db->mutex);
127671 return rc;
127672 }
127673
127674 /*
127675 ** Register a new collation sequence with the database handle db.
127676 */
@@ -127681,10 +129123,14 @@
127681 void* pCtx,
127682 int(*xCompare)(void*,int,const void*,int,const void*),
127683 void(*xDel)(void*)
127684 ){
127685 int rc;
 
 
 
 
127686 sqlite3_mutex_enter(db->mutex);
127687 assert( !db->mallocFailed );
127688 rc = createCollation(db, zName, (u8)enc, pCtx, xCompare, xDel);
127689 rc = sqlite3ApiExit(db, rc);
127690 sqlite3_mutex_leave(db->mutex);
@@ -127702,10 +129148,14 @@
127702 void* pCtx,
127703 int(*xCompare)(void*,int,const void*,int,const void*)
127704 ){
127705 int rc = SQLITE_OK;
127706 char *zName8;
 
 
 
 
127707 sqlite3_mutex_enter(db->mutex);
127708 assert( !db->mallocFailed );
127709 zName8 = sqlite3Utf16to8(db, zName, -1, SQLITE_UTF16NATIVE);
127710 if( zName8 ){
127711 rc = createCollation(db, zName8, (u8)enc, pCtx, xCompare, 0);
@@ -127724,10 +129174,13 @@
127724 SQLITE_API int sqlite3_collation_needed(
127725 sqlite3 *db,
127726 void *pCollNeededArg,
127727 void(*xCollNeeded)(void*,sqlite3*,int eTextRep,const char*)
127728 ){
 
 
 
127729 sqlite3_mutex_enter(db->mutex);
127730 db->xCollNeeded = xCollNeeded;
127731 db->xCollNeeded16 = 0;
127732 db->pCollNeededArg = pCollNeededArg;
127733 sqlite3_mutex_leave(db->mutex);
@@ -127742,10 +129195,13 @@
127742 SQLITE_API int sqlite3_collation_needed16(
127743 sqlite3 *db,
127744 void *pCollNeededArg,
127745 void(*xCollNeeded16)(void*,sqlite3*,int eTextRep,const void*)
127746 ){
 
 
 
127747 sqlite3_mutex_enter(db->mutex);
127748 db->xCollNeeded = 0;
127749 db->xCollNeeded16 = xCollNeeded16;
127750 db->pCollNeededArg = pCollNeededArg;
127751 sqlite3_mutex_leave(db->mutex);
@@ -127768,10 +129224,16 @@
127768 ** mode. Return TRUE if it is and FALSE if not. Autocommit mode is on
127769 ** by default. Autocommit is disabled by a BEGIN statement and reenabled
127770 ** by the next COMMIT or ROLLBACK.
127771 */
127772 SQLITE_API int sqlite3_get_autocommit(sqlite3 *db){
 
 
 
 
 
 
127773 return db->autoCommit;
127774 }
127775
127776 /*
127777 ** The following routines are substitutes for constants SQLITE_CORRUPT,
@@ -127950,10 +129412,13 @@
127950
127951 /*
127952 ** Enable or disable the extended result codes.
127953 */
127954 SQLITE_API int sqlite3_extended_result_codes(sqlite3 *db, int onoff){
 
 
 
127955 sqlite3_mutex_enter(db->mutex);
127956 db->errMask = onoff ? 0xffffffff : 0xff;
127957 sqlite3_mutex_leave(db->mutex);
127958 return SQLITE_OK;
127959 }
@@ -127963,10 +129428,13 @@
127963 */
127964 SQLITE_API int sqlite3_file_control(sqlite3 *db, const char *zDbName, int op, void *pArg){
127965 int rc = SQLITE_ERROR;
127966 Btree *pBtree;
127967
 
 
 
127968 sqlite3_mutex_enter(db->mutex);
127969 pBtree = sqlite3DbNameToBtree(db, zDbName);
127970 if( pBtree ){
127971 Pager *pPager;
127972 sqlite3_file *fd;
@@ -128305,11 +129773,11 @@
128305 ** query parameter we seek. This routine returns the value of the zParam
128306 ** parameter if it exists. If the parameter does not exist, this routine
128307 ** returns a NULL pointer.
128308 */
128309 SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam){
128310 if( zFilename==0 ) return 0;
128311 zFilename += sqlite3Strlen30(zFilename) + 1;
128312 while( zFilename[0] ){
128313 int x = strcmp(zFilename, zParam);
128314 zFilename += sqlite3Strlen30(zFilename) + 1;
128315 if( x==0 ) return zFilename;
@@ -128361,19 +129829,31 @@
128361 /*
128362 ** Return the filename of the database associated with a database
128363 ** connection.
128364 */
128365 SQLITE_API const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName){
 
 
 
 
 
 
128366 Btree *pBt = sqlite3DbNameToBtree(db, zDbName);
128367 return pBt ? sqlite3BtreeGetFilename(pBt) : 0;
128368 }
128369
128370 /*
128371 ** Return 1 if database is read-only or 0 if read/write. Return -1 if
128372 ** no such database exists.
128373 */
128374 SQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName){
 
 
 
 
 
 
128375 Btree *pBt = sqlite3DbNameToBtree(db, zDbName);
128376 return pBt ? sqlite3BtreeIsReadonly(pBt) : -1;
128377 }
128378
128379 /************** End of main.c ************************************************/
@@ -137791,11 +139271,11 @@
137791 ** Return true if the m-value for z is 1 or more. In other words,
137792 ** return true if z contains at least one vowel that is followed
137793 ** by a consonant.
137794 **
137795 ** In this routine z[] is in reverse order. So we are really looking
137796 ** for an instance of of a consonant followed by a vowel.
137797 */
137798 static int m_gt_0(const char *z){
137799 while( isVowel(z) ){ z++; }
137800 if( *z==0 ) return 0;
137801 while( isConsonant(z) ){ z++; }
137802
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1,8 +1,8 @@
1 /******************************************************************************
2 ** This file is an amalgamation of many separate C source files from SQLite
3 ** version 3.8.8. By combining all the individual C code files into this
4 ** single large file, the entire code can be compiled as a single translation
5 ** unit. This allows many compilers to do optimizations that would not be
6 ** possible if the files were compiled separately. Performance improvements
7 ** of 5% or more are commonly seen when SQLite is compiled as a single
8 ** translation unit.
@@ -179,11 +179,11 @@
179
180
181 /*
182 ** These no-op macros are used in front of interfaces to mark those
183 ** interfaces as either deprecated or experimental. New applications
184 ** should not use deprecated interfaces - they are supported for backwards
185 ** compatibility only. Application writers should be aware that
186 ** experimental interfaces are subject to change in point releases.
187 **
188 ** These macros used to resolve to various kinds of compiler magic that
189 ** would generate warning messages when they were used. But that
@@ -229,13 +229,13 @@
229 **
230 ** See also: [sqlite3_libversion()],
231 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
232 ** [sqlite_version()] and [sqlite_source_id()].
233 */
234 #define SQLITE_VERSION "3.8.8"
235 #define SQLITE_VERSION_NUMBER 3008008
236 #define SQLITE_SOURCE_ID "2014-12-06 14:56:49 6aeece19a235344be2537e66a3fe08b1febfb5a0"
237
238 /*
239 ** CAPI3REF: Run-Time Library Version Numbers
240 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
241 **
@@ -1343,11 +1343,11 @@
1343 ** <li> SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED
1344 ** <li> SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE
1345 ** </ul>
1346 **
1347 ** When unlocking, the same SHARED or EXCLUSIVE flag must be supplied as
1348 ** was given on the corresponding lock.
1349 **
1350 ** The xShmLock method can transition between unlocked and SHARED or
1351 ** between unlocked and EXCLUSIVE. It cannot transition between SHARED
1352 ** and EXCLUSIVE.
1353 */
@@ -1626,30 +1626,32 @@
1626 ** it is not possible to set the Serialized [threading mode] and
1627 ** [sqlite3_config()] will return [SQLITE_ERROR] if called with the
1628 ** SQLITE_CONFIG_SERIALIZED configuration option.</dd>
1629 **
1630 ** [[SQLITE_CONFIG_MALLOC]] <dt>SQLITE_CONFIG_MALLOC</dt>
1631 ** <dd> ^(The SQLITE_CONFIG_MALLOC option takes a single argument which is
1632 ** a pointer to an instance of the [sqlite3_mem_methods] structure.
1633 ** The argument specifies
1634 ** alternative low-level memory allocation routines to be used in place of
1635 ** the memory allocation routines built into SQLite.)^ ^SQLite makes
1636 ** its own private copy of the content of the [sqlite3_mem_methods] structure
1637 ** before the [sqlite3_config()] call returns.</dd>
1638 **
1639 ** [[SQLITE_CONFIG_GETMALLOC]] <dt>SQLITE_CONFIG_GETMALLOC</dt>
1640 ** <dd> ^(The SQLITE_CONFIG_GETMALLOC option takes a single argument which
1641 ** is a pointer to an instance of the [sqlite3_mem_methods] structure.
1642 ** The [sqlite3_mem_methods]
1643 ** structure is filled with the currently defined memory allocation routines.)^
1644 ** This option can be used to overload the default memory allocation
1645 ** routines with a wrapper that simulations memory allocation failure or
1646 ** tracks memory usage, for example. </dd>
1647 **
1648 ** [[SQLITE_CONFIG_MEMSTATUS]] <dt>SQLITE_CONFIG_MEMSTATUS</dt>
1649 ** <dd> ^The SQLITE_CONFIG_MEMSTATUS option takes single argument of type int,
1650 ** interpreted as a boolean, which enables or disables the collection of
1651 ** memory allocation statistics. ^(When memory allocation statistics are
1652 ** disabled, the following SQLite interfaces become non-operational:
1653 ** <ul>
1654 ** <li> [sqlite3_memory_used()]
1655 ** <li> [sqlite3_memory_highwater()]
1656 ** <li> [sqlite3_soft_heap_limit64()]
1657 ** <li> [sqlite3_status()]
@@ -1658,78 +1660,92 @@
1660 ** compiled with [SQLITE_DEFAULT_MEMSTATUS]=0 in which case memory
1661 ** allocation statistics are disabled by default.
1662 ** </dd>
1663 **
1664 ** [[SQLITE_CONFIG_SCRATCH]] <dt>SQLITE_CONFIG_SCRATCH</dt>
1665 ** <dd> ^The SQLITE_CONFIG_SCRATCH option specifies a static memory buffer
1666 ** that SQLite can use for scratch memory. ^(There are three arguments
1667 ** to SQLITE_CONFIG_SCRATCH: A pointer an 8-byte
1668 ** aligned memory buffer from which the scratch allocations will be
1669 ** drawn, the size of each scratch allocation (sz),
1670 ** and the maximum number of scratch allocations (N).)^
 
1671 ** The first argument must be a pointer to an 8-byte aligned buffer
1672 ** of at least sz*N bytes of memory.
1673 ** ^SQLite will not use more than one scratch buffers per thread.
1674 ** ^SQLite will never request a scratch buffer that is more than 6
1675 ** times the database page size.
1676 ** ^If SQLite needs needs additional
1677 ** scratch memory beyond what is provided by this configuration option, then
1678 ** [sqlite3_malloc()] will be used to obtain the memory needed.<p>
1679 ** ^When the application provides any amount of scratch memory using
1680 ** SQLITE_CONFIG_SCRATCH, SQLite avoids unnecessary large
1681 ** [sqlite3_malloc|heap allocations].
1682 ** This can help [Robson proof|prevent memory allocation failures] due to heap
1683 ** fragmentation in low-memory embedded systems.
1684 ** </dd>
1685 **
1686 ** [[SQLITE_CONFIG_PAGECACHE]] <dt>SQLITE_CONFIG_PAGECACHE</dt>
1687 ** <dd> ^The SQLITE_CONFIG_PAGECACHE option specifies a static memory buffer
1688 ** that SQLite can use for the database page cache with the default page
1689 ** cache implementation.
1690 ** This configuration should not be used if an application-define page
1691 ** cache implementation is loaded using the [SQLITE_CONFIG_PCACHE2]
1692 ** configuration option.
1693 ** ^There are three arguments to SQLITE_CONFIG_PAGECACHE: A pointer to
1694 ** 8-byte aligned
1695 ** memory, the size of each page buffer (sz), and the number of pages (N).
1696 ** The sz argument should be the size of the largest database page
1697 ** (a power of two between 512 and 32768) plus some extra bytes for each
1698 ** page header. ^The number of extra bytes needed by the page header
1699 ** can be determined using the [SQLITE_CONFIG_PCACHE_HDRSZ] option
1700 ** to [sqlite3_config()].
1701 ** ^It is harmless, apart from the wasted memory,
1702 ** for the sz parameter to be larger than necessary. The first
1703 ** argument should pointer to an 8-byte aligned block of memory that
1704 ** is at least sz*N bytes of memory, otherwise subsequent behavior is
1705 ** undefined.
1706 ** ^SQLite will use the memory provided by the first argument to satisfy its
1707 ** memory needs for the first N pages that it adds to cache. ^If additional
1708 ** page cache memory is needed beyond what is provided by this option, then
1709 ** SQLite goes to [sqlite3_malloc()] for the additional storage space.</dd>
 
 
 
1710 **
1711 ** [[SQLITE_CONFIG_HEAP]] <dt>SQLITE_CONFIG_HEAP</dt>
1712 ** <dd> ^The SQLITE_CONFIG_HEAP option specifies a static memory buffer
1713 ** that SQLite will use for all of its dynamic memory allocation needs
1714 ** beyond those provided for by [SQLITE_CONFIG_SCRATCH] and
1715 ** [SQLITE_CONFIG_PAGECACHE].
1716 ** ^The SQLITE_CONFIG_HEAP option is only available if SQLite is compiled
1717 ** with either [SQLITE_ENABLE_MEMSYS3] or [SQLITE_ENABLE_MEMSYS5] and returns
1718 ** [SQLITE_ERROR] if invoked otherwise.
1719 ** ^There are three arguments to SQLITE_CONFIG_HEAP:
1720 ** An 8-byte aligned pointer to the memory,
1721 ** the number of bytes in the memory buffer, and the minimum allocation size.
1722 ** ^If the first pointer (the memory pointer) is NULL, then SQLite reverts
1723 ** to using its default memory allocator (the system malloc() implementation),
1724 ** undoing any prior invocation of [SQLITE_CONFIG_MALLOC]. ^If the
1725 ** memory pointer is not NULL then the alternative memory
 
1726 ** allocator is engaged to handle all of SQLites memory allocation needs.
1727 ** The first pointer (the memory pointer) must be aligned to an 8-byte
1728 ** boundary or subsequent behavior of SQLite will be undefined.
1729 ** The minimum allocation size is capped at 2**12. Reasonable values
1730 ** for the minimum allocation size are 2**5 through 2**8.</dd>
1731 **
1732 ** [[SQLITE_CONFIG_MUTEX]] <dt>SQLITE_CONFIG_MUTEX</dt>
1733 ** <dd> ^(The SQLITE_CONFIG_MUTEX option takes a single argument which is a
1734 ** pointer to an instance of the [sqlite3_mutex_methods] structure.
1735 ** The argument specifies alternative low-level mutex routines to be used
1736 ** in place the mutex routines built into SQLite.)^ ^SQLite makes a copy of
1737 ** the content of the [sqlite3_mutex_methods] structure before the call to
1738 ** [sqlite3_config()] returns. ^If SQLite is compiled with
1739 ** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
1740 ** the entire mutexing subsystem is omitted from the build and hence calls to
1741 ** [sqlite3_config()] with the SQLITE_CONFIG_MUTEX configuration option will
1742 ** return [SQLITE_ERROR].</dd>
1743 **
1744 ** [[SQLITE_CONFIG_GETMUTEX]] <dt>SQLITE_CONFIG_GETMUTEX</dt>
1745 ** <dd> ^(The SQLITE_CONFIG_GETMUTEX option takes a single argument which
1746 ** is a pointer to an instance of the [sqlite3_mutex_methods] structure. The
1747 ** [sqlite3_mutex_methods]
1748 ** structure is filled with the currently defined mutex routines.)^
1749 ** This option can be used to overload the default mutex allocation
1750 ** routines with a wrapper used to track mutex usage for performance
1751 ** profiling or testing, for example. ^If SQLite is compiled with
@@ -1737,29 +1753,29 @@
1753 ** the entire mutexing subsystem is omitted from the build and hence calls to
1754 ** [sqlite3_config()] with the SQLITE_CONFIG_GETMUTEX configuration option will
1755 ** return [SQLITE_ERROR].</dd>
1756 **
1757 ** [[SQLITE_CONFIG_LOOKASIDE]] <dt>SQLITE_CONFIG_LOOKASIDE</dt>
1758 ** <dd> ^(The SQLITE_CONFIG_LOOKASIDE option takes two arguments that determine
1759 ** the default size of lookaside memory on each [database connection].
1760 ** The first argument is the
1761 ** size of each lookaside buffer slot and the second is the number of
1762 ** slots allocated to each database connection.)^ ^(SQLITE_CONFIG_LOOKASIDE
1763 ** sets the <i>default</i> lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE]
1764 ** option to [sqlite3_db_config()] can be used to change the lookaside
1765 ** configuration on individual connections.)^ </dd>
1766 **
1767 ** [[SQLITE_CONFIG_PCACHE2]] <dt>SQLITE_CONFIG_PCACHE2</dt>
1768 ** <dd> ^(The SQLITE_CONFIG_PCACHE2 option takes a single argument which is
1769 ** a pointer to an [sqlite3_pcache_methods2] object. This object specifies
1770 ** the interface to a custom page cache implementation.)^
1771 ** ^SQLite makes a copy of the [sqlite3_pcache_methods2] object.</dd>
1772 **
1773 ** [[SQLITE_CONFIG_GETPCACHE2]] <dt>SQLITE_CONFIG_GETPCACHE2</dt>
1774 ** <dd> ^(The SQLITE_CONFIG_GETPCACHE2 option takes a single argument which
1775 ** is a pointer to an [sqlite3_pcache_methods2] object. SQLite copies of
1776 ** the current page cache implementation into that object.)^ </dd>
1777 **
1778 ** [[SQLITE_CONFIG_LOG]] <dt>SQLITE_CONFIG_LOG</dt>
1779 ** <dd> The SQLITE_CONFIG_LOG option is used to configure the SQLite
1780 ** global [error log].
1781 ** (^The SQLITE_CONFIG_LOG option takes two arguments: a pointer to a
@@ -1778,26 +1794,28 @@
1794 ** supplied by the application must not invoke any SQLite interface.
1795 ** In a multi-threaded application, the application-defined logger
1796 ** function must be threadsafe. </dd>
1797 **
1798 ** [[SQLITE_CONFIG_URI]] <dt>SQLITE_CONFIG_URI
1799 ** <dd>^(The SQLITE_CONFIG_URI option takes a single argument of type int.
1800 ** If non-zero, then URI handling is globally enabled. If the parameter is zero,
1801 ** then URI handling is globally disabled.)^ ^If URI handling is globally
1802 ** enabled, all filenames passed to [sqlite3_open()], [sqlite3_open_v2()],
1803 ** [sqlite3_open16()] or
1804 ** specified as part of [ATTACH] commands are interpreted as URIs, regardless
1805 ** of whether or not the [SQLITE_OPEN_URI] flag is set when the database
1806 ** connection is opened. ^If it is globally disabled, filenames are
1807 ** only interpreted as URIs if the SQLITE_OPEN_URI flag is set when the
1808 ** database connection is opened. ^(By default, URI handling is globally
1809 ** disabled. The default value may be changed by compiling with the
1810 ** [SQLITE_USE_URI] symbol defined.)^
1811 **
1812 ** [[SQLITE_CONFIG_COVERING_INDEX_SCAN]] <dt>SQLITE_CONFIG_COVERING_INDEX_SCAN
1813 ** <dd>^The SQLITE_CONFIG_COVERING_INDEX_SCAN option takes a single integer
1814 ** argument which is interpreted as a boolean in order to enable or disable
1815 ** the use of covering indices for full table scans in the query optimizer.
1816 ** ^The default setting is determined
1817 ** by the [SQLITE_ALLOW_COVERING_INDEX_SCAN] compile-time option, or is "on"
1818 ** if that compile-time option is omitted.
1819 ** The ability to disable the use of covering indices for full table scans
1820 ** is because some incorrectly coded legacy applications might malfunction
1821 ** when the optimization is enabled. Providing the ability to
@@ -1833,23 +1851,32 @@
1851 ** that are the default mmap size limit (the default setting for
1852 ** [PRAGMA mmap_size]) and the maximum allowed mmap size limit.
1853 ** ^The default setting can be overridden by each database connection using
1854 ** either the [PRAGMA mmap_size] command, or by using the
1855 ** [SQLITE_FCNTL_MMAP_SIZE] file control. ^(The maximum allowed mmap size
1856 ** will be silently truncated if necessary so that it does not exceed the
1857 ** compile-time maximum mmap size set by the
1858 ** [SQLITE_MAX_MMAP_SIZE] compile-time option.)^
1859 ** ^If either argument to this option is negative, then that argument is
1860 ** changed to its compile-time default.
1861 **
1862 ** [[SQLITE_CONFIG_WIN32_HEAPSIZE]]
1863 ** <dt>SQLITE_CONFIG_WIN32_HEAPSIZE
1864 ** <dd>^The SQLITE_CONFIG_WIN32_HEAPSIZE option is only available if SQLite is
1865 ** compiled for Windows with the [SQLITE_WIN32_MALLOC] pre-processor macro
1866 ** defined. ^SQLITE_CONFIG_WIN32_HEAPSIZE takes a 32-bit unsigned integer value
1867 ** that specifies the maximum size of the created heap.
1868 ** </dl>
1869 **
1870 ** [[SQLITE_CONFIG_PCACHE_HDRSZ]]
1871 ** <dt>SQLITE_CONFIG_PCACHE_HDRSZ
1872 ** <dd>^The SQLITE_CONFIG_PCACHE_HDRSZ option takes a single parameter which
1873 ** is a pointer to an integer and writes into that integer the number of extra
1874 ** bytes per page required for each page in [SQLITE_CONFIG_PAGECACHE].
1875 ** The amount of extra space required can change depending on the compiler,
1876 ** target platform, and SQLite version.
1877 ** </dl>
1878 */
1879 #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
1880 #define SQLITE_CONFIG_MULTITHREAD 2 /* nil */
1881 #define SQLITE_CONFIG_SERIALIZED 3 /* nil */
1882 #define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */
@@ -1870,10 +1897,11 @@
1897 #define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */
1898 #define SQLITE_CONFIG_COVERING_INDEX_SCAN 20 /* int */
1899 #define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */
1900 #define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */
1901 #define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */
1902 #define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */
1903
1904 /*
1905 ** CAPI3REF: Database Connection Configuration Options
1906 **
1907 ** These constants are the available integer configuration options that
@@ -1997,51 +2025,49 @@
2025 SQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*);
2026
2027 /*
2028 ** CAPI3REF: Count The Number Of Rows Modified
2029 **
2030 ** ^This function returns the number of rows modified, inserted or
2031 ** deleted by the most recently completed INSERT, UPDATE or DELETE
2032 ** statement on the database connection specified by the only parameter.
2033 ** ^Executing any other type of SQL statement does not modify the value
2034 ** returned by this function.
2035 **
2036 ** ^Only changes made directly by the INSERT, UPDATE or DELETE statement are
2037 ** considered - auxiliary changes caused by [CREATE TRIGGER | triggers],
2038 ** [foreign key actions] or [REPLACE] constraint resolution are not counted.
2039 **
2040 ** Changes to a view that are intercepted by
2041 ** [INSTEAD OF trigger | INSTEAD OF triggers] are not counted. ^The value
2042 ** returned by sqlite3_changes() immediately after an INSERT, UPDATE or
2043 ** DELETE statement run on a view is always zero. Only changes made to real
2044 ** tables are counted.
2045 **
2046 ** Things are more complicated if the sqlite3_changes() function is
2047 ** executed while a trigger program is running. This may happen if the
2048 ** program uses the [changes() SQL function], or if some other callback
2049 ** function invokes sqlite3_changes() directly. Essentially:
2050 **
2051 ** <ul>
2052 ** <li> ^(Before entering a trigger program the value returned by
2053 ** sqlite3_changes() function is saved. After the trigger program
2054 ** has finished, the original value is restored.)^
2055 **
2056 ** <li> ^(Within a trigger program each INSERT, UPDATE and DELETE
2057 ** statement sets the value returned by sqlite3_changes()
2058 ** upon completion as normal. Of course, this value will not include
2059 ** any changes performed by sub-triggers, as the sqlite3_changes()
2060 ** value will be saved and restored after each sub-trigger has run.)^
2061 ** </ul>
2062 **
2063 ** ^This means that if the changes() SQL function (or similar) is used
2064 ** by the first INSERT, UPDATE or DELETE statement within a trigger, it
2065 ** returns the value as set when the calling statement began executing.
2066 ** ^If it is used by the second or subsequent such statement within a trigger
2067 ** program, the value returned reflects the number of rows modified by the
2068 ** previous INSERT, UPDATE or DELETE statement within the same trigger.
 
 
2069 **
2070 ** See also the [sqlite3_total_changes()] interface, the
2071 ** [count_changes pragma], and the [changes() SQL function].
2072 **
2073 ** If a separate thread makes changes on the same database connection
@@ -2051,24 +2077,21 @@
2077 SQLITE_API int sqlite3_changes(sqlite3*);
2078
2079 /*
2080 ** CAPI3REF: Total Number Of Rows Modified
2081 **
2082 ** ^This function returns the total number of rows inserted, modified or
2083 ** deleted by all [INSERT], [UPDATE] or [DELETE] statements completed
2084 ** since the database connection was opened, including those executed as
2085 ** part of trigger programs. ^Executing any other type of SQL statement
2086 ** does not affect the value returned by sqlite3_total_changes().
2087 **
2088 ** ^Changes made as part of [foreign key actions] are included in the
2089 ** count, but those made as part of REPLACE constraint resolution are
2090 ** not. ^Changes to a view that are intercepted by INSTEAD OF triggers
2091 ** are not counted.
2092 **
 
 
 
2093 ** See also the [sqlite3_changes()] interface, the
2094 ** [count_changes pragma], and the [total_changes() SQL function].
2095 **
2096 ** If a separate thread makes changes on the same database connection
2097 ** while [sqlite3_total_changes()] is running then the value
@@ -2151,10 +2174,11 @@
2174 SQLITE_API int sqlite3_complete(const char *sql);
2175 SQLITE_API int sqlite3_complete16(const void *sql);
2176
2177 /*
2178 ** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors
2179 ** KEYWORDS: {busy-handler callback} {busy handler}
2180 **
2181 ** ^The sqlite3_busy_handler(D,X,P) routine sets a callback function X
2182 ** that might be invoked with argument P whenever
2183 ** an attempt is made to access a database table associated with
2184 ** [database connection] D when another thread
@@ -2167,11 +2191,11 @@
2191 ** is not NULL, then the callback might be invoked with two arguments.
2192 **
2193 ** ^The first argument to the busy handler is a copy of the void* pointer which
2194 ** is the third argument to sqlite3_busy_handler(). ^The second argument to
2195 ** the busy handler callback is the number of times that the busy handler has
2196 ** been invoked previously for the same locking event. ^If the
2197 ** busy callback returns 0, then no additional attempts are made to
2198 ** access the database and [SQLITE_BUSY] is returned
2199 ** to the application.
2200 ** ^If the callback returns non-zero, then another attempt
2201 ** is made to access the database and the cycle repeats.
@@ -2542,17 +2566,18 @@
2566 ** already uses the largest possible [ROWID]. The PRNG is also used for
2567 ** the build-in random() and randomblob() SQL functions. This interface allows
2568 ** applications to access the same PRNG for other purposes.
2569 **
2570 ** ^A call to this routine stores N bytes of randomness into buffer P.
2571 ** ^The P parameter can be a NULL pointer.
2572 **
2573 ** ^If this routine has not been previously called or if the previous
2574 ** call had N less than one or a NULL pointer for P, then the PRNG is
2575 ** seeded using randomness obtained from the xRandomness method of
2576 ** the default [sqlite3_vfs] object.
2577 ** ^If the previous call to this routine had an N of 1 or more and a
2578 ** non-NULL P then the pseudo-randomness is generated
2579 ** internally and without recourse to the [sqlite3_vfs] xRandomness
2580 ** method.
2581 */
2582 SQLITE_API void sqlite3_randomness(int N, void *P);
2583
@@ -4270,13 +4295,13 @@
4295 ** CAPI3REF: Text Encodings
4296 **
4297 ** These constant define integer codes that represent the various
4298 ** text encodings supported by SQLite.
4299 */
4300 #define SQLITE_UTF8 1 /* IMP: R-37514-35566 */
4301 #define SQLITE_UTF16LE 2 /* IMP: R-03371-37637 */
4302 #define SQLITE_UTF16BE 3 /* IMP: R-51971-34154 */
4303 #define SQLITE_UTF16 4 /* Use native byte order */
4304 #define SQLITE_ANY 5 /* Deprecated */
4305 #define SQLITE_UTF16_ALIGNED 8 /* sqlite3_create_collation only */
4306
4307 /*
@@ -4621,11 +4646,12 @@
4646 ** If these routines are called from within the different thread
4647 ** than the one containing the application-defined function that received
4648 ** the [sqlite3_context] pointer, the results are undefined.
4649 */
4650 SQLITE_API void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));
4651 SQLITE_API void sqlite3_result_blob64(sqlite3_context*,const void*,
4652 sqlite3_uint64,void(*)(void*));
4653 SQLITE_API void sqlite3_result_double(sqlite3_context*, double);
4654 SQLITE_API void sqlite3_result_error(sqlite3_context*, const char*, int);
4655 SQLITE_API void sqlite3_result_error16(sqlite3_context*, const void*, int);
4656 SQLITE_API void sqlite3_result_error_toobig(sqlite3_context*);
4657 SQLITE_API void sqlite3_result_error_nomem(sqlite3_context*);
@@ -5762,31 +5788,47 @@
5788 ** in other words, the same BLOB that would be selected by:
5789 **
5790 ** <pre>
5791 ** SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow;
5792 ** </pre>)^
5793 **
5794 ** ^(Parameter zDb is not the filename that contains the database, but
5795 ** rather the symbolic name of the database. For attached databases, this is
5796 ** the name that appears after the AS keyword in the [ATTACH] statement.
5797 ** For the main database file, the database name is "main". For TEMP
5798 ** tables, the database name is "temp".)^
5799 **
5800 ** ^If the flags parameter is non-zero, then the BLOB is opened for read
5801 ** and write access. ^If the flags parameter is zero, the BLOB is opened for
5802 ** read-only access.
5803 **
5804 ** ^(On success, [SQLITE_OK] is returned and the new [BLOB handle] is stored
5805 ** in *ppBlob. Otherwise an [error code] is returned and, unless the error
5806 ** code is SQLITE_MISUSE, *ppBlob is set to NULL.)^ ^This means that, provided
5807 ** the API is not misused, it is always safe to call [sqlite3_blob_close()]
5808 ** on *ppBlob after this function it returns.
5809 **
5810 ** This function fails with SQLITE_ERROR if any of the following are true:
5811 ** <ul>
5812 ** <li> ^(Database zDb does not exist)^,
5813 ** <li> ^(Table zTable does not exist within database zDb)^,
5814 ** <li> ^(Table zTable is a WITHOUT ROWID table)^,
5815 ** <li> ^(Column zColumn does not exist)^,
5816 ** <li> ^(Row iRow is not present in the table)^,
5817 ** <li> ^(The specified column of row iRow contains a value that is not
5818 ** a TEXT or BLOB value)^,
5819 ** <li> ^(Column zColumn is part of an index, PRIMARY KEY or UNIQUE
5820 ** constraint and the blob is being opened for read/write access)^,
5821 ** <li> ^([foreign key constraints | Foreign key constraints] are enabled,
5822 ** column zColumn is part of a [child key] definition and the blob is
5823 ** being opened for read/write access)^.
5824 ** </ul>
5825 **
5826 ** ^Unless it returns SQLITE_MISUSE, this function sets the
5827 ** [database connection] error code and message accessible via
5828 ** [sqlite3_errcode()] and [sqlite3_errmsg()] and related functions.
5829 **
5830 **
5831 ** ^(If the row that a BLOB handle points to is modified by an
5832 ** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects
5833 ** then the BLOB handle is marked as "expired".
5834 ** This is true if any column of the row is changed, even a column
@@ -5800,17 +5842,13 @@
5842 ** ^Use the [sqlite3_blob_bytes()] interface to determine the size of
5843 ** the opened blob. ^The size of a blob may not be changed by this
5844 ** interface. Use the [UPDATE] SQL command to change the size of a
5845 ** blob.
5846 **
 
 
 
5847 ** ^The [sqlite3_bind_zeroblob()] and [sqlite3_result_zeroblob()] interfaces
5848 ** and the built-in [zeroblob] SQL function may be used to create a
5849 ** zero-filled blob to read or write using the incremental-blob interface.
 
5850 **
5851 ** To avoid a resource leak, every open [BLOB handle] should eventually
5852 ** be released by a call to [sqlite3_blob_close()].
5853 */
5854 SQLITE_API int sqlite3_blob_open(
@@ -5848,28 +5886,26 @@
5886 SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64);
5887
5888 /*
5889 ** CAPI3REF: Close A BLOB Handle
5890 **
5891 ** ^This function closes an open [BLOB handle]. ^(The BLOB handle is closed
5892 ** unconditionally. Even if this routine returns an error code, the
5893 ** handle is still closed.)^
5894 **
5895 ** ^If the blob handle being closed was opened for read-write access, and if
5896 ** the database is in auto-commit mode and there are no other open read-write
5897 ** blob handles or active write statements, the current transaction is
5898 ** committed. ^If an error occurs while committing the transaction, an error
5899 ** code is returned and the transaction rolled back.
5900 **
5901 ** Calling this function with an argument that is not a NULL pointer or an
5902 ** open blob handle results in undefined behaviour. ^Calling this routine
5903 ** with a null pointer (such as would be returned by a failed call to
5904 ** [sqlite3_blob_open()]) is a harmless no-op. ^Otherwise, if this function
5905 ** is passed a valid open blob handle, the values returned by the
5906 ** sqlite3_errcode() and sqlite3_errmsg() functions are set before returning.
 
 
5907 */
5908 SQLITE_API int sqlite3_blob_close(sqlite3_blob *);
5909
5910 /*
5911 ** CAPI3REF: Return The Size Of An Open BLOB
@@ -5915,36 +5951,39 @@
5951 SQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);
5952
5953 /*
5954 ** CAPI3REF: Write Data Into A BLOB Incrementally
5955 **
5956 ** ^(This function is used to write data into an open [BLOB handle] from a
5957 ** caller-supplied buffer. N bytes of data are copied from the buffer Z
5958 ** into the open BLOB, starting at offset iOffset.)^
5959 **
5960 ** ^(On success, sqlite3_blob_write() returns SQLITE_OK.
5961 ** Otherwise, an [error code] or an [extended error code] is returned.)^
5962 ** ^Unless SQLITE_MISUSE is returned, this function sets the
5963 ** [database connection] error code and message accessible via
5964 ** [sqlite3_errcode()] and [sqlite3_errmsg()] and related functions.
5965 **
5966 ** ^If the [BLOB handle] passed as the first argument was not opened for
5967 ** writing (the flags parameter to [sqlite3_blob_open()] was zero),
5968 ** this function returns [SQLITE_READONLY].
5969 **
5970 ** This function may only modify the contents of the BLOB; it is
5971 ** not possible to increase the size of a BLOB using this API.
5972 ** ^If offset iOffset is less than N bytes from the end of the BLOB,
5973 ** [SQLITE_ERROR] is returned and no data is written. The size of the
5974 ** BLOB (and hence the maximum value of N+iOffset) can be determined
5975 ** using the [sqlite3_blob_bytes()] interface. ^If N or iOffset are less
5976 ** than zero [SQLITE_ERROR] is returned and no data is written.
5977 **
5978 ** ^An attempt to write to an expired [BLOB handle] fails with an
5979 ** error code of [SQLITE_ABORT]. ^Writes to the BLOB that occurred
5980 ** before the [BLOB handle] expired are not rolled back by the
5981 ** expiration of the handle, though of course those changes might
5982 ** have been overwritten by the statement that expired the BLOB handle
5983 ** or by other independent statements.
5984 **
 
 
 
5985 ** This routine only works on a [BLOB handle] which has been created
5986 ** by a prior successful call to [sqlite3_blob_open()] and which has not
5987 ** been closed by [sqlite3_blob_close()]. Passing any other pointer in
5988 ** to this routine results in undefined and probably undesirable behavior.
5989 **
@@ -5993,38 +6032,38 @@
6032 ** use by SQLite, code that links against SQLite is
6033 ** permitted to use any of these routines.
6034 **
6035 ** The SQLite source code contains multiple implementations
6036 ** of these mutex routines. An appropriate implementation
6037 ** is selected automatically at compile-time. The following
6038 ** implementations are available in the SQLite core:
6039 **
6040 ** <ul>
6041 ** <li> SQLITE_MUTEX_PTHREADS
6042 ** <li> SQLITE_MUTEX_W32
6043 ** <li> SQLITE_MUTEX_NOOP
6044 ** </ul>
6045 **
6046 ** The SQLITE_MUTEX_NOOP implementation is a set of routines
6047 ** that does no real locking and is appropriate for use in
6048 ** a single-threaded application. The SQLITE_MUTEX_PTHREADS and
6049 ** SQLITE_MUTEX_W32 implementations are appropriate for use on Unix
6050 ** and Windows.
6051 **
6052 ** If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor
6053 ** macro defined (with "-DSQLITE_MUTEX_APPDEF=1"), then no mutex
6054 ** implementation is included with the library. In this case the
6055 ** application must supply a custom mutex implementation using the
6056 ** [SQLITE_CONFIG_MUTEX] option of the sqlite3_config() function
6057 ** before calling sqlite3_initialize() or any other public sqlite3_
6058 ** function that calls sqlite3_initialize().
6059 **
6060 ** ^The sqlite3_mutex_alloc() routine allocates a new
6061 ** mutex and returns a pointer to it. ^The sqlite3_mutex_alloc()
6062 ** routine returns NULL if it is unable to allocate the requested
6063 ** mutex. The argument to sqlite3_mutex_alloc() must one of these
6064 ** integer constants:
6065 **
6066 ** <ul>
6067 ** <li> SQLITE_MUTEX_FAST
6068 ** <li> SQLITE_MUTEX_RECURSIVE
6069 ** <li> SQLITE_MUTEX_STATIC_MASTER
@@ -6033,68 +6072,64 @@
6072 ** <li> SQLITE_MUTEX_STATIC_PRNG
6073 ** <li> SQLITE_MUTEX_STATIC_LRU
6074 ** <li> SQLITE_MUTEX_STATIC_PMEM
6075 ** <li> SQLITE_MUTEX_STATIC_APP1
6076 ** <li> SQLITE_MUTEX_STATIC_APP2
6077 ** <li> SQLITE_MUTEX_STATIC_APP3
6078 ** </ul>
6079 **
6080 ** ^The first two constants (SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE)
6081 ** cause sqlite3_mutex_alloc() to create
6082 ** a new mutex. ^The new mutex is recursive when SQLITE_MUTEX_RECURSIVE
6083 ** is used but not necessarily so when SQLITE_MUTEX_FAST is used.
6084 ** The mutex implementation does not need to make a distinction
6085 ** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does
6086 ** not want to. SQLite will only request a recursive mutex in
6087 ** cases where it really needs one. If a faster non-recursive mutex
6088 ** implementation is available on the host platform, the mutex subsystem
6089 ** might return such a mutex in response to SQLITE_MUTEX_FAST.
6090 **
6091 ** ^The other allowed parameters to sqlite3_mutex_alloc() (anything other
6092 ** than SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) each return
6093 ** a pointer to a static preexisting mutex. ^Nine static mutexes are
6094 ** used by the current version of SQLite. Future versions of SQLite
6095 ** may add additional static mutexes. Static mutexes are for internal
6096 ** use by SQLite only. Applications that use SQLite mutexes should
6097 ** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or
6098 ** SQLITE_MUTEX_RECURSIVE.
6099 **
6100 ** ^Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST
6101 ** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc()
6102 ** returns a different mutex on every call. ^For the static
6103 ** mutex types, the same mutex is returned on every call that has
6104 ** the same type number.
6105 **
6106 ** ^The sqlite3_mutex_free() routine deallocates a previously
6107 ** allocated dynamic mutex. Attempting to deallocate a static
6108 ** mutex results in undefined behavior.
 
 
 
6109 **
6110 ** ^The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt
6111 ** to enter a mutex. ^If another thread is already within the mutex,
6112 ** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return
6113 ** SQLITE_BUSY. ^The sqlite3_mutex_try() interface returns [SQLITE_OK]
6114 ** upon successful entry. ^(Mutexes created using
6115 ** SQLITE_MUTEX_RECURSIVE can be entered multiple times by the same thread.
6116 ** In such cases, the
6117 ** mutex must be exited an equal number of times before another thread
6118 ** can enter.)^ If the same thread tries to enter any mutex other
6119 ** than an SQLITE_MUTEX_RECURSIVE more than once, the behavior is undefined.
 
 
6120 **
6121 ** ^(Some systems (for example, Windows 95) do not support the operation
6122 ** implemented by sqlite3_mutex_try(). On those systems, sqlite3_mutex_try()
6123 ** will always return SQLITE_BUSY. The SQLite core only ever uses
6124 ** sqlite3_mutex_try() as an optimization so this is acceptable
6125 ** behavior.)^
6126 **
6127 ** ^The sqlite3_mutex_leave() routine exits a mutex that was
6128 ** previously entered by the same thread. The behavior
6129 ** is undefined if the mutex is not currently entered by the
6130 ** calling thread or is not currently allocated.
 
6131 **
6132 ** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(), or
6133 ** sqlite3_mutex_leave() is a NULL pointer, then all three routines
6134 ** behave as no-ops.
6135 **
@@ -6111,13 +6146,13 @@
6146 **
6147 ** An instance of this structure defines the low-level routines
6148 ** used to allocate and use mutexes.
6149 **
6150 ** Usually, the default mutex implementations provided by SQLite are
6151 ** sufficient, however the application has the option of substituting a custom
6152 ** implementation for specialized deployments or systems for which SQLite
6153 ** does not provide a suitable implementation. In this case, the application
6154 ** creates and populates an instance of this structure to pass
6155 ** to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option.
6156 ** Additionally, an instance of this structure can be used as an
6157 ** output variable when querying the system for the current mutex
6158 ** implementation, using the [SQLITE_CONFIG_GETMUTEX] option.
@@ -6154,17 +6189,17 @@
6189 ** by this structure are not required to handle this case, the results
6190 ** of passing a NULL pointer instead of a valid mutex handle are undefined
6191 ** (i.e. it is acceptable to provide an implementation that segfaults if
6192 ** it is passed a NULL pointer).
6193 **
6194 ** The xMutexInit() method must be threadsafe. It must be harmless to
6195 ** invoke xMutexInit() multiple times within the same process and without
6196 ** intervening calls to xMutexEnd(). Second and subsequent calls to
6197 ** xMutexInit() must be no-ops.
6198 **
6199 ** xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()]
6200 ** and its associates). Similarly, xMutexAlloc() must not use SQLite memory
6201 ** allocation for a static mutex. ^However xMutexAlloc() may use SQLite
6202 ** memory allocation for a fast or recursive mutex.
6203 **
6204 ** ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is
6205 ** called, but only if the prior call to xMutexInit returned SQLITE_OK.
@@ -6186,33 +6221,33 @@
6221
6222 /*
6223 ** CAPI3REF: Mutex Verification Routines
6224 **
6225 ** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routines
6226 ** are intended for use inside assert() statements. The SQLite core
6227 ** never uses these routines except inside an assert() and applications
6228 ** are advised to follow the lead of the core. The SQLite core only
6229 ** provides implementations for these routines when it is compiled
6230 ** with the SQLITE_DEBUG flag. External mutex implementations
6231 ** are only required to provide these routines if SQLITE_DEBUG is
6232 ** defined and if NDEBUG is not defined.
6233 **
6234 ** These routines should return true if the mutex in their argument
6235 ** is held or not held, respectively, by the calling thread.
6236 **
6237 ** The implementation is not required to provide versions of these
6238 ** routines that actually work. If the implementation does not provide working
6239 ** versions of these routines, it should at least provide stubs that always
6240 ** return true so that one does not get spurious assertion failures.
6241 **
6242 ** If the argument to sqlite3_mutex_held() is a NULL pointer then
6243 ** the routine should return 1. This seems counter-intuitive since
6244 ** clearly the mutex cannot be held if it does not exist. But
6245 ** the reason the mutex does not exist is because the build is not
6246 ** using mutexes. And we do not want the assert() containing the
6247 ** call to sqlite3_mutex_held() to fail, so a non-zero return is
6248 ** the appropriate thing to do. The sqlite3_mutex_notheld()
6249 ** interface should also return 1 when given a NULL pointer.
6250 */
6251 #ifndef NDEBUG
6252 SQLITE_API int sqlite3_mutex_held(sqlite3_mutex*);
6253 SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*);
@@ -6940,10 +6975,14 @@
6975 ** sqlite3_backup_init(D,N,S,M) identify the [database connection]
6976 ** and database name of the source database, respectively.
6977 ** ^The source and destination [database connections] (parameters S and D)
6978 ** must be different or else sqlite3_backup_init(D,N,S,M) will fail with
6979 ** an error.
6980 **
6981 ** ^A call to sqlite3_backup_init() will fail, returning SQLITE_ERROR, if
6982 ** there is already a read or read-write transaction open on the
6983 ** destination database.
6984 **
6985 ** ^If an error occurs within sqlite3_backup_init(D,N,S,M), then NULL is
6986 ** returned and an error code and error message are stored in the
6987 ** destination [database connection] D.
6988 ** ^The error code and message for the failed call to sqlite3_backup_init()
@@ -7334,101 +7373,118 @@
7373 SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
7374
7375 /*
7376 ** CAPI3REF: Checkpoint a database
7377 **
7378 ** ^(The sqlite3_wal_checkpoint(D,X) is equivalent to
7379 ** [sqlite3_wal_checkpoint_v2](D,X,[SQLITE_CHECKPOINT_PASSIVE],0,0).)^
7380 **
7381 ** In brief, sqlite3_wal_checkpoint(D,X) causes the content in the
7382 ** [write-ahead log] for database X on [database connection] D to be
7383 ** transferred into the database file and for the write-ahead log to
7384 ** be reset. See the [checkpointing] documentation for addition
7385 ** information.
7386 **
7387 ** This interface used to be the only way to cause a checkpoint to
7388 ** occur. But then the newer and more powerful [sqlite3_wal_checkpoint_v2()]
7389 ** interface was added. This interface is retained for backwards
7390 ** compatibility and as a convenience for applications that need to manually
7391 ** start a callback but which do not need the full power (and corresponding
7392 ** complication) of [sqlite3_wal_checkpoint_v2()].
 
7393 */
7394 SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);
7395
7396 /*
7397 ** CAPI3REF: Checkpoint a database
7398 **
7399 ** ^(The sqlite3_wal_checkpoint_v2(D,X,M,L,C) interface runs a checkpoint
7400 ** operation on database X of [database connection] D in mode M. Status
7401 ** information is written back into integers pointed to by L and C.)^
7402 ** ^(The M parameter must be a valid [checkpoint mode]:)^
7403 **
7404 ** <dl>
7405 ** <dt>SQLITE_CHECKPOINT_PASSIVE<dd>
7406 ** ^Checkpoint as many frames as possible without waiting for any database
7407 ** readers or writers to finish, then sync the database file if all frames
7408 ** in the log were checkpointed. ^The [busy-handler callback]
7409 ** is never invoked in the SQLITE_CHECKPOINT_PASSIVE mode.
7410 ** ^On the other hand, passive mode might leave the checkpoint unfinished
7411 ** if there are concurrent readers or writers.
7412 **
7413 ** <dt>SQLITE_CHECKPOINT_FULL<dd>
7414 ** ^This mode blocks (it invokes the
7415 ** [sqlite3_busy_handler|busy-handler callback]) until there is no
7416 ** database writer and all readers are reading from the most recent database
7417 ** snapshot. ^It then checkpoints all frames in the log file and syncs the
7418 ** database file. ^This mode blocks new database writers while it is pending,
7419 ** but new database readers are allowed to continue unimpeded.
7420 **
7421 ** <dt>SQLITE_CHECKPOINT_RESTART<dd>
7422 ** ^This mode works the same way as SQLITE_CHECKPOINT_FULL with the addition
7423 ** that after checkpointing the log file it blocks (calls the
7424 ** [busy-handler callback])
7425 ** until all readers are reading from the database file only. ^This ensures
7426 ** that the next writer will restart the log file from the beginning.
7427 ** ^Like SQLITE_CHECKPOINT_FULL, this mode blocks new
7428 ** database writer attempts while it is pending, but does not impede readers.
7429 **
7430 ** <dt>SQLITE_CHECKPOINT_TRUNCATE<dd>
7431 ** ^This mode works the same way as SQLITE_CHECKPOINT_RESTART with the
7432 ** addition that it also truncates the log file to zero bytes just prior
7433 ** to a successful return.
7434 ** </dl>
7435 **
7436 ** ^If pnLog is not NULL, then *pnLog is set to the total number of frames in
7437 ** the log file or to -1 if the checkpoint could not run because
7438 ** of an error or because the database is not in [WAL mode]. ^If pnCkpt is not
7439 ** NULL,then *pnCkpt is set to the total number of checkpointed frames in the
7440 ** log file (including any that were already checkpointed before the function
7441 ** was called) or to -1 if the checkpoint could not run due to an error or
7442 ** because the database is not in WAL mode. ^Note that upon successful
7443 ** completion of an SQLITE_CHECKPOINT_TRUNCATE, the log file will have been
7444 ** truncated to zero bytes and so both *pnLog and *pnCkpt will be set to zero.
7445 **
7446 ** ^All calls obtain an exclusive "checkpoint" lock on the database file. ^If
7447 ** any other process is running a checkpoint operation at the same time, the
7448 ** lock cannot be obtained and SQLITE_BUSY is returned. ^Even if there is a
7449 ** busy-handler configured, it will not be invoked in this case.
7450 **
7451 ** ^The SQLITE_CHECKPOINT_FULL, RESTART and TRUNCATE modes also obtain the
7452 ** exclusive "writer" lock on the database file. ^If the writer lock cannot be
7453 ** obtained immediately, and a busy-handler is configured, it is invoked and
7454 ** the writer lock retried until either the busy-handler returns 0 or the lock
7455 ** is successfully obtained. ^The busy-handler is also invoked while waiting for
7456 ** database readers as described above. ^If the busy-handler returns 0 before
7457 ** the writer lock is obtained or while waiting for database readers, the
7458 ** checkpoint operation proceeds from that point in the same way as
7459 ** SQLITE_CHECKPOINT_PASSIVE - checkpointing as many frames as possible
7460 ** without blocking any further. ^SQLITE_BUSY is returned in this case.
7461 **
7462 ** ^If parameter zDb is NULL or points to a zero length string, then the
7463 ** specified operation is attempted on all WAL databases [attached] to
7464 ** [database connection] db. In this case the
7465 ** values written to output parameters *pnLog and *pnCkpt are undefined. ^If
7466 ** an SQLITE_BUSY error is encountered when processing one or more of the
7467 ** attached WAL databases, the operation is still attempted on any remaining
7468 ** attached databases and SQLITE_BUSY is returned at the end. ^If any other
7469 ** error occurs while processing an attached database, processing is abandoned
7470 ** and the error code is returned to the caller immediately. ^If no error
7471 ** (SQLITE_BUSY or otherwise) is encountered while processing the attached
7472 ** databases, SQLITE_OK is returned.
7473 **
7474 ** ^If database zDb is the name of an attached database that is not in WAL
7475 ** mode, SQLITE_OK is returned and both *pnLog and *pnCkpt set to -1. ^If
7476 ** zDb is not NULL (or a zero length string) and is not the name of any
7477 ** attached database, SQLITE_ERROR is returned to the caller.
7478 **
7479 ** ^Unless it returns SQLITE_MISUSE,
7480 ** the sqlite3_wal_checkpoint_v2() interface
7481 ** sets the error information that is queried by
7482 ** [sqlite3_errcode()] and [sqlite3_errmsg()].
7483 **
7484 ** ^The [PRAGMA wal_checkpoint] command can be used to invoke this interface
7485 ** from SQL.
7486 */
7487 SQLITE_API int sqlite3_wal_checkpoint_v2(
7488 sqlite3 *db, /* Database handle */
7489 const char *zDb, /* Name of attached database (or NULL) */
7490 int eMode, /* SQLITE_CHECKPOINT_* value */
@@ -7435,20 +7491,22 @@
7491 int *pnLog, /* OUT: Size of WAL log in frames */
7492 int *pnCkpt /* OUT: Total number of frames checkpointed */
7493 );
7494
7495 /*
7496 ** CAPI3REF: Checkpoint Mode Values
7497 ** KEYWORDS: {checkpoint mode}
7498 **
7499 ** These constants define all valid values for the "checkpoint mode" passed
7500 ** as the third parameter to the [sqlite3_wal_checkpoint_v2()] interface.
7501 ** See the [sqlite3_wal_checkpoint_v2()] documentation for details on the
7502 ** meaning of each of these checkpoint modes.
7503 */
7504 #define SQLITE_CHECKPOINT_PASSIVE 0 /* Do as much as possible w/o blocking */
7505 #define SQLITE_CHECKPOINT_FULL 1 /* Wait for writers, then checkpoint */
7506 #define SQLITE_CHECKPOINT_RESTART 2 /* Like FULL but wait for for readers */
7507 #define SQLITE_CHECKPOINT_TRUNCATE 3 /* Like RESTART but also truncate WAL */
7508
7509 /*
7510 ** CAPI3REF: Virtual Table Interface Configuration
7511 **
7512 ** This function may be called by either the [xConnect] or [xCreate] method
@@ -7533,10 +7591,102 @@
7591 /* #define SQLITE_IGNORE 2 // Also used by sqlite3_authorizer() callback */
7592 #define SQLITE_FAIL 3
7593 /* #define SQLITE_ABORT 4 // Also an error code */
7594 #define SQLITE_REPLACE 5
7595
7596 /*
7597 ** CAPI3REF: Prepared Statement Scan Status Opcodes
7598 ** KEYWORDS: {scanstatus options}
7599 **
7600 ** The following constants can be used for the T parameter to the
7601 ** [sqlite3_stmt_scanstatus(S,X,T,V)] interface. Each constant designates a
7602 ** different metric for sqlite3_stmt_scanstatus() to return.
7603 **
7604 ** <dl>
7605 ** [[SQLITE_SCANSTAT_NLOOP]] <dt>SQLITE_SCANSTAT_NLOOP</dt>
7606 ** <dd>^The [sqlite3_int64] variable pointed to by the T parameter will be
7607 ** set to the total number of times that the X-th loop has run.</dd>
7608 **
7609 ** [[SQLITE_SCANSTAT_NVISIT]] <dt>SQLITE_SCANSTAT_NVISIT</dt>
7610 ** <dd>^The [sqlite3_int64] variable pointed to by the T parameter will be set
7611 ** to the total number of rows examined by all iterations of the X-th loop.</dd>
7612 **
7613 ** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt>
7614 ** <dd>^The "double" variable pointed to by the T parameter will be set to the
7615 ** query planner's estimate for the average number of rows output from each
7616 ** iteration of the X-th loop. If the query planner's estimates was accurate,
7617 ** then this value will approximate the quotient NVISIT/NLOOP and the
7618 ** product of this value for all prior loops with the same SELECTID will
7619 ** be the NLOOP value for the current loop.
7620 **
7621 ** [[SQLITE_SCANSTAT_NAME]] <dt>SQLITE_SCANSTAT_NAME</dt>
7622 ** <dd>^The "const char *" variable pointed to by the T parameter will be set
7623 ** to a zero-terminated UTF-8 string containing the name of the index or table
7624 ** used for the X-th loop.
7625 **
7626 ** [[SQLITE_SCANSTAT_EXPLAIN]] <dt>SQLITE_SCANSTAT_EXPLAIN</dt>
7627 ** <dd>^The "const char *" variable pointed to by the T parameter will be set
7628 ** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN]
7629 ** description for the X-th loop.
7630 **
7631 ** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECT</dt>
7632 ** <dd>^The "int" variable pointed to by the T parameter will be set to the
7633 ** "select-id" for the X-th loop. The select-id identifies which query or
7634 ** subquery the loop is part of. The main query has a select-id of zero.
7635 ** The select-id is the same value as is output in the first column
7636 ** of an [EXPLAIN QUERY PLAN] query.
7637 ** </dl>
7638 */
7639 #define SQLITE_SCANSTAT_NLOOP 0
7640 #define SQLITE_SCANSTAT_NVISIT 1
7641 #define SQLITE_SCANSTAT_EST 2
7642 #define SQLITE_SCANSTAT_NAME 3
7643 #define SQLITE_SCANSTAT_EXPLAIN 4
7644 #define SQLITE_SCANSTAT_SELECTID 5
7645
7646 /*
7647 ** CAPI3REF: Prepared Statement Scan Status
7648 **
7649 ** Return status data for a single loop within query pStmt.
7650 **
7651 ** The "iScanStatusOp" parameter determines which status information to return.
7652 ** The "iScanStatusOp" must be one of the [scanstatus options] or the behavior
7653 ** of this interface is undefined.
7654 ** ^The requested measurement is written into a variable pointed to by
7655 ** the "pOut" parameter.
7656 ** Parameter "idx" identifies the specific loop to retrieve statistics for.
7657 ** Loops are numbered starting from zero. ^If idx is out of range - less than
7658 ** zero or greater than or equal to the total number of loops used to implement
7659 ** the statement - a non-zero value is returned and the variable that pOut
7660 ** points to is unchanged.
7661 **
7662 ** ^Statistics might not be available for all loops in all statements. ^In cases
7663 ** where there exist loops with no available statistics, this function behaves
7664 ** as if the loop did not exist - it returns non-zero and leave the variable
7665 ** that pOut points to unchanged.
7666 **
7667 ** This API is only available if the library is built with pre-processor
7668 ** symbol [SQLITE_ENABLE_STMT_SCANSTATUS] defined.
7669 **
7670 ** See also: [sqlite3_stmt_scanstatus_reset()]
7671 */
7672 SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_stmt_scanstatus(
7673 sqlite3_stmt *pStmt, /* Prepared statement for which info desired */
7674 int idx, /* Index of loop to report on */
7675 int iScanStatusOp, /* Information desired. SQLITE_SCANSTAT_* */
7676 void *pOut /* Result written here */
7677 );
7678
7679 /*
7680 ** CAPI3REF: Zero Scan-Status Counters
7681 **
7682 ** ^Zero all [sqlite3_stmt_scanstatus()] related event counters.
7683 **
7684 ** This API is only available if the library is built with pre-processor
7685 ** symbol [SQLITE_ENABLE_STMT_SCANSTATUS] defined.
7686 */
7687 SQLITE_API SQLITE_EXPERIMENTAL void sqlite3_stmt_scanstatus_reset(sqlite3_stmt*);
7688
7689
7690 /*
7691 ** Undo the hack that converts floating point types to integer for
7692 ** builds on processors without floating point support.
@@ -7978,14 +8128,13 @@
8128 #ifndef SQLITE_POWERSAFE_OVERWRITE
8129 # define SQLITE_POWERSAFE_OVERWRITE 1
8130 #endif
8131
8132 /*
8133 ** EVIDENCE-OF: R-25715-37072 Memory allocation statistics are enabled by
8134 ** default unless SQLite is compiled with SQLITE_DEFAULT_MEMSTATUS=0 in
8135 ** which case memory allocation statistics are disabled by default.
 
8136 */
8137 #if !defined(SQLITE_DEFAULT_MEMSTATUS)
8138 # define SQLITE_DEFAULT_MEMSTATUS 1
8139 #endif
8140
@@ -8611,11 +8760,11 @@
8760 ** Estimated quantities used for query planning are stored as 16-bit
8761 ** logarithms. For quantity X, the value stored is 10*log2(X). This
8762 ** gives a possible range of values of approximately 1.0e986 to 1e-986.
8763 ** But the allowed values are "grainy". Not every value is representable.
8764 ** For example, quantities 16 and 17 are both represented by a LogEst
8765 ** of 40. However, since LogEst quantities are suppose to be estimates,
8766 ** not exact values, this imprecision is not a problem.
8767 **
8768 ** "LogEst" is short for "Logarithmic Estimate".
8769 **
8770 ** Examples:
@@ -9011,11 +9160,11 @@
9160 SQLITE_PRIVATE int sqlite3BtreeGetAutoVacuum(Btree *);
9161 SQLITE_PRIVATE int sqlite3BtreeBeginTrans(Btree*,int);
9162 SQLITE_PRIVATE int sqlite3BtreeCommitPhaseOne(Btree*, const char *zMaster);
9163 SQLITE_PRIVATE int sqlite3BtreeCommitPhaseTwo(Btree*, int);
9164 SQLITE_PRIVATE int sqlite3BtreeCommit(Btree*);
9165 SQLITE_PRIVATE int sqlite3BtreeRollback(Btree*,int,int);
9166 SQLITE_PRIVATE int sqlite3BtreeBeginStmt(Btree*,int);
9167 SQLITE_PRIVATE int sqlite3BtreeCreateTable(Btree*, int*, int flags);
9168 SQLITE_PRIVATE int sqlite3BtreeIsInTrans(Btree*);
9169 SQLITE_PRIVATE int sqlite3BtreeIsInReadTrans(Btree*);
9170 SQLITE_PRIVATE int sqlite3BtreeIsInBackup(Btree*);
@@ -9044,11 +9193,11 @@
9193 #define BTREE_BLOBKEY 2 /* Table has keys only - no data */
9194
9195 SQLITE_PRIVATE int sqlite3BtreeDropTable(Btree*, int, int*);
9196 SQLITE_PRIVATE int sqlite3BtreeClearTable(Btree*, int, int*);
9197 SQLITE_PRIVATE int sqlite3BtreeClearTableOfCursor(BtCursor*);
9198 SQLITE_PRIVATE int sqlite3BtreeTripAllCursors(Btree*, int, int);
9199
9200 SQLITE_PRIVATE void sqlite3BtreeGetMeta(Btree *pBtree, int idx, u32 *pValue);
9201 SQLITE_PRIVATE int sqlite3BtreeUpdateMeta(Btree*, int idx, u32 value);
9202
9203 SQLITE_PRIVATE int sqlite3BtreeNewDb(Btree *p);
@@ -9124,10 +9273,11 @@
9273 SQLITE_PRIVATE void sqlite3BtreeIncrblobCursor(BtCursor *);
9274 SQLITE_PRIVATE void sqlite3BtreeClearCursor(BtCursor *);
9275 SQLITE_PRIVATE int sqlite3BtreeSetVersion(Btree *pBt, int iVersion);
9276 SQLITE_PRIVATE void sqlite3BtreeCursorHints(BtCursor *, unsigned int mask);
9277 SQLITE_PRIVATE int sqlite3BtreeIsReadonly(Btree *pBt);
9278 SQLITE_PRIVATE int sqlite3HeaderSizeBtree(void);
9279
9280 #ifndef NDEBUG
9281 SQLITE_PRIVATE int sqlite3BtreeCursorIsValid(BtCursor*);
9282 #endif
9283
@@ -9666,10 +9816,16 @@
9816 # define VdbeCoverageAlwaysTaken(v)
9817 # define VdbeCoverageNeverTaken(v)
9818 # define VDBE_OFFSET_LINENO(x) 0
9819 #endif
9820
9821 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
9822 SQLITE_PRIVATE void sqlite3VdbeScanStatus(Vdbe*, int, int, int, LogEst, const char*);
9823 #else
9824 # define sqlite3VdbeScanStatus(a,b,c,d,e)
9825 #endif
9826
9827 #endif
9828
9829 /************** End of vdbe.h ************************************************/
9830 /************** Continuing where we left off in sqliteInt.h ******************/
9831 /************** Include pager.h in the middle of sqliteInt.h *****************/
@@ -9862,10 +10018,12 @@
10018 SQLITE_PRIVATE int sqlite3SectorSize(sqlite3_file *);
10019
10020 /* Functions used to truncate the database file. */
10021 SQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager*,Pgno);
10022
10023 SQLITE_PRIVATE void sqlite3PagerRekey(DbPage*, Pgno, u16);
10024
10025 #if defined(SQLITE_HAS_CODEC) && !defined(SQLITE_OMIT_WAL)
10026 SQLITE_PRIVATE void *sqlite3PagerCodec(DbPage *);
10027 #endif
10028
10029 /* Functions to support testing and debugging. */
@@ -10049,10 +10207,14 @@
10207 SQLITE_PRIVATE void sqlite3PcacheStats(int*,int*,int*,int*);
10208 #endif
10209
10210 SQLITE_PRIVATE void sqlite3PCacheSetDefault(void);
10211
10212 /* Return the header size */
10213 SQLITE_PRIVATE int sqlite3HeaderSizePcache(void);
10214 SQLITE_PRIVATE int sqlite3HeaderSizePcache1(void);
10215
10216 #endif /* _PCACHE_H_ */
10217
10218 /************** End of pcache.h **********************************************/
10219 /************** Continuing where we left off in sqliteInt.h ******************/
10220
@@ -10735,11 +10897,11 @@
10897 #define SQLITE_CoverIdxScan 0x0040 /* Covering index scans */
10898 #define SQLITE_OrderByIdxJoin 0x0080 /* ORDER BY of joins via index */
10899 #define SQLITE_SubqCoroutine 0x0100 /* Evaluate subqueries as coroutines */
10900 #define SQLITE_Transitive 0x0200 /* Transitive constraints */
10901 #define SQLITE_OmitNoopJoin 0x0400 /* Omit unused tables in joins */
10902 #define SQLITE_Stat34 0x0800 /* Use STAT3 or STAT4 data */
10903 #define SQLITE_AllOpts 0xffff /* All optimizations */
10904
10905 /*
10906 ** Macros for testing whether or not optimizations are enabled or disabled.
10907 */
@@ -11317,16 +11479,18 @@
11479 unsigned idxType:2; /* 1==UNIQUE, 2==PRIMARY KEY, 0==CREATE INDEX */
11480 unsigned bUnordered:1; /* Use this index for == or IN queries only */
11481 unsigned uniqNotNull:1; /* True if UNIQUE and NOT NULL for all columns */
11482 unsigned isResized:1; /* True if resizeIndexObject() has been called */
11483 unsigned isCovering:1; /* True if this is a covering index */
11484 unsigned noSkipScan:1; /* Do not try to use skip-scan if true */
11485 #ifdef SQLITE_ENABLE_STAT3_OR_STAT4
11486 int nSample; /* Number of elements in aSample[] */
11487 int nSampleCol; /* Size of IndexSample.anEq[] and so on */
11488 tRowcnt *aAvgEq; /* Average nEq values for keys not in aSample */
11489 IndexSample *aSample; /* Samples of the left-most key */
11490 tRowcnt *aiRowEst; /* Non-logarithmic stat1 data for this index */
11491 tRowcnt nRowEst0; /* Non-logarithmic number of rows in the index */
11492 #endif
11493 };
11494
11495 /*
11496 ** Allowed values for Index.idxType
@@ -11520,11 +11684,11 @@
11684 int nHeight; /* Height of the tree headed by this node */
11685 #endif
11686 int iTable; /* TK_COLUMN: cursor number of table holding column
11687 ** TK_REGISTER: register number
11688 ** TK_TRIGGER: 1 -> new, 0 -> old
11689 ** EP_Unlikely: 134217728 times likelihood */
11690 ynVar iColumn; /* TK_COLUMN: column index. -1 for rowid.
11691 ** TK_VARIABLE: variable number (always >= 1). */
11692 i16 iAgg; /* Which entry in pAggInfo->aCol[] or ->aFunc[] */
11693 i16 iRightJoinTable; /* If EP_FromJoin, the right table of the join */
11694 u8 op2; /* TK_REGISTER: original value of Expr.op
@@ -11535,11 +11699,11 @@
11699 };
11700
11701 /*
11702 ** The following are the meanings of bits in the Expr.flags field.
11703 */
11704 #define EP_FromJoin 0x000001 /* Originates in ON/USING clause of outer join */
11705 #define EP_Agg 0x000002 /* Contains one or more aggregate functions */
11706 #define EP_Resolved 0x000004 /* IDs have been resolved to COLUMNs */
11707 #define EP_Error 0x000008 /* Expression contains one or more errors */
11708 #define EP_Distinct 0x000010 /* Aggregate function with DISTINCT keyword */
11709 #define EP_VarSelect 0x000020 /* pSelect is correlated, not constant */
@@ -11555,10 +11719,11 @@
11719 #define EP_Static 0x008000 /* Held in memory not obtained from malloc() */
11720 #define EP_MemToken 0x010000 /* Need to sqlite3DbFree() Expr.zToken */
11721 #define EP_NoReduce 0x020000 /* Cannot EXPRDUP_REDUCE this Expr */
11722 #define EP_Unlikely 0x040000 /* unlikely() or likelihood() function */
11723 #define EP_Constant 0x080000 /* Node is a constant */
11724 #define EP_CanBeNull 0x100000 /* Can be null despite NOT NULL constraint */
11725
11726 /*
11727 ** These macros can be used to test, set, or clear bits in the
11728 ** Expr.flags field.
11729 */
@@ -12412,13 +12577,15 @@
12577 int (*xExprCallback)(Walker*, Expr*); /* Callback for expressions */
12578 int (*xSelectCallback)(Walker*,Select*); /* Callback for SELECTs */
12579 void (*xSelectCallback2)(Walker*,Select*);/* Second callback for SELECTs */
12580 Parse *pParse; /* Parser context. */
12581 int walkerDepth; /* Number of subqueries */
12582 u8 eCode; /* A small processing code */
12583 union { /* Extra data for callback */
12584 NameContext *pNC; /* Naming context */
12585 int n; /* A counter */
12586 int iCur; /* A cursor number */
12587 SrcList *pSrcList; /* FROM clause */
12588 struct SrcCount *pSrcCount; /* Counting column references */
12589 } u;
12590 };
12591
@@ -12815,10 +12982,11 @@
12982 SQLITE_PRIVATE void sqlite3CloseSavepoints(sqlite3 *);
12983 SQLITE_PRIVATE void sqlite3LeaveMutexAndCloseZombie(sqlite3*);
12984 SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr*);
12985 SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr*);
12986 SQLITE_PRIVATE int sqlite3ExprIsConstantOrFunction(Expr*, u8);
12987 SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr*,int);
12988 SQLITE_PRIVATE int sqlite3ExprIsInteger(Expr*, int*);
12989 SQLITE_PRIVATE int sqlite3ExprCanBeNull(const Expr*);
12990 SQLITE_PRIVATE int sqlite3ExprNeedsNoAffinityChange(const Expr*, char);
12991 SQLITE_PRIVATE int sqlite3IsRowid(const char*);
12992 SQLITE_PRIVATE void sqlite3GenerateRowDelete(Parse*,Table*,Trigger*,int,int,int,i16,u8,u8,u8);
@@ -13060,11 +13228,11 @@
13228 SQLITE_PRIVATE int sqlite3OpenTempDatabase(Parse *);
13229
13230 SQLITE_PRIVATE void sqlite3StrAccumInit(StrAccum*, char*, int, int);
13231 SQLITE_PRIVATE void sqlite3StrAccumAppend(StrAccum*,const char*,int);
13232 SQLITE_PRIVATE void sqlite3StrAccumAppendAll(StrAccum*,const char*);
13233 SQLITE_PRIVATE void sqlite3AppendChar(StrAccum*,int,char);
13234 SQLITE_PRIVATE char *sqlite3StrAccumFinish(StrAccum*);
13235 SQLITE_PRIVATE void sqlite3StrAccumReset(StrAccum*);
13236 SQLITE_PRIVATE void sqlite3SelectDestInit(SelectDest*,int,int);
13237 SQLITE_PRIVATE Expr *sqlite3CreateColumnExpr(sqlite3 *, SrcList *, int, int);
13238
@@ -13472,15 +13640,23 @@
13640 ** compatibility for legacy applications, the URI filename capability is
13641 ** disabled by default.
13642 **
13643 ** EVIDENCE-OF: R-38799-08373 URI filenames can be enabled or disabled
13644 ** using the SQLITE_USE_URI=1 or SQLITE_USE_URI=0 compile-time options.
13645 **
13646 ** EVIDENCE-OF: R-43642-56306 By default, URI handling is globally
13647 ** disabled. The default value may be changed by compiling with the
13648 ** SQLITE_USE_URI symbol defined.
13649 */
13650 #ifndef SQLITE_USE_URI
13651 # define SQLITE_USE_URI 0
13652 #endif
13653
13654 /* EVIDENCE-OF: R-38720-18127 The default setting is determined by the
13655 ** SQLITE_ALLOW_COVERING_INDEX_SCAN compile-time option, or is "on" if
13656 ** that compile-time option is omitted.
13657 */
13658 #ifndef SQLITE_ALLOW_COVERING_INDEX_SCAN
13659 # define SQLITE_ALLOW_COVERING_INDEX_SCAN 1
13660 #endif
13661
13662 /*
@@ -13566,12 +13742,12 @@
13742 ** than 1 GiB. The sqlite3_test_control() interface can be used to
13743 ** move the pending byte.
13744 **
13745 ** IMPORTANT: Changing the pending byte to any value other than
13746 ** 0x40000000 results in an incompatible database file format!
13747 ** Changing the pending byte during operation will result in undefined
13748 ** and incorrect behavior.
13749 */
13750 #ifndef SQLITE_OMIT_WSD
13751 SQLITE_PRIVATE int sqlite3PendingByte = 0x40000000;
13752 #endif
13753
@@ -13646,10 +13822,13 @@
13822 #ifdef SQLITE_DISABLE_DIRSYNC
13823 "DISABLE_DIRSYNC",
13824 #endif
13825 #ifdef SQLITE_DISABLE_LFS
13826 "DISABLE_LFS",
13827 #endif
13828 #ifdef SQLITE_ENABLE_API_ARMOR
13829 "ENABLE_API_ARMOR",
13830 #endif
13831 #ifdef SQLITE_ENABLE_ATOMIC_WRITE
13832 "ENABLE_ATOMIC_WRITE",
13833 #endif
13834 #ifdef SQLITE_ENABLE_CEROD
@@ -13972,10 +14151,17 @@
14151 ** The name can optionally begin with "SQLITE_" but the "SQLITE_" prefix
14152 ** is not required for a match.
14153 */
14154 SQLITE_API int sqlite3_compileoption_used(const char *zOptName){
14155 int i, n;
14156
14157 #ifdef SQLITE_ENABLE_API_ARMOR
14158 if( zOptName==0 ){
14159 (void)SQLITE_MISUSE_BKPT;
14160 return 0;
14161 }
14162 #endif
14163 if( sqlite3StrNICmp(zOptName, "SQLITE_", 7)==0 ) zOptName += 7;
14164 n = sqlite3Strlen30(zOptName);
14165
14166 /* Since ArraySize(azCompileOpt) is normally in single digits, a
14167 ** linear search is adequate. No need for a binary search. */
@@ -14153,10 +14339,11 @@
14339 typedef struct VdbeFrame VdbeFrame;
14340 struct VdbeFrame {
14341 Vdbe *v; /* VM this frame belongs to */
14342 VdbeFrame *pParent; /* Parent of this frame, or NULL if parent is main */
14343 Op *aOp; /* Program instructions for parent frame */
14344 i64 *anExec; /* Event counters from parent frame */
14345 Mem *aMem; /* Array of memory cells for parent frame */
14346 u8 *aOnceFlag; /* Array of OP_Once flags for parent frame */
14347 VdbeCursor **apCsr; /* Array of Vdbe cursors for parent frame */
14348 void *token; /* Copy of SubProgram.token */
14349 i64 lastRowid; /* Last insert rowid (sqlite3.lastRowid) */
@@ -14165,11 +14352,12 @@
14352 int nOp; /* Size of aOp array */
14353 int nMem; /* Number of entries in aMem */
14354 int nOnceFlag; /* Number of entries in aOnceFlag */
14355 int nChildMem; /* Number of memory cells for child frame */
14356 int nChildCsr; /* Number of cursors for child frame */
14357 int nChange; /* Statement changes (Vdbe.nChange) */
14358 int nDbChange; /* Value of db->nChange */
14359 };
14360
14361 #define VdbeFrameMem(p) ((Mem *)&((u8 *)p)[ROUND8(sizeof(VdbeFrame))])
14362
14363 /*
@@ -14316,10 +14504,20 @@
14504 /* A bitfield type for use inside of structures. Always follow with :N where
14505 ** N is the number of bits.
14506 */
14507 typedef unsigned bft; /* Bit Field Type */
14508
14509 typedef struct ScanStatus ScanStatus;
14510 struct ScanStatus {
14511 int addrExplain; /* OP_Explain for loop */
14512 int addrLoop; /* Address of "loops" counter */
14513 int addrVisit; /* Address of "rows visited" counter */
14514 int iSelectID; /* The "Select-ID" for this loop */
14515 LogEst nEst; /* Estimated output rows per loop */
14516 char *zName; /* Name of table or index */
14517 };
14518
14519 /*
14520 ** An instance of the virtual machine. This structure contains the complete
14521 ** state of the virtual machine.
14522 **
14523 ** The "sqlite3_stmt" structure pointer that is returned by sqlite3_prepare()
@@ -14388,10 +14586,15 @@
14586 u32 expmask; /* Binding to these vars invalidates VM */
14587 SubProgram *pProgram; /* Linked list of all sub-programs used by VM */
14588 int nOnceFlag; /* Size of array aOnceFlag[] */
14589 u8 *aOnceFlag; /* Flags for OP_Once */
14590 AuxData *pAuxData; /* Linked list of auxdata allocations */
14591 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
14592 i64 *anExec; /* Number of times each op has been executed */
14593 int nScan; /* Entries in aScan[] */
14594 ScanStatus *aScan; /* Scan definitions for sqlite3_stmt_scanstatus() */
14595 #endif
14596 };
14597
14598 /*
14599 ** The following are allowed values for Vdbe.magic
14600 */
@@ -14577,10 +14780,13 @@
14780 SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag){
14781 wsdStatInit;
14782 if( op<0 || op>=ArraySize(wsdStat.nowValue) ){
14783 return SQLITE_MISUSE_BKPT;
14784 }
14785 #ifdef SQLITE_ENABLE_API_ARMOR
14786 if( pCurrent==0 || pHighwater==0 ) return SQLITE_MISUSE_BKPT;
14787 #endif
14788 *pCurrent = wsdStat.nowValue[op];
14789 *pHighwater = wsdStat.mxValue[op];
14790 if( resetFlag ){
14791 wsdStat.mxValue[op] = wsdStat.nowValue[op];
14792 }
@@ -14596,10 +14802,15 @@
14802 int *pCurrent, /* Write current value here */
14803 int *pHighwater, /* Write high-water mark here */
14804 int resetFlag /* Reset high-water mark if true */
14805 ){
14806 int rc = SQLITE_OK; /* Return code */
14807 #ifdef SQLITE_ENABLE_API_ARMOR
14808 if( !sqlite3SafetyCheckOk(db) || pCurrent==0|| pHighwater==0 ){
14809 return SQLITE_MISUSE_BKPT;
14810 }
14811 #endif
14812 sqlite3_mutex_enter(db->mutex);
14813 switch( op ){
14814 case SQLITE_DBSTATUS_LOOKASIDE_USED: {
14815 *pCurrent = db->lookaside.nOut;
14816 *pHighwater = db->lookaside.mxOut;
@@ -14774,11 +14985,11 @@
14985 **
14986 ** There is only one exported symbol in this file - the function
14987 ** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
14988 ** All other code has file scope.
14989 **
14990 ** SQLite processes all times and dates as julian day numbers. The
14991 ** dates and times are stored as the number of days since noon
14992 ** in Greenwich on November 24, 4714 B.C. according to the Gregorian
14993 ** calendar system.
14994 **
14995 ** 1970-01-01 00:00:00 is JD 2440587.5
@@ -14789,11 +15000,11 @@
15000 ** be represented, even though julian day numbers allow a much wider
15001 ** range of dates.
15002 **
15003 ** The Gregorian calendar system is used for all dates and times,
15004 ** even those that predate the Gregorian calendar. Historians usually
15005 ** use the julian calendar for dates prior to 1582-10-15 and for some
15006 ** dates afterwards, depending on locale. Beware of this difference.
15007 **
15008 ** The conversion algorithms are implemented based on descriptions
15009 ** in the following text:
15010 **
@@ -15061,11 +15272,11 @@
15272 return 1;
15273 }
15274 }
15275
15276 /*
15277 ** Attempt to parse the given string into a julian day number. Return
15278 ** the number of errors.
15279 **
15280 ** The following are acceptable forms for the input string:
15281 **
15282 ** YYYY-MM-DD HH:MM:SS.FFF +/-HH:MM
@@ -15632,11 +15843,11 @@
15843 **
15844 ** %d day of month
15845 ** %f ** fractional seconds SS.SSS
15846 ** %H hour 00-24
15847 ** %j day of year 000-366
15848 ** %J ** julian day number
15849 ** %m month 01-12
15850 ** %M minute 00-59
15851 ** %s seconds since 1970-01-01
15852 ** %S seconds 00-59
15853 ** %w day of week 0-6 sunday==0
@@ -16257,10 +16468,14 @@
16468 MUTEX_LOGIC(sqlite3_mutex *mutex;)
16469 #ifndef SQLITE_OMIT_AUTOINIT
16470 int rc = sqlite3_initialize();
16471 if( rc ) return rc;
16472 #endif
16473 #ifdef SQLITE_ENABLE_API_ARMOR
16474 if( pVfs==0 ) return SQLITE_MISUSE_BKPT;
16475 #endif
16476
16477 MUTEX_LOGIC( mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); )
16478 sqlite3_mutex_enter(mutex);
16479 vfsUnlink(pVfs);
16480 if( makeDflt || vfsList==0 ){
16481 pVfs->pNext = vfsList;
@@ -18614,10 +18829,11 @@
18829 ** Retrieve a pointer to a static mutex or allocate a new dynamic one.
18830 */
18831 SQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int id){
18832 #ifndef SQLITE_OMIT_AUTOINIT
18833 if( id<=SQLITE_MUTEX_RECURSIVE && sqlite3_initialize() ) return 0;
18834 if( id>SQLITE_MUTEX_RECURSIVE && sqlite3MutexInit() ) return 0;
18835 #endif
18836 return sqlite3GlobalConfig.mutex.xMutexAlloc(id);
18837 }
18838
18839 SQLITE_PRIVATE sqlite3_mutex *sqlite3MutexAlloc(int id){
@@ -19070,12 +19286,16 @@
19286 pthread_mutex_init(&p->mutex, 0);
19287 }
19288 break;
19289 }
19290 default: {
19291 #ifdef SQLITE_ENABLE_API_ARMOR
19292 if( iType-2<0 || iType-2>=ArraySize(staticMutexes) ){
19293 (void)SQLITE_MISUSE_BKPT;
19294 return 0;
19295 }
19296 #endif
19297 p = &staticMutexes[iType-2];
19298 #if SQLITE_MUTEX_NREF
19299 p->id = iType;
19300 #endif
19301 break;
@@ -20293,15 +20513,16 @@
20513 }
20514 assert( sqlite3_mutex_notheld(mem0.mutex) );
20515
20516
20517 #if SQLITE_THREADSAFE==0 && !defined(NDEBUG)
20518 /* EVIDENCE-OF: R-12970-05880 SQLite will not use more than one scratch
20519 ** buffers per thread.
20520 **
20521 ** This can only be checked in single-threaded mode.
20522 */
20523 assert( scratchAllocOut==0 );
20524 if( p ) scratchAllocOut++;
20525 #endif
20526
20527 return p;
20528 }
@@ -20945,11 +21166,11 @@
21166 sqlite_uint64 longvalue; /* Value for integer types */
21167 LONGDOUBLE_TYPE realvalue; /* Value for real types */
21168 const et_info *infop; /* Pointer to the appropriate info structure */
21169 char *zOut; /* Rendering buffer */
21170 int nOut; /* Size of the rendering buffer */
21171 char *zExtra = 0; /* Malloced memory used by some conversion */
21172 #ifndef SQLITE_OMIT_FLOATING_POINT
21173 int exp, e2; /* exponent of real numbers */
21174 int nsd; /* Number of significant digits returned */
21175 double rounder; /* Used for rounding floating point values */
21176 etByte flag_dp; /* True if decimal point should be shown */
@@ -20956,10 +21177,17 @@
21177 etByte flag_rtz; /* True if trailing zeros should be removed */
21178 #endif
21179 PrintfArguments *pArgList = 0; /* Arguments for SQLITE_PRINTF_SQLFUNC */
21180 char buf[etBUFSIZE]; /* Conversion buffer */
21181
21182 #ifdef SQLITE_ENABLE_API_ARMOR
21183 if( ap==0 ){
21184 (void)SQLITE_MISUSE_BKPT;
21185 sqlite3StrAccumReset(pAccum);
21186 return;
21187 }
21188 #endif
21189 bufpt = 0;
21190 if( bFlags ){
21191 if( (bArgList = (bFlags & SQLITE_PRINTF_SQLFUNC))!=0 ){
21192 pArgList = va_arg(ap, PrintfArguments*);
21193 }
@@ -21062,11 +21290,10 @@
21290 return;
21291 }
21292 break;
21293 }
21294 }
 
21295
21296 /*
21297 ** At this point, variables are initialized as follows:
21298 **
21299 ** flag_alternateform TRUE if a '#' is present.
@@ -21353,17 +21580,20 @@
21580 bufpt = getTextArg(pArgList);
21581 c = bufpt ? bufpt[0] : 0;
21582 }else{
21583 c = va_arg(ap,int);
21584 }
21585 if( precision>1 ){
21586 width -= precision-1;
21587 if( width>1 && !flag_leftjustify ){
21588 sqlite3AppendChar(pAccum, width-1, ' ');
21589 width = 0;
21590 }
21591 sqlite3AppendChar(pAccum, precision-1, c);
21592 }
21593 length = 1;
21594 buf[0] = c;
21595 bufpt = buf;
21596 break;
21597 case etSTRING:
21598 case etDYNSTRING:
21599 if( bArgList ){
@@ -21460,15 +21690,18 @@
21690 ** The text of the conversion is pointed to by "bufpt" and is
21691 ** "length" characters long. The field width is "width". Do
21692 ** the output.
21693 */
21694 width -= length;
21695 if( width>0 && !flag_leftjustify ) sqlite3AppendChar(pAccum, width, ' ');
21696 sqlite3StrAccumAppend(pAccum, bufpt, length);
21697 if( width>0 && flag_leftjustify ) sqlite3AppendChar(pAccum, width, ' ');
21698
21699 if( zExtra ){
21700 sqlite3_free(zExtra);
21701 zExtra = 0;
21702 }
21703 }/* End for loop over the format string */
21704 } /* End of function */
21705
21706 /*
21707 ** Enlarge the memory allocation on a StrAccum object so that it is
@@ -21491,10 +21724,15 @@
21724 return N;
21725 }else{
21726 char *zOld = (p->zText==p->zBase ? 0 : p->zText);
21727 i64 szNew = p->nChar;
21728 szNew += N + 1;
21729 if( szNew+p->nChar<=p->mxAlloc ){
21730 /* Force exponential buffer size growth as long as it does not overflow,
21731 ** to avoid having to call this routine too often */
21732 szNew += p->nChar;
21733 }
21734 if( szNew > p->mxAlloc ){
21735 sqlite3StrAccumReset(p);
21736 setStrAccumError(p, STRACCUM_TOOBIG);
21737 return 0;
21738 }else{
@@ -21507,10 +21745,11 @@
21745 }
21746 if( zNew ){
21747 assert( p->zText!=0 || p->nChar==0 );
21748 if( zOld==0 && p->nChar>0 ) memcpy(zNew, p->zText, p->nChar);
21749 p->zText = zNew;
21750 p->nAlloc = sqlite3DbMallocSize(p->db, zNew);
21751 }else{
21752 sqlite3StrAccumReset(p);
21753 setStrAccumError(p, STRACCUM_NOMEM);
21754 return 0;
21755 }
@@ -21517,15 +21756,15 @@
21756 }
21757 return N;
21758 }
21759
21760 /*
21761 ** Append N copies of character c to the given string buffer.
21762 */
21763 SQLITE_PRIVATE void sqlite3AppendChar(StrAccum *p, int N, char c){
21764 if( p->nChar+N >= p->nAlloc && (N = sqlite3StrAccumEnlarge(p, N))<=0 ) return;
21765 while( (N--)>0 ) p->zText[p->nChar++] = c;
21766 }
21767
21768 /*
21769 ** The StrAccum "p" is not large enough to accept N new bytes of z[].
21770 ** So enlarge if first, then do the append.
@@ -21676,10 +21915,17 @@
21915 */
21916 SQLITE_API char *sqlite3_vmprintf(const char *zFormat, va_list ap){
21917 char *z;
21918 char zBase[SQLITE_PRINT_BUF_SIZE];
21919 StrAccum acc;
21920
21921 #ifdef SQLITE_ENABLE_API_ARMOR
21922 if( zFormat==0 ){
21923 (void)SQLITE_MISUSE_BKPT;
21924 return 0;
21925 }
21926 #endif
21927 #ifndef SQLITE_OMIT_AUTOINIT
21928 if( sqlite3_initialize() ) return 0;
21929 #endif
21930 sqlite3StrAccumInit(&acc, zBase, sizeof(zBase), SQLITE_MAX_LENGTH);
21931 acc.useMalloc = 2;
@@ -21718,10 +21964,17 @@
21964 ** sqlite3_vsnprintf() is the varargs version.
21965 */
21966 SQLITE_API char *sqlite3_vsnprintf(int n, char *zBuf, const char *zFormat, va_list ap){
21967 StrAccum acc;
21968 if( n<=0 ) return zBuf;
21969 #ifdef SQLITE_ENABLE_API_ARMOR
21970 if( zBuf==0 || zFormat==0 ) {
21971 (void)SQLITE_MISUSE_BKPT;
21972 if( zBuf && n>0 ) zBuf[0] = 0;
21973 return zBuf;
21974 }
21975 #endif
21976 sqlite3StrAccumInit(&acc, zBuf, n, 0);
21977 acc.useMalloc = 0;
21978 sqlite3VXPrintf(&acc, 0, zFormat, ap);
21979 return sqlite3StrAccumFinish(&acc);
21980 }
@@ -21909,15 +22162,23 @@
22162 #else
22163 # define wsdPrng sqlite3Prng
22164 #endif
22165
22166 #if SQLITE_THREADSAFE
22167 sqlite3_mutex *mutex;
22168 #endif
22169
22170 #ifndef SQLITE_OMIT_AUTOINIT
22171 if( sqlite3_initialize() ) return;
22172 #endif
22173
22174 #if SQLITE_THREADSAFE
22175 mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_PRNG);
22176 #endif
22177
22178 sqlite3_mutex_enter(mutex);
22179 if( N<=0 || pBuf==0 ){
 
 
22180 wsdPrng.isInit = 0;
22181 sqlite3_mutex_leave(mutex);
22182 return;
22183 }
22184
@@ -23035,17 +23296,27 @@
23296 ** case-independent fashion, using the same definition of "case
23297 ** independence" that SQLite uses internally when comparing identifiers.
23298 */
23299 SQLITE_API int sqlite3_stricmp(const char *zLeft, const char *zRight){
23300 register unsigned char *a, *b;
23301 if( zLeft==0 ){
23302 return zRight ? -1 : 0;
23303 }else if( zRight==0 ){
23304 return 1;
23305 }
23306 a = (unsigned char *)zLeft;
23307 b = (unsigned char *)zRight;
23308 while( *a!=0 && UpperToLower[*a]==UpperToLower[*b]){ a++; b++; }
23309 return UpperToLower[*a] - UpperToLower[*b];
23310 }
23311 SQLITE_API int sqlite3_strnicmp(const char *zLeft, const char *zRight, int N){
23312 register unsigned char *a, *b;
23313 if( zLeft==0 ){
23314 return zRight ? -1 : 0;
23315 }else if( zRight==0 ){
23316 return 1;
23317 }
23318 a = (unsigned char *)zLeft;
23319 b = (unsigned char *)zRight;
23320 while( N-- > 0 && *a!=0 && UpperToLower[*a]==UpperToLower[*b]){ a++; b++; }
23321 return N<0 ? 0 : UpperToLower[*a] - UpperToLower[*b];
23322 }
@@ -32574,10 +32845,15 @@
32845 #if !SQLITE_OS_WINNT && !defined(SQLITE_OMIT_WAL)
32846 # error "WAL mode requires support from the Windows NT kernel, compile\
32847 with SQLITE_OMIT_WAL."
32848 #endif
32849
32850 #if !SQLITE_OS_WINNT && SQLITE_MAX_MMAP_SIZE>0
32851 # error "Memory mapped files require support from the Windows NT kernel,\
32852 compile with SQLITE_MAX_MMAP_SIZE=0."
32853 #endif
32854
32855 /*
32856 ** Are most of the Win32 ANSI APIs available (i.e. with certain exceptions
32857 ** based on the sub-platform)?
32858 */
32859 #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && !defined(SQLITE_WIN32_NO_ANSI)
@@ -32703,14 +32979,15 @@
32979 # define winGetDirSep() '\\'
32980 #endif
32981
32982 /*
32983 ** Do we need to manually define the Win32 file mapping APIs for use with WAL
32984 ** mode or memory mapped files (e.g. these APIs are available in the Windows
32985 ** CE SDK; however, they are not present in the header file)?
32986 */
32987 #if SQLITE_WIN32_FILEMAPPING_API && \
32988 (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0)
32989 /*
32990 ** Two of the file mapping APIs are different under WinRT. Figure out which
32991 ** set we need.
32992 */
32993 #if SQLITE_OS_WINRT
@@ -32734,11 +33011,11 @@
33011
33012 /*
33013 ** This file mapping API is common to both Win32 and WinRT.
33014 */
33015 WINBASEAPI BOOL WINAPI UnmapViewOfFile(LPCVOID);
33016 #endif /* SQLITE_WIN32_FILEMAPPING_API */
33017
33018 /*
33019 ** Some Microsoft compilers lack this definition.
33020 */
33021 #ifndef INVALID_FILE_ATTRIBUTES
@@ -33027,21 +33304,21 @@
33304
33305 #define osCreateFileW ((HANDLE(WINAPI*)(LPCWSTR,DWORD,DWORD, \
33306 LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE))aSyscall[5].pCurrent)
33307
33308 #if (!SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_ANSI) && \
33309 (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0))
33310 { "CreateFileMappingA", (SYSCALL)CreateFileMappingA, 0 },
33311 #else
33312 { "CreateFileMappingA", (SYSCALL)0, 0 },
33313 #endif
33314
33315 #define osCreateFileMappingA ((HANDLE(WINAPI*)(HANDLE,LPSECURITY_ATTRIBUTES, \
33316 DWORD,DWORD,DWORD,LPCSTR))aSyscall[6].pCurrent)
33317
33318 #if SQLITE_OS_WINCE || (!SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) && \
33319 (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0))
33320 { "CreateFileMappingW", (SYSCALL)CreateFileMappingW, 0 },
33321 #else
33322 { "CreateFileMappingW", (SYSCALL)0, 0 },
33323 #endif
33324
@@ -33377,11 +33654,12 @@
33654 #ifndef osLockFileEx
33655 #define osLockFileEx ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD,DWORD, \
33656 LPOVERLAPPED))aSyscall[48].pCurrent)
33657 #endif
33658
33659 #if SQLITE_OS_WINCE || (!SQLITE_OS_WINRT && \
33660 (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0))
33661 { "MapViewOfFile", (SYSCALL)MapViewOfFile, 0 },
33662 #else
33663 { "MapViewOfFile", (SYSCALL)0, 0 },
33664 #endif
33665
@@ -33447,11 +33725,11 @@
33725 #endif
33726
33727 #define osUnlockFileEx ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \
33728 LPOVERLAPPED))aSyscall[58].pCurrent)
33729
33730 #if SQLITE_OS_WINCE || !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0
33731 { "UnmapViewOfFile", (SYSCALL)UnmapViewOfFile, 0 },
33732 #else
33733 { "UnmapViewOfFile", (SYSCALL)0, 0 },
33734 #endif
33735
@@ -33510,11 +33788,11 @@
33788 #endif
33789
33790 #define osGetFileInformationByHandleEx ((BOOL(WINAPI*)(HANDLE, \
33791 FILE_INFO_BY_HANDLE_CLASS,LPVOID,DWORD))aSyscall[66].pCurrent)
33792
33793 #if SQLITE_OS_WINRT && (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0)
33794 { "MapViewOfFileFromApp", (SYSCALL)MapViewOfFileFromApp, 0 },
33795 #else
33796 { "MapViewOfFileFromApp", (SYSCALL)0, 0 },
33797 #endif
33798
@@ -33574,11 +33852,11 @@
33852
33853 { "GetProcessHeap", (SYSCALL)GetProcessHeap, 0 },
33854
33855 #define osGetProcessHeap ((HANDLE(WINAPI*)(VOID))aSyscall[74].pCurrent)
33856
33857 #if SQLITE_OS_WINRT && (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0)
33858 { "CreateFileMappingFromApp", (SYSCALL)CreateFileMappingFromApp, 0 },
33859 #else
33860 { "CreateFileMappingFromApp", (SYSCALL)0, 0 },
33861 #endif
33862
@@ -39150,10 +39428,17 @@
39428 */
39429 SQLITE_PRIVATE void sqlite3PcacheShrink(PCache *pCache){
39430 assert( pCache->pCache!=0 );
39431 sqlite3GlobalConfig.pcache2.xShrink(pCache->pCache);
39432 }
39433
39434 /*
39435 ** Return the size of the header added by this middleware layer
39436 ** in the page-cache hierarchy.
39437 */
39438 SQLITE_PRIVATE int sqlite3HeaderSizePcache(void){ return sizeof(PgHdr); }
39439
39440
39441 #if defined(SQLITE_CHECK_PAGES) || defined(SQLITE_DEBUG)
39442 /*
39443 ** For all dirty pages currently in the cache, invoke the specified
39444 ** callback. This is only used if the SQLITE_CHECK_PAGES macro is
@@ -40149,10 +40434,15 @@
40434 pcache1Shrink /* xShrink */
40435 };
40436 sqlite3_config(SQLITE_CONFIG_PCACHE2, &defaultMethods);
40437 }
40438
40439 /*
40440 ** Return the size of the header on each page of this PCACHE implementation.
40441 */
40442 SQLITE_PRIVATE int sqlite3HeaderSizePcache1(void){ return sizeof(PgHdr1); }
40443
40444 #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
40445 /*
40446 ** This function is called to free superfluous dynamically allocated memory
40447 ** held by the pager system. Memory in use by any SQLite pager allocated
40448 ** by the current thread may be sqlite3_free()ed.
@@ -43758,11 +44048,11 @@
44048 ** should be page numbers which are never 0xffffffff. So filling
44049 ** pPager->dbFileVers[] with all 0xff bytes should suffice.
44050 **
44051 ** For an encrypted database, the situation is more complex: bytes
44052 ** 24..39 of the database are white noise. But the probability of
44053 ** white noise equaling 16 bytes of 0xff is vanishingly small so
44054 ** we should still be ok.
44055 */
44056 memset(pPager->dbFileVers, 0xff, sizeof(pPager->dbFileVers));
44057 }else{
44058 u8 *dbFileVers = &((u8*)pPg->pData)[24];
@@ -47705,10 +47995,22 @@
47995 }
47996
47997 return SQLITE_OK;
47998 }
47999 #endif
48000
48001 /*
48002 ** The page handle passed as the first argument refers to a dirty page
48003 ** with a page number other than iNew. This function changes the page's
48004 ** page number to iNew and sets the value of the PgHdr.flags field to
48005 ** the value passed as the third parameter.
48006 */
48007 SQLITE_PRIVATE void sqlite3PagerRekey(DbPage *pPg, Pgno iNew, u16 flags){
48008 assert( pPg->pgno!=iNew );
48009 pPg->flags = flags;
48010 sqlite3PcacheMove(pPg, iNew);
48011 }
48012
48013 /*
48014 ** Return a pointer to the data for the specified page.
48015 */
48016 SQLITE_PRIVATE void *sqlite3PagerGetData(DbPage *pPg){
@@ -47922,11 +48224,12 @@
48224 */
48225 SQLITE_PRIVATE int sqlite3PagerCheckpoint(Pager *pPager, int eMode, int *pnLog, int *pnCkpt){
48226 int rc = SQLITE_OK;
48227 if( pPager->pWal ){
48228 rc = sqlite3WalCheckpoint(pPager->pWal, eMode,
48229 (eMode==SQLITE_CHECKPOINT_PASSIVE ? 0 : pPager->xBusyHandler),
48230 pPager->pBusyHandlerArg,
48231 pPager->ckptSyncFlags, pPager->pageSize, (u8 *)pPager->pTmpSpace,
48232 pnLog, pnCkpt
48233 );
48234 }
48235 return rc;
@@ -48103,10 +48406,11 @@
48406 SQLITE_PRIVATE int sqlite3PagerWalFramesize(Pager *pPager){
48407 assert( pPager->eState>=PAGER_READER );
48408 return sqlite3WalFramesize(pPager->pWal);
48409 }
48410 #endif
48411
48412
48413 #endif /* SQLITE_OMIT_DISKIO */
48414
48415 /************** End of pager.c ***********************************************/
48416 /************** Begin file wal.c *********************************************/
@@ -49613,11 +49917,11 @@
49917
49918 /*
49919 ** Free an iterator allocated by walIteratorInit().
49920 */
49921 static void walIteratorFree(WalIterator *p){
49922 sqlite3_free(p);
49923 }
49924
49925 /*
49926 ** Construct a WalInterator object that can be used to loop over all
49927 ** pages in the WAL in ascending order. The caller must hold the checkpoint
@@ -49648,21 +49952,21 @@
49952 /* Allocate space for the WalIterator object. */
49953 nSegment = walFramePage(iLast) + 1;
49954 nByte = sizeof(WalIterator)
49955 + (nSegment-1)*sizeof(struct WalSegment)
49956 + iLast*sizeof(ht_slot);
49957 p = (WalIterator *)sqlite3_malloc(nByte);
49958 if( !p ){
49959 return SQLITE_NOMEM;
49960 }
49961 memset(p, 0, nByte);
49962 p->nSegment = nSegment;
49963
49964 /* Allocate temporary space used by the merge-sort routine. This block
49965 ** of memory will be freed before this function returns.
49966 */
49967 aTmp = (ht_slot *)sqlite3_malloc(
49968 sizeof(ht_slot) * (iLast>HASHTABLE_NPAGE?HASHTABLE_NPAGE:iLast)
49969 );
49970 if( !aTmp ){
49971 rc = SQLITE_NOMEM;
49972 }
@@ -49695,11 +49999,11 @@
49999 p->aSegment[i].nEntry = nEntry;
50000 p->aSegment[i].aIndex = aIndex;
50001 p->aSegment[i].aPgno = (u32 *)aPgno;
50002 }
50003 }
50004 sqlite3_free(aTmp);
50005
50006 if( rc!=SQLITE_OK ){
50007 walIteratorFree(p);
50008 }
50009 *pp = p;
@@ -49731,10 +50035,42 @@
50035 ** Return the page-size in bytes used by the database.
50036 */
50037 static int walPagesize(Wal *pWal){
50038 return (pWal->hdr.szPage&0xfe00) + ((pWal->hdr.szPage&0x0001)<<16);
50039 }
50040
50041 /*
50042 ** The following is guaranteed when this function is called:
50043 **
50044 ** a) the WRITER lock is held,
50045 ** b) the entire log file has been checkpointed, and
50046 ** c) any existing readers are reading exclusively from the database
50047 ** file - there are no readers that may attempt to read a frame from
50048 ** the log file.
50049 **
50050 ** This function updates the shared-memory structures so that the next
50051 ** client to write to the database (which may be this one) does so by
50052 ** writing frames into the start of the log file.
50053 **
50054 ** The value of parameter salt1 is used as the aSalt[1] value in the
50055 ** new wal-index header. It should be passed a pseudo-random value (i.e.
50056 ** one obtained from sqlite3_randomness()).
50057 */
50058 static void walRestartHdr(Wal *pWal, u32 salt1){
50059 volatile WalCkptInfo *pInfo = walCkptInfo(pWal);
50060 int i; /* Loop counter */
50061 u32 *aSalt = pWal->hdr.aSalt; /* Big-endian salt values */
50062 pWal->nCkpt++;
50063 pWal->hdr.mxFrame = 0;
50064 sqlite3Put4byte((u8*)&aSalt[0], 1 + sqlite3Get4byte((u8*)&aSalt[0]));
50065 memcpy(&pWal->hdr.aSalt[1], &salt1, 4);
50066 walIndexWriteHdr(pWal);
50067 pInfo->nBackfill = 0;
50068 pInfo->aReadMark[1] = 0;
50069 for(i=2; i<WAL_NREADER; i++) pInfo->aReadMark[i] = READMARK_NOT_USED;
50070 assert( pInfo->aReadMark[0]==0 );
50071 }
50072
50073 /*
50074 ** Copy as much content as we can from the WAL back into the database file
50075 ** in response to an sqlite3_wal_checkpoint() request or the equivalent.
50076 **
@@ -49766,11 +50102,11 @@
50102 ** time.
50103 */
50104 static int walCheckpoint(
50105 Wal *pWal, /* Wal connection */
50106 int eMode, /* One of PASSIVE, FULL or RESTART */
50107 int (*xBusy)(void*), /* Function to call when busy */
50108 void *pBusyArg, /* Context argument for xBusyHandler */
50109 int sync_flags, /* Flags for OsSync() (or 0) */
50110 u8 *zBuf /* Temporary buffer to use */
50111 ){
50112 int rc; /* Return code */
@@ -49780,11 +50116,10 @@
50116 u32 iFrame = 0; /* Wal frame containing data for iDbpage */
50117 u32 mxSafeFrame; /* Max frame that can be backfilled */
50118 u32 mxPage; /* Max database page to write */
50119 int i; /* Loop counter */
50120 volatile WalCkptInfo *pInfo; /* The checkpoint status information */
 
50121
50122 szPage = walPagesize(pWal);
50123 testcase( szPage<=32768 );
50124 testcase( szPage>=65536 );
50125 pInfo = walCkptInfo(pWal);
@@ -49795,11 +50130,13 @@
50130 if( rc!=SQLITE_OK ){
50131 return rc;
50132 }
50133 assert( pIter );
50134
50135 /* EVIDENCE-OF: R-62920-47450 The busy-handler callback is never invoked
50136 ** in the SQLITE_CHECKPOINT_PASSIVE mode. */
50137 assert( eMode!=SQLITE_CHECKPOINT_PASSIVE || xBusy==0 );
50138
50139 /* Compute in mxSafeFrame the index of the last frame of the WAL that is
50140 ** safe to write into the database. Frames beyond mxSafeFrame might
50141 ** overwrite database pages that are in use by active readers and thus
50142 ** cannot be backfilled from the WAL.
@@ -49884,23 +50221,42 @@
50221 /* Reset the return code so as not to report a checkpoint failure
50222 ** just because there are active readers. */
50223 rc = SQLITE_OK;
50224 }
50225
50226 /* If this is an SQLITE_CHECKPOINT_RESTART or TRUNCATE operation, and the
50227 ** entire wal file has been copied into the database file, then block
50228 ** until all readers have finished using the wal file. This ensures that
50229 ** the next process to write to the database restarts the wal file.
50230 */
50231 if( rc==SQLITE_OK && eMode!=SQLITE_CHECKPOINT_PASSIVE ){
50232 assert( pWal->writeLock );
50233 if( pInfo->nBackfill<pWal->hdr.mxFrame ){
50234 rc = SQLITE_BUSY;
50235 }else if( eMode>=SQLITE_CHECKPOINT_RESTART ){
50236 u32 salt1;
50237 sqlite3_randomness(4, &salt1);
50238 assert( mxSafeFrame==pWal->hdr.mxFrame );
50239 rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_READ_LOCK(1), WAL_NREADER-1);
50240 if( rc==SQLITE_OK ){
50241 if( eMode==SQLITE_CHECKPOINT_TRUNCATE ){
50242 /* IMPLEMENTATION-OF: R-44699-57140 This mode works the same way as
50243 ** SQLITE_CHECKPOINT_RESTART with the addition that it also
50244 ** truncates the log file to zero bytes just prior to a
50245 ** successful return.
50246 **
50247 ** In theory, it might be safe to do this without updating the
50248 ** wal-index header in shared memory, as all subsequent reader or
50249 ** writer clients should see that the entire log file has been
50250 ** checkpointed and behave accordingly. This seems unsafe though,
50251 ** as it would leave the system in a state where the contents of
50252 ** the wal-index header do not match the contents of the
50253 ** file-system. To avoid this, update the wal-index header to
50254 ** indicate that the log file contains zero valid frames. */
50255 walRestartHdr(pWal, salt1);
50256 rc = sqlite3OsTruncate(pWal->pWalFd, 0);
50257 }
50258 walUnlockExclusive(pWal, WAL_READ_LOCK(1), WAL_NREADER-1);
50259 }
50260 }
50261 }
50262
@@ -50634,11 +50990,10 @@
50990 assert( walFramePgno(pWal, iFrame)!=1 );
50991 rc = xUndo(pUndoCtx, walFramePgno(pWal, iFrame));
50992 }
50993 if( iMax!=pWal->hdr.mxFrame ) walCleanupHash(pWal);
50994 }
 
50995 return rc;
50996 }
50997
50998 /*
50999 ** Argument aWalData must point to an array of WAL_SAVEPOINT_NDATA u32
@@ -50683,11 +51038,10 @@
51038 }
51039
51040 return rc;
51041 }
51042
 
51043 /*
51044 ** This function is called just before writing a set of frames to the log
51045 ** file (see sqlite3WalFrames()). It checks to see if, instead of appending
51046 ** to the current log file, it is possible to overwrite the start of the
51047 ** existing log file with the new frames (i.e. "reset" the log). If so,
@@ -50716,24 +51070,12 @@
51070 ** wal-index header to reflect this.
51071 **
51072 ** In theory it would be Ok to update the cache of the header only
51073 ** at this point. But updating the actual wal-index header is also
51074 ** safe and means there is no special case for sqlite3WalUndo()
51075 ** to handle if this transaction is rolled back. */
51076 walRestartHdr(pWal, salt1);
 
 
 
 
 
 
 
 
 
 
 
 
51077 walUnlockExclusive(pWal, WAL_READ_LOCK(1), WAL_NREADER-1);
51078 }else if( rc!=SQLITE_BUSY ){
51079 return rc;
51080 }
51081 }
@@ -51017,11 +51359,11 @@
51359 ** If parameter xBusy is not NULL, it is a pointer to a busy-handler
51360 ** callback. In this case this function runs a blocking checkpoint.
51361 */
51362 SQLITE_PRIVATE int sqlite3WalCheckpoint(
51363 Wal *pWal, /* Wal connection */
51364 int eMode, /* PASSIVE, FULL, RESTART, or TRUNCATE */
51365 int (*xBusy)(void*), /* Function to call when busy */
51366 void *pBusyArg, /* Context argument for xBusyHandler */
51367 int sync_flags, /* Flags to sync db file with (or 0) */
51368 int nBuf, /* Size of temporary buffer */
51369 u8 *zBuf, /* Temporary buffer to use */
@@ -51029,40 +51371,54 @@
51371 int *pnCkpt /* OUT: Number of backfilled frames in WAL */
51372 ){
51373 int rc; /* Return code */
51374 int isChanged = 0; /* True if a new wal-index header is loaded */
51375 int eMode2 = eMode; /* Mode to pass to walCheckpoint() */
51376 int (*xBusy2)(void*) = xBusy; /* Busy handler for eMode2 */
51377
51378 assert( pWal->ckptLock==0 );
51379 assert( pWal->writeLock==0 );
51380
51381 /* EVIDENCE-OF: R-62920-47450 The busy-handler callback is never invoked
51382 ** in the SQLITE_CHECKPOINT_PASSIVE mode. */
51383 assert( eMode!=SQLITE_CHECKPOINT_PASSIVE || xBusy==0 );
51384
51385 if( pWal->readOnly ) return SQLITE_READONLY;
51386 WALTRACE(("WAL%p: checkpoint begins\n", pWal));
51387
51388 /* IMPLEMENTATION-OF: R-62028-47212 All calls obtain an exclusive
51389 ** "checkpoint" lock on the database file. */
51390 rc = walLockExclusive(pWal, WAL_CKPT_LOCK, 1);
51391 if( rc ){
51392 /* EVIDENCE-OF: R-10421-19736 If any other process is running a
51393 ** checkpoint operation at the same time, the lock cannot be obtained and
51394 ** SQLITE_BUSY is returned.
51395 ** EVIDENCE-OF: R-53820-33897 Even if there is a busy-handler configured,
51396 ** it will not be invoked in this case.
51397 */
51398 testcase( rc==SQLITE_BUSY );
51399 testcase( xBusy!=0 );
51400 return rc;
51401 }
51402 pWal->ckptLock = 1;
51403
51404 /* IMPLEMENTATION-OF: R-59782-36818 The SQLITE_CHECKPOINT_FULL, RESTART and
51405 ** TRUNCATE modes also obtain the exclusive "writer" lock on the database
51406 ** file.
51407 **
51408 ** EVIDENCE-OF: R-60642-04082 If the writer lock cannot be obtained
51409 ** immediately, and a busy-handler is configured, it is invoked and the
51410 ** writer lock retried until either the busy-handler returns 0 or the
51411 ** lock is successfully obtained.
51412 */
51413 if( eMode!=SQLITE_CHECKPOINT_PASSIVE ){
51414 rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_WRITE_LOCK, 1);
51415 if( rc==SQLITE_OK ){
51416 pWal->writeLock = 1;
51417 }else if( rc==SQLITE_BUSY ){
51418 eMode2 = SQLITE_CHECKPOINT_PASSIVE;
51419 xBusy2 = 0;
51420 rc = SQLITE_OK;
51421 }
51422 }
51423
51424 /* Read the wal-index header. */
@@ -51076,11 +51432,11 @@
51432 /* Copy data from the log to the database file. */
51433 if( rc==SQLITE_OK ){
51434 if( pWal->hdr.mxFrame && walPagesize(pWal)!=nBuf ){
51435 rc = SQLITE_CORRUPT_BKPT;
51436 }else{
51437 rc = walCheckpoint(pWal, eMode2, xBusy2, pBusyArg, sync_flags, zBuf);
51438 }
51439
51440 /* If no error occurred, set the output variables. */
51441 if( rc==SQLITE_OK || rc==SQLITE_BUSY ){
51442 if( pnLog ) *pnLog = (int)pWal->hdr.mxFrame;
@@ -51713,10 +52069,15 @@
52069 ** but cursors cannot be shared. Each cursor is associated with a
52070 ** particular database connection identified BtCursor.pBtree.db.
52071 **
52072 ** Fields in this structure are accessed under the BtShared.mutex
52073 ** found at self->pBt->mutex.
52074 **
52075 ** skipNext meaning:
52076 ** eState==SKIPNEXT && skipNext>0: Next sqlite3BtreeNext() is no-op.
52077 ** eState==SKIPNEXT && skipNext<0: Next sqlite3BtreePrevious() is no-op.
52078 ** eState==FAULT: Cursor fault with skipNext as error code.
52079 */
52080 struct BtCursor {
52081 Btree *pBtree; /* The Btree to which this cursor belongs */
52082 BtShared *pBt; /* The BtShared this cursor points to */
52083 BtCursor *pNext, *pPrev; /* Forms a linked list of all cursors */
@@ -51725,11 +52086,12 @@
52086 CellInfo info; /* A parse of the cell we are pointing at */
52087 i64 nKey; /* Size of pKey, or last integer key */
52088 void *pKey; /* Saved key that was cursor last known position */
52089 Pgno pgnoRoot; /* The root page of this tree */
52090 int nOvflAlloc; /* Allocated size of aOverflow[] array */
52091 int skipNext; /* Prev() is noop if negative. Next() is noop if positive.
52092 ** Error code if eState==CURSOR_FAULT */
52093 u8 curFlags; /* zero or more BTCF_* flags defined below */
52094 u8 eState; /* One of the CURSOR_XXX constants (see below) */
52095 u8 hints; /* As configured by CursorSetHints() */
52096 i16 iPage; /* Index of current page in apPage */
52097 u16 aiIdx[BTCURSOR_MAX_DEPTH]; /* Current index in apPage[i] */
@@ -51771,11 +52133,11 @@
52133 ** CURSOR_FAULT:
52134 ** An unrecoverable error (an I/O error or a malloc failure) has occurred
52135 ** on a different connection that shares the BtShared cache with this
52136 ** cursor. The error has left the cache in an inconsistent state.
52137 ** Do nothing else with this cursor. Any attempt to use the cursor
52138 ** should return the error code stored in BtCursor.skipNext
52139 */
52140 #define CURSOR_INVALID 0
52141 #define CURSOR_VALID 1
52142 #define CURSOR_SKIPNEXT 2
52143 #define CURSOR_REQUIRESEEK 3
@@ -53321,10 +53683,15 @@
53683 /*
53684 ** Defragment the page given. All Cells are moved to the
53685 ** end of the page and all free space is collected into one
53686 ** big FreeBlk that occurs in between the header and cell
53687 ** pointer array and the cell content area.
53688 **
53689 ** EVIDENCE-OF: R-44582-60138 SQLite may from time to time reorganize a
53690 ** b-tree page so that there are no freeblocks or fragment bytes, all
53691 ** unused bytes are contained in the unallocated space region, and all
53692 ** cells are packed tightly at the end of the page.
53693 */
53694 static int defragmentPage(MemPage *pPage){
53695 int i; /* Loop counter */
53696 int pc; /* Address of the i-th cell */
53697 int hdr; /* Offset to the page header */
@@ -53333,28 +53700,27 @@
53700 int cellOffset; /* Offset to the cell pointer array */
53701 int cbrk; /* Offset to the cell content area */
53702 int nCell; /* Number of cells on the page */
53703 unsigned char *data; /* The page data */
53704 unsigned char *temp; /* Temp area for cell content */
53705 unsigned char *src; /* Source of content */
53706 int iCellFirst; /* First allowable cell index */
53707 int iCellLast; /* Last possible cell index */
53708
53709
53710 assert( sqlite3PagerIswriteable(pPage->pDbPage) );
53711 assert( pPage->pBt!=0 );
53712 assert( pPage->pBt->usableSize <= SQLITE_MAX_PAGE_SIZE );
53713 assert( pPage->nOverflow==0 );
53714 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
53715 temp = 0;
53716 src = data = pPage->aData;
53717 hdr = pPage->hdrOffset;
53718 cellOffset = pPage->cellOffset;
53719 nCell = pPage->nCell;
53720 assert( nCell==get2byte(&data[hdr+3]) );
53721 usableSize = pPage->pBt->usableSize;
 
 
53722 cbrk = usableSize;
53723 iCellFirst = cellOffset + 2*nCell;
53724 iCellLast = usableSize - 4;
53725 for(i=0; i<nCell; i++){
53726 u8 *pAddr; /* The i-th cell pointer */
@@ -53369,11 +53735,11 @@
53735 if( pc<iCellFirst || pc>iCellLast ){
53736 return SQLITE_CORRUPT_BKPT;
53737 }
53738 #endif
53739 assert( pc>=iCellFirst && pc<=iCellLast );
53740 size = cellSizePtr(pPage, &src[pc]);
53741 cbrk -= size;
53742 #if defined(SQLITE_ENABLE_OVERSIZE_CELL_CHECK)
53743 if( cbrk<iCellFirst ){
53744 return SQLITE_CORRUPT_BKPT;
53745 }
@@ -53383,12 +53749,20 @@
53749 }
53750 #endif
53751 assert( cbrk+size<=usableSize && cbrk>=iCellFirst );
53752 testcase( cbrk+size==usableSize );
53753 testcase( pc+size==usableSize );
 
53754 put2byte(pAddr, cbrk);
53755 if( temp==0 ){
53756 int x;
53757 if( cbrk==pc ) continue;
53758 temp = sqlite3PagerTempSpace(pPage->pBt->pPager);
53759 x = get2byte(&data[hdr+5]);
53760 memcpy(&temp[x], &data[x], (cbrk+size) - x);
53761 src = temp;
53762 }
53763 memcpy(&data[cbrk], &src[pc], size);
53764 }
53765 assert( cbrk>=iCellFirst );
53766 put2byte(&data[hdr+5], cbrk);
53767 data[hdr+1] = 0;
53768 data[hdr+2] = 0;
@@ -53398,10 +53772,73 @@
53772 if( cbrk-iCellFirst!=pPage->nFree ){
53773 return SQLITE_CORRUPT_BKPT;
53774 }
53775 return SQLITE_OK;
53776 }
53777
53778 /*
53779 ** Search the free-list on page pPg for space to store a cell nByte bytes in
53780 ** size. If one can be found, return a pointer to the space and remove it
53781 ** from the free-list.
53782 **
53783 ** If no suitable space can be found on the free-list, return NULL.
53784 **
53785 ** This function may detect corruption within pPg. If corruption is
53786 ** detected then *pRc is set to SQLITE_CORRUPT and NULL is returned.
53787 **
53788 ** If a slot of at least nByte bytes is found but cannot be used because
53789 ** there are already at least 60 fragmented bytes on the page, return NULL.
53790 ** In this case, if pbDefrag parameter is not NULL, set *pbDefrag to true.
53791 */
53792 static u8 *pageFindSlot(MemPage *pPg, int nByte, int *pRc, int *pbDefrag){
53793 const int hdr = pPg->hdrOffset;
53794 u8 * const aData = pPg->aData;
53795 int iAddr;
53796 int pc;
53797 int usableSize = pPg->pBt->usableSize;
53798
53799 for(iAddr=hdr+1; (pc = get2byte(&aData[iAddr]))>0; iAddr=pc){
53800 int size; /* Size of the free slot */
53801 /* EVIDENCE-OF: R-06866-39125 Freeblocks are always connected in order of
53802 ** increasing offset. */
53803 if( pc>usableSize-4 || pc<iAddr+4 ){
53804 *pRc = SQLITE_CORRUPT_BKPT;
53805 return 0;
53806 }
53807 /* EVIDENCE-OF: R-22710-53328 The third and fourth bytes of each
53808 ** freeblock form a big-endian integer which is the size of the freeblock
53809 ** in bytes, including the 4-byte header. */
53810 size = get2byte(&aData[pc+2]);
53811 if( size>=nByte ){
53812 int x = size - nByte;
53813 testcase( x==4 );
53814 testcase( x==3 );
53815 if( x<4 ){
53816 /* EVIDENCE-OF: R-11498-58022 In a well-formed b-tree page, the total
53817 ** number of bytes in fragments may not exceed 60. */
53818 if( aData[hdr+7]>=60 ){
53819 if( pbDefrag ) *pbDefrag = 1;
53820 return 0;
53821 }
53822 /* Remove the slot from the free-list. Update the number of
53823 ** fragmented bytes within the page. */
53824 memcpy(&aData[iAddr], &aData[pc], 2);
53825 aData[hdr+7] += (u8)x;
53826 }else if( size+pc > usableSize ){
53827 *pRc = SQLITE_CORRUPT_BKPT;
53828 return 0;
53829 }else{
53830 /* The slot remains on the free-list. Reduce its size to account
53831 ** for the portion used by the new allocation. */
53832 put2byte(&aData[pc+2], x);
53833 }
53834 return &aData[pc + x];
53835 }
53836 }
53837
53838 return 0;
53839 }
53840
53841 /*
53842 ** Allocate nByte bytes of space from within the B-Tree page passed
53843 ** as the first argument. Write into *pIdx the index into pPage->aData[]
53844 ** of the first byte of allocated space. Return either SQLITE_OK or
@@ -53416,80 +53853,58 @@
53853 */
53854 static int allocateSpace(MemPage *pPage, int nByte, int *pIdx){
53855 const int hdr = pPage->hdrOffset; /* Local cache of pPage->hdrOffset */
53856 u8 * const data = pPage->aData; /* Local cache of pPage->aData */
53857 int top; /* First byte of cell content area */
53858 int rc = SQLITE_OK; /* Integer return code */
53859 int gap; /* First byte of gap between cell pointers and cell content */
 
 
53860
53861 assert( sqlite3PagerIswriteable(pPage->pDbPage) );
53862 assert( pPage->pBt );
53863 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
53864 assert( nByte>=0 ); /* Minimum cell size is 4 */
53865 assert( pPage->nFree>=nByte );
53866 assert( pPage->nOverflow==0 );
53867 assert( nByte < (int)(pPage->pBt->usableSize-8) );
 
53868
53869 assert( pPage->cellOffset == hdr + 12 - 4*pPage->leaf );
53870 gap = pPage->cellOffset + 2*pPage->nCell;
53871 assert( gap<=65536 );
53872 /* EVIDENCE-OF: R-29356-02391 If the database uses a 65536-byte page size
53873 ** and the reserved space is zero (the usual value for reserved space)
53874 ** then the cell content offset of an empty page wants to be 65536.
53875 ** However, that integer is too large to be stored in a 2-byte unsigned
53876 ** integer, so a value of 0 is used in its place. */
53877 top = get2byteNotZero(&data[hdr+5]);
53878 if( gap>top ) return SQLITE_CORRUPT_BKPT;
 
53879
53880 /* If there is enough space between gap and top for one more cell pointer
53881 ** array entry offset, and if the freelist is not empty, then search the
53882 ** freelist looking for a free slot big enough to satisfy the request.
53883 */
53884 testcase( gap+2==top );
53885 testcase( gap+1==top );
53886 testcase( gap==top );
53887 if( gap+2<=top && (data[hdr+1] || data[hdr+2]) ){
53888 int bDefrag = 0;
53889 u8 *pSpace = pageFindSlot(pPage, nByte, &rc, &bDefrag);
53890 if( rc ) return rc;
53891 if( bDefrag ) goto defragment_page;
53892 if( pSpace ){
53893 assert( pSpace>=data && (pSpace - data)<65536 );
53894 *pIdx = (int)(pSpace - data);
53895 return SQLITE_OK;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53896 }
53897 }
53898
53899 /* The request could not be fulfilled using a freelist slot. Check
53900 ** to see if defragmentation is necessary.
53901 */
53902 testcase( gap+2+nByte==top );
53903 if( gap+2+nByte>top ){
53904 defragment_page:
53905 assert( pPage->nCell>0 || CORRUPT_DB );
53906 rc = defragmentPage(pPage);
53907 if( rc ) return rc;
53908 top = get2byteNotZero(&data[hdr+5]);
53909 assert( gap+nByte<=top );
53910 }
@@ -53532,11 +53947,11 @@
53947 unsigned char *data = pPage->aData; /* Page content */
53948
53949 assert( pPage->pBt!=0 );
53950 assert( sqlite3PagerIswriteable(pPage->pDbPage) );
53951 assert( iStart>=pPage->hdrOffset+6+pPage->childPtrSize );
53952 assert( CORRUPT_DB || iEnd <= pPage->pBt->usableSize );
53953 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
53954 assert( iSize>=4 ); /* Minimum cell size is 4 */
53955 assert( iStart<=iLast );
53956
53957 /* Overwrite deleted information with zeros when the secure_delete
@@ -53627,22 +54042,36 @@
54042 pPage->leaf = (u8)(flagByte>>3); assert( PTF_LEAF == 1<<3 );
54043 flagByte &= ~PTF_LEAF;
54044 pPage->childPtrSize = 4-4*pPage->leaf;
54045 pBt = pPage->pBt;
54046 if( flagByte==(PTF_LEAFDATA | PTF_INTKEY) ){
54047 /* EVIDENCE-OF: R-03640-13415 A value of 5 means the page is an interior
54048 ** table b-tree page. */
54049 assert( (PTF_LEAFDATA|PTF_INTKEY)==5 );
54050 /* EVIDENCE-OF: R-20501-61796 A value of 13 means the page is a leaf
54051 ** table b-tree page. */
54052 assert( (PTF_LEAFDATA|PTF_INTKEY|PTF_LEAF)==13 );
54053 pPage->intKey = 1;
54054 pPage->intKeyLeaf = pPage->leaf;
54055 pPage->noPayload = !pPage->leaf;
54056 pPage->maxLocal = pBt->maxLeaf;
54057 pPage->minLocal = pBt->minLeaf;
54058 }else if( flagByte==PTF_ZERODATA ){
54059 /* EVIDENCE-OF: R-27225-53936 A value of 2 means the page is an interior
54060 ** index b-tree page. */
54061 assert( (PTF_ZERODATA)==2 );
54062 /* EVIDENCE-OF: R-16571-11615 A value of 10 means the page is a leaf
54063 ** index b-tree page. */
54064 assert( (PTF_ZERODATA|PTF_LEAF)==10 );
54065 pPage->intKey = 0;
54066 pPage->intKeyLeaf = 0;
54067 pPage->noPayload = 0;
54068 pPage->maxLocal = pBt->maxLocal;
54069 pPage->minLocal = pBt->minLocal;
54070 }else{
54071 /* EVIDENCE-OF: R-47608-56469 Any other value for the b-tree page type is
54072 ** an error. */
54073 return SQLITE_CORRUPT_BKPT;
54074 }
54075 pPage->max1bytePayload = pBt->max1bytePayload;
54076 return SQLITE_OK;
54077 }
@@ -53678,25 +54107,37 @@
54107
54108 pBt = pPage->pBt;
54109
54110 hdr = pPage->hdrOffset;
54111 data = pPage->aData;
54112 /* EVIDENCE-OF: R-28594-02890 The one-byte flag at offset 0 indicating
54113 ** the b-tree page type. */
54114 if( decodeFlags(pPage, data[hdr]) ) return SQLITE_CORRUPT_BKPT;
54115 assert( pBt->pageSize>=512 && pBt->pageSize<=65536 );
54116 pPage->maskPage = (u16)(pBt->pageSize - 1);
54117 pPage->nOverflow = 0;
54118 usableSize = pBt->usableSize;
54119 pPage->cellOffset = cellOffset = hdr + 8 + pPage->childPtrSize;
54120 pPage->aDataEnd = &data[usableSize];
54121 pPage->aCellIdx = &data[cellOffset];
54122 /* EVIDENCE-OF: R-58015-48175 The two-byte integer at offset 5 designates
54123 ** the start of the cell content area. A zero value for this integer is
54124 ** interpreted as 65536. */
54125 top = get2byteNotZero(&data[hdr+5]);
54126 /* EVIDENCE-OF: R-37002-32774 The two-byte integer at offset 3 gives the
54127 ** number of cells on the page. */
54128 pPage->nCell = get2byte(&data[hdr+3]);
54129 if( pPage->nCell>MX_CELL(pBt) ){
54130 /* To many cells for a single page. The page must be corrupt */
54131 return SQLITE_CORRUPT_BKPT;
54132 }
54133 testcase( pPage->nCell==MX_CELL(pBt) );
54134 /* EVIDENCE-OF: R-24089-57979 If a page contains no cells (which is only
54135 ** possible for a root page of a table that contains no rows) then the
54136 ** offset to the cell content area will equal the page size minus the
54137 ** bytes of reserved space. */
54138 assert( pPage->nCell>0 || top==usableSize || CORRUPT_DB );
54139
54140 /* A malformed database page might cause us to read past the end
54141 ** of page when parsing a cell.
54142 **
54143 ** The following block of code checks early to see if a cell extends
@@ -53726,17 +54167,24 @@
54167 }
54168 if( !pPage->leaf ) iCellLast++;
54169 }
54170 #endif
54171
54172 /* Compute the total free space on the page
54173 ** EVIDENCE-OF: R-23588-34450 The two-byte integer at offset 1 gives the
54174 ** start of the first freeblock on the page, or is zero if there are no
54175 ** freeblocks. */
54176 pc = get2byte(&data[hdr+1]);
54177 nFree = data[hdr+7] + top; /* Init nFree to non-freeblock free space */
54178 while( pc>0 ){
54179 u16 next, size;
54180 if( pc<iCellFirst || pc>iCellLast ){
54181 /* EVIDENCE-OF: R-55530-52930 In a well-formed b-tree page, there will
54182 ** always be at least one cell before the first freeblock.
54183 **
54184 ** Or, the freeblock is off the end of the page
54185 */
54186 return SQLITE_CORRUPT_BKPT;
54187 }
54188 next = get2byte(&data[pc]);
54189 size = get2byte(&data[pc+2]);
54190 if( (next>0 && next<=pc+size+3) || pc+size>usableSize ){
@@ -54138,10 +54586,13 @@
54586 pBt->pPage1 = 0;
54587 if( sqlite3PagerIsreadonly(pBt->pPager) ) pBt->btsFlags |= BTS_READ_ONLY;
54588 #ifdef SQLITE_SECURE_DELETE
54589 pBt->btsFlags |= BTS_SECURE_DELETE;
54590 #endif
54591 /* EVIDENCE-OF: R-51873-39618 The page size for a database file is
54592 ** determined by the 2-byte integer located at an offset of 16 bytes from
54593 ** the beginning of the database file. */
54594 pBt->pageSize = (zDbHeader[16]<<8) | (zDbHeader[17]<<16);
54595 if( pBt->pageSize<512 || pBt->pageSize>SQLITE_MAX_PAGE_SIZE
54596 || ((pBt->pageSize-1)&pBt->pageSize)!=0 ){
54597 pBt->pageSize = 0;
54598 #ifndef SQLITE_OMIT_AUTOVACUUM
@@ -54156,10 +54607,13 @@
54607 pBt->incrVacuum = (SQLITE_DEFAULT_AUTOVACUUM==2 ? 1 : 0);
54608 }
54609 #endif
54610 nReserve = 0;
54611 }else{
54612 /* EVIDENCE-OF: R-37497-42412 The size of the reserved region is
54613 ** determined by the one-byte unsigned integer found at an offset of 20
54614 ** into the database file header. */
54615 nReserve = zDbHeader[20];
54616 pBt->btsFlags |= BTS_PAGESIZE_FIXED;
54617 #ifndef SQLITE_OMIT_AUTOVACUUM
54618 pBt->autoVacuum = (get4byte(&zDbHeader[36 + 4*4])?1:0);
54619 pBt->incrVacuum = (get4byte(&zDbHeader[36 + 7*4])?1:0);
@@ -54353,11 +54807,11 @@
54807
54808 /* Rollback any active transaction and free the handle structure.
54809 ** The call to sqlite3BtreeRollback() drops any table-locks held by
54810 ** this handle.
54811 */
54812 sqlite3BtreeRollback(p, SQLITE_OK, 0);
54813 sqlite3BtreeLeave(p);
54814
54815 /* If there are still other outstanding references to the shared-btree
54816 ** structure, return now. The remainder of this procedure cleans
54817 ** up the shared-btree.
@@ -54665,10 +55119,13 @@
55119 if( nPage>0 ){
55120 u32 pageSize;
55121 u32 usableSize;
55122 u8 *page1 = pPage1->aData;
55123 rc = SQLITE_NOTADB;
55124 /* EVIDENCE-OF: R-43737-39999 Every valid SQLite database file begins
55125 ** with the following 16 bytes (in hex): 53 51 4c 69 74 65 20 66 6f 72 6d
55126 ** 61 74 20 33 00. */
55127 if( memcmp(page1, zMagicHeader, 16)!=0 ){
55128 goto page1_init_failed;
55129 }
55130
55131 #ifdef SQLITE_OMIT_WAL
@@ -54705,26 +55162,39 @@
55162 }
55163 rc = SQLITE_NOTADB;
55164 }
55165 #endif
55166
55167 /* EVIDENCE-OF: R-15465-20813 The maximum and minimum embedded payload
55168 ** fractions and the leaf payload fraction values must be 64, 32, and 32.
55169 **
55170 ** The original design allowed these amounts to vary, but as of
55171 ** version 3.6.0, we require them to be fixed.
55172 */
55173 if( memcmp(&page1[21], "\100\040\040",3)!=0 ){
55174 goto page1_init_failed;
55175 }
55176 /* EVIDENCE-OF: R-51873-39618 The page size for a database file is
55177 ** determined by the 2-byte integer located at an offset of 16 bytes from
55178 ** the beginning of the database file. */
55179 pageSize = (page1[16]<<8) | (page1[17]<<16);
55180 /* EVIDENCE-OF: R-25008-21688 The size of a page is a power of two
55181 ** between 512 and 65536 inclusive. */
55182 if( ((pageSize-1)&pageSize)!=0
55183 || pageSize>SQLITE_MAX_PAGE_SIZE
55184 || pageSize<=256
55185 ){
55186 goto page1_init_failed;
55187 }
55188 assert( (pageSize & 7)==0 );
55189 /* EVIDENCE-OF: R-59310-51205 The "reserved space" size in the 1-byte
55190 ** integer at offset 20 is the number of bytes of space at the end of
55191 ** each page to reserve for extensions.
55192 **
55193 ** EVIDENCE-OF: R-37497-42412 The size of the reserved region is
55194 ** determined by the one-byte unsigned integer found at an offset of 20
55195 ** into the database file header. */
55196 usableSize = pageSize - page1[20];
55197 if( (u32)pageSize!=pBt->pageSize ){
55198 /* After reading the first page of the database assuming a page size
55199 ** of BtShared.pageSize, we have discovered that the page-size is
55200 ** actually pageSize. Unlock the database, leave pBt->pPage1 at
@@ -54741,10 +55211,13 @@
55211 }
55212 if( (pBt->db->flags & SQLITE_RecoveryMode)==0 && nPage>nPageFile ){
55213 rc = SQLITE_CORRUPT_BKPT;
55214 goto page1_init_failed;
55215 }
55216 /* EVIDENCE-OF: R-28312-64704 However, the usable size is not allowed to
55217 ** be less than 480. In other words, if the page size is 512, then the
55218 ** reserved space size cannot exceed 32. */
55219 if( usableSize<480 ){
55220 goto page1_init_failed;
55221 }
55222 pBt->pageSize = pageSize;
55223 pBt->usableSize = usableSize;
@@ -55646,64 +56119,95 @@
56119 return rc;
56120 }
56121
56122 /*
56123 ** This routine sets the state to CURSOR_FAULT and the error
56124 ** code to errCode for every cursor on any BtShared that pBtree
56125 ** references. Or if the writeOnly flag is set to 1, then only
56126 ** trip write cursors and leave read cursors unchanged.
56127 **
56128 ** Every cursor is a candidate to be tripped, including cursors
56129 ** that belong to other database connections that happen to be
56130 ** sharing the cache with pBtree.
56131 **
56132 ** This routine gets called when a rollback occurs. If the writeOnly
56133 ** flag is true, then only write-cursors need be tripped - read-only
56134 ** cursors save their current positions so that they may continue
56135 ** following the rollback. Or, if writeOnly is false, all cursors are
56136 ** tripped. In general, writeOnly is false if the transaction being
56137 ** rolled back modified the database schema. In this case b-tree root
56138 ** pages may be moved or deleted from the database altogether, making
56139 ** it unsafe for read cursors to continue.
56140 **
56141 ** If the writeOnly flag is true and an error is encountered while
56142 ** saving the current position of a read-only cursor, all cursors,
56143 ** including all read-cursors are tripped.
56144 **
56145 ** SQLITE_OK is returned if successful, or if an error occurs while
56146 ** saving a cursor position, an SQLite error code.
56147 */
56148 SQLITE_PRIVATE int sqlite3BtreeTripAllCursors(Btree *pBtree, int errCode, int writeOnly){
56149 BtCursor *p;
56150 int rc = SQLITE_OK;
56151
56152 assert( (writeOnly==0 || writeOnly==1) && BTCF_WriteFlag==1 );
56153 if( pBtree ){
56154 sqlite3BtreeEnter(pBtree);
56155 for(p=pBtree->pBt->pCursor; p; p=p->pNext){
56156 int i;
56157 if( writeOnly && (p->curFlags & BTCF_WriteFlag)==0 ){
56158 if( p->eState==CURSOR_VALID ){
56159 rc = saveCursorPosition(p);
56160 if( rc!=SQLITE_OK ){
56161 (void)sqlite3BtreeTripAllCursors(pBtree, rc, 0);
56162 break;
56163 }
56164 }
56165 }else{
56166 sqlite3BtreeClearCursor(p);
56167 p->eState = CURSOR_FAULT;
56168 p->skipNext = errCode;
56169 }
56170 for(i=0; i<=p->iPage; i++){
56171 releasePage(p->apPage[i]);
56172 p->apPage[i] = 0;
56173 }
56174 }
56175 sqlite3BtreeLeave(pBtree);
56176 }
56177 return rc;
56178 }
56179
56180 /*
56181 ** Rollback the transaction in progress.
56182 **
56183 ** If tripCode is not SQLITE_OK then cursors will be invalidated (tripped).
56184 ** Only write cursors are tripped if writeOnly is true but all cursors are
56185 ** tripped if writeOnly is false. Any attempt to use
56186 ** a tripped cursor will result in an error.
56187 **
56188 ** This will release the write lock on the database file. If there
56189 ** are no active cursors, it also releases the read lock.
56190 */
56191 SQLITE_PRIVATE int sqlite3BtreeRollback(Btree *p, int tripCode, int writeOnly){
56192 int rc;
56193 BtShared *pBt = p->pBt;
56194 MemPage *pPage1;
56195
56196 assert( writeOnly==1 || writeOnly==0 );
56197 assert( tripCode==SQLITE_ABORT_ROLLBACK || tripCode==SQLITE_OK );
56198 sqlite3BtreeEnter(p);
56199 if( tripCode==SQLITE_OK ){
56200 rc = tripCode = saveAllCursors(pBt, 0, 0);
56201 if( rc ) writeOnly = 0;
56202 }else{
56203 rc = SQLITE_OK;
56204 }
56205 if( tripCode ){
56206 int rc2 = sqlite3BtreeTripAllCursors(p, tripCode, writeOnly);
56207 assert( rc==SQLITE_OK || (writeOnly==0 && rc2==SQLITE_OK) );
56208 if( rc2!=SQLITE_OK ) rc = rc2;
56209 }
56210 btreeIntegrity(p);
56211
56212 if( p->inTrans==TRANS_WRITE ){
56213 int rc2;
@@ -56034,17 +56538,13 @@
56538 **
56539 ** This routine cannot fail. It always returns SQLITE_OK.
56540 */
56541 SQLITE_PRIVATE int sqlite3BtreeKeySize(BtCursor *pCur, i64 *pSize){
56542 assert( cursorHoldsMutex(pCur) );
56543 assert( pCur->eState==CURSOR_VALID );
56544 getCellInfo(pCur);
56545 *pSize = pCur->info.nKey;
 
 
 
 
56546 return SQLITE_OK;
56547 }
56548
56549 /*
56550 ** Set *pSize to the number of bytes of data in the entry the
@@ -57291,10 +57791,12 @@
57791
57792 assert( sqlite3_mutex_held(pBt->mutex) );
57793 assert( eMode==BTALLOC_ANY || (nearby>0 && IfNotOmitAV(pBt->autoVacuum)) );
57794 pPage1 = pBt->pPage1;
57795 mxPage = btreePagecount(pBt);
57796 /* EVIDENCE-OF: R-05119-02637 The 4-byte big-endian integer at offset 36
57797 ** stores stores the total number of pages on the freelist. */
57798 n = get4byte(&pPage1->aData[36]);
57799 testcase( n==mxPage-1 );
57800 if( n>=mxPage ){
57801 return SQLITE_CORRUPT_BKPT;
57802 }
@@ -57337,12 +57839,18 @@
57839 ** or until a page less than 'nearby' is located (eMode==BTALLOC_LT)
57840 */
57841 do {
57842 pPrevTrunk = pTrunk;
57843 if( pPrevTrunk ){
57844 /* EVIDENCE-OF: R-01506-11053 The first integer on a freelist trunk page
57845 ** is the page number of the next freelist trunk page in the list or
57846 ** zero if this is the last freelist trunk page. */
57847 iTrunk = get4byte(&pPrevTrunk->aData[0]);
57848 }else{
57849 /* EVIDENCE-OF: R-59841-13798 The 4-byte big-endian integer at offset 32
57850 ** stores the page number of the first page of the freelist, or zero if
57851 ** the freelist is empty. */
57852 iTrunk = get4byte(&pPage1->aData[32]);
57853 }
57854 testcase( iTrunk==mxPage );
57855 if( iTrunk>mxPage ){
57856 rc = SQLITE_CORRUPT_BKPT;
@@ -57353,12 +57861,13 @@
57861 pTrunk = 0;
57862 goto end_allocate_page;
57863 }
57864 assert( pTrunk!=0 );
57865 assert( pTrunk->aData!=0 );
57866 /* EVIDENCE-OF: R-13523-04394 The second integer on a freelist trunk page
57867 ** is the number of leaf page pointers to follow. */
57868 k = get4byte(&pTrunk->aData[4]);
57869 if( k==0 && !searchList ){
57870 /* The trunk has no leaves and the list is not being searched.
57871 ** So extract the trunk page itself and use it as the newly
57872 ** allocated page */
57873 assert( pPrevTrunk==0 );
@@ -57672,10 +58181,15 @@
58181 ** to maintain backwards compatibility with older versions of SQLite,
58182 ** we will continue to restrict the number of entries to usableSize/4 - 8
58183 ** for now. At some point in the future (once everyone has upgraded
58184 ** to 3.6.0 or later) we should consider fixing the conditional above
58185 ** to read "usableSize/4-2" instead of "usableSize/4-8".
58186 **
58187 ** EVIDENCE-OF: R-19920-11576 However, newer versions of SQLite still
58188 ** avoid using the last six entries in the freelist trunk page array in
58189 ** order that database files created by newer versions of SQLite can be
58190 ** read by older versions of SQLite.
58191 */
58192 rc = sqlite3PagerWrite(pTrunk->pDbPage);
58193 if( rc==SQLITE_OK ){
58194 put4byte(&pTrunk->aData[4], nLeaf+1);
58195 put4byte(&pTrunk->aData[8+nLeaf*4], iPage);
@@ -58023,13 +58537,21 @@
58537 if( rc ){
58538 *pRC = rc;
58539 return;
58540 }
58541 pPage->nCell--;
58542 if( pPage->nCell==0 ){
58543 memset(&data[hdr+1], 0, 4);
58544 data[hdr+7] = 0;
58545 put2byte(&data[hdr+5], pPage->pBt->usableSize);
58546 pPage->nFree = pPage->pBt->usableSize - pPage->hdrOffset
58547 - pPage->childPtrSize - 8;
58548 }else{
58549 memmove(ptr, ptr+2, 2*(pPage->nCell - idx));
58550 put2byte(&data[hdr+3], pPage->nCell);
58551 pPage->nFree += 2;
58552 }
58553 }
58554
58555 /*
58556 ** Insert a new cell on pPage at cell index "i". pCell points to the
58557 ** content of the cell.
@@ -58120,49 +58642,275 @@
58642 #endif
58643 }
58644 }
58645
58646 /*
58647 ** Array apCell[] contains pointers to nCell b-tree page cells. The
58648 ** szCell[] array contains the size in bytes of each cell. This function
58649 ** replaces the current contents of page pPg with the contents of the cell
58650 ** array.
58651 **
58652 ** Some of the cells in apCell[] may currently be stored in pPg. This
58653 ** function works around problems caused by this by making a copy of any
58654 ** such cells before overwriting the page data.
58655 **
58656 ** The MemPage.nFree field is invalidated by this function. It is the
58657 ** responsibility of the caller to set it correctly.
58658 */
58659 static void rebuildPage(
58660 MemPage *pPg, /* Edit this page */
58661 int nCell, /* Final number of cells on page */
58662 u8 **apCell, /* Array of cells */
58663 u16 *szCell /* Array of cell sizes */
58664 ){
58665 const int hdr = pPg->hdrOffset; /* Offset of header on pPg */
58666 u8 * const aData = pPg->aData; /* Pointer to data for pPg */
58667 const int usableSize = pPg->pBt->usableSize;
58668 u8 * const pEnd = &aData[usableSize];
58669 int i;
58670 u8 *pCellptr = pPg->aCellIdx;
58671 u8 *pTmp = sqlite3PagerTempSpace(pPg->pBt->pPager);
58672 u8 *pData;
58673
58674 i = get2byte(&aData[hdr+5]);
58675 memcpy(&pTmp[i], &aData[i], usableSize - i);
58676
58677 pData = pEnd;
58678 for(i=0; i<nCell; i++){
58679 u8 *pCell = apCell[i];
58680 if( pCell>aData && pCell<pEnd ){
58681 pCell = &pTmp[pCell - aData];
58682 }
58683 pData -= szCell[i];
58684 memcpy(pData, pCell, szCell[i]);
58685 put2byte(pCellptr, (pData - aData));
58686 pCellptr += 2;
58687 assert( szCell[i]==cellSizePtr(pPg, pCell) );
58688 }
58689
58690 /* The pPg->nFree field is now set incorrectly. The caller will fix it. */
58691 pPg->nCell = nCell;
58692 pPg->nOverflow = 0;
58693
58694 put2byte(&aData[hdr+1], 0);
58695 put2byte(&aData[hdr+3], pPg->nCell);
58696 put2byte(&aData[hdr+5], pData - aData);
58697 aData[hdr+7] = 0x00;
58698 }
58699
58700 /*
58701 ** Array apCell[] contains nCell pointers to b-tree cells. Array szCell
58702 ** contains the size in bytes of each such cell. This function attempts to
58703 ** add the cells stored in the array to page pPg. If it cannot (because
58704 ** the page needs to be defragmented before the cells will fit), non-zero
58705 ** is returned. Otherwise, if the cells are added successfully, zero is
58706 ** returned.
58707 **
58708 ** Argument pCellptr points to the first entry in the cell-pointer array
58709 ** (part of page pPg) to populate. After cell apCell[0] is written to the
58710 ** page body, a 16-bit offset is written to pCellptr. And so on, for each
58711 ** cell in the array. It is the responsibility of the caller to ensure
58712 ** that it is safe to overwrite this part of the cell-pointer array.
58713 **
58714 ** When this function is called, *ppData points to the start of the
58715 ** content area on page pPg. If the size of the content area is extended,
58716 ** *ppData is updated to point to the new start of the content area
58717 ** before returning.
58718 **
58719 ** Finally, argument pBegin points to the byte immediately following the
58720 ** end of the space required by this page for the cell-pointer area (for
58721 ** all cells - not just those inserted by the current call). If the content
58722 ** area must be extended to before this point in order to accomodate all
58723 ** cells in apCell[], then the cells do not fit and non-zero is returned.
58724 */
58725 static int pageInsertArray(
58726 MemPage *pPg, /* Page to add cells to */
58727 u8 *pBegin, /* End of cell-pointer array */
58728 u8 **ppData, /* IN/OUT: Page content -area pointer */
58729 u8 *pCellptr, /* Pointer to cell-pointer area */
58730 int nCell, /* Number of cells to add to pPg */
58731 u8 **apCell, /* Array of cells */
58732 u16 *szCell /* Array of cell sizes */
58733 ){
58734 int i;
58735 u8 *aData = pPg->aData;
58736 u8 *pData = *ppData;
58737 const int bFreelist = aData[1] || aData[2];
58738 assert( CORRUPT_DB || pPg->hdrOffset==0 ); /* Never called on page 1 */
58739 for(i=0; i<nCell; i++){
58740 int sz = szCell[i];
58741 int rc;
58742 u8 *pSlot;
58743 if( bFreelist==0 || (pSlot = pageFindSlot(pPg, sz, &rc, 0))==0 ){
58744 pData -= sz;
58745 if( pData<pBegin ) return 1;
58746 pSlot = pData;
58747 }
58748 memcpy(pSlot, apCell[i], sz);
58749 put2byte(pCellptr, (pSlot - aData));
58750 pCellptr += 2;
58751 }
58752 *ppData = pData;
58753 return 0;
58754 }
58755
58756 /*
58757 ** Array apCell[] contains nCell pointers to b-tree cells. Array szCell
58758 ** contains the size in bytes of each such cell. This function adds the
58759 ** space associated with each cell in the array that is currently stored
58760 ** within the body of pPg to the pPg free-list. The cell-pointers and other
58761 ** fields of the page are not updated.
58762 **
58763 ** This function returns the total number of cells added to the free-list.
58764 */
58765 static int pageFreeArray(
58766 MemPage *pPg, /* Page to edit */
58767 int nCell, /* Cells to delete */
58768 u8 **apCell, /* Array of cells */
58769 u16 *szCell /* Array of cell sizes */
58770 ){
58771 u8 * const aData = pPg->aData;
58772 u8 * const pEnd = &aData[pPg->pBt->usableSize];
58773 u8 * const pStart = &aData[pPg->hdrOffset + 8 + pPg->childPtrSize];
58774 int nRet = 0;
58775 int i;
58776 u8 *pFree = 0;
58777 int szFree = 0;
58778
58779 for(i=0; i<nCell; i++){
58780 u8 *pCell = apCell[i];
58781 if( pCell>=pStart && pCell<pEnd ){
58782 int sz = szCell[i];
58783 if( pFree!=(pCell + sz) ){
58784 if( pFree ){
58785 assert( pFree>aData && (pFree - aData)<65536 );
58786 freeSpace(pPg, (u16)(pFree - aData), szFree);
58787 }
58788 pFree = pCell;
58789 szFree = sz;
58790 if( pFree+sz>pEnd ) return 0;
58791 }else{
58792 pFree = pCell;
58793 szFree += sz;
58794 }
58795 nRet++;
58796 }
58797 }
58798 if( pFree ){
58799 assert( pFree>aData && (pFree - aData)<65536 );
58800 freeSpace(pPg, (u16)(pFree - aData), szFree);
58801 }
58802 return nRet;
58803 }
58804
58805 /*
58806 ** apCell[] and szCell[] contains pointers to and sizes of all cells in the
58807 ** pages being balanced. The current page, pPg, has pPg->nCell cells starting
58808 ** with apCell[iOld]. After balancing, this page should hold nNew cells
58809 ** starting at apCell[iNew].
58810 **
58811 ** This routine makes the necessary adjustments to pPg so that it contains
58812 ** the correct cells after being balanced.
58813 **
58814 ** The pPg->nFree field is invalid when this function returns. It is the
58815 ** responsibility of the caller to set it correctly.
58816 */
58817 static void editPage(
58818 MemPage *pPg, /* Edit this page */
58819 int iOld, /* Index of first cell currently on page */
58820 int iNew, /* Index of new first cell on page */
58821 int nNew, /* Final number of cells on page */
58822 u8 **apCell, /* Array of cells */
58823 u16 *szCell /* Array of cell sizes */
58824 ){
58825 u8 * const aData = pPg->aData;
58826 const int hdr = pPg->hdrOffset;
58827 u8 *pBegin = &pPg->aCellIdx[nNew * 2];
58828 int nCell = pPg->nCell; /* Cells stored on pPg */
58829 u8 *pData;
58830 u8 *pCellptr;
58831 int i;
58832 int iOldEnd = iOld + pPg->nCell + pPg->nOverflow;
58833 int iNewEnd = iNew + nNew;
58834
58835 #ifdef SQLITE_DEBUG
58836 u8 *pTmp = sqlite3PagerTempSpace(pPg->pBt->pPager);
58837 memcpy(pTmp, aData, pPg->pBt->usableSize);
58838 #endif
58839
58840 /* Remove cells from the start and end of the page */
58841 if( iOld<iNew ){
58842 int nShift = pageFreeArray(
58843 pPg, iNew-iOld, &apCell[iOld], &szCell[iOld]
58844 );
58845 memmove(pPg->aCellIdx, &pPg->aCellIdx[nShift*2], nCell*2);
58846 nCell -= nShift;
58847 }
58848 if( iNewEnd < iOldEnd ){
58849 nCell -= pageFreeArray(
58850 pPg, iOldEnd-iNewEnd, &apCell[iNewEnd], &szCell[iNewEnd]
58851 );
58852 }
58853
58854 pData = &aData[get2byteNotZero(&aData[hdr+5])];
58855 if( pData<pBegin ) goto editpage_fail;
58856
58857 /* Add cells to the start of the page */
58858 if( iNew<iOld ){
58859 int nAdd = MIN(nNew,iOld-iNew);
58860 assert( (iOld-iNew)<nNew || nCell==0 || CORRUPT_DB );
58861 pCellptr = pPg->aCellIdx;
58862 memmove(&pCellptr[nAdd*2], pCellptr, nCell*2);
58863 if( pageInsertArray(
58864 pPg, pBegin, &pData, pCellptr,
58865 nAdd, &apCell[iNew], &szCell[iNew]
58866 ) ) goto editpage_fail;
58867 nCell += nAdd;
58868 }
58869
58870 /* Add any overflow cells */
58871 for(i=0; i<pPg->nOverflow; i++){
58872 int iCell = (iOld + pPg->aiOvfl[i]) - iNew;
58873 if( iCell>=0 && iCell<nNew ){
58874 pCellptr = &pPg->aCellIdx[iCell * 2];
58875 memmove(&pCellptr[2], pCellptr, (nCell - iCell) * 2);
58876 nCell++;
58877 if( pageInsertArray(
58878 pPg, pBegin, &pData, pCellptr,
58879 1, &apCell[iCell + iNew], &szCell[iCell + iNew]
58880 ) ) goto editpage_fail;
58881 }
58882 }
58883
58884 /* Append cells to the end of the page */
58885 pCellptr = &pPg->aCellIdx[nCell*2];
58886 if( pageInsertArray(
58887 pPg, pBegin, &pData, pCellptr,
58888 nNew-nCell, &apCell[iNew+nCell], &szCell[iNew+nCell]
58889 ) ) goto editpage_fail;
58890
58891 pPg->nCell = nNew;
58892 pPg->nOverflow = 0;
58893
58894 put2byte(&aData[hdr+3], pPg->nCell);
58895 put2byte(&aData[hdr+5], pData - aData);
58896
58897 #ifdef SQLITE_DEBUG
58898 for(i=0; i<nNew && !CORRUPT_DB; i++){
58899 u8 *pCell = apCell[i+iNew];
58900 int iOff = get2byte(&pPg->aCellIdx[i*2]);
58901 if( pCell>=aData && pCell<&aData[pPg->pBt->usableSize] ){
58902 pCell = &pTmp[pCell - aData];
58903 }
58904 assert( 0==memcmp(pCell, &aData[iOff], szCell[i+iNew]) );
58905 }
58906 #endif
58907
58908 return;
58909 editpage_fail:
58910 /* Unable to edit this page. Rebuild it from scratch instead. */
58911 rebuildPage(pPg, nNew, &apCell[iNew], &szCell[iNew]);
58912 }
58913
58914 /*
58915 ** The following parameters determine how many adjacent pages get involved
58916 ** in a balancing operation. NN is the number of neighbors on either side
@@ -58212,11 +58960,11 @@
58960 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
58961 assert( sqlite3PagerIswriteable(pParent->pDbPage) );
58962 assert( pPage->nOverflow==1 );
58963
58964 /* This error condition is now caught prior to reaching this function */
58965 if( NEVER(pPage->nCell==0) ) return SQLITE_CORRUPT_BKPT;
58966
58967 /* Allocate a new page. This page will become the right-sibling of
58968 ** pPage. Make the parent page writable, so that the new divider cell
58969 ** may be inserted. If both these operations are successful, proceed.
58970 */
@@ -58230,11 +58978,12 @@
58978 u8 *pStop;
58979
58980 assert( sqlite3PagerIswriteable(pNew->pDbPage) );
58981 assert( pPage->aData[0]==(PTF_INTKEY|PTF_LEAFDATA|PTF_LEAF) );
58982 zeroPage(pNew, PTF_INTKEY|PTF_LEAFDATA|PTF_LEAF);
58983 rebuildPage(pNew, 1, &pCell, &szCell);
58984 pNew->nFree = pBt->usableSize - pNew->cellOffset - 2 - szCell;
58985
58986 /* If this is an auto-vacuum database, update the pointer map
58987 ** with entries for the new page, and any pointer from the
58988 ** cell on the page to an overflow page. If either of these
58989 ** operations fails, the return code is set, but the contents
@@ -58449,21 +59198,26 @@
59198 int subtotal; /* Subtotal of bytes in cells on one page */
59199 int iSpace1 = 0; /* First unused byte of aSpace1[] */
59200 int iOvflSpace = 0; /* First unused byte of aOvflSpace[] */
59201 int szScratch; /* Size of scratch memory requested */
59202 MemPage *apOld[NB]; /* pPage and up to two siblings */
 
59203 MemPage *apNew[NB+2]; /* pPage and up to NB siblings after balancing */
59204 u8 *pRight; /* Location in parent of right-sibling pointer */
59205 u8 *apDiv[NB-1]; /* Divider cells in pParent */
59206 int cntNew[NB+2]; /* Index in aCell[] of cell after i-th page */
59207 int cntOld[NB+2]; /* Old index in aCell[] after i-th page */
59208 int szNew[NB+2]; /* Combined size of cells placed on i-th page */
59209 u8 **apCell = 0; /* All cells begin balanced */
59210 u16 *szCell; /* Local size of all cells in apCell[] */
59211 u8 *aSpace1; /* Space for copies of dividers cells */
59212 Pgno pgno; /* Temp var to store a page number in */
59213 u8 abDone[NB+2]; /* True after i'th new page is populated */
59214 Pgno aPgno[NB+2]; /* Page numbers of new pages before shuffling */
59215 Pgno aPgOrder[NB+2]; /* Copy of aPgno[] used for sorting pages */
59216 u16 aPgFlags[NB+2]; /* flags field of new pages before shuffling */
59217
59218 memset(abDone, 0, sizeof(abDone));
59219 pBt = pParent->pBt;
59220 assert( sqlite3_mutex_held(pBt->mutex) );
59221 assert( sqlite3PagerIswriteable(pParent->pDbPage) );
59222
59223 #if 0
@@ -58568,16 +59322,18 @@
59322 nMaxCells = (nMaxCells + 3)&~3;
59323
59324 /*
59325 ** Allocate space for memory structures
59326 */
 
59327 szScratch =
59328 nMaxCells*sizeof(u8*) /* apCell */
59329 + nMaxCells*sizeof(u16) /* szCell */
59330 + pBt->pageSize; /* aSpace1 */
59331
59332 /* EVIDENCE-OF: R-28375-38319 SQLite will never request a scratch buffer
59333 ** that is more than 6 times the database page size. */
59334 assert( szScratch<=6*pBt->pageSize );
59335 apCell = sqlite3ScratchMalloc( szScratch );
59336 if( apCell==0 ){
59337 rc = SQLITE_NOMEM;
59338 goto balance_cleanup;
59339 }
@@ -58586,12 +59342,12 @@
59342 assert( EIGHT_BYTE_ALIGNMENT(aSpace1) );
59343
59344 /*
59345 ** Load pointers to all cells on sibling pages and the divider cells
59346 ** into the local apCell[] array. Make copies of the divider cells
59347 ** into space obtained from aSpace1[]. The divider cells have already
59348 ** been removed from pParent.
59349 **
59350 ** If the siblings are on leaf pages, then the child pointers of the
59351 ** divider cells are stripped from the cells before they are copied
59352 ** into aSpace1[]. In this way, all cells in apCell[] are without
59353 ** child pointers. If siblings are not leaves, then all cell in
@@ -58603,19 +59359,11 @@
59359 */
59360 leafCorrection = apOld[0]->leaf*4;
59361 leafData = apOld[0]->intKeyLeaf;
59362 for(i=0; i<nOld; i++){
59363 int limit;
59364 MemPage *pOld = apOld[i];
 
 
 
 
 
 
 
 
59365
59366 limit = pOld->nCell+pOld->nOverflow;
59367 if( pOld->nOverflow>0 ){
59368 for(j=0; j<limit; j++){
59369 assert( nCell<nMaxCells );
@@ -58632,10 +59380,11 @@
59380 apCell[nCell] = findCellv2(aData, maskPage, cellOffset, j);
59381 szCell[nCell] = cellSizePtr(pOld, apCell[nCell]);
59382 nCell++;
59383 }
59384 }
59385 cntOld[i] = nCell;
59386 if( i<nOld-1 && !leafData){
59387 u16 sz = (u16)szNew[i];
59388 u8 *pTemp;
59389 assert( nCell<nMaxCells );
59390 szCell[nCell] = sz;
@@ -58654,11 +59403,15 @@
59403 ** pointer of the divider cell */
59404 memcpy(apCell[nCell], &pOld->aData[8], 4);
59405 }else{
59406 assert( leafCorrection==4 );
59407 if( szCell[nCell]<4 ){
59408 /* Do not allow any cells smaller than 4 bytes. If a smaller cell
59409 ** does exist, pad it with 0x00 bytes. */
59410 assert( szCell[nCell]==3 );
59411 assert( apCell[nCell]==&pTemp[iSpace1-3] );
59412 pTemp[iSpace1++] = 0x00;
59413 szCell[nCell] = 4;
59414 }
59415 }
59416 nCell++;
59417 }
@@ -58683,11 +59436,11 @@
59436 usableSpace = pBt->usableSize - 12 + leafCorrection;
59437 for(subtotal=k=i=0; i<nCell; i++){
59438 assert( i<nMaxCells );
59439 subtotal += szCell[i] + 2;
59440 if( subtotal > usableSpace ){
59441 szNew[k] = subtotal - szCell[i] - 2;
59442 cntNew[k] = i;
59443 if( leafData ){ i--; }
59444 subtotal = 0;
59445 k++;
59446 if( k>NB+1 ){ rc = SQLITE_CORRUPT_BKPT; goto balance_cleanup; }
@@ -58697,13 +59450,14 @@
59450 cntNew[k] = nCell;
59451 k++;
59452
59453 /*
59454 ** The packing computed by the previous block is biased toward the siblings
59455 ** on the left side (siblings with smaller keys). The left siblings are
59456 ** always nearly full, while the right-most sibling might be nearly empty.
59457 ** The next block of code attempts to adjust the packing of siblings to
59458 ** get a better balance.
59459 **
59460 ** This adjustment is more than an optimization. The packing above might
59461 ** be so out of balance as to be illegal. For example, the right-most
59462 ** sibling might be completely empty. This adjustment is not optional.
59463 */
@@ -58728,26 +59482,22 @@
59482 }
59483 szNew[i] = szRight;
59484 szNew[i-1] = szLeft;
59485 }
59486
59487 /* Sanity check: For a non-corrupt database file one of the follwing
59488 ** must be true:
59489 ** (1) We found one or more cells (cntNew[0])>0), or
59490 ** (2) pPage is a virtual root page. A virtual root page is when
59491 ** the real root page is page 1 and we are the only child of
59492 ** that page.
 
59493 */
59494 assert( cntNew[0]>0 || (pParent->pgno==1 && pParent->nCell==0) || CORRUPT_DB);
59495 TRACE(("BALANCE: old: %d(nc=%d) %d(nc=%d) %d(nc=%d)\n",
59496 apOld[0]->pgno, apOld[0]->nCell,
59497 nOld>=2 ? apOld[1]->pgno : 0, nOld>=2 ? apOld[1]->nCell : 0,
59498 nOld>=3 ? apOld[2]->pgno : 0, nOld>=3 ? apOld[2]->nCell : 0
 
 
 
59499 ));
59500
59501 /*
59502 ** Allocate k new pages. Reuse old pages where possible.
59503 */
@@ -58766,12 +59516,14 @@
59516 if( rc ) goto balance_cleanup;
59517 }else{
59518 assert( i>0 );
59519 rc = allocateBtreePage(pBt, &pNew, &pgno, (bBulk ? 1 : pgno), 0);
59520 if( rc ) goto balance_cleanup;
59521 zeroPage(pNew, pageFlags);
59522 apNew[i] = pNew;
59523 nNew++;
59524 cntOld[i] = nCell;
59525
59526 /* Set the pointer-map entry for the new sibling page. */
59527 if( ISAUTOVACUUM ){
59528 ptrmapPut(pBt, pNew->pgno, PTRMAP_BTREE, pParent->pgno, &rc);
59529 if( rc!=SQLITE_OK ){
@@ -58779,139 +59531,251 @@
59531 }
59532 }
59533 }
59534 }
59535
 
 
 
 
 
 
 
 
 
 
59536 /*
59537 ** Reassign page numbers so that the new pages are in ascending order.
59538 ** This helps to keep entries in the disk file in order so that a scan
59539 ** of the table is closer to a linear scan through the file. That in turn
59540 ** helps the operating system to deliver pages from the disk more rapidly.
59541 **
59542 ** An O(n^2) insertion sort algorithm is used, but since n is never more
59543 ** than (NB+2) (a small constant), that should not be a problem.
59544 **
59545 ** When NB==3, this one optimization makes the database about 25% faster
59546 ** for large insertions and deletions.
59547 */
59548 for(i=0; i<nNew; i++){
59549 aPgOrder[i] = aPgno[i] = apNew[i]->pgno;
59550 aPgFlags[i] = apNew[i]->pDbPage->flags;
59551 for(j=0; j<i; j++){
59552 if( aPgno[j]==aPgno[i] ){
59553 /* This branch is taken if the set of sibling pages somehow contains
59554 ** duplicate entries. This can happen if the database is corrupt.
59555 ** It would be simpler to detect this as part of the loop below, but
59556 ** we do the detection here in order to avoid populating the pager
59557 ** cache with two separate objects associated with the same
59558 ** page number. */
59559 assert( CORRUPT_DB );
59560 rc = SQLITE_CORRUPT_BKPT;
59561 goto balance_cleanup;
59562 }
59563 }
59564 }
59565 for(i=0; i<nNew; i++){
59566 int iBest = 0; /* aPgno[] index of page number to use */
59567 for(j=1; j<nNew; j++){
59568 if( aPgOrder[j]<aPgOrder[iBest] ) iBest = j;
59569 }
59570 pgno = aPgOrder[iBest];
59571 aPgOrder[iBest] = 0xffffffff;
59572 if( iBest!=i ){
59573 if( iBest>i ){
59574 sqlite3PagerRekey(apNew[iBest]->pDbPage, pBt->nPage+iBest+1, 0);
59575 }
59576 sqlite3PagerRekey(apNew[i]->pDbPage, pgno, aPgFlags[iBest]);
59577 apNew[i]->pgno = pgno;
59578 }
59579 }
59580
59581 TRACE(("BALANCE: new: %d(%d nc=%d) %d(%d nc=%d) %d(%d nc=%d) "
59582 "%d(%d nc=%d) %d(%d nc=%d)\n",
59583 apNew[0]->pgno, szNew[0], cntNew[0],
59584 nNew>=2 ? apNew[1]->pgno : 0, nNew>=2 ? szNew[1] : 0,
59585 nNew>=2 ? cntNew[1] - cntNew[0] - !leafData : 0,
59586 nNew>=3 ? apNew[2]->pgno : 0, nNew>=3 ? szNew[2] : 0,
59587 nNew>=3 ? cntNew[2] - cntNew[1] - !leafData : 0,
59588 nNew>=4 ? apNew[3]->pgno : 0, nNew>=4 ? szNew[3] : 0,
59589 nNew>=4 ? cntNew[3] - cntNew[2] - !leafData : 0,
59590 nNew>=5 ? apNew[4]->pgno : 0, nNew>=5 ? szNew[4] : 0,
59591 nNew>=5 ? cntNew[4] - cntNew[3] - !leafData : 0
59592 ));
59593
59594 assert( sqlite3PagerIswriteable(pParent->pDbPage) );
59595 put4byte(pRight, apNew[nNew-1]->pgno);
59596
59597 /* If the sibling pages are not leaves, ensure that the right-child pointer
59598 ** of the right-most new sibling page is set to the value that was
59599 ** originally in the same field of the right-most old sibling page. */
59600 if( (pageFlags & PTF_LEAF)==0 && nOld!=nNew ){
59601 MemPage *pOld = (nNew>nOld ? apNew : apOld)[nOld-1];
59602 memcpy(&apNew[nNew-1]->aData[8], &pOld->aData[8], 4);
59603 }
59604
59605 /* Make any required updates to pointer map entries associated with
59606 ** cells stored on sibling pages following the balance operation. Pointer
59607 ** map entries associated with divider cells are set by the insertCell()
59608 ** routine. The associated pointer map entries are:
59609 **
59610 ** a) if the cell contains a reference to an overflow chain, the
59611 ** entry associated with the first page in the overflow chain, and
59612 **
59613 ** b) if the sibling pages are not leaves, the child page associated
59614 ** with the cell.
59615 **
59616 ** If the sibling pages are not leaves, then the pointer map entry
59617 ** associated with the right-child of each sibling may also need to be
59618 ** updated. This happens below, after the sibling pages have been
59619 ** populated, not here.
59620 */
59621 if( ISAUTOVACUUM ){
59622 MemPage *pNew = apNew[0];
59623 u8 *aOld = pNew->aData;
59624 int cntOldNext = pNew->nCell + pNew->nOverflow;
59625 int usableSize = pBt->usableSize;
59626 int iNew = 0;
59627 int iOld = 0;
59628
59629 for(i=0; i<nCell; i++){
59630 u8 *pCell = apCell[i];
59631 if( i==cntOldNext ){
59632 MemPage *pOld = (++iOld)<nNew ? apNew[iOld] : apOld[iOld];
59633 cntOldNext += pOld->nCell + pOld->nOverflow + !leafData;
59634 aOld = pOld->aData;
59635 }
59636 if( i==cntNew[iNew] ){
59637 pNew = apNew[++iNew];
59638 if( !leafData ) continue;
59639 }
59640
59641 /* Cell pCell is destined for new sibling page pNew. Originally, it
59642 ** was either part of sibling page iOld (possibly an overflow cell),
59643 ** or else the divider cell to the left of sibling page iOld. So,
59644 ** if sibling page iOld had the same page number as pNew, and if
59645 ** pCell really was a part of sibling page iOld (not a divider or
59646 ** overflow cell), we can skip updating the pointer map entries. */
59647 if( iOld>=nNew
59648 || pNew->pgno!=aPgno[iOld]
59649 || pCell<aOld
59650 || pCell>=&aOld[usableSize]
59651 ){
59652 if( !leafCorrection ){
59653 ptrmapPut(pBt, get4byte(pCell), PTRMAP_BTREE, pNew->pgno, &rc);
59654 }
59655 if( szCell[i]>pNew->minLocal ){
59656 ptrmapPutOvflPtr(pNew, pCell, &rc);
59657 }
59658 }
59659 }
59660 }
59661
59662 /* Insert new divider cells into pParent. */
59663 for(i=0; i<nNew-1; i++){
59664 u8 *pCell;
59665 u8 *pTemp;
59666 int sz;
59667 MemPage *pNew = apNew[i];
 
 
 
 
 
 
59668 j = cntNew[i];
59669
59670 assert( j<nMaxCells );
59671 pCell = apCell[j];
59672 sz = szCell[j] + leafCorrection;
59673 pTemp = &aOvflSpace[iOvflSpace];
59674 if( !pNew->leaf ){
59675 memcpy(&pNew->aData[8], pCell, 4);
59676 }else if( leafData ){
59677 /* If the tree is a leaf-data tree, and the siblings are leaves,
59678 ** then there is no divider cell in apCell[]. Instead, the divider
59679 ** cell consists of the integer key for the right-most cell of
59680 ** the sibling-page assembled above only.
59681 */
59682 CellInfo info;
59683 j--;
59684 btreeParseCellPtr(pNew, apCell[j], &info);
59685 pCell = pTemp;
59686 sz = 4 + putVarint(&pCell[4], info.nKey);
59687 pTemp = 0;
59688 }else{
59689 pCell -= 4;
59690 /* Obscure case for non-leaf-data trees: If the cell at pCell was
59691 ** previously stored on a leaf node, and its reported size was 4
59692 ** bytes, then it may actually be smaller than this
59693 ** (see btreeParseCellPtr(), 4 bytes is the minimum size of
59694 ** any cell). But it is important to pass the correct size to
59695 ** insertCell(), so reparse the cell now.
59696 **
59697 ** Note that this can never happen in an SQLite data file, as all
59698 ** cells are at least 4 bytes. It only happens in b-trees used
59699 ** to evaluate "IN (SELECT ...)" and similar clauses.
59700 */
59701 if( szCell[j]==4 ){
59702 assert(leafCorrection==4);
59703 sz = cellSizePtr(pParent, pCell);
59704 }
59705 }
59706 iOvflSpace += sz;
59707 assert( sz<=pBt->maxLocal+23 );
59708 assert( iOvflSpace <= (int)pBt->pageSize );
59709 insertCell(pParent, nxDiv+i, pCell, sz, pTemp, pNew->pgno, &rc);
59710 if( rc!=SQLITE_OK ) goto balance_cleanup;
59711 assert( sqlite3PagerIswriteable(pParent->pDbPage) );
59712 }
59713
59714 /* Now update the actual sibling pages. The order in which they are updated
59715 ** is important, as this code needs to avoid disrupting any page from which
59716 ** cells may still to be read. In practice, this means:
59717 **
59718 ** (1) If cells are moving left (from apNew[iPg] to apNew[iPg-1])
59719 ** then it is not safe to update page apNew[iPg] until after
59720 ** the left-hand sibling apNew[iPg-1] has been updated.
59721 **
59722 ** (2) If cells are moving right (from apNew[iPg] to apNew[iPg+1])
59723 ** then it is not safe to update page apNew[iPg] until after
59724 ** the right-hand sibling apNew[iPg+1] has been updated.
59725 **
59726 ** If neither of the above apply, the page is safe to update.
59727 **
59728 ** The iPg value in the following loop starts at nNew-1 goes down
59729 ** to 0, then back up to nNew-1 again, thus making two passes over
59730 ** the pages. On the initial downward pass, only condition (1) above
59731 ** needs to be tested because (2) will always be true from the previous
59732 ** step. On the upward pass, both conditions are always true, so the
59733 ** upwards pass simply processes pages that were missed on the downward
59734 ** pass.
59735 */
59736 for(i=1-nNew; i<nNew; i++){
59737 int iPg = i<0 ? -i : i;
59738 assert( iPg>=0 && iPg<nNew );
59739 if( abDone[iPg] ) continue; /* Skip pages already processed */
59740 if( i>=0 /* On the upwards pass, or... */
59741 || cntOld[iPg-1]>=cntNew[iPg-1] /* Condition (1) is true */
59742 ){
59743 int iNew;
59744 int iOld;
59745 int nNewCell;
59746
59747 /* Verify condition (1): If cells are moving left, update iPg
59748 ** only after iPg-1 has already been updated. */
59749 assert( iPg==0 || cntOld[iPg-1]>=cntNew[iPg-1] || abDone[iPg-1] );
59750
59751 /* Verify condition (2): If cells are moving right, update iPg
59752 ** only after iPg+1 has already been updated. */
59753 assert( cntNew[iPg]>=cntOld[iPg] || abDone[iPg+1] );
59754
59755 if( iPg==0 ){
59756 iNew = iOld = 0;
59757 nNewCell = cntNew[0];
59758 }else{
59759 iOld = iPg<nOld ? (cntOld[iPg-1] + !leafData) : nCell;
59760 iNew = cntNew[iPg-1] + !leafData;
59761 nNewCell = cntNew[iPg] - iNew;
59762 }
59763
59764 editPage(apNew[iPg], iOld, iNew, nNewCell, apCell, szCell);
59765 abDone[iPg]++;
59766 apNew[iPg]->nFree = usableSpace-szNew[iPg];
59767 assert( apNew[iPg]->nOverflow==0 );
59768 assert( apNew[iPg]->nCell==nNewCell );
59769 }
59770 }
59771
59772 /* All pages have been processed exactly once */
59773 assert( memcmp(abDone, "\01\01\01\01\01", nNew)==0 );
59774
59775 assert( nOld>0 );
59776 assert( nNew>0 );
 
 
 
 
59777
59778 if( isRoot && pParent->nCell==0 && pParent->hdrOffset<=apNew[0]->nFree ){
59779 /* The root page of the b-tree now contains no cells. The only sibling
59780 ** page is the right-child of the parent. Copy the contents of the
59781 ** child page into the parent, decreasing the overall height of the
@@ -58920,130 +59784,54 @@
59784 **
59785 ** If this is an auto-vacuum database, the call to copyNodeContent()
59786 ** sets all pointer-map entries corresponding to database image pages
59787 ** for which the pointer is stored within the content being copied.
59788 **
59789 ** It is critical that the child page be defragmented before being
59790 ** copied into the parent, because if the parent is page 1 then it will
59791 ** by smaller than the child due to the database header, and so all the
59792 ** free space needs to be up front.
59793 */
59794 assert( nNew==1 );
59795 rc = defragmentPage(apNew[0]);
59796 testcase( rc!=SQLITE_OK );
59797 assert( apNew[0]->nFree ==
59798 (get2byte(&apNew[0]->aData[5])-apNew[0]->cellOffset-apNew[0]->nCell*2)
59799 || rc!=SQLITE_OK
59800 );
59801 copyNodeContent(apNew[0], pParent, &rc);
59802 freePage(apNew[0], &rc);
59803 }else if( ISAUTOVACUUM && !leafCorrection ){
59804 /* Fix the pointer map entries associated with the right-child of each
59805 ** sibling page. All other pointer map entries have already been taken
59806 ** care of. */
59807 for(i=0; i<nNew; i++){
59808 u32 key = get4byte(&apNew[i]->aData[8]);
59809 ptrmapPut(pBt, key, PTRMAP_BTREE, apNew[i]->pgno, &rc);
59810 }
59811 }
59812
59813 assert( pParent->isInit );
59814 TRACE(("BALANCE: finished: old=%d new=%d cells=%d\n",
59815 nOld, nNew, nCell));
59816
59817 /* Free any old pages that were not reused as new pages.
59818 */
59819 for(i=nNew; i<nOld; i++){
59820 freePage(apOld[i], &rc);
59821 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59822
59823 #if 0
59824 if( ISAUTOVACUUM && rc==SQLITE_OK && apNew[0]->isInit ){
59825 /* The ptrmapCheckPages() contains assert() statements that verify that
59826 ** all pointer map pages are set correctly. This is helpful while
59827 ** debugging. This is usually disabled because a corrupt database may
59828 ** cause an assert() statement to fail. */
59829 ptrmapCheckPages(apNew, nNew);
59830 ptrmapCheckPages(&pParent, 1);
59831 }
59832 #endif
 
 
 
 
 
59833
59834 /*
59835 ** Cleanup before returning.
59836 */
59837 balance_cleanup:
@@ -60424,12 +61212,18 @@
61212 }else{
61213 int contentOffset = get2byteNotZero(&data[hdr+5]);
61214 assert( contentOffset<=usableSize ); /* Enforced by btreeInitPage() */
61215 memset(hit+contentOffset, 0, usableSize-contentOffset);
61216 memset(hit, 1, contentOffset);
61217 /* EVIDENCE-OF: R-37002-32774 The two-byte integer at offset 3 gives the
61218 ** number of cells on the page. */
61219 nCell = get2byte(&data[hdr+3]);
61220 /* EVIDENCE-OF: R-23882-45353 The cell pointer array of a b-tree page
61221 ** immediately follows the b-tree page header. */
61222 cellStart = hdr + 12 - 4*pPage->leaf;
61223 /* EVIDENCE-OF: R-02776-14802 The cell pointer array consists of K 2-byte
61224 ** integer offsets to the cell contents. */
61225 for(i=0; i<nCell; i++){
61226 int pc = get2byte(&data[cellStart+i*2]);
61227 u32 size = 65536;
61228 int j;
61229 if( pc<=usableSize-4 ){
@@ -60441,18 +61235,27 @@
61235 "Corruption detected in cell %d on page %d",i,iPage);
61236 }else{
61237 for(j=pc+size-1; j>=pc; j--) hit[j]++;
61238 }
61239 }
61240 /* EVIDENCE-OF: R-20690-50594 The second field of the b-tree page header
61241 ** is the offset of the first freeblock, or zero if there are no
61242 ** freeblocks on the page. */
61243 i = get2byte(&data[hdr+1]);
61244 while( i>0 ){
61245 int size, j;
61246 assert( i<=usableSize-4 ); /* Enforced by btreeInitPage() */
61247 size = get2byte(&data[i+2]);
61248 assert( i+size<=usableSize ); /* Enforced by btreeInitPage() */
61249 for(j=i+size-1; j>=i; j--) hit[j]++;
61250 /* EVIDENCE-OF: R-58208-19414 The first 2 bytes of a freeblock are a
61251 ** big-endian integer which is the offset in the b-tree page of the next
61252 ** freeblock in the chain, or zero if the freeblock is the last on the
61253 ** chain. */
61254 j = get2byte(&data[i]);
61255 /* EVIDENCE-OF: R-06866-39125 Freeblocks are always connected in order of
61256 ** increasing offset. */
61257 assert( j==0 || j>i+size ); /* Enforced by btreeInitPage() */
61258 assert( j<=usableSize-4 ); /* Enforced by btreeInitPage() */
61259 i = j;
61260 }
61261 for(i=cnt=0; i<usableSize; i++){
@@ -60462,10 +61265,15 @@
61265 checkAppendMsg(pCheck,
61266 "Multiple uses for byte %d of page %d", i, iPage);
61267 break;
61268 }
61269 }
61270 /* EVIDENCE-OF: R-43263-13491 The total number of bytes in all fragments
61271 ** is stored in the fifth field of the b-tree page header.
61272 ** EVIDENCE-OF: R-07161-27322 The one-byte integer at offset 7 gives the
61273 ** number of fragmented free bytes within the cell content area.
61274 */
61275 if( cnt!=data[hdr+7] ){
61276 checkAppendMsg(pCheck,
61277 "Fragmentation of %d bytes reported as %d on page %d",
61278 cnt, data[hdr+7], iPage);
61279 }
@@ -60865,10 +61673,15 @@
61673 */
61674 SQLITE_PRIVATE int sqlite3BtreeIsReadonly(Btree *p){
61675 return (p->pBt->btsFlags & BTS_READ_ONLY)!=0;
61676 }
61677
61678 /*
61679 ** Return the size of the header added to each page by this module.
61680 */
61681 SQLITE_PRIVATE int sqlite3HeaderSizeBtree(void){ return sizeof(MemPage); }
61682
61683 /************** End of btree.c ***********************************************/
61684 /************** Begin file backup.c ******************************************/
61685 /*
61686 ** 2009 January 28
61687 **
@@ -60988,10 +61801,24 @@
61801 static int setDestPgsz(sqlite3_backup *p){
61802 int rc;
61803 rc = sqlite3BtreeSetPageSize(p->pDest,sqlite3BtreeGetPageSize(p->pSrc),-1,0);
61804 return rc;
61805 }
61806
61807 /*
61808 ** Check that there is no open read-transaction on the b-tree passed as the
61809 ** second argument. If there is not, return SQLITE_OK. Otherwise, if there
61810 ** is an open read-transaction, return SQLITE_ERROR and leave an error
61811 ** message in database handle db.
61812 */
61813 static int checkReadTransaction(sqlite3 *db, Btree *p){
61814 if( sqlite3BtreeIsInReadTrans(p) ){
61815 sqlite3ErrorWithMsg(db, SQLITE_ERROR, "destination database is in use");
61816 return SQLITE_ERROR;
61817 }
61818 return SQLITE_OK;
61819 }
61820
61821 /*
61822 ** Create an sqlite3_backup process to copy the contents of zSrcDb from
61823 ** connection handle pSrcDb to zDestDb in pDestDb. If successful, return
61824 ** a pointer to the new sqlite3_backup object.
@@ -61004,10 +61831,17 @@
61831 const char *zDestDb, /* Name of database within pDestDb */
61832 sqlite3* pSrcDb, /* Database connection to read from */
61833 const char *zSrcDb /* Name of database within pSrcDb */
61834 ){
61835 sqlite3_backup *p; /* Value to return */
61836
61837 #ifdef SQLITE_ENABLE_API_ARMOR
61838 if( !sqlite3SafetyCheckOk(pSrcDb)||!sqlite3SafetyCheckOk(pDestDb) ){
61839 (void)SQLITE_MISUSE_BKPT;
61840 return 0;
61841 }
61842 #endif
61843
61844 /* Lock the source database handle. The destination database
61845 ** handle is not locked in this routine, but it is locked in
61846 ** sqlite3_backup_step(). The user is required to ensure that no
61847 ** other thread accesses the destination handle for the duration
@@ -61041,16 +61875,19 @@
61875 p->pDestDb = pDestDb;
61876 p->pSrcDb = pSrcDb;
61877 p->iNext = 1;
61878 p->isAttached = 0;
61879
61880 if( 0==p->pSrc || 0==p->pDest
61881 || setDestPgsz(p)==SQLITE_NOMEM
61882 || checkReadTransaction(pDestDb, p->pDest)!=SQLITE_OK
61883 ){
61884 /* One (or both) of the named databases did not exist or an OOM
61885 ** error was hit. Or there is a transaction open on the destination
61886 ** database. The error has already been written into the pDestDb
61887 ** handle. All that is left to do here is free the sqlite3_backup
61888 ** structure. */
61889 sqlite3_free(p);
61890 p = 0;
61891 }
61892 }
61893 if( p ){
@@ -61201,10 +62038,13 @@
62038 int rc;
62039 int destMode; /* Destination journal mode */
62040 int pgszSrc = 0; /* Source page size */
62041 int pgszDest = 0; /* Destination page size */
62042
62043 #ifdef SQLITE_ENABLE_API_ARMOR
62044 if( p==0 ) return SQLITE_MISUSE_BKPT;
62045 #endif
62046 sqlite3_mutex_enter(p->pSrcDb->mutex);
62047 sqlite3BtreeEnter(p->pSrc);
62048 if( p->pDestDb ){
62049 sqlite3_mutex_enter(p->pDestDb->mutex);
62050 }
@@ -61464,11 +62304,11 @@
62304 }
62305 *pp = p->pNext;
62306 }
62307
62308 /* If a transaction is still open on the Btree, roll it back. */
62309 sqlite3BtreeRollback(p->pDest, SQLITE_OK, 0);
62310
62311 /* Set the error code of the destination database handle. */
62312 rc = (p->rc==SQLITE_DONE) ? SQLITE_OK : p->rc;
62313 if( p->pDestDb ){
62314 sqlite3Error(p->pDestDb, rc);
@@ -61490,18 +62330,30 @@
62330 /*
62331 ** Return the number of pages still to be backed up as of the most recent
62332 ** call to sqlite3_backup_step().
62333 */
62334 SQLITE_API int sqlite3_backup_remaining(sqlite3_backup *p){
62335 #ifdef SQLITE_ENABLE_API_ARMOR
62336 if( p==0 ){
62337 (void)SQLITE_MISUSE_BKPT;
62338 return 0;
62339 }
62340 #endif
62341 return p->nRemaining;
62342 }
62343
62344 /*
62345 ** Return the total number of pages in the source database as of the most
62346 ** recent call to sqlite3_backup_step().
62347 */
62348 SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p){
62349 #ifdef SQLITE_ENABLE_API_ARMOR
62350 if( p==0 ){
62351 (void)SQLITE_MISUSE_BKPT;
62352 return 0;
62353 }
62354 #endif
62355 return p->nPagecount;
62356 }
62357
62358 /*
62359 ** This function is called after the contents of page iPage of the
@@ -63788,10 +64640,38 @@
64640 }
64641 p->nOp += nOp;
64642 }
64643 return addr;
64644 }
64645
64646 #if defined(SQLITE_ENABLE_STMT_SCANSTATUS)
64647 /*
64648 ** Add an entry to the array of counters managed by sqlite3_stmt_scanstatus().
64649 */
64650 SQLITE_PRIVATE void sqlite3VdbeScanStatus(
64651 Vdbe *p, /* VM to add scanstatus() to */
64652 int addrExplain, /* Address of OP_Explain (or 0) */
64653 int addrLoop, /* Address of loop counter */
64654 int addrVisit, /* Address of rows visited counter */
64655 LogEst nEst, /* Estimated number of output rows */
64656 const char *zName /* Name of table or index being scanned */
64657 ){
64658 int nByte = (p->nScan+1) * sizeof(ScanStatus);
64659 ScanStatus *aNew;
64660 aNew = (ScanStatus*)sqlite3DbRealloc(p->db, p->aScan, nByte);
64661 if( aNew ){
64662 ScanStatus *pNew = &aNew[p->nScan++];
64663 pNew->addrExplain = addrExplain;
64664 pNew->addrLoop = addrLoop;
64665 pNew->addrVisit = addrVisit;
64666 pNew->nEst = nEst;
64667 pNew->zName = sqlite3DbStrDup(p->db, zName);
64668 p->aScan = aNew;
64669 }
64670 }
64671 #endif
64672
64673
64674 /*
64675 ** Change the value of the P1 operand for a specific instruction.
64676 ** This routine is useful when a large program is loaded from a
64677 ** static array using sqlite3VdbeAddOpList but we want to make a
@@ -64887,10 +65767,13 @@
65767 p->apArg = allocSpace(p->apArg, nArg*sizeof(Mem*), &zCsr, zEnd, &nByte);
65768 p->azVar = allocSpace(p->azVar, nVar*sizeof(char*), &zCsr, zEnd, &nByte);
65769 p->apCsr = allocSpace(p->apCsr, nCursor*sizeof(VdbeCursor*),
65770 &zCsr, zEnd, &nByte);
65771 p->aOnceFlag = allocSpace(p->aOnceFlag, nOnce, &zCsr, zEnd, &nByte);
65772 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
65773 p->anExec = allocSpace(p->anExec, p->nOp*sizeof(i64), &zCsr, zEnd, &nByte);
65774 #endif
65775 if( nByte ){
65776 p->pFree = sqlite3DbMallocZero(db, nByte);
65777 }
65778 zCsr = p->pFree;
65779 zEnd = &zCsr[nByte];
@@ -64903,11 +65786,11 @@
65786 for(n=0; n<nVar; n++){
65787 p->aVar[n].flags = MEM_Null;
65788 p->aVar[n].db = db;
65789 }
65790 }
65791 if( p->azVar && pParse->nzVar>0 ){
65792 p->nzVar = pParse->nzVar;
65793 memcpy(p->azVar, pParse->azVar, p->nzVar*sizeof(p->azVar[0]));
65794 memset(pParse->azVar, 0, pParse->nzVar*sizeof(pParse->azVar[0]));
65795 }
65796 if( p->aMem ){
@@ -64954,10 +65837,13 @@
65837 ** is used, for example, when a trigger sub-program is halted to restore
65838 ** control to the main program.
65839 */
65840 SQLITE_PRIVATE int sqlite3VdbeFrameRestore(VdbeFrame *pFrame){
65841 Vdbe *v = pFrame->v;
65842 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
65843 v->anExec = pFrame->anExec;
65844 #endif
65845 v->aOnceFlag = pFrame->aOnceFlag;
65846 v->nOnceFlag = pFrame->nOnceFlag;
65847 v->aOp = pFrame->aOp;
65848 v->nOp = pFrame->nOp;
65849 v->aMem = pFrame->aMem;
@@ -64964,10 +65850,11 @@
65850 v->nMem = pFrame->nMem;
65851 v->apCsr = pFrame->apCsr;
65852 v->nCursor = pFrame->nCursor;
65853 v->db->lastRowid = pFrame->lastRowid;
65854 v->nChange = pFrame->nChange;
65855 v->db->nChange = pFrame->nDbChange;
65856 return pFrame->pc;
65857 }
65858
65859 /*
65860 ** Close all cursors.
@@ -65531,10 +66418,11 @@
66418 ** so, abort any other statements this handle currently has active.
66419 */
66420 sqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK);
66421 sqlite3CloseSavepoints(db);
66422 db->autoCommit = 1;
66423 p->nChange = 0;
66424 }
66425 }
66426 }
66427
66428 /* Check for immediate foreign key violations. */
@@ -65571,18 +66459,20 @@
66459 sqlite3VdbeLeave(p);
66460 return SQLITE_BUSY;
66461 }else if( rc!=SQLITE_OK ){
66462 p->rc = rc;
66463 sqlite3RollbackAll(db, SQLITE_OK);
66464 p->nChange = 0;
66465 }else{
66466 db->nDeferredCons = 0;
66467 db->nDeferredImmCons = 0;
66468 db->flags &= ~SQLITE_DeferFKs;
66469 sqlite3CommitInternalChanges(db);
66470 }
66471 }else{
66472 sqlite3RollbackAll(db, SQLITE_OK);
66473 p->nChange = 0;
66474 }
66475 db->nStatement = 0;
66476 }else if( eStatementOp==0 ){
66477 if( p->rc==SQLITE_OK || p->errorAction==OE_Fail ){
66478 eStatementOp = SAVEPOINT_RELEASE;
@@ -65590,10 +66480,11 @@
66480 eStatementOp = SAVEPOINT_ROLLBACK;
66481 }else{
66482 sqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK);
66483 sqlite3CloseSavepoints(db);
66484 db->autoCommit = 1;
66485 p->nChange = 0;
66486 }
66487 }
66488
66489 /* If eStatementOp is non-zero, then a statement transaction needs to
66490 ** be committed or rolled back. Call sqlite3VdbeCloseStatement() to
@@ -65610,10 +66501,11 @@
66501 p->zErrMsg = 0;
66502 }
66503 sqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK);
66504 sqlite3CloseSavepoints(db);
66505 db->autoCommit = 1;
66506 p->nChange = 0;
66507 }
66508 }
66509
66510 /* If this was an INSERT, UPDATE or DELETE and no statement transaction
66511 ** has been rolled back, update the database connection change-counter.
@@ -65871,10 +66763,16 @@
66763 for(i=p->nzVar-1; i>=0; i--) sqlite3DbFree(db, p->azVar[i]);
66764 vdbeFreeOpArray(db, p->aOp, p->nOp);
66765 sqlite3DbFree(db, p->aColName);
66766 sqlite3DbFree(db, p->zSql);
66767 sqlite3DbFree(db, p->pFree);
66768 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
66769 for(i=0; i<p->nScan; i++){
66770 sqlite3DbFree(db, p->aScan[i].zName);
66771 }
66772 sqlite3DbFree(db, p->aScan);
66773 #endif
66774 }
66775
66776 /*
66777 ** Delete an entire VDBE.
66778 */
@@ -66029,13 +66927,11 @@
66927 /* Figure out whether to use 1, 2, 4, 6 or 8 bytes. */
66928 # define MAX_6BYTE ((((i64)0x00008000)<<32)-1)
66929 i64 i = pMem->u.i;
66930 u64 u;
66931 if( i<0 ){
66932 u = ~i;
 
 
66933 }else{
66934 u = i;
66935 }
66936 if( u<=127 ){
66937 return ((i&1)==i && file_format>=4) ? 8+(u32)u : 1;
@@ -66197,14 +67093,18 @@
67093 ){
67094 u64 x = FOUR_BYTE_UINT(buf);
67095 u32 y = FOUR_BYTE_UINT(buf+4);
67096 x = (x<<32) + y;
67097 if( serial_type==6 ){
67098 /* EVIDENCE-OF: R-29851-52272 Value is a big-endian 64-bit
67099 ** twos-complement integer. */
67100 pMem->u.i = *(i64*)&x;
67101 pMem->flags = MEM_Int;
67102 testcase( pMem->u.i<0 );
67103 }else{
67104 /* EVIDENCE-OF: R-57343-49114 Value is a big-endian IEEE 754-2008 64-bit
67105 ** floating point number. */
67106 #if !defined(NDEBUG) && !defined(SQLITE_OMIT_FLOATING_POINT)
67107 /* Verify that integers and floating point values use the same
67108 ** byte order. Or, that if SQLITE_MIXED_ENDIAN_64BIT_FLOAT is
67109 ** defined that 64-bit floating point values really are mixed
67110 ** endian.
@@ -66228,39 +67128,50 @@
67128 Mem *pMem /* Memory cell to write value into */
67129 ){
67130 switch( serial_type ){
67131 case 10: /* Reserved for future use */
67132 case 11: /* Reserved for future use */
67133 case 0: { /* Null */
67134 /* EVIDENCE-OF: R-24078-09375 Value is a NULL. */
67135 pMem->flags = MEM_Null;
67136 break;
67137 }
67138 case 1: {
67139 /* EVIDENCE-OF: R-44885-25196 Value is an 8-bit twos-complement
67140 ** integer. */
67141 pMem->u.i = ONE_BYTE_INT(buf);
67142 pMem->flags = MEM_Int;
67143 testcase( pMem->u.i<0 );
67144 return 1;
67145 }
67146 case 2: { /* 2-byte signed integer */
67147 /* EVIDENCE-OF: R-49794-35026 Value is a big-endian 16-bit
67148 ** twos-complement integer. */
67149 pMem->u.i = TWO_BYTE_INT(buf);
67150 pMem->flags = MEM_Int;
67151 testcase( pMem->u.i<0 );
67152 return 2;
67153 }
67154 case 3: { /* 3-byte signed integer */
67155 /* EVIDENCE-OF: R-37839-54301 Value is a big-endian 24-bit
67156 ** twos-complement integer. */
67157 pMem->u.i = THREE_BYTE_INT(buf);
67158 pMem->flags = MEM_Int;
67159 testcase( pMem->u.i<0 );
67160 return 3;
67161 }
67162 case 4: { /* 4-byte signed integer */
67163 /* EVIDENCE-OF: R-01849-26079 Value is a big-endian 32-bit
67164 ** twos-complement integer. */
67165 pMem->u.i = FOUR_BYTE_INT(buf);
67166 pMem->flags = MEM_Int;
67167 testcase( pMem->u.i<0 );
67168 return 4;
67169 }
67170 case 5: { /* 6-byte signed integer */
67171 /* EVIDENCE-OF: R-50385-09674 Value is a big-endian 48-bit
67172 ** twos-complement integer. */
67173 pMem->u.i = FOUR_BYTE_UINT(buf+2) + (((i64)1)<<32)*TWO_BYTE_INT(buf);
67174 pMem->flags = MEM_Int;
67175 testcase( pMem->u.i<0 );
67176 return 6;
67177 }
@@ -66270,15 +67181,21 @@
67181 ** to avoid having to move the frame pointer in the common case */
67182 return serialGet(buf,serial_type,pMem);
67183 }
67184 case 8: /* Integer 0 */
67185 case 9: { /* Integer 1 */
67186 /* EVIDENCE-OF: R-12976-22893 Value is the integer 0. */
67187 /* EVIDENCE-OF: R-18143-12121 Value is the integer 1. */
67188 pMem->u.i = serial_type-8;
67189 pMem->flags = MEM_Int;
67190 return 0;
67191 }
67192 default: {
67193 /* EVIDENCE-OF: R-14606-31564 Value is a BLOB that is (N-12)/2 bytes in
67194 ** length.
67195 ** EVIDENCE-OF: R-28401-00140 Value is a string in the text encoding and
67196 ** (N-13)/2 bytes in length. */
67197 static const u16 aFlag[] = { MEM_Blob|MEM_Ephem, MEM_Str|MEM_Ephem };
67198 pMem->z = (char *)buf;
67199 pMem->n = (serial_type-12)/2;
67200 pMem->flags = aFlag[serial_type&1];
67201 return pMem->n;
@@ -68238,15 +69155,23 @@
69155 sqlite3_stmt *pStmt,
69156 int N,
69157 const void *(*xFunc)(Mem*),
69158 int useType
69159 ){
69160 const void *ret;
69161 Vdbe *p;
69162 int n;
69163 sqlite3 *db;
69164 #ifdef SQLITE_ENABLE_API_ARMOR
69165 if( pStmt==0 ){
69166 (void)SQLITE_MISUSE_BKPT;
69167 return 0;
69168 }
69169 #endif
69170 ret = 0;
69171 p = (Vdbe *)pStmt;
69172 db = p->db;
69173 assert( db!=0 );
69174 n = sqlite3_column_count(pStmt);
69175 if( N<n && N>=0 ){
69176 N += useType*n;
69177 sqlite3_mutex_enter(db->mutex);
@@ -68707,10 +69632,16 @@
69632 ** prepared statement for the database connection. Return NULL if there
69633 ** are no more.
69634 */
69635 SQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt){
69636 sqlite3_stmt *pNext;
69637 #ifdef SQLITE_ENABLE_API_ARMOR
69638 if( !sqlite3SafetyCheckOk(pDb) ){
69639 (void)SQLITE_MISUSE_BKPT;
69640 return 0;
69641 }
69642 #endif
69643 sqlite3_mutex_enter(pDb->mutex);
69644 if( pStmt==0 ){
69645 pNext = (sqlite3_stmt*)pDb->pVdbe;
69646 }else{
69647 pNext = (sqlite3_stmt*)((Vdbe*)pStmt)->pNext;
@@ -68722,15 +69653,91 @@
69653 /*
69654 ** Return the value of a status counter for a prepared statement
69655 */
69656 SQLITE_API int sqlite3_stmt_status(sqlite3_stmt *pStmt, int op, int resetFlag){
69657 Vdbe *pVdbe = (Vdbe*)pStmt;
69658 u32 v;
69659 #ifdef SQLITE_ENABLE_API_ARMOR
69660 if( !pStmt ){
69661 (void)SQLITE_MISUSE_BKPT;
69662 return 0;
69663 }
69664 #endif
69665 v = pVdbe->aCounter[op];
69666 if( resetFlag ) pVdbe->aCounter[op] = 0;
69667 return (int)v;
69668 }
69669
69670 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
69671 /*
69672 ** Return status data for a single loop within query pStmt.
69673 */
69674 SQLITE_API int sqlite3_stmt_scanstatus(
69675 sqlite3_stmt *pStmt, /* Prepared statement being queried */
69676 int idx, /* Index of loop to report on */
69677 int iScanStatusOp, /* Which metric to return */
69678 void *pOut /* OUT: Write the answer here */
69679 ){
69680 Vdbe *p = (Vdbe*)pStmt;
69681 ScanStatus *pScan;
69682 if( idx<0 || idx>=p->nScan ) return 1;
69683 pScan = &p->aScan[idx];
69684 switch( iScanStatusOp ){
69685 case SQLITE_SCANSTAT_NLOOP: {
69686 *(sqlite3_int64*)pOut = p->anExec[pScan->addrLoop];
69687 break;
69688 }
69689 case SQLITE_SCANSTAT_NVISIT: {
69690 *(sqlite3_int64*)pOut = p->anExec[pScan->addrVisit];
69691 break;
69692 }
69693 case SQLITE_SCANSTAT_EST: {
69694 double r = 1.0;
69695 LogEst x = pScan->nEst;
69696 while( x<100 ){
69697 x += 10;
69698 r *= 0.5;
69699 }
69700 *(double*)pOut = r*sqlite3LogEstToInt(x);
69701 break;
69702 }
69703 case SQLITE_SCANSTAT_NAME: {
69704 *(const char**)pOut = pScan->zName;
69705 break;
69706 }
69707 case SQLITE_SCANSTAT_EXPLAIN: {
69708 if( pScan->addrExplain ){
69709 *(const char**)pOut = p->aOp[ pScan->addrExplain ].p4.z;
69710 }else{
69711 *(const char**)pOut = 0;
69712 }
69713 break;
69714 }
69715 case SQLITE_SCANSTAT_SELECTID: {
69716 if( pScan->addrExplain ){
69717 *(int*)pOut = p->aOp[ pScan->addrExplain ].p1;
69718 }else{
69719 *(int*)pOut = -1;
69720 }
69721 break;
69722 }
69723 default: {
69724 return 1;
69725 }
69726 }
69727 return 0;
69728 }
69729
69730 /*
69731 ** Zero all counters associated with the sqlite3_stmt_scanstatus() data.
69732 */
69733 SQLITE_API void sqlite3_stmt_scanstatus_reset(sqlite3_stmt *pStmt){
69734 Vdbe *p = (Vdbe*)pStmt;
69735 memset(p->anExec, 0, p->nOp * sizeof(i64));
69736 }
69737 #endif /* SQLITE_ENABLE_STMT_SCANSTATUS */
69738
69739 /************** End of vdbeapi.c *********************************************/
69740 /************** Begin file vdbetrace.c ***************************************/
69741 /*
69742 ** 2009 November 25
69743 **
@@ -69612,10 +70619,13 @@
70619 #ifdef VDBE_PROFILE
70620 start = sqlite3Hwtime();
70621 #endif
70622 nVmStep++;
70623 pOp = &aOp[pc];
70624 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
70625 if( p->anExec ) p->anExec[pc]++;
70626 #endif
70627
70628 /* Only allow tracing if SQLITE_DEBUG is defined.
70629 */
70630 #ifdef SQLITE_DEBUG
70631 if( db->flags & SQLITE_VdbeTrace ){
@@ -71302,11 +72312,11 @@
72312 assert( pReg->flags & MEM_Blob );
72313 assert( memIsValid(pReg) );
72314 pC->payloadSize = pC->szRow = avail = pReg->n;
72315 pC->aRow = (u8*)pReg->z;
72316 }else{
72317 sqlite3VdbeMemSetNull(pDest);
72318 goto op_column_out;
72319 }
72320 }else{
72321 assert( pCrsr );
72322 if( pC->isTable==0 ){
@@ -71637,11 +72647,14 @@
72647 testcase( serial_type==127 );
72648 testcase( serial_type==128 );
72649 nHdr += serial_type<=127 ? 1 : sqlite3VarintLen(serial_type);
72650 }while( (--pRec)>=pData0 );
72651
72652 /* EVIDENCE-OF: R-22564-11647 The header begins with a single varint
72653 ** which determines the total number of bytes in the header. The varint
72654 ** value is the size of the header in bytes including the size varint
72655 ** itself. */
72656 testcase( nHdr==126 );
72657 testcase( nHdr==127 );
72658 if( nHdr<=126 ){
72659 /* The common case */
72660 nHdr += 1;
@@ -71671,11 +72684,15 @@
72684 j = nHdr;
72685 assert( pData0<=pLast );
72686 pRec = pData0;
72687 do{
72688 serial_type = pRec->uTemp;
72689 /* EVIDENCE-OF: R-06529-47362 Following the size varint are one or more
72690 ** additional varints, one per column. */
72691 i += putVarint32(&zNewRecord[i], serial_type); /* serial type */
72692 /* EVIDENCE-OF: R-64536-51728 The values for each column in the record
72693 ** immediately follow the header. */
72694 j += sqlite3VdbeSerialPut(&zNewRecord[j], pRec, serial_type); /* content */
72695 }while( (++pRec)<=pLast );
72696 assert( i==nHdr );
72697 assert( j==nByte );
72698
@@ -71826,23 +72843,30 @@
72843 goto vdbe_return;
72844 }
72845 db->isTransactionSavepoint = 0;
72846 rc = p->rc;
72847 }else{
72848 int isSchemaChange;
72849 iSavepoint = db->nSavepoint - iSavepoint - 1;
72850 if( p1==SAVEPOINT_ROLLBACK ){
72851 isSchemaChange = (db->flags & SQLITE_InternChanges)!=0;
72852 for(ii=0; ii<db->nDb; ii++){
72853 rc = sqlite3BtreeTripAllCursors(db->aDb[ii].pBt,
72854 SQLITE_ABORT_ROLLBACK,
72855 isSchemaChange==0);
72856 if( rc!=SQLITE_OK ) goto abort_due_to_error;
72857 }
72858 }else{
72859 isSchemaChange = 0;
72860 }
72861 for(ii=0; ii<db->nDb; ii++){
72862 rc = sqlite3BtreeSavepoint(db->aDb[ii].pBt, p1, iSavepoint);
72863 if( rc!=SQLITE_OK ){
72864 goto abort_due_to_error;
72865 }
72866 }
72867 if( isSchemaChange ){
72868 sqlite3ExpirePreparedStatements(db);
72869 sqlite3ResetAllSchemasOfConnection(db);
72870 db->flags = (db->flags | SQLITE_InternChanges);
72871 }
72872 }
@@ -72235,11 +73259,11 @@
73259 assert( p->bIsReader );
73260 assert( pOp->opcode==OP_OpenRead || pOp->opcode==OP_ReopenIdx
73261 || p->readOnly==0 );
73262
73263 if( p->expired ){
73264 rc = SQLITE_ABORT_ROLLBACK;
73265 break;
73266 }
73267
73268 nField = 0;
73269 pKeyInfo = 0;
@@ -72799,14 +73823,14 @@
73823 }
73824 pIdxKey = &r;
73825 }else{
73826 pIdxKey = sqlite3VdbeAllocUnpackedRecord(
73827 pC->pKeyInfo, aTempRec, sizeof(aTempRec), &pFree
73828 );
73829 if( pIdxKey==0 ) goto no_mem;
73830 assert( pIn3->flags & MEM_Blob );
73831 ExpandBlob(pIn3);
73832 sqlite3VdbeRecordUnpack(pC->pKeyInfo, pIn3->n, pIn3->z, pIdxKey);
73833 }
73834 pIdxKey->default_rc = 0;
73835 if( pOp->opcode==OP_NoConflict ){
73836 /* For the OP_NoConflict opcode, take the jump if any of the
@@ -73402,10 +74426,14 @@
74426 #endif /* SQLITE_OMIT_VIRTUALTABLE */
74427 }else{
74428 assert( pC->pCursor!=0 );
74429 rc = sqlite3VdbeCursorRestore(pC);
74430 if( rc ) goto abort_due_to_error;
74431 if( pC->nullRow ){
74432 pOut->flags = MEM_Null;
74433 break;
74434 }
74435 rc = sqlite3BtreeKeySize(pC->pCursor, &v);
74436 assert( rc==SQLITE_OK ); /* Always so because of CursorRestore() above */
74437 }
74438 pOut->u.i = v;
74439 break;
@@ -73492,13 +74520,13 @@
74520 }
74521 /* Opcode: Rewind P1 P2 * * *
74522 **
74523 ** The next use of the Rowid or Column or Next instruction for P1
74524 ** will refer to the first entry in the database table or index.
74525 ** If the table or index is empty, jump immediately to P2.
74526 ** If the table or index is not empty, fall through to the following
74527 ** instruction.
74528 **
74529 ** This opcode leaves the cursor configured to move in forward order,
74530 ** from the beginning toward the end. In other words, the cursor is
74531 ** configured to use Next, not Prev.
74532 */
@@ -74410,10 +75438,13 @@
75438 pFrame->aOp = p->aOp;
75439 pFrame->nOp = p->nOp;
75440 pFrame->token = pProgram->token;
75441 pFrame->aOnceFlag = p->aOnceFlag;
75442 pFrame->nOnceFlag = p->nOnceFlag;
75443 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
75444 pFrame->anExec = p->anExec;
75445 #endif
75446
75447 pEnd = &VdbeFrameMem(pFrame)[pFrame->nChildMem];
75448 for(pMem=VdbeFrameMem(pFrame); pMem!=pEnd; pMem++){
75449 pMem->flags = MEM_Undefined;
75450 pMem->db = db;
@@ -74427,10 +75458,11 @@
75458
75459 p->nFrame++;
75460 pFrame->pParent = p->pFrame;
75461 pFrame->lastRowid = lastRowid;
75462 pFrame->nChange = p->nChange;
75463 pFrame->nDbChange = p->db->nChange;
75464 p->nChange = 0;
75465 p->pFrame = pFrame;
75466 p->aMem = aMem = &VdbeFrameMem(pFrame)[-1];
75467 p->nMem = pFrame->nChildMem;
75468 p->nCursor = (u16)pFrame->nChildCsr;
@@ -74437,10 +75469,13 @@
75469 p->apCsr = (VdbeCursor **)&aMem[p->nMem+1];
75470 p->aOp = aOp = pProgram->aOp;
75471 p->nOp = pProgram->nOp;
75472 p->aOnceFlag = (u8 *)&p->apCsr[p->nCursor];
75473 p->nOnceFlag = pProgram->nOnce;
75474 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
75475 p->anExec = 0;
75476 #endif
75477 pc = -1;
75478 memset(p->aOnceFlag, 0, p->nOnceFlag);
75479
75480 break;
75481 }
@@ -74681,12 +75716,12 @@
75716
75717 #ifndef SQLITE_OMIT_WAL
75718 /* Opcode: Checkpoint P1 P2 P3 * *
75719 **
75720 ** Checkpoint database P1. This is a no-op if P1 is not currently in
75721 ** WAL mode. Parameter P2 is one of SQLITE_CHECKPOINT_PASSIVE, FULL,
75722 ** RESTART, or TRUNCATE. Write 1 or 0 into mem[P3] if the checkpoint returns
75723 ** SQLITE_BUSY or not, respectively. Write the number of pages in the
75724 ** WAL after the checkpoint into mem[P3+1] and the number of pages
75725 ** in the WAL that have been checkpointed after the checkpoint
75726 ** completes into mem[P3+2]. However on an error, mem[P3+1] and
75727 ** mem[P3+2] are initialized to -1.
@@ -74700,10 +75735,11 @@
75735 aRes[0] = 0;
75736 aRes[1] = aRes[2] = -1;
75737 assert( pOp->p2==SQLITE_CHECKPOINT_PASSIVE
75738 || pOp->p2==SQLITE_CHECKPOINT_FULL
75739 || pOp->p2==SQLITE_CHECKPOINT_RESTART
75740 || pOp->p2==SQLITE_CHECKPOINT_TRUNCATE
75741 );
75742 rc = sqlite3Checkpoint(db, pOp->p1, pOp->p2, &aRes[1], &aRes[2]);
75743 if( rc==SQLITE_BUSY ){
75744 rc = SQLITE_OK;
75745 aRes[0] = 1;
@@ -75625,10 +76661,15 @@
76661 char *zErr = 0;
76662 Table *pTab;
76663 Parse *pParse = 0;
76664 Incrblob *pBlob = 0;
76665
76666 #ifdef SQLITE_ENABLE_API_ARMOR
76667 if( !sqlite3SafetyCheckOk(db) || ppBlob==0 || zTable==0 ){
76668 return SQLITE_MISUSE_BKPT;
76669 }
76670 #endif
76671 flags = !!flags; /* flags = (flags ? 1 : 0); */
76672 *ppBlob = 0;
76673
76674 sqlite3_mutex_enter(db->mutex);
76675
@@ -75843,11 +76884,10 @@
76884 v = (Vdbe*)p->pStmt;
76885
76886 if( n<0 || iOffset<0 || (iOffset+n)>p->nByte ){
76887 /* Request is out of range. Return a transient error. */
76888 rc = SQLITE_ERROR;
 
76889 }else if( v==0 ){
76890 /* If there is no statement handle, then the blob-handle has
76891 ** already been invalidated. Return SQLITE_ABORT in this case.
76892 */
76893 rc = SQLITE_ABORT;
@@ -75861,14 +76901,14 @@
76901 sqlite3BtreeLeaveCursor(p->pCsr);
76902 if( rc==SQLITE_ABORT ){
76903 sqlite3VdbeFinalize(v);
76904 p->pStmt = 0;
76905 }else{
 
76906 v->rc = rc;
76907 }
76908 }
76909 sqlite3Error(db, rc);
76910 rc = sqlite3ApiExit(db, rc);
76911 sqlite3_mutex_leave(db->mutex);
76912 return rc;
76913 }
76914
@@ -76041,11 +77081,11 @@
77081 ** itself.
77082 **
77083 ** The sorter is running in multi-threaded mode if (a) the library was built
77084 ** with pre-processor symbol SQLITE_MAX_WORKER_THREADS set to a value greater
77085 ** than zero, and (b) worker threads have been enabled at runtime by calling
77086 ** "PRAGMA threads=N" with some value of N greater than 0.
77087 **
77088 ** When Rewind() is called, any data remaining in memory is flushed to a
77089 ** final PMA. So at this point the data is stored in some number of sorted
77090 ** PMAs within temporary files on disk.
77091 **
@@ -76086,10 +77126,17 @@
77126 */
77127 #if 0
77128 # define SQLITE_DEBUG_SORTER_THREADS 1
77129 #endif
77130
77131 /*
77132 ** Hard-coded maximum amount of data to accumulate in memory before flushing
77133 ** to a level 0 PMA. The purpose of this limit is to prevent various integer
77134 ** overflows. 512MiB.
77135 */
77136 #define SQLITE_MAX_MXPMASIZE (1<<29)
77137
77138 /*
77139 ** Private objects used by the sorter
77140 */
77141 typedef struct MergeEngine MergeEngine; /* Merge PMAs together */
77142 typedef struct PmaReader PmaReader; /* Incrementally read one PMA */
@@ -76784,17 +77831,15 @@
77831
77832 if( !sqlite3TempInMemory(db) ){
77833 pSorter->mnPmaSize = SORTER_MIN_WORKING * pgsz;
77834 mxCache = db->aDb[0].pSchema->cache_size;
77835 if( mxCache<SORTER_MIN_WORKING ) mxCache = SORTER_MIN_WORKING;
77836 pSorter->mxPmaSize = MIN((i64)mxCache*pgsz, SQLITE_MAX_MXPMASIZE);
77837
77838 /* EVIDENCE-OF: R-26747-61719 When the application provides any amount of
77839 ** scratch memory using SQLITE_CONFIG_SCRATCH, SQLite avoids unnecessary
77840 ** large heap allocations.
 
 
77841 */
77842 if( sqlite3GlobalConfig.pScratch==0 ){
77843 assert( pSorter->iMemory==0 );
77844 pSorter->nMemory = pgsz;
77845 pSorter->list.aMemory = (u8*)sqlite3Malloc(pgsz);
@@ -79162,19 +80207,19 @@
80207 **
80208 ** incrAggFunctionDepth(pExpr,n) is the main routine. incrAggDepth(..)
80209 ** is a helper function - a callback for the tree walker.
80210 */
80211 static int incrAggDepth(Walker *pWalker, Expr *pExpr){
80212 if( pExpr->op==TK_AGG_FUNCTION ) pExpr->op2 += pWalker->u.n;
80213 return WRC_Continue;
80214 }
80215 static void incrAggFunctionDepth(Expr *pExpr, int N){
80216 if( N>0 ){
80217 Walker w;
80218 memset(&w, 0, sizeof(w));
80219 w.xExprCallback = incrAggDepth;
80220 w.u.n = N;
80221 sqlite3WalkExpr(&w, pExpr);
80222 }
80223 }
80224
80225 /*
@@ -79454,10 +80499,14 @@
80499 }
80500 }
80501 if( pMatch ){
80502 pExpr->iTable = pMatch->iCursor;
80503 pExpr->pTab = pMatch->pTab;
80504 assert( (pMatch->jointype & JT_RIGHT)==0 ); /* RIGHT JOIN not (yet) supported */
80505 if( (pMatch->jointype & JT_LEFT)!=0 ){
80506 ExprSetProperty(pExpr, EP_CanBeNull);
80507 }
80508 pSchema = pExpr->pTab->pSchema;
80509 }
80510 } /* if( pSrcList ) */
80511
80512 #ifndef SQLITE_OMIT_TRIGGER
@@ -79718,11 +80767,11 @@
80767 double r = -1.0;
80768 if( p->op!=TK_FLOAT ) return -1;
80769 sqlite3AtoF(p->u.zToken, &r, sqlite3Strlen30(p->u.zToken), SQLITE_UTF8);
80770 assert( r>=0.0 );
80771 if( r>1.0 ) return -1;
80772 return (int)(r*134217728.0);
80773 }
80774
80775 /*
80776 ** This routine is callback for sqlite3WalkExpr().
80777 **
@@ -79850,11 +80899,11 @@
80899 ** EVIDENCE-OF: R-36850-34127 The likely(X) function is short-hand for
80900 ** likelihood(X,0.9375).
80901 ** EVIDENCE-OF: R-53436-40973 The likely(X) function is equivalent to
80902 ** likelihood(X,0.9375). */
80903 /* TUNING: unlikely() probability is 0.0625. likely() is 0.9375 */
80904 pExpr->iTable = pDef->zName[0]=='u' ? 8388608 : 125829120;
80905 }
80906 }
80907 #ifndef SQLITE_OMIT_AUTHORIZATION
80908 auth = sqlite3AuthCheck(pParse, SQLITE_FUNCTION, 0, pDef->zName, 0);
80909 if( auth!=SQLITE_OK ){
@@ -81807,69 +82856,79 @@
82856 sqlite3DbFree(db, pList->a);
82857 sqlite3DbFree(db, pList);
82858 }
82859
82860 /*
82861 ** These routines are Walker callbacks used to check expressions to
82862 ** see if they are "constant" for some definition of constant. The
82863 ** Walker.eCode value determines the type of "constant" we are looking
82864 ** for.
82865 **
82866 ** These callback routines are used to implement the following:
82867 **
82868 ** sqlite3ExprIsConstant() pWalker->eCode==1
82869 ** sqlite3ExprIsConstantNotJoin() pWalker->eCode==2
82870 ** sqlite3ExprRefOneTableOnly() pWalker->eCode==3
82871 ** sqlite3ExprIsConstantOrFunction() pWalker->eCode==4 or 5
82872 **
82873 ** In all cases, the callbacks set Walker.eCode=0 and abort if the expression
82874 ** is found to not be a constant.
82875 **
82876 ** The sqlite3ExprIsConstantOrFunction() is used for evaluating expressions
82877 ** in a CREATE TABLE statement. The Walker.eCode value is 5 when parsing
82878 ** an existing schema and 4 when processing a new statement. A bound
82879 ** parameter raises an error for new statements, but is silently converted
82880 ** to NULL for existing schemas. This allows sqlite_master tables that
82881 ** contain a bound parameter because they were generated by older versions
82882 ** of SQLite to be parsed by newer versions of SQLite without raising a
82883 ** malformed schema error.
82884 */
82885 static int exprNodeIsConstant(Walker *pWalker, Expr *pExpr){
82886
82887 /* If pWalker->eCode is 2 then any term of the expression that comes from
82888 ** the ON or USING clauses of a left join disqualifies the expression
82889 ** from being considered constant. */
82890 if( pWalker->eCode==2 && ExprHasProperty(pExpr, EP_FromJoin) ){
82891 pWalker->eCode = 0;
82892 return WRC_Abort;
82893 }
82894
82895 switch( pExpr->op ){
82896 /* Consider functions to be constant if all their arguments are constant
82897 ** and either pWalker->eCode==4 or 5 or the function has the
82898 ** SQLITE_FUNC_CONST flag. */
82899 case TK_FUNCTION:
82900 if( pWalker->eCode>=4 || ExprHasProperty(pExpr,EP_Constant) ){
82901 return WRC_Continue;
82902 }else{
82903 pWalker->eCode = 0;
82904 return WRC_Abort;
82905 }
 
82906 case TK_ID:
82907 case TK_COLUMN:
82908 case TK_AGG_FUNCTION:
82909 case TK_AGG_COLUMN:
82910 testcase( pExpr->op==TK_ID );
82911 testcase( pExpr->op==TK_COLUMN );
82912 testcase( pExpr->op==TK_AGG_FUNCTION );
82913 testcase( pExpr->op==TK_AGG_COLUMN );
82914 if( pWalker->eCode==3 && pExpr->iTable==pWalker->u.iCur ){
82915 return WRC_Continue;
82916 }else{
82917 pWalker->eCode = 0;
82918 return WRC_Abort;
82919 }
82920 case TK_VARIABLE:
82921 if( pWalker->eCode==5 ){
82922 /* Silently convert bound parameters that appear inside of CREATE
82923 ** statements into a NULL when parsing the CREATE statement text out
82924 ** of the sqlite_master table */
82925 pExpr->op = TK_NULL;
82926 }else if( pWalker->eCode==4 ){
82927 /* A bound parameter in a CREATE statement that originates from
82928 ** sqlite3_prepare() causes an error */
82929 pWalker->eCode = 0;
82930 return WRC_Abort;
82931 }
82932 /* Fall through */
82933 default:
82934 testcase( pExpr->op==TK_SELECT ); /* selectNodeIsConstant will disallow */
@@ -81877,57 +82936,68 @@
82936 return WRC_Continue;
82937 }
82938 }
82939 static int selectNodeIsConstant(Walker *pWalker, Select *NotUsed){
82940 UNUSED_PARAMETER(NotUsed);
82941 pWalker->eCode = 0;
82942 return WRC_Abort;
82943 }
82944 static int exprIsConst(Expr *p, int initFlag, int iCur){
82945 Walker w;
82946 memset(&w, 0, sizeof(w));
82947 w.eCode = initFlag;
82948 w.xExprCallback = exprNodeIsConstant;
82949 w.xSelectCallback = selectNodeIsConstant;
82950 w.u.iCur = iCur;
82951 sqlite3WalkExpr(&w, p);
82952 return w.eCode;
82953 }
82954
82955 /*
82956 ** Walk an expression tree. Return non-zero if the expression is constant
82957 ** and 0 if it involves variables or function calls.
82958 **
82959 ** For the purposes of this function, a double-quoted string (ex: "abc")
82960 ** is considered a variable but a single-quoted string (ex: 'abc') is
82961 ** a constant.
82962 */
82963 SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr *p){
82964 return exprIsConst(p, 1, 0);
82965 }
82966
82967 /*
82968 ** Walk an expression tree. Return non-zero if the expression is constant
82969 ** that does no originate from the ON or USING clauses of a join.
82970 ** Return 0 if it involves variables or function calls or terms from
82971 ** an ON or USING clause.
82972 */
82973 SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr *p){
82974 return exprIsConst(p, 2, 0);
82975 }
82976
82977 /*
82978 ** Walk an expression tree. Return non-zero if the expression constant
82979 ** for any single row of the table with cursor iCur. In other words, the
82980 ** expression must not refer to any non-deterministic function nor any
82981 ** table other than iCur.
82982 */
82983 SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr *p, int iCur){
82984 return exprIsConst(p, 3, iCur);
82985 }
82986
82987 /*
82988 ** Walk an expression tree. Return non-zero if the expression is constant
82989 ** or a function call with constant arguments. Return and 0 if there
82990 ** are any variables.
82991 **
82992 ** For the purposes of this function, a double-quoted string (ex: "abc")
82993 ** is considered a variable but a single-quoted string (ex: 'abc') is
82994 ** a constant.
82995 */
82996 SQLITE_PRIVATE int sqlite3ExprIsConstantOrFunction(Expr *p, u8 isInit){
82997 assert( isInit==0 || isInit==1 );
82998 return exprIsConst(p, 4+isInit, 0);
82999 }
83000
83001 /*
83002 ** If the expression p codes a constant integer that is small enough
83003 ** to fit in a 32-bit integer, return 1 and put the value of the integer
@@ -81990,11 +83060,12 @@
83060 case TK_FLOAT:
83061 case TK_BLOB:
83062 return 0;
83063 case TK_COLUMN:
83064 assert( p->pTab!=0 );
83065 return ExprHasProperty(p, EP_CanBeNull) ||
83066 (p->iColumn>=0 && p->pTab->aCol[p->iColumn].notNull==0);
83067 default:
83068 return 1;
83069 }
83070 }
83071
@@ -82433,11 +83504,10 @@
83504 sqlite3SelectDestInit(&dest, SRT_Set, pExpr->iTable);
83505 dest.affSdst = (u8)affinity;
83506 assert( (pExpr->iTable&0x0000FFFF)==pExpr->iTable );
83507 pSelect->iLimit = 0;
83508 testcase( pSelect->selFlags & SF_Distinct );
 
83509 testcase( pKeyInfo==0 ); /* Caused by OOM in sqlite3KeyInfoAlloc() */
83510 if( sqlite3Select(pParse, pSelect, &dest) ){
83511 sqlite3KeyInfoUnref(pKeyInfo);
83512 return 0;
83513 }
@@ -83580,11 +84650,14 @@
84650 target
84651 ));
84652
84653 #ifndef SQLITE_OMIT_FLOATING_POINT
84654 /* If the column has REAL affinity, it may currently be stored as an
84655 ** integer. Use OP_RealAffinity to make sure it is really real.
84656 **
84657 ** EVIDENCE-OF: R-60985-57662 SQLite will convert the value back to
84658 ** floating point when extracting it from the record. */
84659 if( pExpr->iColumn>=0
84660 && pTab->aCol[pExpr->iColumn].affinity==SQLITE_AFF_REAL
84661 ){
84662 sqlite3VdbeAddOp1(v, OP_RealAffinity, target);
84663 }
@@ -87232,27 +88305,32 @@
88305 aLog[i] = sqlite3LogEst(v);
88306 #endif
88307 if( *z==' ' ) z++;
88308 }
88309 #ifndef SQLITE_ENABLE_STAT3_OR_STAT4
88310 assert( pIndex!=0 ); {
88311 #else
88312 if( pIndex ){
88313 #endif
88314 pIndex->bUnordered = 0;
88315 pIndex->noSkipScan = 0;
88316 while( z[0] ){
88317 if( sqlite3_strglob("unordered*", z)==0 ){
88318 pIndex->bUnordered = 1;
88319 }else if( sqlite3_strglob("sz=[0-9]*", z)==0 ){
88320 pIndex->szIdxRow = sqlite3LogEst(sqlite3Atoi(z+3));
88321 }else if( sqlite3_strglob("noskipscan*", z)==0 ){
88322 pIndex->noSkipScan = 1;
88323 }
88324 #ifdef SQLITE_ENABLE_COSTMULT
88325 else if( sqlite3_strglob("costmult=[0-9]*",z)==0 ){
88326 pIndex->pTable->costMult = sqlite3LogEst(sqlite3Atoi(z+9));
88327 }
88328 #endif
88329 while( z[0]!=0 && z[0]!=' ' ) z++;
88330 while( z[0]==' ' ) z++;
88331 }
 
 
 
88332 }
88333 }
88334
88335 /*
88336 ** This callback is invoked once for each index when reading the
@@ -87366,18 +88444,19 @@
88444 tRowcnt avgEq = 0;
88445 tRowcnt nRow; /* Number of rows in index */
88446 i64 nSum100 = 0; /* Number of terms contributing to sumEq */
88447 i64 nDist100; /* Number of distinct values in index */
88448
88449 if( !pIdx->aiRowEst || iCol>=pIdx->nKeyCol || pIdx->aiRowEst[iCol+1]==0 ){
88450 nRow = pFinal->anLt[iCol];
88451 nDist100 = (i64)100 * pFinal->anDLt[iCol];
88452 nSample--;
88453 }else{
88454 nRow = pIdx->aiRowEst[0];
88455 nDist100 = ((i64)100 * pIdx->aiRowEst[0]) / pIdx->aiRowEst[iCol+1];
88456 }
88457 pIdx->nRowEst0 = nRow;
88458
88459 /* Set nSum to the number of distinct (iCol+1) field prefixes that
88460 ** occur in the stat4 table for this index. Set sumEq to the sum of
88461 ** the nEq values for column iCol for the same set (adding the value
88462 ** only once where there exist duplicate prefixes). */
@@ -87635,11 +88714,11 @@
88714 }
88715
88716
88717 /* Load the statistics from the sqlite_stat4 table. */
88718 #ifdef SQLITE_ENABLE_STAT3_OR_STAT4
88719 if( rc==SQLITE_OK && OptimizationEnabled(db, SQLITE_Stat34) ){
88720 int lookasideEnabled = db->lookaside.bEnabled;
88721 db->lookaside.bEnabled = 0;
88722 rc = loadStat4(db, sInfo.zDatabase);
88723 db->lookaside.bEnabled = lookasideEnabled;
88724 }
@@ -88317,10 +89396,13 @@
89396 SQLITE_API int sqlite3_set_authorizer(
89397 sqlite3 *db,
89398 int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),
89399 void *pArg
89400 ){
89401 #ifdef SQLITE_ENABLE_API_ARMOR
89402 if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
89403 #endif
89404 sqlite3_mutex_enter(db->mutex);
89405 db->xAuth = (sqlite3_xauth)xAuth;
89406 db->pAuthArg = pArg;
89407 sqlite3ExpirePreparedStatements(db);
89408 sqlite3_mutex_leave(db->mutex);
@@ -88811,11 +89893,15 @@
89893 ** See also sqlite3LocateTable().
89894 */
89895 SQLITE_PRIVATE Table *sqlite3FindTable(sqlite3 *db, const char *zName, const char *zDatabase){
89896 Table *p = 0;
89897 int i;
89898
89899 #ifdef SQLITE_ENABLE_API_ARMOR
89900 if( !sqlite3SafetyCheckOk(db) || zName==0 ) return 0;
89901 #endif
89902
89903 /* All mutexes are required for schema access. Make sure we hold them. */
89904 assert( zDatabase!=0 || sqlite3BtreeHoldsAllMutexes(db) );
89905 #if SQLITE_USER_AUTHENTICATION
89906 /* Only the admin user is allowed to know that the sqlite_user table
89907 ** exists */
@@ -94275,12 +95361,12 @@
95361 break;
95362 }
95363 default: {
95364 /* Because sqlite3_value_double() returns 0.0 if the argument is not
95365 ** something that can be converted into a number, we have:
95366 ** IMP: R-01992-00519 Abs(X) returns 0.0 if X is a string or blob
95367 ** that cannot be converted to a numeric value.
95368 */
95369 double rVal = sqlite3_value_double(argv[0]);
95370 if( rVal<0 ) rVal = -rVal;
95371 sqlite3_result_double(context, rVal);
95372 break;
@@ -102928,11 +104014,11 @@
104014 break;
104015 #endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
104016
104017 #ifndef SQLITE_OMIT_WAL
104018 /*
104019 ** PRAGMA [database.]wal_checkpoint = passive|full|restart|truncate
104020 **
104021 ** Checkpoint the database.
104022 */
104023 case PragTyp_WAL_CHECKPOINT: {
104024 int iBt = (pId2->z?iDb:SQLITE_MAX_ATTACHED);
@@ -102940,10 +104026,12 @@
104026 if( zRight ){
104027 if( sqlite3StrICmp(zRight, "full")==0 ){
104028 eMode = SQLITE_CHECKPOINT_FULL;
104029 }else if( sqlite3StrICmp(zRight, "restart")==0 ){
104030 eMode = SQLITE_CHECKPOINT_RESTART;
104031 }else if( sqlite3StrICmp(zRight, "truncate")==0 ){
104032 eMode = SQLITE_CHECKPOINT_TRUNCATE;
104033 }
104034 }
104035 sqlite3VdbeSetNumCols(v, 3);
104036 pParse->nMem = 3;
104037 sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "busy", SQLITE_STATIC);
@@ -103834,13 +104922,16 @@
104922 Vdbe *pOld, /* VM being reprepared */
104923 sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
104924 const char **pzTail /* OUT: End of parsed string */
104925 ){
104926 int rc;
104927
104928 #ifdef SQLITE_ENABLE_API_ARMOR
104929 if( ppStmt==0 ) return SQLITE_MISUSE_BKPT;
104930 #endif
104931 *ppStmt = 0;
104932 if( !sqlite3SafetyCheckOk(db)||zSql==0 ){
104933 return SQLITE_MISUSE_BKPT;
104934 }
104935 sqlite3_mutex_enter(db->mutex);
104936 sqlite3BtreeEnterAll(db);
104937 rc = sqlite3Prepare(db, zSql, nBytes, saveSqlFlag, pOld, ppStmt, pzTail);
@@ -103943,13 +105034,15 @@
105034 */
105035 char *zSql8;
105036 const char *zTail8 = 0;
105037 int rc = SQLITE_OK;
105038
105039 #ifdef SQLITE_ENABLE_API_ARMOR
105040 if( ppStmt==0 ) return SQLITE_MISUSE_BKPT;
105041 #endif
105042 *ppStmt = 0;
105043 if( !sqlite3SafetyCheckOk(db)||zSql==0 ){
105044 return SQLITE_MISUSE_BKPT;
105045 }
105046 if( nBytes>=0 ){
105047 int sz;
105048 const char *z = (const char*)zSql;
@@ -108842,11 +109935,11 @@
109935 **
109936 ** SELECT DISTINCT xyz FROM ... ORDER BY xyz
109937 **
109938 ** is transformed to:
109939 **
109940 ** SELECT xyz FROM ... GROUP BY xyz ORDER BY xyz
109941 **
109942 ** The second form is preferred as a single index (or temp-table) may be
109943 ** used for both the ORDER BY and DISTINCT processing. As originally
109944 ** written the query must use a temp-table for at least one of the ORDER
109945 ** BY and DISTINCT, and an index or separate temp-table for the other.
@@ -108855,11 +109948,10 @@
109948 && sqlite3ExprListCompare(sSort.pOrderBy, p->pEList, -1)==0
109949 ){
109950 p->selFlags &= ~SF_Distinct;
109951 p->pGroupBy = sqlite3ExprListDup(db, p->pEList, 0);
109952 pGroupBy = p->pGroupBy;
 
109953 /* Notice that even thought SF_Distinct has been cleared from p->selFlags,
109954 ** the sDistinct.isTnct is still set. Hence, isTnct represents the
109955 ** original setting of the SF_Distinct flag, not the current setting */
109956 assert( sDistinct.isTnct );
109957 }
@@ -109658,10 +110750,13 @@
110750 char **pzErrMsg /* Write error messages here */
110751 ){
110752 int rc;
110753 TabResult res;
110754
110755 #ifdef SQLITE_ENABLE_API_ARMOR
110756 if( pazResult==0 ) return SQLITE_MISUSE_BKPT;
110757 #endif
110758 *pazResult = 0;
110759 if( pnColumn ) *pnColumn = 0;
110760 if( pnRow ) *pnRow = 0;
110761 if( pzErrMsg ) *pzErrMsg = 0;
110762 res.zErrMsg = 0;
@@ -111721,11 +112816,11 @@
112816 ** Two writes per page are required in step (3) because the original
112817 ** database content must be written into the rollback journal prior to
112818 ** overwriting the database with the vacuumed content.
112819 **
112820 ** Only 1x temporary space and only 1x writes would be required if
112821 ** the copy of step (3) were replaced by deleting the original database
112822 ** and renaming the transient database as the original. But that will
112823 ** not work if other processes are attached to the original database.
112824 ** And a power loss in between deleting the original and renaming the
112825 ** transient would cause the database file to appear to be deleted
112826 ** following reboot.
@@ -112079,10 +113174,13 @@
113174 sqlite3 *db, /* Database in which module is registered */
113175 const char *zName, /* Name assigned to this module */
113176 const sqlite3_module *pModule, /* The definition of the module */
113177 void *pAux /* Context pointer for xCreate/xConnect */
113178 ){
113179 #ifdef SQLITE_ENABLE_API_ARMOR
113180 if( !sqlite3SafetyCheckOk(db) || zName==0 ) return SQLITE_MISUSE_BKPT;
113181 #endif
113182 return createModule(db, zName, pModule, pAux, 0);
113183 }
113184
113185 /*
113186 ** External API function used to create a new virtual-table module.
@@ -112092,10 +113190,13 @@
113190 const char *zName, /* Name assigned to this module */
113191 const sqlite3_module *pModule, /* The definition of the module */
113192 void *pAux, /* Context pointer for xCreate/xConnect */
113193 void (*xDestroy)(void *) /* Module destructor function */
113194 ){
113195 #ifdef SQLITE_ENABLE_API_ARMOR
113196 if( !sqlite3SafetyCheckOk(db) || zName==0 ) return SQLITE_MISUSE_BKPT;
113197 #endif
113198 return createModule(db, zName, pModule, pAux, xDestroy);
113199 }
113200
113201 /*
113202 ** Lock the virtual table so that it cannot be disconnected.
@@ -112324,11 +113425,16 @@
113425 pTable->tabFlags |= TF_Virtual;
113426 pTable->nModuleArg = 0;
113427 addModuleArgument(db, pTable, sqlite3NameFromToken(db, pModuleName));
113428 addModuleArgument(db, pTable, 0);
113429 addModuleArgument(db, pTable, sqlite3DbStrDup(db, pTable->zName));
113430 assert( (pParse->sNameToken.z==pName2->z && pName2->z!=0)
113431 || (pParse->sNameToken.z==pName1->z && pName2->z==0)
113432 );
113433 pParse->sNameToken.n = (int)(
113434 &pModuleName->z[pModuleName->n] - pParse->sNameToken.z
113435 );
113436
113437 #ifndef SQLITE_OMIT_AUTHORIZATION
113438 /* Creating a virtual table invokes the authorization callback twice.
113439 ** The first invocation, to obtain permission to INSERT a row into the
113440 ** sqlite_master table, has already been made by sqlite3StartTable().
@@ -112696,10 +113802,13 @@
113802
113803 int rc = SQLITE_OK;
113804 Table *pTab;
113805 char *zErr = 0;
113806
113807 #ifdef SQLITE_ENABLE_API_ARMOR
113808 if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
113809 #endif
113810 sqlite3_mutex_enter(db->mutex);
113811 if( !db->pVtabCtx || !(pTab = db->pVtabCtx->pTab) ){
113812 sqlite3Error(db, SQLITE_MISUSE);
113813 sqlite3_mutex_leave(db->mutex);
113814 return SQLITE_MISUSE_BKPT;
@@ -113052,10 +114161,13 @@
114161 */
114162 SQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *db){
114163 static const unsigned char aMap[] = {
114164 SQLITE_ROLLBACK, SQLITE_ABORT, SQLITE_FAIL, SQLITE_IGNORE, SQLITE_REPLACE
114165 };
114166 #ifdef SQLITE_ENABLE_API_ARMOR
114167 if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
114168 #endif
114169 assert( OE_Rollback==1 && OE_Abort==2 && OE_Fail==3 );
114170 assert( OE_Ignore==4 && OE_Replace==5 );
114171 assert( db->vtabOnConflict>=1 && db->vtabOnConflict<=5 );
114172 return (int)aMap[db->vtabOnConflict-1];
114173 }
@@ -113067,12 +114179,14 @@
114179 */
114180 SQLITE_API int sqlite3_vtab_config(sqlite3 *db, int op, ...){
114181 va_list ap;
114182 int rc = SQLITE_OK;
114183
114184 #ifdef SQLITE_ENABLE_API_ARMOR
114185 if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
114186 #endif
114187 sqlite3_mutex_enter(db->mutex);
 
114188 va_start(ap, op);
114189 switch( op ){
114190 case SQLITE_VTAB_CONSTRAINT_SUPPORT: {
114191 VtabCtx *p = db->pVtabCtx;
114192 if( !p ){
@@ -113203,10 +114317,13 @@
114317 } in; /* Used when pWLoop->wsFlags&WHERE_IN_ABLE */
114318 Index *pCovidx; /* Possible covering index for WHERE_MULTI_OR */
114319 } u;
114320 struct WhereLoop *pWLoop; /* The selected WhereLoop object */
114321 Bitmask notReady; /* FROM entries not usable at this level */
114322 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
114323 int addrVisit; /* Address at which row is visited */
114324 #endif
114325 };
114326
114327 /*
114328 ** Each instance of this object represents an algorithm for evaluating one
114329 ** term of a join. Every term of the FROM clause will have at least
@@ -113233,11 +114350,10 @@
114350 LogEst rRun; /* Cost of running each loop */
114351 LogEst nOut; /* Estimated number of output rows */
114352 union {
114353 struct { /* Information for internal btree tables */
114354 u16 nEq; /* Number of equality constraints */
 
114355 Index *pIndex; /* Index used, or NULL */
114356 } btree;
114357 struct { /* Information for virtual tables */
114358 int idxNum; /* Index number */
114359 u8 needFree; /* True if sqlite3_free(idxStr) is needed */
@@ -113246,16 +114362,17 @@
114362 char *idxStr; /* Index identifier string */
114363 } vtab;
114364 } u;
114365 u32 wsFlags; /* WHERE_* flags describing the plan */
114366 u16 nLTerm; /* Number of entries in aLTerm[] */
114367 u16 nSkip; /* Number of NULL aLTerm[] entries */
114368 /**** whereLoopXfer() copies fields above ***********************/
114369 # define WHERE_LOOP_XFER_SZ offsetof(WhereLoop,nLSlot)
114370 u16 nLSlot; /* Number of slots allocated for aLTerm[] */
114371 WhereTerm **aLTerm; /* WhereTerms used */
114372 WhereLoop *pNextLoop; /* Next WhereLoop object in the WhereClause */
114373 WhereTerm *aLTermSpace[3]; /* Initial aLTerm[] space */
114374 };
114375
114376 /* This object holds the prerequisites and the cost of running a
114377 ** subquery on one operand of an OR operator in the WHERE clause.
114378 ** See WhereOrSet for additional information
@@ -113577,10 +114694,11 @@
114694 #define WHERE_ONEROW 0x00001000 /* Selects no more than one row */
114695 #define WHERE_MULTI_OR 0x00002000 /* OR using multiple indices */
114696 #define WHERE_AUTO_INDEX 0x00004000 /* Uses an ephemeral index */
114697 #define WHERE_SKIPSCAN 0x00008000 /* Uses the skip-scan algorithm */
114698 #define WHERE_UNQ_WANTED 0x00010000 /* WHERE_ONEROW would have been helpful*/
114699 #define WHERE_PARTIALIDX 0x00020000 /* The automatic index is partial */
114700
114701 /************** End of whereInt.h ********************************************/
114702 /************** Continuing where we left off in where.c **********************/
114703
114704 /*
@@ -113784,14 +114902,15 @@
114902 memcpy(pWC->a, pOld, sizeof(pWC->a[0])*pWC->nTerm);
114903 if( pOld!=pWC->aStatic ){
114904 sqlite3DbFree(db, pOld);
114905 }
114906 pWC->nSlot = sqlite3DbMallocSize(db, pWC->a)/sizeof(pWC->a[0]);
114907 memset(&pWC->a[pWC->nTerm], 0, sizeof(pWC->a[0])*(pWC->nSlot-pWC->nTerm));
114908 }
114909 pTerm = &pWC->a[idx = pWC->nTerm++];
114910 if( p && ExprHasProperty(p, EP_Unlikely) ){
114911 pTerm->truthProb = sqlite3LogEst(p->iTable) - 270;
114912 }else{
114913 pTerm->truthProb = 1;
114914 }
114915 pTerm->pExpr = sqlite3ExprSkipCollate(p);
114916 pTerm->wtFlags = wtFlags;
@@ -114317,10 +115436,19 @@
115436 if( pDerived ){
115437 pDerived->flags |= pBase->flags & EP_FromJoin;
115438 pDerived->iRightJoinTable = pBase->iRightJoinTable;
115439 }
115440 }
115441
115442 /*
115443 ** Mark term iChild as being a child of term iParent
115444 */
115445 static void markTermAsChild(WhereClause *pWC, int iChild, int iParent){
115446 pWC->a[iChild].iParent = iParent;
115447 pWC->a[iChild].truthProb = pWC->a[iParent].truthProb;
115448 pWC->a[iParent].nChild++;
115449 }
115450
115451 #if !defined(SQLITE_OMIT_OR_OPTIMIZATION) && !defined(SQLITE_OMIT_SUBQUERY)
115452 /*
115453 ** Analyze a term that consists of two or more OR-connected
115454 ** subterms. So in:
@@ -114615,12 +115743,11 @@
115743 pNew->x.pList = pList;
115744 idxNew = whereClauseInsert(pWC, pNew, TERM_VIRTUAL|TERM_DYNAMIC);
115745 testcase( idxNew==0 );
115746 exprAnalyze(pSrc, pWC, idxNew);
115747 pTerm = &pWC->a[idxTerm];
115748 markTermAsChild(pWC, idxNew, idxTerm);
 
115749 }else{
115750 sqlite3ExprListDelete(db, pList);
115751 }
115752 pTerm->eOperator = WO_NOOP; /* case 1 trumps case 2 */
115753 }
@@ -114718,13 +115845,12 @@
115845 return;
115846 }
115847 idxNew = whereClauseInsert(pWC, pDup, TERM_VIRTUAL|TERM_DYNAMIC);
115848 if( idxNew==0 ) return;
115849 pNew = &pWC->a[idxNew];
115850 markTermAsChild(pWC, idxNew, idxTerm);
115851 pTerm = &pWC->a[idxTerm];
 
115852 pTerm->wtFlags |= TERM_COPIED;
115853 if( pExpr->op==TK_EQ
115854 && !ExprHasProperty(pExpr, EP_FromJoin)
115855 && OptimizationEnabled(db, SQLITE_Transitive)
115856 ){
@@ -114777,13 +115903,12 @@
115903 transferJoinMarkings(pNewExpr, pExpr);
115904 idxNew = whereClauseInsert(pWC, pNewExpr, TERM_VIRTUAL|TERM_DYNAMIC);
115905 testcase( idxNew==0 );
115906 exprAnalyze(pSrc, pWC, idxNew);
115907 pTerm = &pWC->a[idxTerm];
115908 markTermAsChild(pWC, idxNew, idxTerm);
115909 }
 
115910 }
115911 #endif /* SQLITE_OMIT_BETWEEN_OPTIMIZATION */
115912
115913 #if !defined(SQLITE_OMIT_OR_OPTIMIZATION) && !defined(SQLITE_OMIT_SUBQUERY)
115914 /* Analyze a term that is composed of two or more subterms connected by
@@ -114854,13 +115979,12 @@
115979 idxNew2 = whereClauseInsert(pWC, pNewExpr2, TERM_VIRTUAL|TERM_DYNAMIC);
115980 testcase( idxNew2==0 );
115981 exprAnalyze(pSrc, pWC, idxNew2);
115982 pTerm = &pWC->a[idxTerm];
115983 if( isComplete ){
115984 markTermAsChild(pWC, idxNew1, idxTerm);
115985 markTermAsChild(pWC, idxNew2, idxTerm);
 
115986 }
115987 }
115988 #endif /* SQLITE_OMIT_LIKE_OPTIMIZATION */
115989
115990 #ifndef SQLITE_OMIT_VIRTUALTABLE
@@ -114889,13 +116013,12 @@
116013 pNewTerm = &pWC->a[idxNew];
116014 pNewTerm->prereqRight = prereqExpr;
116015 pNewTerm->leftCursor = pLeft->iTable;
116016 pNewTerm->u.leftColumn = pLeft->iColumn;
116017 pNewTerm->eOperator = WO_MATCH;
116018 markTermAsChild(pWC, idxNew, idxTerm);
116019 pTerm = &pWC->a[idxTerm];
 
116020 pTerm->wtFlags |= TERM_COPIED;
116021 pNewTerm->prereqAll = pTerm->prereqAll;
116022 }
116023 }
116024 #endif /* SQLITE_OMIT_VIRTUALTABLE */
@@ -114912,11 +116035,11 @@
116035 ** the start of the loop will prevent any results from being returned.
116036 */
116037 if( pExpr->op==TK_NOTNULL
116038 && pExpr->pLeft->op==TK_COLUMN
116039 && pExpr->pLeft->iColumn>=0
116040 && OptimizationEnabled(db, SQLITE_Stat34)
116041 ){
116042 Expr *pNewExpr;
116043 Expr *pLeft = pExpr->pLeft;
116044 int idxNew;
116045 WhereTerm *pNewTerm;
@@ -114931,13 +116054,12 @@
116054 pNewTerm = &pWC->a[idxNew];
116055 pNewTerm->prereqRight = 0;
116056 pNewTerm->leftCursor = pLeft->iTable;
116057 pNewTerm->u.leftColumn = pLeft->iColumn;
116058 pNewTerm->eOperator = WO_GT;
116059 markTermAsChild(pWC, idxNew, idxTerm);
116060 pTerm = &pWC->a[idxTerm];
 
116061 pTerm->wtFlags |= TERM_COPIED;
116062 pNewTerm->prereqAll = pTerm->prereqAll;
116063 }
116064 }
116065 #endif /* SQLITE_ENABLE_STAT3_OR_STAT4 */
@@ -115153,10 +116275,12 @@
116275 WhereLoop *pLoop; /* The Loop object */
116276 char *zNotUsed; /* Extra space on the end of pIdx */
116277 Bitmask idxCols; /* Bitmap of columns used for indexing */
116278 Bitmask extraCols; /* Bitmap of additional columns */
116279 u8 sentWarning = 0; /* True if a warnning has been issued */
116280 Expr *pPartial = 0; /* Partial Index Expression */
116281 int iContinue = 0; /* Jump here to skip excluded rows */
116282
116283 /* Generate code to skip over the creation and initialization of the
116284 ** transient index on 2nd and subsequent iterations of the loop. */
116285 v = pParse->pVdbe;
116286 assert( v!=0 );
@@ -115168,10 +116292,16 @@
116292 pTable = pSrc->pTab;
116293 pWCEnd = &pWC->a[pWC->nTerm];
116294 pLoop = pLevel->pWLoop;
116295 idxCols = 0;
116296 for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){
116297 if( pLoop->prereq==0
116298 && (pTerm->wtFlags & TERM_VIRTUAL)==0
116299 && sqlite3ExprIsTableConstant(pTerm->pExpr, pSrc->iCursor) ){
116300 pPartial = sqlite3ExprAnd(pParse->db, pPartial,
116301 sqlite3ExprDup(pParse->db, pTerm->pExpr, 0));
116302 }
116303 if( termCanDriveIndex(pTerm, pSrc, notReady) ){
116304 int iCol = pTerm->u.leftColumn;
116305 Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol);
116306 testcase( iCol==BMS );
116307 testcase( iCol==BMS-1 );
@@ -115180,11 +116310,13 @@
116310 "automatic index on %s(%s)", pTable->zName,
116311 pTable->aCol[iCol].zName);
116312 sentWarning = 1;
116313 }
116314 if( (idxCols & cMask)==0 ){
116315 if( whereLoopResize(pParse->db, pLoop, nKeyCol+1) ){
116316 goto end_auto_index_create;
116317 }
116318 pLoop->aLTerm[nKeyCol++] = pTerm;
116319 idxCols |= cMask;
116320 }
116321 }
116322 }
@@ -115200,24 +116332,23 @@
116332 ** be a covering index because the index will not be updated if the
116333 ** original table changes and the index and table cannot both be used
116334 ** if they go out of sync.
116335 */
116336 extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1));
116337 mxBitCol = MIN(BMS-1,pTable->nCol);
116338 testcase( pTable->nCol==BMS-1 );
116339 testcase( pTable->nCol==BMS-2 );
116340 for(i=0; i<mxBitCol; i++){
116341 if( extraCols & MASKBIT(i) ) nKeyCol++;
116342 }
116343 if( pSrc->colUsed & MASKBIT(BMS-1) ){
116344 nKeyCol += pTable->nCol - BMS + 1;
116345 }
 
116346
116347 /* Construct the Index object to describe this index */
116348 pIdx = sqlite3AllocateIndexObject(pParse->db, nKeyCol+1, 0, &zNotUsed);
116349 if( pIdx==0 ) goto end_auto_index_create;
116350 pLoop->u.btree.pIndex = pIdx;
116351 pIdx->zName = "auto-index";
116352 pIdx->pTable = pTable;
116353 n = 0;
116354 idxCols = 0;
@@ -115265,22 +116396,33 @@
116396 sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1);
116397 sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
116398 VdbeComment((v, "for %s", pTable->zName));
116399
116400 /* Fill the automatic index with content */
116401 sqlite3ExprCachePush(pParse);
116402 addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, pLevel->iTabCur); VdbeCoverage(v);
116403 if( pPartial ){
116404 iContinue = sqlite3VdbeMakeLabel(v);
116405 sqlite3ExprIfFalse(pParse, pPartial, iContinue, SQLITE_JUMPIFNULL);
116406 pLoop->wsFlags |= WHERE_PARTIALIDX;
116407 }
116408 regRecord = sqlite3GetTempReg(pParse);
116409 sqlite3GenerateIndexKey(pParse, pIdx, pLevel->iTabCur, regRecord, 0, 0, 0, 0);
116410 sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord);
116411 sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
116412 if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue);
116413 sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v);
116414 sqlite3VdbeChangeP5(v, SQLITE_STMTSTATUS_AUTOINDEX);
116415 sqlite3VdbeJumpHere(v, addrTop);
116416 sqlite3ReleaseTempReg(pParse, regRecord);
116417 sqlite3ExprCachePop(pParse);
116418
116419 /* Jump here when skipping the initialization */
116420 sqlite3VdbeJumpHere(v, addrInit);
116421
116422 end_auto_index_create:
116423 sqlite3ExprDelete(pParse->db, pPartial);
116424 }
116425 #endif /* SQLITE_OMIT_AUTOMATIC_INDEX */
116426
116427 #ifndef SQLITE_OMIT_VIRTUALTABLE
116428 /*
@@ -115436,22 +116578,22 @@
116578
116579 return pParse->nErr;
116580 }
116581 #endif /* !defined(SQLITE_OMIT_VIRTUALTABLE) */
116582
 
116583 #ifdef SQLITE_ENABLE_STAT3_OR_STAT4
116584 /*
116585 ** Estimate the location of a particular key among all keys in an
116586 ** index. Store the results in aStat as follows:
116587 **
116588 ** aStat[0] Est. number of rows less than pVal
116589 ** aStat[1] Est. number of rows equal to pVal
116590 **
116591 ** Return the index of the sample that is the smallest sample that
116592 ** is greater than or equal to pRec.
116593 */
116594 static int whereKeyStats(
116595 Parse *pParse, /* Database connection */
116596 Index *pIdx, /* Index to consider domain of */
116597 UnpackedRecord *pRec, /* Vector of values to consider */
116598 int roundUp, /* Round up if true. Round down if false */
116599 tRowcnt *aStat /* OUT: stats written here */
@@ -115529,10 +116671,11 @@
116671 }else{
116672 iGap = iGap/3;
116673 }
116674 aStat[0] = iLower + iGap;
116675 }
116676 return i;
116677 }
116678 #endif /* SQLITE_ENABLE_STAT3_OR_STAT4 */
116679
116680 /*
116681 ** If it is not NULL, pTerm is a term that provides an upper or lower
@@ -115679,11 +116822,11 @@
116822 ** pLower pUpper
116823 **
116824 ** If either of the upper or lower bound is not present, then NULL is passed in
116825 ** place of the corresponding WhereTerm.
116826 **
116827 ** The value in (pBuilder->pNew->u.btree.nEq) is the number of the index
116828 ** column subject to the range constraint. Or, equivalently, the number of
116829 ** equality constraints optimized by the proposed index scan. For example,
116830 ** assuming index p is on t1(a, b), and the SQL query is:
116831 **
116832 ** ... FROM t1 WHERE a = ? AND b > ? AND b < ? ...
@@ -115695,11 +116838,11 @@
116838 **
116839 ** then nEq is set to 0.
116840 **
116841 ** When this function is called, *pnOut is set to the sqlite3LogEst() of the
116842 ** number of rows that the index scan is expected to visit without
116843 ** considering the range constraints. If nEq is 0, then *pnOut is the number of
116844 ** rows in the index. Assuming no error occurs, *pnOut is adjusted (reduced)
116845 ** to account for the range constraints pLower and pUpper.
116846 **
116847 ** In the absence of sqlite_stat4 ANALYZE data, or if such data cannot be
116848 ** used, a single range inequality reduces the search space by a factor of 4.
@@ -115719,14 +116862,11 @@
116862
116863 #ifdef SQLITE_ENABLE_STAT3_OR_STAT4
116864 Index *p = pLoop->u.btree.pIndex;
116865 int nEq = pLoop->u.btree.nEq;
116866
116867 if( p->nSample>0 && nEq<p->nSampleCol ){
 
 
 
116868 if( nEq==pBuilder->nRecValid ){
116869 UnpackedRecord *pRec = pBuilder->pRec;
116870 tRowcnt a[2];
116871 u8 aff;
116872
@@ -115738,19 +116878,23 @@
116878 **
116879 ** Or, if pLower is NULL or $L cannot be extracted from it (because it
116880 ** is not a simple variable or literal value), the lower bound of the
116881 ** range is $P. Due to a quirk in the way whereKeyStats() works, even
116882 ** if $L is available, whereKeyStats() is called for both ($P) and
116883 ** ($P:$L) and the larger of the two returned values is used.
116884 **
116885 ** Similarly, iUpper is to be set to the estimate of the number of rows
116886 ** less than the upper bound of the range query. Where the upper bound
116887 ** is either ($P) or ($P:$U). Again, even if $U is available, both values
116888 ** of iUpper are requested of whereKeyStats() and the smaller used.
116889 **
116890 ** The number of rows between the two bounds is then just iUpper-iLower.
116891 */
116892 tRowcnt iLower; /* Rows less than the lower bound */
116893 tRowcnt iUpper; /* Rows less than the upper bound */
116894 int iLwrIdx = -2; /* aSample[] for the lower bound */
116895 int iUprIdx = -1; /* aSample[] for the upper bound */
116896
116897 if( pRec ){
116898 testcase( pRec->nField!=pBuilder->nRecValid );
116899 pRec->nField = pBuilder->nRecValid;
116900 }
@@ -115760,11 +116904,11 @@
116904 aff = p->pTable->aCol[p->aiColumn[nEq]].affinity;
116905 }
116906 /* Determine iLower and iUpper using ($P) only. */
116907 if( nEq==0 ){
116908 iLower = 0;
116909 iUpper = p->nRowEst0;
116910 }else{
116911 /* Note: this call could be optimized away - since the same values must
116912 ** have been requested when testing key $P in whereEqualScanEst(). */
116913 whereKeyStats(pParse, p, pRec, 0, a);
116914 iLower = a[0];
@@ -115784,11 +116928,11 @@
116928 int bOk; /* True if value is extracted from pExpr */
116929 Expr *pExpr = pLower->pExpr->pRight;
116930 rc = sqlite3Stat4ProbeSetValue(pParse, p, &pRec, pExpr, aff, nEq, &bOk);
116931 if( rc==SQLITE_OK && bOk ){
116932 tRowcnt iNew;
116933 iLwrIdx = whereKeyStats(pParse, p, pRec, 0, a);
116934 iNew = a[0] + ((pLower->eOperator & (WO_GT|WO_LE)) ? a[1] : 0);
116935 if( iNew>iLower ) iLower = iNew;
116936 nOut--;
116937 pLower = 0;
116938 }
@@ -115799,11 +116943,11 @@
116943 int bOk; /* True if value is extracted from pExpr */
116944 Expr *pExpr = pUpper->pExpr->pRight;
116945 rc = sqlite3Stat4ProbeSetValue(pParse, p, &pRec, pExpr, aff, nEq, &bOk);
116946 if( rc==SQLITE_OK && bOk ){
116947 tRowcnt iNew;
116948 iUprIdx = whereKeyStats(pParse, p, pRec, 1, a);
116949 iNew = a[0] + ((pUpper->eOperator & (WO_GT|WO_LE)) ? a[1] : 0);
116950 if( iNew<iUpper ) iUpper = iNew;
116951 nOut--;
116952 pUpper = 0;
116953 }
@@ -115811,10 +116955,15 @@
116955
116956 pBuilder->pRec = pRec;
116957 if( rc==SQLITE_OK ){
116958 if( iUpper>iLower ){
116959 nNew = sqlite3LogEst(iUpper - iLower);
116960 /* TUNING: If both iUpper and iLower are derived from the same
116961 ** sample, then assume they are 4x more selective. This brings
116962 ** the estimated selectivity more in line with what it would be
116963 ** if estimated without the use of STAT3/4 tables. */
116964 if( iLwrIdx==iUprIdx ) nNew -= 20; assert( 20==sqlite3LogEst(4) );
116965 }else{
116966 nNew = 10; assert( 10==sqlite3LogEst(2) );
116967 }
116968 if( nNew<nOut ){
116969 nOut = nNew;
@@ -115835,16 +116984,19 @@
116984 #endif
116985 assert( pUpper==0 || (pUpper->wtFlags & TERM_VNULL)==0 );
116986 nNew = whereRangeAdjust(pLower, nOut);
116987 nNew = whereRangeAdjust(pUpper, nNew);
116988
116989 /* TUNING: If there is both an upper and lower limit and neither limit
116990 ** has an application-defined likelihood(), assume the range is
116991 ** reduced by an additional 75%. This means that, by default, an open-ended
116992 ** range query (e.g. col > ?) is assumed to match 1/4 of the rows in the
116993 ** index. While a closed range (e.g. col BETWEEN ? AND ?) is estimated to
116994 ** match 1/64 of the index. */
116995 if( pLower && pLower->truthProb>0 && pUpper && pUpper->truthProb>0 ){
116996 nNew -= 20;
116997 }
116998
116999 nOut -= (pLower!=0) + (pUpper!=0);
117000 if( nNew<10 ) nNew = 10;
117001 if( nNew<nOut ) nOut = nNew;
117002 #if defined(WHERETRACE_ENABLED)
@@ -116200,11 +117352,11 @@
117352
117353 /* This module is only called on query plans that use an index. */
117354 pLoop = pLevel->pWLoop;
117355 assert( (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 );
117356 nEq = pLoop->u.btree.nEq;
117357 nSkip = pLoop->nSkip;
117358 pIdx = pLoop->u.btree.pIndex;
117359 assert( pIdx!=0 );
117360
117361 /* Figure out how many memory cells we will need then allocate them.
117362 */
@@ -116314,11 +117466,11 @@
117466 ** "a=? AND b>?"
117467 */
117468 static void explainIndexRange(StrAccum *pStr, WhereLoop *pLoop, Table *pTab){
117469 Index *pIndex = pLoop->u.btree.pIndex;
117470 u16 nEq = pLoop->u.btree.nEq;
117471 u16 nSkip = pLoop->nSkip;
117472 int i, j;
117473 Column *aCol = pTab->aCol;
117474 i16 *aiColumn = pIndex->aiColumn;
117475
117476 if( nEq==0 && (pLoop->wsFlags&(WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))==0 ) return;
@@ -116345,23 +117497,27 @@
117497 sqlite3StrAccumAppend(pStr, ")", 1);
117498 }
117499
117500 /*
117501 ** This function is a no-op unless currently processing an EXPLAIN QUERY PLAN
117502 ** command, or if either SQLITE_DEBUG or SQLITE_ENABLE_STMT_SCANSTATUS was
117503 ** defined at compile-time. If it is not a no-op, a single OP_Explain opcode
117504 ** is added to the output to describe the table scan strategy in pLevel.
117505 **
117506 ** If an OP_Explain opcode is added to the VM, its address is returned.
117507 ** Otherwise, if no OP_Explain is coded, zero is returned.
117508 */
117509 static int explainOneScan(
117510 Parse *pParse, /* Parse context */
117511 SrcList *pTabList, /* Table list this loop refers to */
117512 WhereLevel *pLevel, /* Scan to write OP_Explain opcode for */
117513 int iLevel, /* Value for "level" column of output */
117514 int iFrom, /* Value for "from" column of output */
117515 u16 wctrlFlags /* Flags passed to sqlite3WhereBegin() */
117516 ){
117517 int ret = 0;
117518 #if !defined(SQLITE_DEBUG) && !defined(SQLITE_ENABLE_STMT_SCANSTATUS)
117519 if( pParse->explain==2 )
117520 #endif
117521 {
117522 struct SrcList_item *pItem = &pTabList->a[pLevel->iFrom];
117523 Vdbe *v = pParse->pVdbe; /* VM being constructed */
@@ -116374,11 +117530,11 @@
117530 StrAccum str; /* EQP output string */
117531 char zBuf[100]; /* Initial space for EQP output string */
117532
117533 pLoop = pLevel->pWLoop;
117534 flags = pLoop->wsFlags;
117535 if( (flags&WHERE_MULTI_OR) || (wctrlFlags&WHERE_ONETABLE_ONLY) ) return 0;
117536
117537 isSearch = (flags&(WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))!=0
117538 || ((flags&WHERE_VIRTUALTABLE)==0 && (pLoop->u.btree.nEq>0))
117539 || (wctrlFlags&(WHERE_ORDERBY_MIN|WHERE_ORDERBY_MAX));
117540
@@ -116403,10 +117559,12 @@
117559 assert( !(flags&WHERE_AUTO_INDEX) || (flags&WHERE_IDX_ONLY) );
117560 if( !HasRowid(pItem->pTab) && IsPrimaryKeyIndex(pIdx) ){
117561 if( isSearch ){
117562 zFmt = "PRIMARY KEY";
117563 }
117564 }else if( flags & WHERE_PARTIALIDX ){
117565 zFmt = "AUTOMATIC PARTIAL COVERING INDEX";
117566 }else if( flags & WHERE_AUTO_INDEX ){
117567 zFmt = "AUTOMATIC COVERING INDEX";
117568 }else if( flags & WHERE_IDX_ONLY ){
117569 zFmt = "COVERING INDEX %s";
117570 }else{
@@ -116444,16 +117602,49 @@
117602 }else{
117603 sqlite3StrAccumAppend(&str, " (~1 row)", 9);
117604 }
117605 #endif
117606 zMsg = sqlite3StrAccumFinish(&str);
117607 ret = sqlite3VdbeAddOp4(v, OP_Explain, iId, iLevel, iFrom, zMsg,P4_DYNAMIC);
117608 }
117609 return ret;
117610 }
117611 #else
117612 # define explainOneScan(u,v,w,x,y,z) 0
117613 #endif /* SQLITE_OMIT_EXPLAIN */
117614
117615 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
117616 /*
117617 ** Configure the VM passed as the first argument with an
117618 ** sqlite3_stmt_scanstatus() entry corresponding to the scan used to
117619 ** implement level pLvl. Argument pSrclist is a pointer to the FROM
117620 ** clause that the scan reads data from.
117621 **
117622 ** If argument addrExplain is not 0, it must be the address of an
117623 ** OP_Explain instruction that describes the same loop.
117624 */
117625 static void addScanStatus(
117626 Vdbe *v, /* Vdbe to add scanstatus entry to */
117627 SrcList *pSrclist, /* FROM clause pLvl reads data from */
117628 WhereLevel *pLvl, /* Level to add scanstatus() entry for */
117629 int addrExplain /* Address of OP_Explain (or 0) */
117630 ){
117631 const char *zObj = 0;
117632 WhereLoop *pLoop = pLvl->pWLoop;
117633 if( (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 && pLoop->u.btree.pIndex!=0 ){
117634 zObj = pLoop->u.btree.pIndex->zName;
117635 }else{
117636 zObj = pSrclist->a[pLvl->iFrom].zName;
117637 }
117638 sqlite3VdbeScanStatus(
117639 v, addrExplain, pLvl->addrBody, pLvl->addrVisit, pLoop->nOut, zObj
117640 );
117641 }
117642 #else
117643 # define addScanStatus(a, b, c, d) ((void)d)
117644 #endif
117645
117646
117647
117648 /*
117649 ** Generate code for the start of the iLevel-th loop in the WHERE clause
117650 ** implementation described by pWInfo.
@@ -116751,11 +117942,11 @@
117942 u8 bSeekPastNull = 0; /* True to seek past initial nulls */
117943 u8 bStopAtNull = 0; /* Add condition to terminate at NULLs */
117944
117945 pIdx = pLoop->u.btree.pIndex;
117946 iIdxCur = pLevel->iIdxCur;
117947 assert( nEq>=pLoop->nSkip );
117948
117949 /* If this loop satisfies a sort order (pOrderBy) request that
117950 ** was passed to this function to implement a "SELECT min(x) ..."
117951 ** query, then the caller will only allow the loop to run for
117952 ** a single iteration. This means that the first row returned
@@ -116768,11 +117959,11 @@
117959 || (pWInfo->wctrlFlags&WHERE_ORDERBY_MIN)==0 );
117960 if( (pWInfo->wctrlFlags&WHERE_ORDERBY_MIN)!=0
117961 && pWInfo->nOBSat>0
117962 && (pIdx->nKeyCol>nEq)
117963 ){
117964 assert( pLoop->nSkip==0 );
117965 bSeekPastNull = 1;
117966 nExtraReg = 1;
117967 }
117968
117969 /* Find any inequality constraint terms for the start and end
@@ -117081,14 +118272,13 @@
118272 int iTerm;
118273 for(iTerm=0; iTerm<pWC->nTerm; iTerm++){
118274 Expr *pExpr = pWC->a[iTerm].pExpr;
118275 if( &pWC->a[iTerm] == pTerm ) continue;
118276 if( ExprHasProperty(pExpr, EP_FromJoin) ) continue;
118277 if( (pWC->a[iTerm].wtFlags & TERM_VIRTUAL)!=0 ) continue;
 
 
118278 if( (pWC->a[iTerm].eOperator & WO_ALL)==0 ) continue;
118279 testcase( pWC->a[iTerm].wtFlags & TERM_ORINFO );
118280 pExpr = sqlite3ExprDup(db, pExpr, 0);
118281 pAndExpr = sqlite3ExprAnd(db, pAndExpr, pExpr);
118282 }
118283 if( pAndExpr ){
118284 pAndExpr = sqlite3PExpr(pParse, TK_AND, 0, pAndExpr, 0);
@@ -117117,13 +118307,15 @@
118307 pSubWInfo = sqlite3WhereBegin(pParse, pOrTab, pOrExpr, 0, 0,
118308 wctrlFlags, iCovCur);
118309 assert( pSubWInfo || pParse->nErr || db->mallocFailed );
118310 if( pSubWInfo ){
118311 WhereLoop *pSubLoop;
118312 int addrExplain = explainOneScan(
118313 pParse, pOrTab, &pSubWInfo->a[0], iLevel, pLevel->iFrom, 0
118314 );
118315 addScanStatus(v, pOrTab, &pSubWInfo->a[0], addrExplain);
118316
118317 /* This is the sub-WHERE clause body. First skip over
118318 ** duplicate rows from prior sub-WHERE clauses, and record the
118319 ** rowid (or PRIMARY KEY) for the current row so that the same
118320 ** row will be skipped in subsequent sub-WHERE clauses.
118321 */
@@ -117249,10 +118441,14 @@
118441 VdbeCoverageIf(v, bRev==0);
118442 VdbeCoverageIf(v, bRev!=0);
118443 pLevel->p5 = SQLITE_STMTSTATUS_FULLSCAN_STEP;
118444 }
118445 }
118446
118447 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
118448 pLevel->addrVisit = sqlite3VdbeCurrentAddr(v);
118449 #endif
118450
118451 /* Insert code to test every subexpression that can be completely
118452 ** computed using the current set of tables.
118453 */
118454 for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){
@@ -117389,11 +118585,11 @@
118585 }
118586 sqlite3DebugPrintf(" %-19s", z);
118587 sqlite3_free(z);
118588 }
118589 if( p->wsFlags & WHERE_SKIPSCAN ){
118590 sqlite3DebugPrintf(" f %05x %d-%d", p->wsFlags, p->nLTerm,p->nSkip);
118591 }else{
118592 sqlite3DebugPrintf(" f %05x N %d", p->wsFlags, p->nLTerm);
118593 }
118594 sqlite3DebugPrintf(" cost %d,%d,%d\n", p->rSetup, p->rRun, p->nOut);
118595 if( p->nLTerm && (sqlite3WhereTrace & 0x100)!=0 ){
@@ -117500,34 +118696,41 @@
118696 sqlite3DbFree(db, pWInfo);
118697 }
118698 }
118699
118700 /*
118701 ** Return TRUE if all of the following are true:
118702 **
118703 ** (1) X has the same or lower cost that Y
118704 ** (2) X is a proper subset of Y
118705 ** (3) X skips at least as many columns as Y
118706 **
118707 ** By "proper subset" we mean that X uses fewer WHERE clause terms
118708 ** than Y and that every WHERE clause term used by X is also used
118709 ** by Y.
118710 **
118711 ** If X is a proper subset of Y then Y is a better choice and ought
118712 ** to have a lower cost. This routine returns TRUE when that cost
118713 ** relationship is inverted and needs to be adjusted. The third rule
118714 ** was added because if X uses skip-scan less than Y it still might
118715 ** deserve a lower cost even if it is a proper subset of Y.
118716 */
118717 static int whereLoopCheaperProperSubset(
118718 const WhereLoop *pX, /* First WhereLoop to compare */
118719 const WhereLoop *pY /* Compare against this WhereLoop */
118720 ){
118721 int i, j;
118722 if( pX->nLTerm-pX->nSkip >= pY->nLTerm-pY->nSkip ){
118723 return 0; /* X is not a subset of Y */
118724 }
118725 if( pY->nSkip > pX->nSkip ) return 0;
118726 if( pX->rRun >= pY->rRun ){
118727 if( pX->rRun > pY->rRun ) return 0; /* X costs more than Y */
118728 if( pX->nOut > pY->nOut ) return 0; /* X costs more than Y */
118729 }
118730 for(i=pX->nLTerm-1; i>=0; i--){
118731 if( pX->aLTerm[i]==0 ) continue;
118732 for(j=pY->nLTerm-1; j>=0; j--){
118733 if( pY->aLTerm[j]==pX->aLTerm[i] ) break;
118734 }
118735 if( j<0 ) return 0; /* X not a subset of Y since term X[i] not used by Y */
118736 }
@@ -117545,37 +118748,28 @@
118748 ** is a proper subset.
118749 **
118750 ** To say "WhereLoop X is a proper subset of Y" means that X uses fewer
118751 ** WHERE clause terms than Y and that every WHERE clause term used by X is
118752 ** also used by Y.
 
 
 
 
 
 
 
 
 
 
 
118753 */
118754 static void whereLoopAdjustCost(const WhereLoop *p, WhereLoop *pTemplate){
118755 if( (pTemplate->wsFlags & WHERE_INDEXED)==0 ) return;
 
118756 for(; p; p=p->pNextLoop){
118757 if( p->iTab!=pTemplate->iTab ) continue;
118758 if( (p->wsFlags & WHERE_INDEXED)==0 ) continue;
 
118759 if( whereLoopCheaperProperSubset(p, pTemplate) ){
118760 /* Adjust pTemplate cost downward so that it is cheaper than its
118761 ** subset p. */
118762 WHERETRACE(0x80,("subset cost adjustment %d,%d to %d,%d\n",
118763 pTemplate->rRun, pTemplate->nOut, p->rRun, p->nOut-1));
118764 pTemplate->rRun = p->rRun;
118765 pTemplate->nOut = p->nOut - 1;
118766 }else if( whereLoopCheaperProperSubset(pTemplate, p) ){
118767 /* Adjust pTemplate cost upward so that it is costlier than p since
118768 ** pTemplate is a proper subset of p */
118769 WHERETRACE(0x80,("subset cost adjustment %d,%d to %d,%d\n",
118770 pTemplate->rRun, pTemplate->nOut, p->rRun, p->nOut+1));
118771 pTemplate->rRun = p->rRun;
118772 pTemplate->nOut = p->nOut + 1;
118773 }
118774 }
118775 }
@@ -117616,12 +118810,13 @@
118810 ** rSetup. Call this SETUP-INVARIANT */
118811 assert( p->rSetup>=pTemplate->rSetup );
118812
118813 /* Any loop using an appliation-defined index (or PRIMARY KEY or
118814 ** UNIQUE constraint) with one or more == constraints is better
118815 ** than an automatic index. Unless it is a skip-scan. */
118816 if( (p->wsFlags & WHERE_AUTO_INDEX)!=0
118817 && (pTemplate->nSkip)==0
118818 && (pTemplate->wsFlags & WHERE_INDEXED)!=0
118819 && (pTemplate->wsFlags & WHERE_COLUMN_EQ)!=0
118820 && (p->prereq & pTemplate->prereq)==pTemplate->prereq
118821 ){
118822 break;
@@ -117776,25 +118971,46 @@
118971
118972 /*
118973 ** Adjust the WhereLoop.nOut value downward to account for terms of the
118974 ** WHERE clause that reference the loop but which are not used by an
118975 ** index.
118976 *
118977 ** For every WHERE clause term that is not used by the index
118978 ** and which has a truth probability assigned by one of the likelihood(),
118979 ** likely(), or unlikely() SQL functions, reduce the estimated number
118980 ** of output rows by the probability specified.
118981 **
118982 ** TUNING: For every WHERE clause term that is not used by the index
118983 ** and which does not have an assigned truth probability, heuristics
118984 ** described below are used to try to estimate the truth probability.
118985 ** TODO --> Perhaps this is something that could be improved by better
118986 ** table statistics.
118987 **
118988 ** Heuristic 1: Estimate the truth probability as 93.75%. The 93.75%
118989 ** value corresponds to -1 in LogEst notation, so this means decrement
118990 ** the WhereLoop.nOut field for every such WHERE clause term.
118991 **
118992 ** Heuristic 2: If there exists one or more WHERE clause terms of the
118993 ** form "x==EXPR" and EXPR is not a constant 0 or 1, then make sure the
118994 ** final output row estimate is no greater than 1/4 of the total number
118995 ** of rows in the table. In other words, assume that x==EXPR will filter
118996 ** out at least 3 out of 4 rows. If EXPR is -1 or 0 or 1, then maybe the
118997 ** "x" column is boolean or else -1 or 0 or 1 is a common default value
118998 ** on the "x" column and so in that case only cap the output row estimate
118999 ** at 1/2 instead of 1/4.
119000 */
119001 static void whereLoopOutputAdjust(
119002 WhereClause *pWC, /* The WHERE clause */
119003 WhereLoop *pLoop, /* The loop to adjust downward */
119004 LogEst nRow /* Number of rows in the entire table */
119005 ){
119006 WhereTerm *pTerm, *pX;
119007 Bitmask notAllowed = ~(pLoop->prereq|pLoop->maskSelf);
119008 int i, j, k;
119009 LogEst iReduce = 0; /* pLoop->nOut should not exceed nRow-iReduce */
119010
119011 assert( (pLoop->wsFlags & WHERE_AUTO_INDEX)==0 );
119012 for(i=pWC->nTerm, pTerm=pWC->a; i>0; i--, pTerm++){
119013 if( (pTerm->wtFlags & TERM_VIRTUAL)!=0 ) break;
119014 if( (pTerm->prereqAll & pLoop->maskSelf)==0 ) continue;
119015 if( (pTerm->prereqAll & notAllowed)!=0 ) continue;
119016 for(j=pLoop->nLTerm-1; j>=0; j--){
@@ -117803,24 +119019,30 @@
119019 if( pX==pTerm ) break;
119020 if( pX->iParent>=0 && (&pWC->a[pX->iParent])==pTerm ) break;
119021 }
119022 if( j<0 ){
119023 if( pTerm->truthProb<=0 ){
119024 /* If a truth probability is specified using the likelihood() hints,
119025 ** then use the probability provided by the application. */
119026 pLoop->nOut += pTerm->truthProb;
119027 }else{
119028 /* In the absence of explicit truth probabilities, use heuristics to
119029 ** guess a reasonable truth probability. */
119030 pLoop->nOut--;
119031 if( pTerm->eOperator&WO_EQ ){
119032 Expr *pRight = pTerm->pExpr->pRight;
119033 if( sqlite3ExprIsInteger(pRight, &k) && k>=(-1) && k<=1 ){
119034 k = 10;
119035 }else{
119036 k = 20;
119037 }
119038 if( iReduce<k ) iReduce = k;
119039 }
119040 }
119041 }
119042 }
119043 if( pLoop->nOut > nRow-iReduce ) pLoop->nOut = nRow - iReduce;
 
 
 
 
 
 
119044 }
119045
119046 /*
119047 ** Adjust the cost C by the costMult facter T. This only occurs if
119048 ** compiled with -DSQLITE_ENABLE_COSTMULT
@@ -117857,11 +119079,11 @@
119079 int opMask; /* Valid operators for constraints */
119080 WhereScan scan; /* Iterator for WHERE terms */
119081 Bitmask saved_prereq; /* Original value of pNew->prereq */
119082 u16 saved_nLTerm; /* Original value of pNew->nLTerm */
119083 u16 saved_nEq; /* Original value of pNew->u.btree.nEq */
119084 u16 saved_nSkip; /* Original value of pNew->nSkip */
119085 u32 saved_wsFlags; /* Original value of pNew->wsFlags */
119086 LogEst saved_nOut; /* Original value of pNew->nOut */
119087 int iCol; /* Index of the column in the table */
119088 int rc = SQLITE_OK; /* Return code */
119089 LogEst rSize; /* Number of rows in the table */
@@ -117886,56 +119108,18 @@
119108 iCol = pProbe->aiColumn[pNew->u.btree.nEq];
119109
119110 pTerm = whereScanInit(&scan, pBuilder->pWC, pSrc->iCursor, iCol,
119111 opMask, pProbe);
119112 saved_nEq = pNew->u.btree.nEq;
119113 saved_nSkip = pNew->nSkip;
119114 saved_nLTerm = pNew->nLTerm;
119115 saved_wsFlags = pNew->wsFlags;
119116 saved_prereq = pNew->prereq;
119117 saved_nOut = pNew->nOut;
119118 pNew->rSetup = 0;
119119 rSize = pProbe->aiRowLogEst[0];
119120 rLogSize = estLog(rSize);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119121 for(; rc==SQLITE_OK && pTerm!=0; pTerm = whereScanNext(&scan)){
119122 u16 eOp = pTerm->eOperator; /* Shorthand for pTerm->eOperator */
119123 LogEst rCostIdx;
119124 LogEst nOutUnadjusted; /* nOut before IN() and WHERE adjustments */
119125 int nIn = 0;
@@ -118026,11 +119210,10 @@
119210 #ifdef SQLITE_ENABLE_STAT3_OR_STAT4
119211 tRowcnt nOut = 0;
119212 if( nInMul==0
119213 && pProbe->nSample
119214 && pNew->u.btree.nEq<=pProbe->nSampleCol
 
119215 && ((eOp & WO_IN)==0 || !ExprHasProperty(pTerm->pExpr, EP_xIsSelect))
119216 ){
119217 Expr *pExpr = pTerm->pExpr;
119218 if( (eOp & (WO_EQ|WO_ISNULL))!=0 ){
119219 testcase( eOp & WO_EQ );
@@ -118094,14 +119277,49 @@
119277 pBuilder->nRecValid = nRecValid;
119278 #endif
119279 }
119280 pNew->prereq = saved_prereq;
119281 pNew->u.btree.nEq = saved_nEq;
119282 pNew->nSkip = saved_nSkip;
119283 pNew->wsFlags = saved_wsFlags;
119284 pNew->nOut = saved_nOut;
119285 pNew->nLTerm = saved_nLTerm;
119286
119287 /* Consider using a skip-scan if there are no WHERE clause constraints
119288 ** available for the left-most terms of the index, and if the average
119289 ** number of repeats in the left-most terms is at least 18.
119290 **
119291 ** The magic number 18 is selected on the basis that scanning 17 rows
119292 ** is almost always quicker than an index seek (even though if the index
119293 ** contains fewer than 2^17 rows we assume otherwise in other parts of
119294 ** the code). And, even if it is not, it should not be too much slower.
119295 ** On the other hand, the extra seeks could end up being significantly
119296 ** more expensive. */
119297 assert( 42==sqlite3LogEst(18) );
119298 if( saved_nEq==saved_nSkip
119299 && saved_nEq+1<pProbe->nKeyCol
119300 && pProbe->noSkipScan==0
119301 && pProbe->aiRowLogEst[saved_nEq+1]>=42 /* TUNING: Minimum for skip-scan */
119302 && (rc = whereLoopResize(db, pNew, pNew->nLTerm+1))==SQLITE_OK
119303 ){
119304 LogEst nIter;
119305 pNew->u.btree.nEq++;
119306 pNew->nSkip++;
119307 pNew->aLTerm[pNew->nLTerm++] = 0;
119308 pNew->wsFlags |= WHERE_SKIPSCAN;
119309 nIter = pProbe->aiRowLogEst[saved_nEq] - pProbe->aiRowLogEst[saved_nEq+1];
119310 pNew->nOut -= nIter;
119311 /* TUNING: Because uncertainties in the estimates for skip-scan queries,
119312 ** add a 1.375 fudge factor to make skip-scan slightly less likely. */
119313 nIter += 5;
119314 whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, nIter + nInMul);
119315 pNew->nOut = saved_nOut;
119316 pNew->u.btree.nEq = saved_nEq;
119317 pNew->nSkip = saved_nSkip;
119318 pNew->wsFlags = saved_wsFlags;
119319 }
119320
119321 return rc;
119322 }
119323
119324 /*
119325 ** Return True if it is possible that pIndex might be useful in
@@ -118276,11 +119494,11 @@
119494 WhereTerm *pWCEnd = pWC->a + pWC->nTerm;
119495 for(pTerm=pWC->a; rc==SQLITE_OK && pTerm<pWCEnd; pTerm++){
119496 if( pTerm->prereqRight & pNew->maskSelf ) continue;
119497 if( termCanDriveIndex(pTerm, pSrc, 0) ){
119498 pNew->u.btree.nEq = 1;
119499 pNew->nSkip = 0;
119500 pNew->u.btree.pIndex = 0;
119501 pNew->nLTerm = 1;
119502 pNew->aLTerm[0] = pTerm;
119503 /* TUNING: One-time cost for computing the automatic index is
119504 ** estimated to be X*N*log2(N) where N is the number of rows in
@@ -118317,11 +119535,11 @@
119535 testcase( pNew->iTab!=pSrc->iCursor ); /* See ticket [98d973b8f5] */
119536 continue; /* Partial index inappropriate for this query */
119537 }
119538 rSize = pProbe->aiRowLogEst[0];
119539 pNew->u.btree.nEq = 0;
119540 pNew->nSkip = 0;
119541 pNew->nLTerm = 0;
119542 pNew->iSortIdx = 0;
119543 pNew->rSetup = 0;
119544 pNew->prereq = mExtra;
119545 pNew->nOut = rSize;
@@ -118867,11 +120085,11 @@
120085 for(j=0; j<nColumn; j++){
120086 u8 bOnce; /* True to run the ORDER BY search loop */
120087
120088 /* Skip over == and IS NULL terms */
120089 if( j<pLoop->u.btree.nEq
120090 && pLoop->nSkip==0
120091 && ((i = pLoop->aLTerm[j]->eOperator) & (WO_EQ|WO_ISNULL))!=0
120092 ){
120093 if( i & WO_ISNULL ){
120094 testcase( isOrderDistinct );
120095 isOrderDistinct = 0;
@@ -119321,11 +120539,11 @@
120539 }
120540 }
120541 }
120542
120543 #ifdef WHERETRACE_ENABLED /* >=2 */
120544 if( sqlite3WhereTrace & 0x02 ){
120545 sqlite3DebugPrintf("---- after round %d ----\n", iLoop);
120546 for(ii=0, pTo=aTo; ii<nTo; ii++, pTo++){
120547 sqlite3DebugPrintf(" %s cost=%-3d nrow=%-3d order=%c",
120548 wherePathName(pTo, iLoop+1, 0), pTo->rCost, pTo->nRow,
120549 pTo->isOrdered>=0 ? (pTo->isOrdered+'0') : '?');
@@ -119440,11 +120658,11 @@
120658 if( pItem->zIndex ) return 0;
120659 iCur = pItem->iCursor;
120660 pWC = &pWInfo->sWC;
120661 pLoop = pBuilder->pNew;
120662 pLoop->wsFlags = 0;
120663 pLoop->nSkip = 0;
120664 pTerm = findTerm(pWC, iCur, -1, 0, WO_EQ, 0);
120665 if( pTerm ){
120666 pLoop->wsFlags = WHERE_COLUMN_EQ|WHERE_IPK|WHERE_ONEROW;
120667 pLoop->aLTerm[0] = pTerm;
120668 pLoop->nLTerm = 1;
@@ -119452,11 +120670,10 @@
120670 /* TUNING: Cost of a rowid lookup is 10 */
120671 pLoop->rRun = 33; /* 33==sqlite3LogEst(10) */
120672 }else{
120673 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
120674 assert( pLoop->aLTermSpace==pLoop->aLTerm );
 
120675 if( !IsUniqueIndex(pIdx)
120676 || pIdx->pPartIdxWhere!=0
120677 || pIdx->nKeyCol>ArraySize(pLoop->aLTermSpace)
120678 ) continue;
120679 for(j=0; j<pIdx->nKeyCol; j++){
@@ -119961,22 +121178,30 @@
121178 ** loop below generates code for a single nested loop of the VM
121179 ** program.
121180 */
121181 notReady = ~(Bitmask)0;
121182 for(ii=0; ii<nTabList; ii++){
121183 int addrExplain;
121184 int wsFlags;
121185 pLevel = &pWInfo->a[ii];
121186 wsFlags = pLevel->pWLoop->wsFlags;
121187 #ifndef SQLITE_OMIT_AUTOMATIC_INDEX
121188 if( (pLevel->pWLoop->wsFlags & WHERE_AUTO_INDEX)!=0 ){
121189 constructAutomaticIndex(pParse, &pWInfo->sWC,
121190 &pTabList->a[pLevel->iFrom], notReady, pLevel);
121191 if( db->mallocFailed ) goto whereBeginError;
121192 }
121193 #endif
121194 addrExplain = explainOneScan(
121195 pParse, pTabList, pLevel, ii, pLevel->iFrom, wctrlFlags
121196 );
121197 pLevel->addrBody = sqlite3VdbeCurrentAddr(v);
121198 notReady = codeOneLoopStart(pWInfo, ii, notReady);
121199 pWInfo->iContinue = pLevel->addrCont;
121200 if( (wsFlags&WHERE_MULTI_OR)==0 && (wctrlFlags&WHERE_ONETABLE_ONLY)==0 ){
121201 addScanStatus(v, pTabList, pLevel, addrExplain);
121202 }
121203 }
121204
121205 /* Done. */
121206 VdbeModuleComment((v, "Begin WHERE-core"));
121207 return pWInfo;
@@ -124640,10 +125865,17 @@
125865 ** is look for a semicolon that is not part of an string or comment.
125866 */
125867 SQLITE_API int sqlite3_complete(const char *zSql){
125868 u8 state = 0; /* Current state, using numbers defined in header comment */
125869 u8 token; /* Value of the next token */
125870
125871 #ifdef SQLITE_ENABLE_API_ARMOR
125872 if( zSql==0 ){
125873 (void)SQLITE_MISUSE_BKPT;
125874 return 0;
125875 }
125876 #endif
125877
125878 #ifndef SQLITE_OMIT_TRIGGER
125879 /* A complex statement machine used to detect the end of a CREATE TRIGGER
125880 ** statement. This is the normal case.
125881 */
@@ -125238,74 +126470,106 @@
126470
126471 va_start(ap, op);
126472 switch( op ){
126473
126474 /* Mutex configuration options are only available in a threadsafe
126475 ** compile.
126476 */
126477 #if defined(SQLITE_THREADSAFE) && SQLITE_THREADSAFE>0 /* IMP: R-54466-46756 */
126478 case SQLITE_CONFIG_SINGLETHREAD: {
126479 /* Disable all mutexing */
126480 sqlite3GlobalConfig.bCoreMutex = 0;
126481 sqlite3GlobalConfig.bFullMutex = 0;
126482 break;
126483 }
126484 #endif
126485 #if defined(SQLITE_THREADSAFE) && SQLITE_THREADSAFE>0 /* IMP: R-20520-54086 */
126486 case SQLITE_CONFIG_MULTITHREAD: {
126487 /* Disable mutexing of database connections */
126488 /* Enable mutexing of core data structures */
126489 sqlite3GlobalConfig.bCoreMutex = 1;
126490 sqlite3GlobalConfig.bFullMutex = 0;
126491 break;
126492 }
126493 #endif
126494 #if defined(SQLITE_THREADSAFE) && SQLITE_THREADSAFE>0 /* IMP: R-59593-21810 */
126495 case SQLITE_CONFIG_SERIALIZED: {
126496 /* Enable all mutexing */
126497 sqlite3GlobalConfig.bCoreMutex = 1;
126498 sqlite3GlobalConfig.bFullMutex = 1;
126499 break;
126500 }
126501 #endif
126502 #if defined(SQLITE_THREADSAFE) && SQLITE_THREADSAFE>0 /* IMP: R-63666-48755 */
126503 case SQLITE_CONFIG_MUTEX: {
126504 /* Specify an alternative mutex implementation */
126505 sqlite3GlobalConfig.mutex = *va_arg(ap, sqlite3_mutex_methods*);
126506 break;
126507 }
126508 #endif
126509 #if defined(SQLITE_THREADSAFE) && SQLITE_THREADSAFE>0 /* IMP: R-14450-37597 */
126510 case SQLITE_CONFIG_GETMUTEX: {
126511 /* Retrieve the current mutex implementation */
126512 *va_arg(ap, sqlite3_mutex_methods*) = sqlite3GlobalConfig.mutex;
126513 break;
126514 }
126515 #endif
126516
 
126517 case SQLITE_CONFIG_MALLOC: {
126518 /* EVIDENCE-OF: R-55594-21030 The SQLITE_CONFIG_MALLOC option takes a
126519 ** single argument which is a pointer to an instance of the
126520 ** sqlite3_mem_methods structure. The argument specifies alternative
126521 ** low-level memory allocation routines to be used in place of the memory
126522 ** allocation routines built into SQLite. */
126523 sqlite3GlobalConfig.m = *va_arg(ap, sqlite3_mem_methods*);
126524 break;
126525 }
126526 case SQLITE_CONFIG_GETMALLOC: {
126527 /* EVIDENCE-OF: R-51213-46414 The SQLITE_CONFIG_GETMALLOC option takes a
126528 ** single argument which is a pointer to an instance of the
126529 ** sqlite3_mem_methods structure. The sqlite3_mem_methods structure is
126530 ** filled with the currently defined memory allocation routines. */
126531 if( sqlite3GlobalConfig.m.xMalloc==0 ) sqlite3MemSetDefault();
126532 *va_arg(ap, sqlite3_mem_methods*) = sqlite3GlobalConfig.m;
126533 break;
126534 }
126535 case SQLITE_CONFIG_MEMSTATUS: {
126536 /* EVIDENCE-OF: R-61275-35157 The SQLITE_CONFIG_MEMSTATUS option takes
126537 ** single argument of type int, interpreted as a boolean, which enables
126538 ** or disables the collection of memory allocation statistics. */
126539 sqlite3GlobalConfig.bMemstat = va_arg(ap, int);
126540 break;
126541 }
126542 case SQLITE_CONFIG_SCRATCH: {
126543 /* EVIDENCE-OF: R-08404-60887 There are three arguments to
126544 ** SQLITE_CONFIG_SCRATCH: A pointer an 8-byte aligned memory buffer from
126545 ** which the scratch allocations will be drawn, the size of each scratch
126546 ** allocation (sz), and the maximum number of scratch allocations (N). */
126547 sqlite3GlobalConfig.pScratch = va_arg(ap, void*);
126548 sqlite3GlobalConfig.szScratch = va_arg(ap, int);
126549 sqlite3GlobalConfig.nScratch = va_arg(ap, int);
126550 break;
126551 }
126552 case SQLITE_CONFIG_PAGECACHE: {
126553 /* EVIDENCE-OF: R-31408-40510 There are three arguments to
126554 ** SQLITE_CONFIG_PAGECACHE: A pointer to 8-byte aligned memory, the size
126555 ** of each page buffer (sz), and the number of pages (N). */
126556 sqlite3GlobalConfig.pPage = va_arg(ap, void*);
126557 sqlite3GlobalConfig.szPage = va_arg(ap, int);
126558 sqlite3GlobalConfig.nPage = va_arg(ap, int);
126559 break;
126560 }
126561 case SQLITE_CONFIG_PCACHE_HDRSZ: {
126562 /* EVIDENCE-OF: R-39100-27317 The SQLITE_CONFIG_PCACHE_HDRSZ option takes
126563 ** a single parameter which is a pointer to an integer and writes into
126564 ** that integer the number of extra bytes per page required for each page
126565 ** in SQLITE_CONFIG_PAGECACHE. */
126566 *va_arg(ap, int*) =
126567 sqlite3HeaderSizeBtree() +
126568 sqlite3HeaderSizePcache() +
126569 sqlite3HeaderSizePcache1();
126570 break;
126571 }
126572
126573 case SQLITE_CONFIG_PCACHE: {
126574 /* no-op */
126575 break;
@@ -125315,25 +126579,37 @@
126579 rc = SQLITE_ERROR;
126580 break;
126581 }
126582
126583 case SQLITE_CONFIG_PCACHE2: {
126584 /* EVIDENCE-OF: R-63325-48378 The SQLITE_CONFIG_PCACHE2 option takes a
126585 ** single argument which is a pointer to an sqlite3_pcache_methods2
126586 ** object. This object specifies the interface to a custom page cache
126587 ** implementation. */
126588 sqlite3GlobalConfig.pcache2 = *va_arg(ap, sqlite3_pcache_methods2*);
126589 break;
126590 }
126591 case SQLITE_CONFIG_GETPCACHE2: {
126592 /* EVIDENCE-OF: R-22035-46182 The SQLITE_CONFIG_GETPCACHE2 option takes a
126593 ** single argument which is a pointer to an sqlite3_pcache_methods2
126594 ** object. SQLite copies of the current page cache implementation into
126595 ** that object. */
126596 if( sqlite3GlobalConfig.pcache2.xInit==0 ){
126597 sqlite3PCacheSetDefault();
126598 }
126599 *va_arg(ap, sqlite3_pcache_methods2*) = sqlite3GlobalConfig.pcache2;
126600 break;
126601 }
126602
126603 /* EVIDENCE-OF: R-06626-12911 The SQLITE_CONFIG_HEAP option is only
126604 ** available if SQLite is compiled with either SQLITE_ENABLE_MEMSYS3 or
126605 ** SQLITE_ENABLE_MEMSYS5 and returns SQLITE_ERROR if invoked otherwise. */
126606 #if defined(SQLITE_ENABLE_MEMSYS3) || defined(SQLITE_ENABLE_MEMSYS5)
126607 case SQLITE_CONFIG_HEAP: {
126608 /* EVIDENCE-OF: R-19854-42126 There are three arguments to
126609 ** SQLITE_CONFIG_HEAP: An 8-byte aligned pointer to the memory, the
126610 ** number of bytes in the memory buffer, and the minimum allocation size. */
126611 sqlite3GlobalConfig.pHeap = va_arg(ap, void*);
126612 sqlite3GlobalConfig.nHeap = va_arg(ap, int);
126613 sqlite3GlobalConfig.mnReq = va_arg(ap, int);
126614
126615 if( sqlite3GlobalConfig.mnReq<1 ){
@@ -125342,21 +126618,23 @@
126618 /* cap min request size at 2^12 */
126619 sqlite3GlobalConfig.mnReq = (1<<12);
126620 }
126621
126622 if( sqlite3GlobalConfig.pHeap==0 ){
126623 /* EVIDENCE-OF: R-49920-60189 If the first pointer (the memory pointer)
126624 ** is NULL, then SQLite reverts to using its default memory allocator
126625 ** (the system malloc() implementation), undoing any prior invocation of
126626 ** SQLITE_CONFIG_MALLOC.
126627 **
126628 ** Setting sqlite3GlobalConfig.m to all zeros will cause malloc to
126629 ** revert to its default implementation when sqlite3_initialize() is run
126630 */
126631 memset(&sqlite3GlobalConfig.m, 0, sizeof(sqlite3GlobalConfig.m));
126632 }else{
126633 /* EVIDENCE-OF: R-61006-08918 If the memory pointer is not NULL then the
126634 ** alternative memory allocator is engaged to handle all of SQLites
126635 ** memory allocation needs. */
 
126636 #ifdef SQLITE_ENABLE_MEMSYS3
126637 sqlite3GlobalConfig.m = *sqlite3MemGetMemsys3();
126638 #endif
126639 #ifdef SQLITE_ENABLE_MEMSYS5
126640 sqlite3GlobalConfig.m = *sqlite3MemGetMemsys5();
@@ -125391,15 +126669,23 @@
126669 ** can be changed at start-time using the
126670 ** sqlite3_config(SQLITE_CONFIG_URI,1) or
126671 ** sqlite3_config(SQLITE_CONFIG_URI,0) configuration calls.
126672 */
126673 case SQLITE_CONFIG_URI: {
126674 /* EVIDENCE-OF: R-25451-61125 The SQLITE_CONFIG_URI option takes a single
126675 ** argument of type int. If non-zero, then URI handling is globally
126676 ** enabled. If the parameter is zero, then URI handling is globally
126677 ** disabled. */
126678 sqlite3GlobalConfig.bOpenUri = va_arg(ap, int);
126679 break;
126680 }
126681
126682 case SQLITE_CONFIG_COVERING_INDEX_SCAN: {
126683 /* EVIDENCE-OF: R-36592-02772 The SQLITE_CONFIG_COVERING_INDEX_SCAN
126684 ** option takes a single integer argument which is interpreted as a
126685 ** boolean in order to enable or disable the use of covering indices for
126686 ** full table scans in the query optimizer. */
126687 sqlite3GlobalConfig.bUseCis = va_arg(ap, int);
126688 break;
126689 }
126690
126691 #ifdef SQLITE_ENABLE_SQLLOG
@@ -125410,24 +126696,37 @@
126696 break;
126697 }
126698 #endif
126699
126700 case SQLITE_CONFIG_MMAP_SIZE: {
126701 /* EVIDENCE-OF: R-58063-38258 SQLITE_CONFIG_MMAP_SIZE takes two 64-bit
126702 ** integer (sqlite3_int64) values that are the default mmap size limit
126703 ** (the default setting for PRAGMA mmap_size) and the maximum allowed
126704 ** mmap size limit. */
126705 sqlite3_int64 szMmap = va_arg(ap, sqlite3_int64);
126706 sqlite3_int64 mxMmap = va_arg(ap, sqlite3_int64);
126707 /* EVIDENCE-OF: R-53367-43190 If either argument to this option is
126708 ** negative, then that argument is changed to its compile-time default.
126709 **
126710 ** EVIDENCE-OF: R-34993-45031 The maximum allowed mmap size will be
126711 ** silently truncated if necessary so that it does not exceed the
126712 ** compile-time maximum mmap size set by the SQLITE_MAX_MMAP_SIZE
126713 ** compile-time option.
126714 */
126715 if( mxMmap<0 || mxMmap>SQLITE_MAX_MMAP_SIZE ) mxMmap = SQLITE_MAX_MMAP_SIZE;
126716 if( szMmap<0 ) szMmap = SQLITE_DEFAULT_MMAP_SIZE;
126717 if( szMmap>mxMmap) szMmap = mxMmap;
126718 sqlite3GlobalConfig.mxMmap = mxMmap;
126719 sqlite3GlobalConfig.szMmap = szMmap;
126720 break;
126721 }
126722
126723 #if SQLITE_OS_WIN && defined(SQLITE_WIN32_MALLOC) /* IMP: R-04780-55815 */
126724 case SQLITE_CONFIG_WIN32_HEAPSIZE: {
126725 /* EVIDENCE-OF: R-34926-03360 SQLITE_CONFIG_WIN32_HEAPSIZE takes a 32-bit
126726 ** unsigned integer value that specifies the maximum size of the created
126727 ** heap. */
126728 sqlite3GlobalConfig.nHeap = va_arg(ap, int);
126729 break;
126730 }
126731 #endif
126732
@@ -125507,19 +126806,29 @@
126806
126807 /*
126808 ** Return the mutex associated with a database connection.
126809 */
126810 SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3 *db){
126811 #ifdef SQLITE_ENABLE_API_ARMOR
126812 if( !sqlite3SafetyCheckOk(db) ){
126813 (void)SQLITE_MISUSE_BKPT;
126814 return 0;
126815 }
126816 #endif
126817 return db->mutex;
126818 }
126819
126820 /*
126821 ** Free up as much memory as we can from the given database
126822 ** connection.
126823 */
126824 SQLITE_API int sqlite3_db_release_memory(sqlite3 *db){
126825 int i;
126826
126827 #ifdef SQLITE_ENABLE_API_ARMOR
126828 if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
126829 #endif
126830 sqlite3_mutex_enter(db->mutex);
126831 sqlite3BtreeEnterAll(db);
126832 for(i=0; i<db->nDb; i++){
126833 Btree *pBt = db->aDb[i].pBt;
126834 if( pBt ){
@@ -125605,17 +126914,24 @@
126914 int nKey1, const void *pKey1,
126915 int nKey2, const void *pKey2
126916 ){
126917 int rc, n;
126918 n = nKey1<nKey2 ? nKey1 : nKey2;
126919 /* EVIDENCE-OF: R-65033-28449 The built-in BINARY collation compares
126920 ** strings byte by byte using the memcmp() function from the standard C
126921 ** library. */
126922 rc = memcmp(pKey1, pKey2, n);
126923 if( rc==0 ){
126924 if( padFlag
126925 && allSpaces(((char*)pKey1)+n, nKey1-n)
126926 && allSpaces(((char*)pKey2)+n, nKey2-n)
126927 ){
126928 /* EVIDENCE-OF: R-31624-24737 RTRIM is like BINARY except that extra
126929 ** spaces at the end of either string do not change the result. In other
126930 ** words, strings will compare equal to one another as long as they
126931 ** differ only in the number of spaces at the end.
126932 */
126933 }else{
126934 rc = nKey1 - nKey2;
126935 }
126936 }
126937 return rc;
@@ -125646,24 +126962,42 @@
126962
126963 /*
126964 ** Return the ROWID of the most recent insert
126965 */
126966 SQLITE_API sqlite_int64 sqlite3_last_insert_rowid(sqlite3 *db){
126967 #ifdef SQLITE_ENABLE_API_ARMOR
126968 if( !sqlite3SafetyCheckOk(db) ){
126969 (void)SQLITE_MISUSE_BKPT;
126970 return 0;
126971 }
126972 #endif
126973 return db->lastRowid;
126974 }
126975
126976 /*
126977 ** Return the number of changes in the most recent call to sqlite3_exec().
126978 */
126979 SQLITE_API int sqlite3_changes(sqlite3 *db){
126980 #ifdef SQLITE_ENABLE_API_ARMOR
126981 if( !sqlite3SafetyCheckOk(db) ){
126982 (void)SQLITE_MISUSE_BKPT;
126983 return 0;
126984 }
126985 #endif
126986 return db->nChange;
126987 }
126988
126989 /*
126990 ** Return the number of changes since the database handle was opened.
126991 */
126992 SQLITE_API int sqlite3_total_changes(sqlite3 *db){
126993 #ifdef SQLITE_ENABLE_API_ARMOR
126994 if( !sqlite3SafetyCheckOk(db) ){
126995 (void)SQLITE_MISUSE_BKPT;
126996 return 0;
126997 }
126998 #endif
126999 return db->nTotalChange;
127000 }
127001
127002 /*
127003 ** Close all open savepoints. This function only manipulates fields of the
@@ -125839,10 +127173,18 @@
127173
127174 /* Close all database connections */
127175 for(j=0; j<db->nDb; j++){
127176 struct Db *pDb = &db->aDb[j];
127177 if( pDb->pBt ){
127178 if( pDb->pSchema ){
127179 /* Must clear the KeyInfo cache. See ticket [e4a18565a36884b00edf] */
127180 for(i=sqliteHashFirst(&pDb->pSchema->idxHash); i; i=sqliteHashNext(i)){
127181 Index *pIdx = sqliteHashData(i);
127182 sqlite3KeyInfoUnref(pIdx->pKeyInfo);
127183 pIdx->pKeyInfo = 0;
127184 }
127185 }
127186 sqlite3BtreeClose(pDb->pBt);
127187 pDb->pBt = 0;
127188 if( j!=1 ){
127189 pDb->pSchema = 0;
127190 }
@@ -125925,17 +127267,19 @@
127267 sqlite3_free(db);
127268 }
127269
127270 /*
127271 ** Rollback all database files. If tripCode is not SQLITE_OK, then
127272 ** any write cursors are invalidated ("tripped" - as in "tripping a circuit
127273 ** breaker") and made to return tripCode if there are any further
127274 ** attempts to use that cursor. Read cursors remain open and valid
127275 ** but are "saved" in case the table pages are moved around.
127276 */
127277 SQLITE_PRIVATE void sqlite3RollbackAll(sqlite3 *db, int tripCode){
127278 int i;
127279 int inTrans = 0;
127280 int schemaChange;
127281 assert( sqlite3_mutex_held(db->mutex) );
127282 sqlite3BeginBenignMalloc();
127283
127284 /* Obtain all b-tree mutexes before making any calls to BtreeRollback().
127285 ** This is important in case the transaction being rolled back has
@@ -125942,18 +127286,19 @@
127286 ** modified the database schema. If the b-tree mutexes are not taken
127287 ** here, then another shared-cache connection might sneak in between
127288 ** the database rollback and schema reset, which can cause false
127289 ** corruption reports in some cases. */
127290 sqlite3BtreeEnterAll(db);
127291 schemaChange = (db->flags & SQLITE_InternChanges)!=0 && db->init.busy==0;
127292
127293 for(i=0; i<db->nDb; i++){
127294 Btree *p = db->aDb[i].pBt;
127295 if( p ){
127296 if( sqlite3BtreeIsInTrans(p) ){
127297 inTrans = 1;
127298 }
127299 sqlite3BtreeRollback(p, tripCode, !schemaChange);
127300 }
127301 }
127302 sqlite3VtabRollback(db);
127303 sqlite3EndBenignMalloc();
127304
@@ -126205,10 +127550,13 @@
127550 SQLITE_API int sqlite3_busy_handler(
127551 sqlite3 *db,
127552 int (*xBusy)(void*,int),
127553 void *pArg
127554 ){
127555 #ifdef SQLITE_ENABLE_API_ARMOR
127556 if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE;
127557 #endif
127558 sqlite3_mutex_enter(db->mutex);
127559 db->busyHandler.xFunc = xBusy;
127560 db->busyHandler.pArg = pArg;
127561 db->busyHandler.nBusy = 0;
127562 db->busyTimeout = 0;
@@ -126226,10 +127574,16 @@
127574 sqlite3 *db,
127575 int nOps,
127576 int (*xProgress)(void*),
127577 void *pArg
127578 ){
127579 #ifdef SQLITE_ENABLE_API_ARMOR
127580 if( !sqlite3SafetyCheckOk(db) ){
127581 (void)SQLITE_MISUSE_BKPT;
127582 return;
127583 }
127584 #endif
127585 sqlite3_mutex_enter(db->mutex);
127586 if( nOps>0 ){
127587 db->xProgress = xProgress;
127588 db->nProgressOps = (unsigned)nOps;
127589 db->pProgressArg = pArg;
@@ -126246,10 +127600,13 @@
127600 /*
127601 ** This routine installs a default busy handler that waits for the
127602 ** specified number of milliseconds before returning 0.
127603 */
127604 SQLITE_API int sqlite3_busy_timeout(sqlite3 *db, int ms){
127605 #ifdef SQLITE_ENABLE_API_ARMOR
127606 if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
127607 #endif
127608 if( ms>0 ){
127609 sqlite3_busy_handler(db, sqliteDefaultBusyCallback, (void*)db);
127610 db->busyTimeout = ms;
127611 }else{
127612 sqlite3_busy_handler(db, 0, 0);
@@ -126259,10 +127616,16 @@
127616
127617 /*
127618 ** Cause any pending operation to stop at its earliest opportunity.
127619 */
127620 SQLITE_API void sqlite3_interrupt(sqlite3 *db){
127621 #ifdef SQLITE_ENABLE_API_ARMOR
127622 if( !sqlite3SafetyCheckOk(db) ){
127623 (void)SQLITE_MISUSE_BKPT;
127624 return;
127625 }
127626 #endif
127627 db->u1.isInterrupted = 1;
127628 }
127629
127630
127631 /*
@@ -126396,10 +127759,16 @@
127759 void (*xFinal)(sqlite3_context*),
127760 void (*xDestroy)(void *)
127761 ){
127762 int rc = SQLITE_ERROR;
127763 FuncDestructor *pArg = 0;
127764
127765 #ifdef SQLITE_ENABLE_API_ARMOR
127766 if( !sqlite3SafetyCheckOk(db) ){
127767 return SQLITE_MISUSE_BKPT;
127768 }
127769 #endif
127770 sqlite3_mutex_enter(db->mutex);
127771 if( xDestroy ){
127772 pArg = (FuncDestructor *)sqlite3DbMallocZero(db, sizeof(FuncDestructor));
127773 if( !pArg ){
127774 xDestroy(p);
@@ -126432,10 +127801,14 @@
127801 void (*xStep)(sqlite3_context*,int,sqlite3_value**),
127802 void (*xFinal)(sqlite3_context*)
127803 ){
127804 int rc;
127805 char *zFunc8;
127806
127807 #ifdef SQLITE_ENABLE_API_ARMOR
127808 if( !sqlite3SafetyCheckOk(db) || zFunctionName==0 ) return SQLITE_MISUSE_BKPT;
127809 #endif
127810 sqlite3_mutex_enter(db->mutex);
127811 assert( !db->mallocFailed );
127812 zFunc8 = sqlite3Utf16to8(db, zFunctionName, -1, SQLITE_UTF16NATIVE);
127813 rc = sqlite3CreateFunc(db, zFunc8, nArg, eTextRep, p, xFunc, xStep, xFinal,0);
127814 sqlite3DbFree(db, zFunc8);
@@ -126463,10 +127836,16 @@
127836 const char *zName,
127837 int nArg
127838 ){
127839 int nName = sqlite3Strlen30(zName);
127840 int rc = SQLITE_OK;
127841
127842 #ifdef SQLITE_ENABLE_API_ARMOR
127843 if( !sqlite3SafetyCheckOk(db) || zName==0 || nArg<-2 ){
127844 return SQLITE_MISUSE_BKPT;
127845 }
127846 #endif
127847 sqlite3_mutex_enter(db->mutex);
127848 if( sqlite3FindFunction(db, zName, nName, nArg, SQLITE_UTF8, 0)==0 ){
127849 rc = sqlite3CreateFunc(db, zName, nArg, SQLITE_UTF8,
127850 0, sqlite3InvalidFunction, 0, 0, 0);
127851 }
@@ -126484,10 +127863,17 @@
127863 ** trace is a pointer to a function that is invoked at the start of each
127864 ** SQL statement.
127865 */
127866 SQLITE_API void *sqlite3_trace(sqlite3 *db, void (*xTrace)(void*,const char*), void *pArg){
127867 void *pOld;
127868
127869 #ifdef SQLITE_ENABLE_API_ARMOR
127870 if( !sqlite3SafetyCheckOk(db) ){
127871 (void)SQLITE_MISUSE_BKPT;
127872 return 0;
127873 }
127874 #endif
127875 sqlite3_mutex_enter(db->mutex);
127876 pOld = db->pTraceArg;
127877 db->xTrace = xTrace;
127878 db->pTraceArg = pArg;
127879 sqlite3_mutex_leave(db->mutex);
@@ -126505,10 +127891,17 @@
127891 sqlite3 *db,
127892 void (*xProfile)(void*,const char*,sqlite_uint64),
127893 void *pArg
127894 ){
127895 void *pOld;
127896
127897 #ifdef SQLITE_ENABLE_API_ARMOR
127898 if( !sqlite3SafetyCheckOk(db) ){
127899 (void)SQLITE_MISUSE_BKPT;
127900 return 0;
127901 }
127902 #endif
127903 sqlite3_mutex_enter(db->mutex);
127904 pOld = db->pProfileArg;
127905 db->xProfile = xProfile;
127906 db->pProfileArg = pArg;
127907 sqlite3_mutex_leave(db->mutex);
@@ -126525,10 +127918,17 @@
127918 sqlite3 *db, /* Attach the hook to this database */
127919 int (*xCallback)(void*), /* Function to invoke on each commit */
127920 void *pArg /* Argument to the function */
127921 ){
127922 void *pOld;
127923
127924 #ifdef SQLITE_ENABLE_API_ARMOR
127925 if( !sqlite3SafetyCheckOk(db) ){
127926 (void)SQLITE_MISUSE_BKPT;
127927 return 0;
127928 }
127929 #endif
127930 sqlite3_mutex_enter(db->mutex);
127931 pOld = db->pCommitArg;
127932 db->xCommitCallback = xCallback;
127933 db->pCommitArg = pArg;
127934 sqlite3_mutex_leave(db->mutex);
@@ -126543,10 +127943,17 @@
127943 sqlite3 *db, /* Attach the hook to this database */
127944 void (*xCallback)(void*,int,char const *,char const *,sqlite_int64),
127945 void *pArg /* Argument to the function */
127946 ){
127947 void *pRet;
127948
127949 #ifdef SQLITE_ENABLE_API_ARMOR
127950 if( !sqlite3SafetyCheckOk(db) ){
127951 (void)SQLITE_MISUSE_BKPT;
127952 return 0;
127953 }
127954 #endif
127955 sqlite3_mutex_enter(db->mutex);
127956 pRet = db->pUpdateArg;
127957 db->xUpdateCallback = xCallback;
127958 db->pUpdateArg = pArg;
127959 sqlite3_mutex_leave(db->mutex);
@@ -126561,10 +127968,17 @@
127968 sqlite3 *db, /* Attach the hook to this database */
127969 void (*xCallback)(void*), /* Callback function */
127970 void *pArg /* Argument to the function */
127971 ){
127972 void *pRet;
127973
127974 #ifdef SQLITE_ENABLE_API_ARMOR
127975 if( !sqlite3SafetyCheckOk(db) ){
127976 (void)SQLITE_MISUSE_BKPT;
127977 return 0;
127978 }
127979 #endif
127980 sqlite3_mutex_enter(db->mutex);
127981 pRet = db->pRollbackArg;
127982 db->xRollbackCallback = xCallback;
127983 db->pRollbackArg = pArg;
127984 sqlite3_mutex_leave(db->mutex);
@@ -126607,10 +128021,13 @@
128021 SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int nFrame){
128022 #ifdef SQLITE_OMIT_WAL
128023 UNUSED_PARAMETER(db);
128024 UNUSED_PARAMETER(nFrame);
128025 #else
128026 #ifdef SQLITE_ENABLE_API_ARMOR
128027 if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
128028 #endif
128029 if( nFrame>0 ){
128030 sqlite3_wal_hook(db, sqlite3WalDefaultHook, SQLITE_INT_TO_PTR(nFrame));
128031 }else{
128032 sqlite3_wal_hook(db, 0, 0);
128033 }
@@ -126627,10 +128044,16 @@
128044 int(*xCallback)(void *, sqlite3*, const char*, int),
128045 void *pArg /* First argument passed to xCallback() */
128046 ){
128047 #ifndef SQLITE_OMIT_WAL
128048 void *pRet;
128049 #ifdef SQLITE_ENABLE_API_ARMOR
128050 if( !sqlite3SafetyCheckOk(db) ){
128051 (void)SQLITE_MISUSE_BKPT;
128052 return 0;
128053 }
128054 #endif
128055 sqlite3_mutex_enter(db->mutex);
128056 pRet = db->pWalArg;
128057 db->xWalCallback = xCallback;
128058 db->pWalArg = pArg;
128059 sqlite3_mutex_leave(db->mutex);
@@ -126653,19 +128076,26 @@
128076 #ifdef SQLITE_OMIT_WAL
128077 return SQLITE_OK;
128078 #else
128079 int rc; /* Return code */
128080 int iDb = SQLITE_MAX_ATTACHED; /* sqlite3.aDb[] index of db to checkpoint */
128081
128082 #ifdef SQLITE_ENABLE_API_ARMOR
128083 if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
128084 #endif
128085
128086 /* Initialize the output variables to -1 in case an error occurs. */
128087 if( pnLog ) *pnLog = -1;
128088 if( pnCkpt ) *pnCkpt = -1;
128089
128090 assert( SQLITE_CHECKPOINT_PASSIVE==0 );
128091 assert( SQLITE_CHECKPOINT_FULL==1 );
128092 assert( SQLITE_CHECKPOINT_RESTART==2 );
128093 assert( SQLITE_CHECKPOINT_TRUNCATE==3 );
128094 if( eMode<SQLITE_CHECKPOINT_PASSIVE || eMode>SQLITE_CHECKPOINT_TRUNCATE ){
128095 /* EVIDENCE-OF: R-03996-12088 The M parameter must be a valid checkpoint
128096 ** mode: */
128097 return SQLITE_MISUSE;
128098 }
128099
128100 sqlite3_mutex_enter(db->mutex);
128101 if( zDb && zDb[0] ){
@@ -126689,11 +128119,13 @@
128119 ** Checkpoint database zDb. If zDb is NULL, or if the buffer zDb points
128120 ** to contains a zero-length string, all attached databases are
128121 ** checkpointed.
128122 */
128123 SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb){
128124 /* EVIDENCE-OF: R-41613-20553 The sqlite3_wal_checkpoint(D,X) is equivalent to
128125 ** sqlite3_wal_checkpoint_v2(D,X,SQLITE_CHECKPOINT_PASSIVE,0,0). */
128126 return sqlite3_wal_checkpoint_v2(db,zDb,SQLITE_CHECKPOINT_PASSIVE,0,0);
128127 }
128128
128129 #ifndef SQLITE_OMIT_WAL
128130 /*
128131 ** Run a checkpoint on database iDb. This is a no-op if database iDb is
@@ -127050,10 +128482,16 @@
128482 ** from forming.
128483 */
128484 SQLITE_API int sqlite3_limit(sqlite3 *db, int limitId, int newLimit){
128485 int oldLimit;
128486
128487 #ifdef SQLITE_ENABLE_API_ARMOR
128488 if( !sqlite3SafetyCheckOk(db) ){
128489 (void)SQLITE_MISUSE_BKPT;
128490 return -1;
128491 }
128492 #endif
128493
128494 /* EVIDENCE-OF: R-30189-54097 For each limit category SQLITE_LIMIT_NAME
128495 ** there is a hard upper bound set at compile-time by a C preprocessor
128496 ** macro called SQLITE_MAX_NAME. (The "_LIMIT_" in the name is changed to
128497 ** "_MAX_".)
@@ -127126,11 +128564,12 @@
128564 char c;
128565 int nUri = sqlite3Strlen30(zUri);
128566
128567 assert( *pzErrMsg==0 );
128568
128569 if( ((flags & SQLITE_OPEN_URI) /* IMP: R-48725-32206 */
128570 || sqlite3GlobalConfig.bOpenUri) /* IMP: R-51689-46548 */
128571 && nUri>=5 && memcmp(zUri, "file:", 5)==0 /* IMP: R-57884-37496 */
128572 ){
128573 char *zOpt;
128574 int eState; /* Parser state when parsing URI */
128575 int iIn; /* Input character index */
@@ -127335,10 +128774,13 @@
128774 int rc; /* Return code */
128775 int isThreadsafe; /* True for threadsafe connections */
128776 char *zOpen = 0; /* Filename argument to pass to BtreeOpen() */
128777 char *zErrMsg = 0; /* Error message from sqlite3ParseUri() */
128778
128779 #ifdef SQLITE_ENABLE_API_ARMOR
128780 if( ppDb==0 ) return SQLITE_MISUSE_BKPT;
128781 #endif
128782 *ppDb = 0;
128783 #ifndef SQLITE_OMIT_AUTOINIT
128784 rc = sqlite3_initialize();
128785 if( rc ) return rc;
128786 #endif
@@ -127449,24 +128891,28 @@
128891 #endif
128892
128893 /* Add the default collation sequence BINARY. BINARY works for both UTF-8
128894 ** and UTF-16, so add a version for each to avoid any unnecessary
128895 ** conversions. The only error that can occur here is a malloc() failure.
128896 **
128897 ** EVIDENCE-OF: R-52786-44878 SQLite defines three built-in collating
128898 ** functions:
128899 */
128900 createCollation(db, "BINARY", SQLITE_UTF8, 0, binCollFunc, 0);
128901 createCollation(db, "BINARY", SQLITE_UTF16BE, 0, binCollFunc, 0);
128902 createCollation(db, "BINARY", SQLITE_UTF16LE, 0, binCollFunc, 0);
128903 createCollation(db, "NOCASE", SQLITE_UTF8, 0, nocaseCollatingFunc, 0);
128904 createCollation(db, "RTRIM", SQLITE_UTF8, (void*)1, binCollFunc, 0);
128905 if( db->mallocFailed ){
128906 goto opendb_out;
128907 }
128908 /* EVIDENCE-OF: R-08308-17224 The default collating function for all
128909 ** strings is BINARY.
128910 */
128911 db->pDfltColl = sqlite3FindCollSeq(db, SQLITE_UTF8, "BINARY", 0);
128912 assert( db->pDfltColl!=0 );
128913
 
 
 
128914 /* Parse the filename/URI argument. */
128915 db->openFlags = flags;
128916 rc = sqlite3ParseUri(zVfs, zFilename, &flags, &db->pVfs, &zOpen, &zErrMsg);
128917 if( rc!=SQLITE_OK ){
128918 if( rc==SQLITE_NOMEM ) db->mallocFailed = 1;
@@ -127624,17 +129070,19 @@
129070 ){
129071 char const *zFilename8; /* zFilename encoded in UTF-8 instead of UTF-16 */
129072 sqlite3_value *pVal;
129073 int rc;
129074
129075 #ifdef SQLITE_ENABLE_API_ARMOR
129076 if( ppDb==0 ) return SQLITE_MISUSE_BKPT;
129077 #endif
129078 *ppDb = 0;
129079 #ifndef SQLITE_OMIT_AUTOINIT
129080 rc = sqlite3_initialize();
129081 if( rc ) return rc;
129082 #endif
129083 if( zFilename==0 ) zFilename = "\000\000";
129084 pVal = sqlite3ValueNew(0);
129085 sqlite3ValueSetStr(pVal, -1, zFilename, SQLITE_UTF16NATIVE, SQLITE_STATIC);
129086 zFilename8 = sqlite3ValueText(pVal, SQLITE_UTF8);
129087 if( zFilename8 ){
129088 rc = openDatabase(zFilename8, ppDb,
@@ -127660,17 +129108,11 @@
129108 const char *zName,
129109 int enc,
129110 void* pCtx,
129111 int(*xCompare)(void*,int,const void*,int,const void*)
129112 ){
129113 return sqlite3_create_collation_v2(db, zName, enc, pCtx, xCompare, 0);
 
 
 
 
 
 
129114 }
129115
129116 /*
129117 ** Register a new collation sequence with the database handle db.
129118 */
@@ -127681,10 +129123,14 @@
129123 void* pCtx,
129124 int(*xCompare)(void*,int,const void*,int,const void*),
129125 void(*xDel)(void*)
129126 ){
129127 int rc;
129128
129129 #ifdef SQLITE_ENABLE_API_ARMOR
129130 if( !sqlite3SafetyCheckOk(db) || zName==0 ) return SQLITE_MISUSE_BKPT;
129131 #endif
129132 sqlite3_mutex_enter(db->mutex);
129133 assert( !db->mallocFailed );
129134 rc = createCollation(db, zName, (u8)enc, pCtx, xCompare, xDel);
129135 rc = sqlite3ApiExit(db, rc);
129136 sqlite3_mutex_leave(db->mutex);
@@ -127702,10 +129148,14 @@
129148 void* pCtx,
129149 int(*xCompare)(void*,int,const void*,int,const void*)
129150 ){
129151 int rc = SQLITE_OK;
129152 char *zName8;
129153
129154 #ifdef SQLITE_ENABLE_API_ARMOR
129155 if( !sqlite3SafetyCheckOk(db) || zName==0 ) return SQLITE_MISUSE_BKPT;
129156 #endif
129157 sqlite3_mutex_enter(db->mutex);
129158 assert( !db->mallocFailed );
129159 zName8 = sqlite3Utf16to8(db, zName, -1, SQLITE_UTF16NATIVE);
129160 if( zName8 ){
129161 rc = createCollation(db, zName8, (u8)enc, pCtx, xCompare, 0);
@@ -127724,10 +129174,13 @@
129174 SQLITE_API int sqlite3_collation_needed(
129175 sqlite3 *db,
129176 void *pCollNeededArg,
129177 void(*xCollNeeded)(void*,sqlite3*,int eTextRep,const char*)
129178 ){
129179 #ifdef SQLITE_ENABLE_API_ARMOR
129180 if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
129181 #endif
129182 sqlite3_mutex_enter(db->mutex);
129183 db->xCollNeeded = xCollNeeded;
129184 db->xCollNeeded16 = 0;
129185 db->pCollNeededArg = pCollNeededArg;
129186 sqlite3_mutex_leave(db->mutex);
@@ -127742,10 +129195,13 @@
129195 SQLITE_API int sqlite3_collation_needed16(
129196 sqlite3 *db,
129197 void *pCollNeededArg,
129198 void(*xCollNeeded16)(void*,sqlite3*,int eTextRep,const void*)
129199 ){
129200 #ifdef SQLITE_ENABLE_API_ARMOR
129201 if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
129202 #endif
129203 sqlite3_mutex_enter(db->mutex);
129204 db->xCollNeeded = 0;
129205 db->xCollNeeded16 = xCollNeeded16;
129206 db->pCollNeededArg = pCollNeededArg;
129207 sqlite3_mutex_leave(db->mutex);
@@ -127768,10 +129224,16 @@
129224 ** mode. Return TRUE if it is and FALSE if not. Autocommit mode is on
129225 ** by default. Autocommit is disabled by a BEGIN statement and reenabled
129226 ** by the next COMMIT or ROLLBACK.
129227 */
129228 SQLITE_API int sqlite3_get_autocommit(sqlite3 *db){
129229 #ifdef SQLITE_ENABLE_API_ARMOR
129230 if( !sqlite3SafetyCheckOk(db) ){
129231 (void)SQLITE_MISUSE_BKPT;
129232 return 0;
129233 }
129234 #endif
129235 return db->autoCommit;
129236 }
129237
129238 /*
129239 ** The following routines are substitutes for constants SQLITE_CORRUPT,
@@ -127950,10 +129412,13 @@
129412
129413 /*
129414 ** Enable or disable the extended result codes.
129415 */
129416 SQLITE_API int sqlite3_extended_result_codes(sqlite3 *db, int onoff){
129417 #ifdef SQLITE_ENABLE_API_ARMOR
129418 if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
129419 #endif
129420 sqlite3_mutex_enter(db->mutex);
129421 db->errMask = onoff ? 0xffffffff : 0xff;
129422 sqlite3_mutex_leave(db->mutex);
129423 return SQLITE_OK;
129424 }
@@ -127963,10 +129428,13 @@
129428 */
129429 SQLITE_API int sqlite3_file_control(sqlite3 *db, const char *zDbName, int op, void *pArg){
129430 int rc = SQLITE_ERROR;
129431 Btree *pBtree;
129432
129433 #ifdef SQLITE_ENABLE_API_ARMOR
129434 if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
129435 #endif
129436 sqlite3_mutex_enter(db->mutex);
129437 pBtree = sqlite3DbNameToBtree(db, zDbName);
129438 if( pBtree ){
129439 Pager *pPager;
129440 sqlite3_file *fd;
@@ -128305,11 +129773,11 @@
129773 ** query parameter we seek. This routine returns the value of the zParam
129774 ** parameter if it exists. If the parameter does not exist, this routine
129775 ** returns a NULL pointer.
129776 */
129777 SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam){
129778 if( zFilename==0 || zParam==0 ) return 0;
129779 zFilename += sqlite3Strlen30(zFilename) + 1;
129780 while( zFilename[0] ){
129781 int x = strcmp(zFilename, zParam);
129782 zFilename += sqlite3Strlen30(zFilename) + 1;
129783 if( x==0 ) return zFilename;
@@ -128361,19 +129829,31 @@
129829 /*
129830 ** Return the filename of the database associated with a database
129831 ** connection.
129832 */
129833 SQLITE_API const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName){
129834 #ifdef SQLITE_ENABLE_API_ARMOR
129835 if( !sqlite3SafetyCheckOk(db) ){
129836 (void)SQLITE_MISUSE_BKPT;
129837 return 0;
129838 }
129839 #endif
129840 Btree *pBt = sqlite3DbNameToBtree(db, zDbName);
129841 return pBt ? sqlite3BtreeGetFilename(pBt) : 0;
129842 }
129843
129844 /*
129845 ** Return 1 if database is read-only or 0 if read/write. Return -1 if
129846 ** no such database exists.
129847 */
129848 SQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName){
129849 #ifdef SQLITE_ENABLE_API_ARMOR
129850 if( !sqlite3SafetyCheckOk(db) ){
129851 (void)SQLITE_MISUSE_BKPT;
129852 return -1;
129853 }
129854 #endif
129855 Btree *pBt = sqlite3DbNameToBtree(db, zDbName);
129856 return pBt ? sqlite3BtreeIsReadonly(pBt) : -1;
129857 }
129858
129859 /************** End of main.c ************************************************/
@@ -137791,11 +139271,11 @@
139271 ** Return true if the m-value for z is 1 or more. In other words,
139272 ** return true if z contains at least one vowel that is followed
139273 ** by a consonant.
139274 **
139275 ** In this routine z[] is in reverse order. So we are really looking
139276 ** for an instance of a consonant followed by a vowel.
139277 */
139278 static int m_gt_0(const char *z){
139279 while( isVowel(z) ){ z++; }
139280 if( *z==0 ) return 0;
139281 while( isConsonant(z) ){ z++; }
139282
+450 -300
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -55,11 +55,11 @@
5555
5656
5757
/*
5858
** These no-op macros are used in front of interfaces to mark those
5959
** interfaces as either deprecated or experimental. New applications
60
-** should not use deprecated interfaces - they are support for backwards
60
+** should not use deprecated interfaces - they are supported for backwards
6161
** compatibility only. Application writers should be aware that
6262
** experimental interfaces are subject to change in point releases.
6363
**
6464
** These macros used to resolve to various kinds of compiler magic that
6565
** would generate warning messages when they were used. But that
@@ -105,13 +105,13 @@
105105
**
106106
** See also: [sqlite3_libversion()],
107107
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108108
** [sqlite_version()] and [sqlite_source_id()].
109109
*/
110
-#define SQLITE_VERSION "3.8.7.1"
111
-#define SQLITE_VERSION_NUMBER 3008007
112
-#define SQLITE_SOURCE_ID "2014-10-29 01:27:43 83afe23e553e802c0947c80d0ffdd120423e7c52"
110
+#define SQLITE_VERSION "3.8.8"
111
+#define SQLITE_VERSION_NUMBER 3008008
112
+#define SQLITE_SOURCE_ID "2014-12-06 14:56:49 6aeece19a235344be2537e66a3fe08b1febfb5a0"
113113
114114
/*
115115
** CAPI3REF: Run-Time Library Version Numbers
116116
** KEYWORDS: sqlite3_version, sqlite3_sourceid
117117
**
@@ -1219,11 +1219,11 @@
12191219
** <li> SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED
12201220
** <li> SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE
12211221
** </ul>
12221222
**
12231223
** When unlocking, the same SHARED or EXCLUSIVE flag must be supplied as
1224
-** was given no the corresponding lock.
1224
+** was given on the corresponding lock.
12251225
**
12261226
** The xShmLock method can transition between unlocked and SHARED or
12271227
** between unlocked and EXCLUSIVE. It cannot transition between SHARED
12281228
** and EXCLUSIVE.
12291229
*/
@@ -1502,30 +1502,32 @@
15021502
** it is not possible to set the Serialized [threading mode] and
15031503
** [sqlite3_config()] will return [SQLITE_ERROR] if called with the
15041504
** SQLITE_CONFIG_SERIALIZED configuration option.</dd>
15051505
**
15061506
** [[SQLITE_CONFIG_MALLOC]] <dt>SQLITE_CONFIG_MALLOC</dt>
1507
-** <dd> ^(This option takes a single argument which is a pointer to an
1508
-** instance of the [sqlite3_mem_methods] structure. The argument specifies
1507
+** <dd> ^(The SQLITE_CONFIG_MALLOC option takes a single argument which is
1508
+** a pointer to an instance of the [sqlite3_mem_methods] structure.
1509
+** The argument specifies
15091510
** alternative low-level memory allocation routines to be used in place of
15101511
** the memory allocation routines built into SQLite.)^ ^SQLite makes
15111512
** its own private copy of the content of the [sqlite3_mem_methods] structure
15121513
** before the [sqlite3_config()] call returns.</dd>
15131514
**
15141515
** [[SQLITE_CONFIG_GETMALLOC]] <dt>SQLITE_CONFIG_GETMALLOC</dt>
1515
-** <dd> ^(This option takes a single argument which is a pointer to an
1516
-** instance of the [sqlite3_mem_methods] structure. The [sqlite3_mem_methods]
1516
+** <dd> ^(The SQLITE_CONFIG_GETMALLOC option takes a single argument which
1517
+** is a pointer to an instance of the [sqlite3_mem_methods] structure.
1518
+** The [sqlite3_mem_methods]
15171519
** structure is filled with the currently defined memory allocation routines.)^
15181520
** This option can be used to overload the default memory allocation
15191521
** routines with a wrapper that simulations memory allocation failure or
15201522
** tracks memory usage, for example. </dd>
15211523
**
15221524
** [[SQLITE_CONFIG_MEMSTATUS]] <dt>SQLITE_CONFIG_MEMSTATUS</dt>
1523
-** <dd> ^This option takes single argument of type int, interpreted as a
1524
-** boolean, which enables or disables the collection of memory allocation
1525
-** statistics. ^(When memory allocation statistics are disabled, the
1526
-** following SQLite interfaces become non-operational:
1525
+** <dd> ^The SQLITE_CONFIG_MEMSTATUS option takes single argument of type int,
1526
+** interpreted as a boolean, which enables or disables the collection of
1527
+** memory allocation statistics. ^(When memory allocation statistics are
1528
+** disabled, the following SQLite interfaces become non-operational:
15271529
** <ul>
15281530
** <li> [sqlite3_memory_used()]
15291531
** <li> [sqlite3_memory_highwater()]
15301532
** <li> [sqlite3_soft_heap_limit64()]
15311533
** <li> [sqlite3_status()]
@@ -1534,78 +1536,92 @@
15341536
** compiled with [SQLITE_DEFAULT_MEMSTATUS]=0 in which case memory
15351537
** allocation statistics are disabled by default.
15361538
** </dd>
15371539
**
15381540
** [[SQLITE_CONFIG_SCRATCH]] <dt>SQLITE_CONFIG_SCRATCH</dt>
1539
-** <dd> ^This option specifies a static memory buffer that SQLite can use for
1540
-** scratch memory. There are three arguments: A pointer an 8-byte
1541
+** <dd> ^The SQLITE_CONFIG_SCRATCH option specifies a static memory buffer
1542
+** that SQLite can use for scratch memory. ^(There are three arguments
1543
+** to SQLITE_CONFIG_SCRATCH: A pointer an 8-byte
15411544
** aligned memory buffer from which the scratch allocations will be
15421545
** drawn, the size of each scratch allocation (sz),
1543
-** and the maximum number of scratch allocations (N). The sz
1544
-** argument must be a multiple of 16.
1546
+** and the maximum number of scratch allocations (N).)^
15451547
** The first argument must be a pointer to an 8-byte aligned buffer
15461548
** of at least sz*N bytes of memory.
1547
-** ^SQLite will use no more than two scratch buffers per thread. So
1548
-** N should be set to twice the expected maximum number of threads.
1549
-** ^SQLite will never require a scratch buffer that is more than 6
1550
-** times the database page size. ^If SQLite needs needs additional
1549
+** ^SQLite will not use more than one scratch buffers per thread.
1550
+** ^SQLite will never request a scratch buffer that is more than 6
1551
+** times the database page size.
1552
+** ^If SQLite needs needs additional
15511553
** scratch memory beyond what is provided by this configuration option, then
1552
-** [sqlite3_malloc()] will be used to obtain the memory needed.</dd>
1554
+** [sqlite3_malloc()] will be used to obtain the memory needed.<p>
1555
+** ^When the application provides any amount of scratch memory using
1556
+** SQLITE_CONFIG_SCRATCH, SQLite avoids unnecessary large
1557
+** [sqlite3_malloc|heap allocations].
1558
+** This can help [Robson proof|prevent memory allocation failures] due to heap
1559
+** fragmentation in low-memory embedded systems.
1560
+** </dd>
15531561
**
15541562
** [[SQLITE_CONFIG_PAGECACHE]] <dt>SQLITE_CONFIG_PAGECACHE</dt>
1555
-** <dd> ^This option specifies a static memory buffer that SQLite can use for
1556
-** the database page cache with the default page cache implementation.
1563
+** <dd> ^The SQLITE_CONFIG_PAGECACHE option specifies a static memory buffer
1564
+** that SQLite can use for the database page cache with the default page
1565
+** cache implementation.
15571566
** This configuration should not be used if an application-define page
1558
-** cache implementation is loaded using the SQLITE_CONFIG_PCACHE2 option.
1559
-** There are three arguments to this option: A pointer to 8-byte aligned
1567
+** cache implementation is loaded using the [SQLITE_CONFIG_PCACHE2]
1568
+** configuration option.
1569
+** ^There are three arguments to SQLITE_CONFIG_PAGECACHE: A pointer to
1570
+** 8-byte aligned
15601571
** memory, the size of each page buffer (sz), and the number of pages (N).
15611572
** The sz argument should be the size of the largest database page
1562
-** (a power of two between 512 and 32768) plus a little extra for each
1563
-** page header. ^The page header size is 20 to 40 bytes depending on
1564
-** the host architecture. ^It is harmless, apart from the wasted memory,
1565
-** to make sz a little too large. The first
1566
-** argument should point to an allocation of at least sz*N bytes of memory.
1573
+** (a power of two between 512 and 32768) plus some extra bytes for each
1574
+** page header. ^The number of extra bytes needed by the page header
1575
+** can be determined using the [SQLITE_CONFIG_PCACHE_HDRSZ] option
1576
+** to [sqlite3_config()].
1577
+** ^It is harmless, apart from the wasted memory,
1578
+** for the sz parameter to be larger than necessary. The first
1579
+** argument should pointer to an 8-byte aligned block of memory that
1580
+** is at least sz*N bytes of memory, otherwise subsequent behavior is
1581
+** undefined.
15671582
** ^SQLite will use the memory provided by the first argument to satisfy its
15681583
** memory needs for the first N pages that it adds to cache. ^If additional
15691584
** page cache memory is needed beyond what is provided by this option, then
1570
-** SQLite goes to [sqlite3_malloc()] for the additional storage space.
1571
-** The pointer in the first argument must
1572
-** be aligned to an 8-byte boundary or subsequent behavior of SQLite
1573
-** will be undefined.</dd>
1585
+** SQLite goes to [sqlite3_malloc()] for the additional storage space.</dd>
15741586
**
15751587
** [[SQLITE_CONFIG_HEAP]] <dt>SQLITE_CONFIG_HEAP</dt>
1576
-** <dd> ^This option specifies a static memory buffer that SQLite will use
1577
-** for all of its dynamic memory allocation needs beyond those provided
1578
-** for by [SQLITE_CONFIG_SCRATCH] and [SQLITE_CONFIG_PAGECACHE].
1579
-** There are three arguments: An 8-byte aligned pointer to the memory,
1588
+** <dd> ^The SQLITE_CONFIG_HEAP option specifies a static memory buffer
1589
+** that SQLite will use for all of its dynamic memory allocation needs
1590
+** beyond those provided for by [SQLITE_CONFIG_SCRATCH] and
1591
+** [SQLITE_CONFIG_PAGECACHE].
1592
+** ^The SQLITE_CONFIG_HEAP option is only available if SQLite is compiled
1593
+** with either [SQLITE_ENABLE_MEMSYS3] or [SQLITE_ENABLE_MEMSYS5] and returns
1594
+** [SQLITE_ERROR] if invoked otherwise.
1595
+** ^There are three arguments to SQLITE_CONFIG_HEAP:
1596
+** An 8-byte aligned pointer to the memory,
15801597
** the number of bytes in the memory buffer, and the minimum allocation size.
15811598
** ^If the first pointer (the memory pointer) is NULL, then SQLite reverts
15821599
** to using its default memory allocator (the system malloc() implementation),
15831600
** undoing any prior invocation of [SQLITE_CONFIG_MALLOC]. ^If the
1584
-** memory pointer is not NULL and either [SQLITE_ENABLE_MEMSYS3] or
1585
-** [SQLITE_ENABLE_MEMSYS5] are defined, then the alternative memory
1601
+** memory pointer is not NULL then the alternative memory
15861602
** allocator is engaged to handle all of SQLites memory allocation needs.
15871603
** The first pointer (the memory pointer) must be aligned to an 8-byte
15881604
** boundary or subsequent behavior of SQLite will be undefined.
15891605
** The minimum allocation size is capped at 2**12. Reasonable values
15901606
** for the minimum allocation size are 2**5 through 2**8.</dd>
15911607
**
15921608
** [[SQLITE_CONFIG_MUTEX]] <dt>SQLITE_CONFIG_MUTEX</dt>
1593
-** <dd> ^(This option takes a single argument which is a pointer to an
1594
-** instance of the [sqlite3_mutex_methods] structure. The argument specifies
1595
-** alternative low-level mutex routines to be used in place
1596
-** the mutex routines built into SQLite.)^ ^SQLite makes a copy of the
1597
-** content of the [sqlite3_mutex_methods] structure before the call to
1609
+** <dd> ^(The SQLITE_CONFIG_MUTEX option takes a single argument which is a
1610
+** pointer to an instance of the [sqlite3_mutex_methods] structure.
1611
+** The argument specifies alternative low-level mutex routines to be used
1612
+** in place the mutex routines built into SQLite.)^ ^SQLite makes a copy of
1613
+** the content of the [sqlite3_mutex_methods] structure before the call to
15981614
** [sqlite3_config()] returns. ^If SQLite is compiled with
15991615
** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
16001616
** the entire mutexing subsystem is omitted from the build and hence calls to
16011617
** [sqlite3_config()] with the SQLITE_CONFIG_MUTEX configuration option will
16021618
** return [SQLITE_ERROR].</dd>
16031619
**
16041620
** [[SQLITE_CONFIG_GETMUTEX]] <dt>SQLITE_CONFIG_GETMUTEX</dt>
1605
-** <dd> ^(This option takes a single argument which is a pointer to an
1606
-** instance of the [sqlite3_mutex_methods] structure. The
1621
+** <dd> ^(The SQLITE_CONFIG_GETMUTEX option takes a single argument which
1622
+** is a pointer to an instance of the [sqlite3_mutex_methods] structure. The
16071623
** [sqlite3_mutex_methods]
16081624
** structure is filled with the currently defined mutex routines.)^
16091625
** This option can be used to overload the default mutex allocation
16101626
** routines with a wrapper used to track mutex usage for performance
16111627
** profiling or testing, for example. ^If SQLite is compiled with
@@ -1613,29 +1629,29 @@
16131629
** the entire mutexing subsystem is omitted from the build and hence calls to
16141630
** [sqlite3_config()] with the SQLITE_CONFIG_GETMUTEX configuration option will
16151631
** return [SQLITE_ERROR].</dd>
16161632
**
16171633
** [[SQLITE_CONFIG_LOOKASIDE]] <dt>SQLITE_CONFIG_LOOKASIDE</dt>
1618
-** <dd> ^(This option takes two arguments that determine the default
1619
-** memory allocation for the lookaside memory allocator on each
1620
-** [database connection]. The first argument is the
1634
+** <dd> ^(The SQLITE_CONFIG_LOOKASIDE option takes two arguments that determine
1635
+** the default size of lookaside memory on each [database connection].
1636
+** The first argument is the
16211637
** size of each lookaside buffer slot and the second is the number of
1622
-** slots allocated to each database connection.)^ ^(This option sets the
1623
-** <i>default</i> lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE]
1624
-** verb to [sqlite3_db_config()] can be used to change the lookaside
1638
+** slots allocated to each database connection.)^ ^(SQLITE_CONFIG_LOOKASIDE
1639
+** sets the <i>default</i> lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE]
1640
+** option to [sqlite3_db_config()] can be used to change the lookaside
16251641
** configuration on individual connections.)^ </dd>
16261642
**
16271643
** [[SQLITE_CONFIG_PCACHE2]] <dt>SQLITE_CONFIG_PCACHE2</dt>
1628
-** <dd> ^(This option takes a single argument which is a pointer to
1629
-** an [sqlite3_pcache_methods2] object. This object specifies the interface
1630
-** to a custom page cache implementation.)^ ^SQLite makes a copy of the
1631
-** object and uses it for page cache memory allocations.</dd>
1644
+** <dd> ^(The SQLITE_CONFIG_PCACHE2 option takes a single argument which is
1645
+** a pointer to an [sqlite3_pcache_methods2] object. This object specifies
1646
+** the interface to a custom page cache implementation.)^
1647
+** ^SQLite makes a copy of the [sqlite3_pcache_methods2] object.</dd>
16321648
**
16331649
** [[SQLITE_CONFIG_GETPCACHE2]] <dt>SQLITE_CONFIG_GETPCACHE2</dt>
1634
-** <dd> ^(This option takes a single argument which is a pointer to an
1635
-** [sqlite3_pcache_methods2] object. SQLite copies of the current
1636
-** page cache implementation into that object.)^ </dd>
1650
+** <dd> ^(The SQLITE_CONFIG_GETPCACHE2 option takes a single argument which
1651
+** is a pointer to an [sqlite3_pcache_methods2] object. SQLite copies of
1652
+** the current page cache implementation into that object.)^ </dd>
16371653
**
16381654
** [[SQLITE_CONFIG_LOG]] <dt>SQLITE_CONFIG_LOG</dt>
16391655
** <dd> The SQLITE_CONFIG_LOG option is used to configure the SQLite
16401656
** global [error log].
16411657
** (^The SQLITE_CONFIG_LOG option takes two arguments: a pointer to a
@@ -1654,26 +1670,28 @@
16541670
** supplied by the application must not invoke any SQLite interface.
16551671
** In a multi-threaded application, the application-defined logger
16561672
** function must be threadsafe. </dd>
16571673
**
16581674
** [[SQLITE_CONFIG_URI]] <dt>SQLITE_CONFIG_URI
1659
-** <dd>^(This option takes a single argument of type int. If non-zero, then
1660
-** URI handling is globally enabled. If the parameter is zero, then URI handling
1661
-** is globally disabled.)^ ^If URI handling is globally enabled, all filenames
1662
-** passed to [sqlite3_open()], [sqlite3_open_v2()], [sqlite3_open16()] or
1675
+** <dd>^(The SQLITE_CONFIG_URI option takes a single argument of type int.
1676
+** If non-zero, then URI handling is globally enabled. If the parameter is zero,
1677
+** then URI handling is globally disabled.)^ ^If URI handling is globally
1678
+** enabled, all filenames passed to [sqlite3_open()], [sqlite3_open_v2()],
1679
+** [sqlite3_open16()] or
16631680
** specified as part of [ATTACH] commands are interpreted as URIs, regardless
16641681
** of whether or not the [SQLITE_OPEN_URI] flag is set when the database
16651682
** connection is opened. ^If it is globally disabled, filenames are
16661683
** only interpreted as URIs if the SQLITE_OPEN_URI flag is set when the
16671684
** database connection is opened. ^(By default, URI handling is globally
16681685
** disabled. The default value may be changed by compiling with the
16691686
** [SQLITE_USE_URI] symbol defined.)^
16701687
**
16711688
** [[SQLITE_CONFIG_COVERING_INDEX_SCAN]] <dt>SQLITE_CONFIG_COVERING_INDEX_SCAN
1672
-** <dd>^This option takes a single integer argument which is interpreted as
1673
-** a boolean in order to enable or disable the use of covering indices for
1674
-** full table scans in the query optimizer. ^The default setting is determined
1689
+** <dd>^The SQLITE_CONFIG_COVERING_INDEX_SCAN option takes a single integer
1690
+** argument which is interpreted as a boolean in order to enable or disable
1691
+** the use of covering indices for full table scans in the query optimizer.
1692
+** ^The default setting is determined
16751693
** by the [SQLITE_ALLOW_COVERING_INDEX_SCAN] compile-time option, or is "on"
16761694
** if that compile-time option is omitted.
16771695
** The ability to disable the use of covering indices for full table scans
16781696
** is because some incorrectly coded legacy applications might malfunction
16791697
** when the optimization is enabled. Providing the ability to
@@ -1709,23 +1727,32 @@
17091727
** that are the default mmap size limit (the default setting for
17101728
** [PRAGMA mmap_size]) and the maximum allowed mmap size limit.
17111729
** ^The default setting can be overridden by each database connection using
17121730
** either the [PRAGMA mmap_size] command, or by using the
17131731
** [SQLITE_FCNTL_MMAP_SIZE] file control. ^(The maximum allowed mmap size
1714
-** cannot be changed at run-time. Nor may the maximum allowed mmap size
1715
-** exceed the compile-time maximum mmap size set by the
1732
+** will be silently truncated if necessary so that it does not exceed the
1733
+** compile-time maximum mmap size set by the
17161734
** [SQLITE_MAX_MMAP_SIZE] compile-time option.)^
17171735
** ^If either argument to this option is negative, then that argument is
17181736
** changed to its compile-time default.
17191737
**
17201738
** [[SQLITE_CONFIG_WIN32_HEAPSIZE]]
17211739
** <dt>SQLITE_CONFIG_WIN32_HEAPSIZE
1722
-** <dd>^This option is only available if SQLite is compiled for Windows
1723
-** with the [SQLITE_WIN32_MALLOC] pre-processor macro defined.
1724
-** SQLITE_CONFIG_WIN32_HEAPSIZE takes a 32-bit unsigned integer value
1740
+** <dd>^The SQLITE_CONFIG_WIN32_HEAPSIZE option is only available if SQLite is
1741
+** compiled for Windows with the [SQLITE_WIN32_MALLOC] pre-processor macro
1742
+** defined. ^SQLITE_CONFIG_WIN32_HEAPSIZE takes a 32-bit unsigned integer value
17251743
** that specifies the maximum size of the created heap.
17261744
** </dl>
1745
+**
1746
+** [[SQLITE_CONFIG_PCACHE_HDRSZ]]
1747
+** <dt>SQLITE_CONFIG_PCACHE_HDRSZ
1748
+** <dd>^The SQLITE_CONFIG_PCACHE_HDRSZ option takes a single parameter which
1749
+** is a pointer to an integer and writes into that integer the number of extra
1750
+** bytes per page required for each page in [SQLITE_CONFIG_PAGECACHE].
1751
+** The amount of extra space required can change depending on the compiler,
1752
+** target platform, and SQLite version.
1753
+** </dl>
17271754
*/
17281755
#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
17291756
#define SQLITE_CONFIG_MULTITHREAD 2 /* nil */
17301757
#define SQLITE_CONFIG_SERIALIZED 3 /* nil */
17311758
#define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */
@@ -1746,10 +1773,11 @@
17461773
#define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */
17471774
#define SQLITE_CONFIG_COVERING_INDEX_SCAN 20 /* int */
17481775
#define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */
17491776
#define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */
17501777
#define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */
1778
+#define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */
17511779
17521780
/*
17531781
** CAPI3REF: Database Connection Configuration Options
17541782
**
17551783
** These constants are the available integer configuration options that
@@ -1873,51 +1901,49 @@
18731901
SQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*);
18741902
18751903
/*
18761904
** CAPI3REF: Count The Number Of Rows Modified
18771905
**
1878
-** ^This function returns the number of database rows that were changed
1879
-** or inserted or deleted by the most recently completed SQL statement
1880
-** on the [database connection] specified by the first parameter.
1881
-** ^(Only changes that are directly specified by the [INSERT], [UPDATE],
1882
-** or [DELETE] statement are counted. Auxiliary changes caused by
1883
-** triggers or [foreign key actions] are not counted.)^ Use the
1884
-** [sqlite3_total_changes()] function to find the total number of changes
1885
-** including changes caused by triggers and foreign key actions.
1886
-**
1887
-** ^Changes to a view that are simulated by an [INSTEAD OF trigger]
1888
-** are not counted. Only real table changes are counted.
1889
-**
1890
-** ^(A "row change" is a change to a single row of a single table
1891
-** caused by an INSERT, DELETE, or UPDATE statement. Rows that
1892
-** are changed as side effects of [REPLACE] constraint resolution,
1893
-** rollback, ABORT processing, [DROP TABLE], or by any other
1894
-** mechanisms do not count as direct row changes.)^
1895
-**
1896
-** A "trigger context" is a scope of execution that begins and
1897
-** ends with the script of a [CREATE TRIGGER | trigger].
1898
-** Most SQL statements are
1899
-** evaluated outside of any trigger. This is the "top level"
1900
-** trigger context. If a trigger fires from the top level, a
1901
-** new trigger context is entered for the duration of that one
1902
-** trigger. Subtriggers create subcontexts for their duration.
1903
-**
1904
-** ^Calling [sqlite3_exec()] or [sqlite3_step()] recursively does
1905
-** not create a new trigger context.
1906
-**
1907
-** ^This function returns the number of direct row changes in the
1908
-** most recent INSERT, UPDATE, or DELETE statement within the same
1909
-** trigger context.
1910
-**
1911
-** ^Thus, when called from the top level, this function returns the
1912
-** number of changes in the most recent INSERT, UPDATE, or DELETE
1913
-** that also occurred at the top level. ^(Within the body of a trigger,
1914
-** the sqlite3_changes() interface can be called to find the number of
1915
-** changes in the most recently completed INSERT, UPDATE, or DELETE
1916
-** statement within the body of the same trigger.
1917
-** However, the number returned does not include changes
1918
-** caused by subtriggers since those have their own context.)^
1906
+** ^This function returns the number of rows modified, inserted or
1907
+** deleted by the most recently completed INSERT, UPDATE or DELETE
1908
+** statement on the database connection specified by the only parameter.
1909
+** ^Executing any other type of SQL statement does not modify the value
1910
+** returned by this function.
1911
+**
1912
+** ^Only changes made directly by the INSERT, UPDATE or DELETE statement are
1913
+** considered - auxiliary changes caused by [CREATE TRIGGER | triggers],
1914
+** [foreign key actions] or [REPLACE] constraint resolution are not counted.
1915
+**
1916
+** Changes to a view that are intercepted by
1917
+** [INSTEAD OF trigger | INSTEAD OF triggers] are not counted. ^The value
1918
+** returned by sqlite3_changes() immediately after an INSERT, UPDATE or
1919
+** DELETE statement run on a view is always zero. Only changes made to real
1920
+** tables are counted.
1921
+**
1922
+** Things are more complicated if the sqlite3_changes() function is
1923
+** executed while a trigger program is running. This may happen if the
1924
+** program uses the [changes() SQL function], or if some other callback
1925
+** function invokes sqlite3_changes() directly. Essentially:
1926
+**
1927
+** <ul>
1928
+** <li> ^(Before entering a trigger program the value returned by
1929
+** sqlite3_changes() function is saved. After the trigger program
1930
+** has finished, the original value is restored.)^
1931
+**
1932
+** <li> ^(Within a trigger program each INSERT, UPDATE and DELETE
1933
+** statement sets the value returned by sqlite3_changes()
1934
+** upon completion as normal. Of course, this value will not include
1935
+** any changes performed by sub-triggers, as the sqlite3_changes()
1936
+** value will be saved and restored after each sub-trigger has run.)^
1937
+** </ul>
1938
+**
1939
+** ^This means that if the changes() SQL function (or similar) is used
1940
+** by the first INSERT, UPDATE or DELETE statement within a trigger, it
1941
+** returns the value as set when the calling statement began executing.
1942
+** ^If it is used by the second or subsequent such statement within a trigger
1943
+** program, the value returned reflects the number of rows modified by the
1944
+** previous INSERT, UPDATE or DELETE statement within the same trigger.
19191945
**
19201946
** See also the [sqlite3_total_changes()] interface, the
19211947
** [count_changes pragma], and the [changes() SQL function].
19221948
**
19231949
** If a separate thread makes changes on the same database connection
@@ -1927,24 +1953,21 @@
19271953
SQLITE_API int sqlite3_changes(sqlite3*);
19281954
19291955
/*
19301956
** CAPI3REF: Total Number Of Rows Modified
19311957
**
1932
-** ^This function returns the number of row changes caused by [INSERT],
1933
-** [UPDATE] or [DELETE] statements since the [database connection] was opened.
1934
-** ^(The count returned by sqlite3_total_changes() includes all changes
1935
-** from all [CREATE TRIGGER | trigger] contexts and changes made by
1936
-** [foreign key actions]. However,
1937
-** the count does not include changes used to implement [REPLACE] constraints,
1938
-** do rollbacks or ABORT processing, or [DROP TABLE] processing. The
1939
-** count does not include rows of views that fire an [INSTEAD OF trigger],
1940
-** though if the INSTEAD OF trigger makes changes of its own, those changes
1941
-** are counted.)^
1942
-** ^The sqlite3_total_changes() function counts the changes as soon as
1943
-** the statement that makes them is completed (when the statement handle
1944
-** is passed to [sqlite3_reset()] or [sqlite3_finalize()]).
1945
-**
1958
+** ^This function returns the total number of rows inserted, modified or
1959
+** deleted by all [INSERT], [UPDATE] or [DELETE] statements completed
1960
+** since the database connection was opened, including those executed as
1961
+** part of trigger programs. ^Executing any other type of SQL statement
1962
+** does not affect the value returned by sqlite3_total_changes().
1963
+**
1964
+** ^Changes made as part of [foreign key actions] are included in the
1965
+** count, but those made as part of REPLACE constraint resolution are
1966
+** not. ^Changes to a view that are intercepted by INSTEAD OF triggers
1967
+** are not counted.
1968
+**
19461969
** See also the [sqlite3_changes()] interface, the
19471970
** [count_changes pragma], and the [total_changes() SQL function].
19481971
**
19491972
** If a separate thread makes changes on the same database connection
19501973
** while [sqlite3_total_changes()] is running then the value
@@ -2027,10 +2050,11 @@
20272050
SQLITE_API int sqlite3_complete(const char *sql);
20282051
SQLITE_API int sqlite3_complete16(const void *sql);
20292052
20302053
/*
20312054
** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors
2055
+** KEYWORDS: {busy-handler callback} {busy handler}
20322056
**
20332057
** ^The sqlite3_busy_handler(D,X,P) routine sets a callback function X
20342058
** that might be invoked with argument P whenever
20352059
** an attempt is made to access a database table associated with
20362060
** [database connection] D when another thread
@@ -2043,11 +2067,11 @@
20432067
** is not NULL, then the callback might be invoked with two arguments.
20442068
**
20452069
** ^The first argument to the busy handler is a copy of the void* pointer which
20462070
** is the third argument to sqlite3_busy_handler(). ^The second argument to
20472071
** the busy handler callback is the number of times that the busy handler has
2048
-** been invoked for the same locking event. ^If the
2072
+** been invoked previously for the same locking event. ^If the
20492073
** busy callback returns 0, then no additional attempts are made to
20502074
** access the database and [SQLITE_BUSY] is returned
20512075
** to the application.
20522076
** ^If the callback returns non-zero, then another attempt
20532077
** is made to access the database and the cycle repeats.
@@ -2418,17 +2442,18 @@
24182442
** already uses the largest possible [ROWID]. The PRNG is also used for
24192443
** the build-in random() and randomblob() SQL functions. This interface allows
24202444
** applications to access the same PRNG for other purposes.
24212445
**
24222446
** ^A call to this routine stores N bytes of randomness into buffer P.
2423
-** ^If N is less than one, then P can be a NULL pointer.
2447
+** ^The P parameter can be a NULL pointer.
24242448
**
24252449
** ^If this routine has not been previously called or if the previous
2426
-** call had N less than one, then the PRNG is seeded using randomness
2427
-** obtained from the xRandomness method of the default [sqlite3_vfs] object.
2428
-** ^If the previous call to this routine had an N of 1 or more then
2429
-** the pseudo-randomness is generated
2450
+** call had N less than one or a NULL pointer for P, then the PRNG is
2451
+** seeded using randomness obtained from the xRandomness method of
2452
+** the default [sqlite3_vfs] object.
2453
+** ^If the previous call to this routine had an N of 1 or more and a
2454
+** non-NULL P then the pseudo-randomness is generated
24302455
** internally and without recourse to the [sqlite3_vfs] xRandomness
24312456
** method.
24322457
*/
24332458
SQLITE_API void sqlite3_randomness(int N, void *P);
24342459
@@ -4146,13 +4171,13 @@
41464171
** CAPI3REF: Text Encodings
41474172
**
41484173
** These constant define integer codes that represent the various
41494174
** text encodings supported by SQLite.
41504175
*/
4151
-#define SQLITE_UTF8 1
4152
-#define SQLITE_UTF16LE 2
4153
-#define SQLITE_UTF16BE 3
4176
+#define SQLITE_UTF8 1 /* IMP: R-37514-35566 */
4177
+#define SQLITE_UTF16LE 2 /* IMP: R-03371-37637 */
4178
+#define SQLITE_UTF16BE 3 /* IMP: R-51971-34154 */
41544179
#define SQLITE_UTF16 4 /* Use native byte order */
41554180
#define SQLITE_ANY 5 /* Deprecated */
41564181
#define SQLITE_UTF16_ALIGNED 8 /* sqlite3_create_collation only */
41574182
41584183
/*
@@ -4497,11 +4522,12 @@
44974522
** If these routines are called from within the different thread
44984523
** than the one containing the application-defined function that received
44994524
** the [sqlite3_context] pointer, the results are undefined.
45004525
*/
45014526
SQLITE_API void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));
4502
-SQLITE_API void sqlite3_result_blob64(sqlite3_context*,const void*,sqlite3_uint64,void(*)(void*));
4527
+SQLITE_API void sqlite3_result_blob64(sqlite3_context*,const void*,
4528
+ sqlite3_uint64,void(*)(void*));
45034529
SQLITE_API void sqlite3_result_double(sqlite3_context*, double);
45044530
SQLITE_API void sqlite3_result_error(sqlite3_context*, const char*, int);
45054531
SQLITE_API void sqlite3_result_error16(sqlite3_context*, const void*, int);
45064532
SQLITE_API void sqlite3_result_error_toobig(sqlite3_context*);
45074533
SQLITE_API void sqlite3_result_error_nomem(sqlite3_context*);
@@ -5638,31 +5664,47 @@
56385664
** in other words, the same BLOB that would be selected by:
56395665
**
56405666
** <pre>
56415667
** SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow;
56425668
** </pre>)^
5669
+**
5670
+** ^(Parameter zDb is not the filename that contains the database, but
5671
+** rather the symbolic name of the database. For attached databases, this is
5672
+** the name that appears after the AS keyword in the [ATTACH] statement.
5673
+** For the main database file, the database name is "main". For TEMP
5674
+** tables, the database name is "temp".)^
56435675
**
56445676
** ^If the flags parameter is non-zero, then the BLOB is opened for read
5645
-** and write access. ^If it is zero, the BLOB is opened for read access.
5646
-** ^It is not possible to open a column that is part of an index or primary
5647
-** key for writing. ^If [foreign key constraints] are enabled, it is
5648
-** not possible to open a column that is part of a [child key] for writing.
5649
-**
5650
-** ^Note that the database name is not the filename that contains
5651
-** the database but rather the symbolic name of the database that
5652
-** appears after the AS keyword when the database is connected using [ATTACH].
5653
-** ^For the main database file, the database name is "main".
5654
-** ^For TEMP tables, the database name is "temp".
5655
-**
5656
-** ^(On success, [SQLITE_OK] is returned and the new [BLOB handle] is written
5657
-** to *ppBlob. Otherwise an [error code] is returned and *ppBlob is set
5658
-** to be a null pointer.)^
5659
-** ^This function sets the [database connection] error code and message
5660
-** accessible via [sqlite3_errcode()] and [sqlite3_errmsg()] and related
5661
-** functions. ^Note that the *ppBlob variable is always initialized in a
5662
-** way that makes it safe to invoke [sqlite3_blob_close()] on *ppBlob
5663
-** regardless of the success or failure of this routine.
5677
+** and write access. ^If the flags parameter is zero, the BLOB is opened for
5678
+** read-only access.
5679
+**
5680
+** ^(On success, [SQLITE_OK] is returned and the new [BLOB handle] is stored
5681
+** in *ppBlob. Otherwise an [error code] is returned and, unless the error
5682
+** code is SQLITE_MISUSE, *ppBlob is set to NULL.)^ ^This means that, provided
5683
+** the API is not misused, it is always safe to call [sqlite3_blob_close()]
5684
+** on *ppBlob after this function it returns.
5685
+**
5686
+** This function fails with SQLITE_ERROR if any of the following are true:
5687
+** <ul>
5688
+** <li> ^(Database zDb does not exist)^,
5689
+** <li> ^(Table zTable does not exist within database zDb)^,
5690
+** <li> ^(Table zTable is a WITHOUT ROWID table)^,
5691
+** <li> ^(Column zColumn does not exist)^,
5692
+** <li> ^(Row iRow is not present in the table)^,
5693
+** <li> ^(The specified column of row iRow contains a value that is not
5694
+** a TEXT or BLOB value)^,
5695
+** <li> ^(Column zColumn is part of an index, PRIMARY KEY or UNIQUE
5696
+** constraint and the blob is being opened for read/write access)^,
5697
+** <li> ^([foreign key constraints | Foreign key constraints] are enabled,
5698
+** column zColumn is part of a [child key] definition and the blob is
5699
+** being opened for read/write access)^.
5700
+** </ul>
5701
+**
5702
+** ^Unless it returns SQLITE_MISUSE, this function sets the
5703
+** [database connection] error code and message accessible via
5704
+** [sqlite3_errcode()] and [sqlite3_errmsg()] and related functions.
5705
+**
56645706
**
56655707
** ^(If the row that a BLOB handle points to is modified by an
56665708
** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects
56675709
** then the BLOB handle is marked as "expired".
56685710
** This is true if any column of the row is changed, even a column
@@ -5676,17 +5718,13 @@
56765718
** ^Use the [sqlite3_blob_bytes()] interface to determine the size of
56775719
** the opened blob. ^The size of a blob may not be changed by this
56785720
** interface. Use the [UPDATE] SQL command to change the size of a
56795721
** blob.
56805722
**
5681
-** ^The [sqlite3_blob_open()] interface will fail for a [WITHOUT ROWID]
5682
-** table. Incremental BLOB I/O is not possible on [WITHOUT ROWID] tables.
5683
-**
56845723
** ^The [sqlite3_bind_zeroblob()] and [sqlite3_result_zeroblob()] interfaces
5685
-** and the built-in [zeroblob] SQL function can be used, if desired,
5686
-** to create an empty, zero-filled blob in which to read or write using
5687
-** this interface.
5724
+** and the built-in [zeroblob] SQL function may be used to create a
5725
+** zero-filled blob to read or write using the incremental-blob interface.
56885726
**
56895727
** To avoid a resource leak, every open [BLOB handle] should eventually
56905728
** be released by a call to [sqlite3_blob_close()].
56915729
*/
56925730
SQLITE_API int sqlite3_blob_open(
@@ -5724,28 +5762,26 @@
57245762
SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64);
57255763
57265764
/*
57275765
** CAPI3REF: Close A BLOB Handle
57285766
**
5729
-** ^Closes an open [BLOB handle].
5730
-**
5731
-** ^Closing a BLOB shall cause the current transaction to commit
5732
-** if there are no other BLOBs, no pending prepared statements, and the
5733
-** database connection is in [autocommit mode].
5734
-** ^If any writes were made to the BLOB, they might be held in cache
5735
-** until the close operation if they will fit.
5736
-**
5737
-** ^(Closing the BLOB often forces the changes
5738
-** out to disk and so if any I/O errors occur, they will likely occur
5739
-** at the time when the BLOB is closed. Any errors that occur during
5740
-** closing are reported as a non-zero return value.)^
5741
-**
5742
-** ^(The BLOB is closed unconditionally. Even if this routine returns
5743
-** an error code, the BLOB is still closed.)^
5744
-**
5745
-** ^Calling this routine with a null pointer (such as would be returned
5746
-** by a failed call to [sqlite3_blob_open()]) is a harmless no-op.
5767
+** ^This function closes an open [BLOB handle]. ^(The BLOB handle is closed
5768
+** unconditionally. Even if this routine returns an error code, the
5769
+** handle is still closed.)^
5770
+**
5771
+** ^If the blob handle being closed was opened for read-write access, and if
5772
+** the database is in auto-commit mode and there are no other open read-write
5773
+** blob handles or active write statements, the current transaction is
5774
+** committed. ^If an error occurs while committing the transaction, an error
5775
+** code is returned and the transaction rolled back.
5776
+**
5777
+** Calling this function with an argument that is not a NULL pointer or an
5778
+** open blob handle results in undefined behaviour. ^Calling this routine
5779
+** with a null pointer (such as would be returned by a failed call to
5780
+** [sqlite3_blob_open()]) is a harmless no-op. ^Otherwise, if this function
5781
+** is passed a valid open blob handle, the values returned by the
5782
+** sqlite3_errcode() and sqlite3_errmsg() functions are set before returning.
57475783
*/
57485784
SQLITE_API int sqlite3_blob_close(sqlite3_blob *);
57495785
57505786
/*
57515787
** CAPI3REF: Return The Size Of An Open BLOB
@@ -5791,36 +5827,39 @@
57915827
SQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);
57925828
57935829
/*
57945830
** CAPI3REF: Write Data Into A BLOB Incrementally
57955831
**
5796
-** ^This function is used to write data into an open [BLOB handle] from a
5797
-** caller-supplied buffer. ^N bytes of data are copied from the buffer Z
5798
-** into the open BLOB, starting at offset iOffset.
5832
+** ^(This function is used to write data into an open [BLOB handle] from a
5833
+** caller-supplied buffer. N bytes of data are copied from the buffer Z
5834
+** into the open BLOB, starting at offset iOffset.)^
5835
+**
5836
+** ^(On success, sqlite3_blob_write() returns SQLITE_OK.
5837
+** Otherwise, an [error code] or an [extended error code] is returned.)^
5838
+** ^Unless SQLITE_MISUSE is returned, this function sets the
5839
+** [database connection] error code and message accessible via
5840
+** [sqlite3_errcode()] and [sqlite3_errmsg()] and related functions.
57995841
**
58005842
** ^If the [BLOB handle] passed as the first argument was not opened for
58015843
** writing (the flags parameter to [sqlite3_blob_open()] was zero),
58025844
** this function returns [SQLITE_READONLY].
58035845
**
5804
-** ^This function may only modify the contents of the BLOB; it is
5846
+** This function may only modify the contents of the BLOB; it is
58055847
** not possible to increase the size of a BLOB using this API.
58065848
** ^If offset iOffset is less than N bytes from the end of the BLOB,
5807
-** [SQLITE_ERROR] is returned and no data is written. ^If N is
5808
-** less than zero [SQLITE_ERROR] is returned and no data is written.
5809
-** The size of the BLOB (and hence the maximum value of N+iOffset)
5810
-** can be determined using the [sqlite3_blob_bytes()] interface.
5849
+** [SQLITE_ERROR] is returned and no data is written. The size of the
5850
+** BLOB (and hence the maximum value of N+iOffset) can be determined
5851
+** using the [sqlite3_blob_bytes()] interface. ^If N or iOffset are less
5852
+** than zero [SQLITE_ERROR] is returned and no data is written.
58115853
**
58125854
** ^An attempt to write to an expired [BLOB handle] fails with an
58135855
** error code of [SQLITE_ABORT]. ^Writes to the BLOB that occurred
58145856
** before the [BLOB handle] expired are not rolled back by the
58155857
** expiration of the handle, though of course those changes might
58165858
** have been overwritten by the statement that expired the BLOB handle
58175859
** or by other independent statements.
58185860
**
5819
-** ^(On success, sqlite3_blob_write() returns SQLITE_OK.
5820
-** Otherwise, an [error code] or an [extended error code] is returned.)^
5821
-**
58225861
** This routine only works on a [BLOB handle] which has been created
58235862
** by a prior successful call to [sqlite3_blob_open()] and which has not
58245863
** been closed by [sqlite3_blob_close()]. Passing any other pointer in
58255864
** to this routine results in undefined and probably undesirable behavior.
58265865
**
@@ -5869,38 +5908,38 @@
58695908
** use by SQLite, code that links against SQLite is
58705909
** permitted to use any of these routines.
58715910
**
58725911
** The SQLite source code contains multiple implementations
58735912
** of these mutex routines. An appropriate implementation
5874
-** is selected automatically at compile-time. ^(The following
5913
+** is selected automatically at compile-time. The following
58755914
** implementations are available in the SQLite core:
58765915
**
58775916
** <ul>
58785917
** <li> SQLITE_MUTEX_PTHREADS
58795918
** <li> SQLITE_MUTEX_W32
58805919
** <li> SQLITE_MUTEX_NOOP
5881
-** </ul>)^
5920
+** </ul>
58825921
**
5883
-** ^The SQLITE_MUTEX_NOOP implementation is a set of routines
5922
+** The SQLITE_MUTEX_NOOP implementation is a set of routines
58845923
** that does no real locking and is appropriate for use in
5885
-** a single-threaded application. ^The SQLITE_MUTEX_PTHREADS and
5924
+** a single-threaded application. The SQLITE_MUTEX_PTHREADS and
58865925
** SQLITE_MUTEX_W32 implementations are appropriate for use on Unix
58875926
** and Windows.
58885927
**
5889
-** ^(If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor
5928
+** If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor
58905929
** macro defined (with "-DSQLITE_MUTEX_APPDEF=1"), then no mutex
58915930
** implementation is included with the library. In this case the
58925931
** application must supply a custom mutex implementation using the
58935932
** [SQLITE_CONFIG_MUTEX] option of the sqlite3_config() function
58945933
** before calling sqlite3_initialize() or any other public sqlite3_
5895
-** function that calls sqlite3_initialize().)^
5934
+** function that calls sqlite3_initialize().
58965935
**
58975936
** ^The sqlite3_mutex_alloc() routine allocates a new
5898
-** mutex and returns a pointer to it. ^If it returns NULL
5899
-** that means that a mutex could not be allocated. ^SQLite
5900
-** will unwind its stack and return an error. ^(The argument
5901
-** to sqlite3_mutex_alloc() is one of these integer constants:
5937
+** mutex and returns a pointer to it. ^The sqlite3_mutex_alloc()
5938
+** routine returns NULL if it is unable to allocate the requested
5939
+** mutex. The argument to sqlite3_mutex_alloc() must one of these
5940
+** integer constants:
59025941
**
59035942
** <ul>
59045943
** <li> SQLITE_MUTEX_FAST
59055944
** <li> SQLITE_MUTEX_RECURSIVE
59065945
** <li> SQLITE_MUTEX_STATIC_MASTER
@@ -5909,68 +5948,64 @@
59095948
** <li> SQLITE_MUTEX_STATIC_PRNG
59105949
** <li> SQLITE_MUTEX_STATIC_LRU
59115950
** <li> SQLITE_MUTEX_STATIC_PMEM
59125951
** <li> SQLITE_MUTEX_STATIC_APP1
59135952
** <li> SQLITE_MUTEX_STATIC_APP2
5914
-** </ul>)^
5953
+** <li> SQLITE_MUTEX_STATIC_APP3
5954
+** </ul>
59155955
**
59165956
** ^The first two constants (SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE)
59175957
** cause sqlite3_mutex_alloc() to create
59185958
** a new mutex. ^The new mutex is recursive when SQLITE_MUTEX_RECURSIVE
59195959
** is used but not necessarily so when SQLITE_MUTEX_FAST is used.
59205960
** The mutex implementation does not need to make a distinction
59215961
** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does
5922
-** not want to. ^SQLite will only request a recursive mutex in
5923
-** cases where it really needs one. ^If a faster non-recursive mutex
5962
+** not want to. SQLite will only request a recursive mutex in
5963
+** cases where it really needs one. If a faster non-recursive mutex
59245964
** implementation is available on the host platform, the mutex subsystem
59255965
** might return such a mutex in response to SQLITE_MUTEX_FAST.
59265966
**
59275967
** ^The other allowed parameters to sqlite3_mutex_alloc() (anything other
59285968
** than SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) each return
5929
-** a pointer to a static preexisting mutex. ^Six static mutexes are
5969
+** a pointer to a static preexisting mutex. ^Nine static mutexes are
59305970
** used by the current version of SQLite. Future versions of SQLite
59315971
** may add additional static mutexes. Static mutexes are for internal
59325972
** use by SQLite only. Applications that use SQLite mutexes should
59335973
** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or
59345974
** SQLITE_MUTEX_RECURSIVE.
59355975
**
59365976
** ^Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST
59375977
** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc()
5938
-** returns a different mutex on every call. ^But for the static
5978
+** returns a different mutex on every call. ^For the static
59395979
** mutex types, the same mutex is returned on every call that has
59405980
** the same type number.
59415981
**
59425982
** ^The sqlite3_mutex_free() routine deallocates a previously
5943
-** allocated dynamic mutex. ^SQLite is careful to deallocate every
5944
-** dynamic mutex that it allocates. The dynamic mutexes must not be in
5945
-** use when they are deallocated. Attempting to deallocate a static
5946
-** mutex results in undefined behavior. ^SQLite never deallocates
5947
-** a static mutex.
5983
+** allocated dynamic mutex. Attempting to deallocate a static
5984
+** mutex results in undefined behavior.
59485985
**
59495986
** ^The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt
59505987
** to enter a mutex. ^If another thread is already within the mutex,
59515988
** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return
59525989
** SQLITE_BUSY. ^The sqlite3_mutex_try() interface returns [SQLITE_OK]
59535990
** upon successful entry. ^(Mutexes created using
59545991
** SQLITE_MUTEX_RECURSIVE can be entered multiple times by the same thread.
5955
-** In such cases the,
5992
+** In such cases, the
59565993
** mutex must be exited an equal number of times before another thread
5957
-** can enter.)^ ^(If the same thread tries to enter any other
5958
-** kind of mutex more than once, the behavior is undefined.
5959
-** SQLite will never exhibit
5960
-** such behavior in its own use of mutexes.)^
5994
+** can enter.)^ If the same thread tries to enter any mutex other
5995
+** than an SQLITE_MUTEX_RECURSIVE more than once, the behavior is undefined.
59615996
**
59625997
** ^(Some systems (for example, Windows 95) do not support the operation
59635998
** implemented by sqlite3_mutex_try(). On those systems, sqlite3_mutex_try()
5964
-** will always return SQLITE_BUSY. The SQLite core only ever uses
5965
-** sqlite3_mutex_try() as an optimization so this is acceptable behavior.)^
5999
+** will always return SQLITE_BUSY. The SQLite core only ever uses
6000
+** sqlite3_mutex_try() as an optimization so this is acceptable
6001
+** behavior.)^
59666002
**
59676003
** ^The sqlite3_mutex_leave() routine exits a mutex that was
5968
-** previously entered by the same thread. ^(The behavior
6004
+** previously entered by the same thread. The behavior
59696005
** is undefined if the mutex is not currently entered by the
5970
-** calling thread or is not currently allocated. SQLite will
5971
-** never do either.)^
6006
+** calling thread or is not currently allocated.
59726007
**
59736008
** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(), or
59746009
** sqlite3_mutex_leave() is a NULL pointer, then all three routines
59756010
** behave as no-ops.
59766011
**
@@ -5987,13 +6022,13 @@
59876022
**
59886023
** An instance of this structure defines the low-level routines
59896024
** used to allocate and use mutexes.
59906025
**
59916026
** Usually, the default mutex implementations provided by SQLite are
5992
-** sufficient, however the user has the option of substituting a custom
6027
+** sufficient, however the application has the option of substituting a custom
59936028
** implementation for specialized deployments or systems for which SQLite
5994
-** does not provide a suitable implementation. In this case, the user
6029
+** does not provide a suitable implementation. In this case, the application
59956030
** creates and populates an instance of this structure to pass
59966031
** to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option.
59976032
** Additionally, an instance of this structure can be used as an
59986033
** output variable when querying the system for the current mutex
59996034
** implementation, using the [SQLITE_CONFIG_GETMUTEX] option.
@@ -6030,17 +6065,17 @@
60306065
** by this structure are not required to handle this case, the results
60316066
** of passing a NULL pointer instead of a valid mutex handle are undefined
60326067
** (i.e. it is acceptable to provide an implementation that segfaults if
60336068
** it is passed a NULL pointer).
60346069
**
6035
-** The xMutexInit() method must be threadsafe. ^It must be harmless to
6070
+** The xMutexInit() method must be threadsafe. It must be harmless to
60366071
** invoke xMutexInit() multiple times within the same process and without
60376072
** intervening calls to xMutexEnd(). Second and subsequent calls to
60386073
** xMutexInit() must be no-ops.
60396074
**
6040
-** ^xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()]
6041
-** and its associates). ^Similarly, xMutexAlloc() must not use SQLite memory
6075
+** xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()]
6076
+** and its associates). Similarly, xMutexAlloc() must not use SQLite memory
60426077
** allocation for a static mutex. ^However xMutexAlloc() may use SQLite
60436078
** memory allocation for a fast or recursive mutex.
60446079
**
60456080
** ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is
60466081
** called, but only if the prior call to xMutexInit returned SQLITE_OK.
@@ -6062,33 +6097,33 @@
60626097
60636098
/*
60646099
** CAPI3REF: Mutex Verification Routines
60656100
**
60666101
** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routines
6067
-** are intended for use inside assert() statements. ^The SQLite core
6102
+** are intended for use inside assert() statements. The SQLite core
60686103
** never uses these routines except inside an assert() and applications
6069
-** are advised to follow the lead of the core. ^The SQLite core only
6104
+** are advised to follow the lead of the core. The SQLite core only
60706105
** provides implementations for these routines when it is compiled
6071
-** with the SQLITE_DEBUG flag. ^External mutex implementations
6106
+** with the SQLITE_DEBUG flag. External mutex implementations
60726107
** are only required to provide these routines if SQLITE_DEBUG is
60736108
** defined and if NDEBUG is not defined.
60746109
**
6075
-** ^These routines should return true if the mutex in their argument
6110
+** These routines should return true if the mutex in their argument
60766111
** is held or not held, respectively, by the calling thread.
60776112
**
6078
-** ^The implementation is not required to provide versions of these
6113
+** The implementation is not required to provide versions of these
60796114
** routines that actually work. If the implementation does not provide working
60806115
** versions of these routines, it should at least provide stubs that always
60816116
** return true so that one does not get spurious assertion failures.
60826117
**
6083
-** ^If the argument to sqlite3_mutex_held() is a NULL pointer then
6118
+** If the argument to sqlite3_mutex_held() is a NULL pointer then
60846119
** the routine should return 1. This seems counter-intuitive since
60856120
** clearly the mutex cannot be held if it does not exist. But
60866121
** the reason the mutex does not exist is because the build is not
60876122
** using mutexes. And we do not want the assert() containing the
60886123
** call to sqlite3_mutex_held() to fail, so a non-zero return is
6089
-** the appropriate thing to do. ^The sqlite3_mutex_notheld()
6124
+** the appropriate thing to do. The sqlite3_mutex_notheld()
60906125
** interface should also return 1 when given a NULL pointer.
60916126
*/
60926127
#ifndef NDEBUG
60936128
SQLITE_API int sqlite3_mutex_held(sqlite3_mutex*);
60946129
SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*);
@@ -6816,10 +6851,14 @@
68166851
** sqlite3_backup_init(D,N,S,M) identify the [database connection]
68176852
** and database name of the source database, respectively.
68186853
** ^The source and destination [database connections] (parameters S and D)
68196854
** must be different or else sqlite3_backup_init(D,N,S,M) will fail with
68206855
** an error.
6856
+**
6857
+** ^A call to sqlite3_backup_init() will fail, returning SQLITE_ERROR, if
6858
+** there is already a read or read-write transaction open on the
6859
+** destination database.
68216860
**
68226861
** ^If an error occurs within sqlite3_backup_init(D,N,S,M), then NULL is
68236862
** returned and an error code and error message are stored in the
68246863
** destination [database connection] D.
68256864
** ^The error code and message for the failed call to sqlite3_backup_init()
@@ -7210,101 +7249,118 @@
72107249
SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
72117250
72127251
/*
72137252
** CAPI3REF: Checkpoint a database
72147253
**
7215
-** ^The [sqlite3_wal_checkpoint(D,X)] interface causes database named X
7216
-** on [database connection] D to be [checkpointed]. ^If X is NULL or an
7217
-** empty string, then a checkpoint is run on all databases of
7218
-** connection D. ^If the database connection D is not in
7219
-** [WAL | write-ahead log mode] then this interface is a harmless no-op.
7220
-** ^The [sqlite3_wal_checkpoint(D,X)] interface initiates a
7221
-** [sqlite3_wal_checkpoint_v2|PASSIVE] checkpoint.
7222
-** Use the [sqlite3_wal_checkpoint_v2()] interface to get a FULL
7223
-** or RESET checkpoint.
7224
-**
7225
-** ^The [wal_checkpoint pragma] can be used to invoke this interface
7226
-** from SQL. ^The [sqlite3_wal_autocheckpoint()] interface and the
7227
-** [wal_autocheckpoint pragma] can be used to cause this interface to be
7228
-** run whenever the WAL reaches a certain size threshold.
7229
-**
7230
-** See also: [sqlite3_wal_checkpoint_v2()]
7254
+** ^(The sqlite3_wal_checkpoint(D,X) is equivalent to
7255
+** [sqlite3_wal_checkpoint_v2](D,X,[SQLITE_CHECKPOINT_PASSIVE],0,0).)^
7256
+**
7257
+** In brief, sqlite3_wal_checkpoint(D,X) causes the content in the
7258
+** [write-ahead log] for database X on [database connection] D to be
7259
+** transferred into the database file and for the write-ahead log to
7260
+** be reset. See the [checkpointing] documentation for addition
7261
+** information.
7262
+**
7263
+** This interface used to be the only way to cause a checkpoint to
7264
+** occur. But then the newer and more powerful [sqlite3_wal_checkpoint_v2()]
7265
+** interface was added. This interface is retained for backwards
7266
+** compatibility and as a convenience for applications that need to manually
7267
+** start a callback but which do not need the full power (and corresponding
7268
+** complication) of [sqlite3_wal_checkpoint_v2()].
72317269
*/
72327270
SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);
72337271
72347272
/*
72357273
** CAPI3REF: Checkpoint a database
72367274
**
7237
-** Run a checkpoint operation on WAL database zDb attached to database
7238
-** handle db. The specific operation is determined by the value of the
7239
-** eMode parameter:
7275
+** ^(The sqlite3_wal_checkpoint_v2(D,X,M,L,C) interface runs a checkpoint
7276
+** operation on database X of [database connection] D in mode M. Status
7277
+** information is written back into integers pointed to by L and C.)^
7278
+** ^(The M parameter must be a valid [checkpoint mode]:)^
72407279
**
72417280
** <dl>
72427281
** <dt>SQLITE_CHECKPOINT_PASSIVE<dd>
7243
-** Checkpoint as many frames as possible without waiting for any database
7244
-** readers or writers to finish. Sync the db file if all frames in the log
7245
-** are checkpointed. This mode is the same as calling
7246
-** sqlite3_wal_checkpoint(). The [sqlite3_busy_handler|busy-handler callback]
7247
-** is never invoked.
7282
+** ^Checkpoint as many frames as possible without waiting for any database
7283
+** readers or writers to finish, then sync the database file if all frames
7284
+** in the log were checkpointed. ^The [busy-handler callback]
7285
+** is never invoked in the SQLITE_CHECKPOINT_PASSIVE mode.
7286
+** ^On the other hand, passive mode might leave the checkpoint unfinished
7287
+** if there are concurrent readers or writers.
72487288
**
72497289
** <dt>SQLITE_CHECKPOINT_FULL<dd>
7250
-** This mode blocks (it invokes the
7290
+** ^This mode blocks (it invokes the
72517291
** [sqlite3_busy_handler|busy-handler callback]) until there is no
72527292
** database writer and all readers are reading from the most recent database
7253
-** snapshot. It then checkpoints all frames in the log file and syncs the
7254
-** database file. This call blocks database writers while it is running,
7255
-** but not database readers.
7293
+** snapshot. ^It then checkpoints all frames in the log file and syncs the
7294
+** database file. ^This mode blocks new database writers while it is pending,
7295
+** but new database readers are allowed to continue unimpeded.
72567296
**
72577297
** <dt>SQLITE_CHECKPOINT_RESTART<dd>
7258
-** This mode works the same way as SQLITE_CHECKPOINT_FULL, except after
7259
-** checkpointing the log file it blocks (calls the
7260
-** [sqlite3_busy_handler|busy-handler callback])
7261
-** until all readers are reading from the database file only. This ensures
7262
-** that the next client to write to the database file restarts the log file
7263
-** from the beginning. This call blocks database writers while it is running,
7264
-** but not database readers.
7298
+** ^This mode works the same way as SQLITE_CHECKPOINT_FULL with the addition
7299
+** that after checkpointing the log file it blocks (calls the
7300
+** [busy-handler callback])
7301
+** until all readers are reading from the database file only. ^This ensures
7302
+** that the next writer will restart the log file from the beginning.
7303
+** ^Like SQLITE_CHECKPOINT_FULL, this mode blocks new
7304
+** database writer attempts while it is pending, but does not impede readers.
7305
+**
7306
+** <dt>SQLITE_CHECKPOINT_TRUNCATE<dd>
7307
+** ^This mode works the same way as SQLITE_CHECKPOINT_RESTART with the
7308
+** addition that it also truncates the log file to zero bytes just prior
7309
+** to a successful return.
72657310
** </dl>
72667311
**
7267
-** If pnLog is not NULL, then *pnLog is set to the total number of frames in
7268
-** the log file before returning. If pnCkpt is not NULL, then *pnCkpt is set to
7269
-** the total number of checkpointed frames (including any that were already
7270
-** checkpointed when this function is called). *pnLog and *pnCkpt may be
7271
-** populated even if sqlite3_wal_checkpoint_v2() returns other than SQLITE_OK.
7272
-** If no values are available because of an error, they are both set to -1
7273
-** before returning to communicate this to the caller.
7312
+** ^If pnLog is not NULL, then *pnLog is set to the total number of frames in
7313
+** the log file or to -1 if the checkpoint could not run because
7314
+** of an error or because the database is not in [WAL mode]. ^If pnCkpt is not
7315
+** NULL,then *pnCkpt is set to the total number of checkpointed frames in the
7316
+** log file (including any that were already checkpointed before the function
7317
+** was called) or to -1 if the checkpoint could not run due to an error or
7318
+** because the database is not in WAL mode. ^Note that upon successful
7319
+** completion of an SQLITE_CHECKPOINT_TRUNCATE, the log file will have been
7320
+** truncated to zero bytes and so both *pnLog and *pnCkpt will be set to zero.
72747321
**
7275
-** All calls obtain an exclusive "checkpoint" lock on the database file. If
7322
+** ^All calls obtain an exclusive "checkpoint" lock on the database file. ^If
72767323
** any other process is running a checkpoint operation at the same time, the
7277
-** lock cannot be obtained and SQLITE_BUSY is returned. Even if there is a
7324
+** lock cannot be obtained and SQLITE_BUSY is returned. ^Even if there is a
72787325
** busy-handler configured, it will not be invoked in this case.
72797326
**
7280
-** The SQLITE_CHECKPOINT_FULL and RESTART modes also obtain the exclusive
7281
-** "writer" lock on the database file. If the writer lock cannot be obtained
7282
-** immediately, and a busy-handler is configured, it is invoked and the writer
7283
-** lock retried until either the busy-handler returns 0 or the lock is
7284
-** successfully obtained. The busy-handler is also invoked while waiting for
7285
-** database readers as described above. If the busy-handler returns 0 before
7327
+** ^The SQLITE_CHECKPOINT_FULL, RESTART and TRUNCATE modes also obtain the
7328
+** exclusive "writer" lock on the database file. ^If the writer lock cannot be
7329
+** obtained immediately, and a busy-handler is configured, it is invoked and
7330
+** the writer lock retried until either the busy-handler returns 0 or the lock
7331
+** is successfully obtained. ^The busy-handler is also invoked while waiting for
7332
+** database readers as described above. ^If the busy-handler returns 0 before
72867333
** the writer lock is obtained or while waiting for database readers, the
72877334
** checkpoint operation proceeds from that point in the same way as
72887335
** SQLITE_CHECKPOINT_PASSIVE - checkpointing as many frames as possible
7289
-** without blocking any further. SQLITE_BUSY is returned in this case.
7336
+** without blocking any further. ^SQLITE_BUSY is returned in this case.
72907337
**
7291
-** If parameter zDb is NULL or points to a zero length string, then the
7292
-** specified operation is attempted on all WAL databases. In this case the
7293
-** values written to output parameters *pnLog and *pnCkpt are undefined. If
7338
+** ^If parameter zDb is NULL or points to a zero length string, then the
7339
+** specified operation is attempted on all WAL databases [attached] to
7340
+** [database connection] db. In this case the
7341
+** values written to output parameters *pnLog and *pnCkpt are undefined. ^If
72947342
** an SQLITE_BUSY error is encountered when processing one or more of the
72957343
** attached WAL databases, the operation is still attempted on any remaining
7296
-** attached databases and SQLITE_BUSY is returned to the caller. If any other
7344
+** attached databases and SQLITE_BUSY is returned at the end. ^If any other
72977345
** error occurs while processing an attached database, processing is abandoned
7298
-** and the error code returned to the caller immediately. If no error
7346
+** and the error code is returned to the caller immediately. ^If no error
72997347
** (SQLITE_BUSY or otherwise) is encountered while processing the attached
73007348
** databases, SQLITE_OK is returned.
73017349
**
7302
-** If database zDb is the name of an attached database that is not in WAL
7303
-** mode, SQLITE_OK is returned and both *pnLog and *pnCkpt set to -1. If
7350
+** ^If database zDb is the name of an attached database that is not in WAL
7351
+** mode, SQLITE_OK is returned and both *pnLog and *pnCkpt set to -1. ^If
73047352
** zDb is not NULL (or a zero length string) and is not the name of any
73057353
** attached database, SQLITE_ERROR is returned to the caller.
7354
+**
7355
+** ^Unless it returns SQLITE_MISUSE,
7356
+** the sqlite3_wal_checkpoint_v2() interface
7357
+** sets the error information that is queried by
7358
+** [sqlite3_errcode()] and [sqlite3_errmsg()].
7359
+**
7360
+** ^The [PRAGMA wal_checkpoint] command can be used to invoke this interface
7361
+** from SQL.
73067362
*/
73077363
SQLITE_API int sqlite3_wal_checkpoint_v2(
73087364
sqlite3 *db, /* Database handle */
73097365
const char *zDb, /* Name of attached database (or NULL) */
73107366
int eMode, /* SQLITE_CHECKPOINT_* value */
@@ -7311,20 +7367,22 @@
73117367
int *pnLog, /* OUT: Size of WAL log in frames */
73127368
int *pnCkpt /* OUT: Total number of frames checkpointed */
73137369
);
73147370
73157371
/*
7316
-** CAPI3REF: Checkpoint operation parameters
7372
+** CAPI3REF: Checkpoint Mode Values
7373
+** KEYWORDS: {checkpoint mode}
73177374
**
7318
-** These constants can be used as the 3rd parameter to
7319
-** [sqlite3_wal_checkpoint_v2()]. See the [sqlite3_wal_checkpoint_v2()]
7320
-** documentation for additional information about the meaning and use of
7321
-** each of these values.
7375
+** These constants define all valid values for the "checkpoint mode" passed
7376
+** as the third parameter to the [sqlite3_wal_checkpoint_v2()] interface.
7377
+** See the [sqlite3_wal_checkpoint_v2()] documentation for details on the
7378
+** meaning of each of these checkpoint modes.
73227379
*/
7323
-#define SQLITE_CHECKPOINT_PASSIVE 0
7324
-#define SQLITE_CHECKPOINT_FULL 1
7325
-#define SQLITE_CHECKPOINT_RESTART 2
7380
+#define SQLITE_CHECKPOINT_PASSIVE 0 /* Do as much as possible w/o blocking */
7381
+#define SQLITE_CHECKPOINT_FULL 1 /* Wait for writers, then checkpoint */
7382
+#define SQLITE_CHECKPOINT_RESTART 2 /* Like FULL but wait for for readers */
7383
+#define SQLITE_CHECKPOINT_TRUNCATE 3 /* Like RESTART but also truncate WAL */
73267384
73277385
/*
73287386
** CAPI3REF: Virtual Table Interface Configuration
73297387
**
73307388
** This function may be called by either the [xConnect] or [xCreate] method
@@ -7409,10 +7467,102 @@
74097467
/* #define SQLITE_IGNORE 2 // Also used by sqlite3_authorizer() callback */
74107468
#define SQLITE_FAIL 3
74117469
/* #define SQLITE_ABORT 4 // Also an error code */
74127470
#define SQLITE_REPLACE 5
74137471
7472
+/*
7473
+** CAPI3REF: Prepared Statement Scan Status Opcodes
7474
+** KEYWORDS: {scanstatus options}
7475
+**
7476
+** The following constants can be used for the T parameter to the
7477
+** [sqlite3_stmt_scanstatus(S,X,T,V)] interface. Each constant designates a
7478
+** different metric for sqlite3_stmt_scanstatus() to return.
7479
+**
7480
+** <dl>
7481
+** [[SQLITE_SCANSTAT_NLOOP]] <dt>SQLITE_SCANSTAT_NLOOP</dt>
7482
+** <dd>^The [sqlite3_int64] variable pointed to by the T parameter will be
7483
+** set to the total number of times that the X-th loop has run.</dd>
7484
+**
7485
+** [[SQLITE_SCANSTAT_NVISIT]] <dt>SQLITE_SCANSTAT_NVISIT</dt>
7486
+** <dd>^The [sqlite3_int64] variable pointed to by the T parameter will be set
7487
+** to the total number of rows examined by all iterations of the X-th loop.</dd>
7488
+**
7489
+** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt>
7490
+** <dd>^The "double" variable pointed to by the T parameter will be set to the
7491
+** query planner's estimate for the average number of rows output from each
7492
+** iteration of the X-th loop. If the query planner's estimates was accurate,
7493
+** then this value will approximate the quotient NVISIT/NLOOP and the
7494
+** product of this value for all prior loops with the same SELECTID will
7495
+** be the NLOOP value for the current loop.
7496
+**
7497
+** [[SQLITE_SCANSTAT_NAME]] <dt>SQLITE_SCANSTAT_NAME</dt>
7498
+** <dd>^The "const char *" variable pointed to by the T parameter will be set
7499
+** to a zero-terminated UTF-8 string containing the name of the index or table
7500
+** used for the X-th loop.
7501
+**
7502
+** [[SQLITE_SCANSTAT_EXPLAIN]] <dt>SQLITE_SCANSTAT_EXPLAIN</dt>
7503
+** <dd>^The "const char *" variable pointed to by the T parameter will be set
7504
+** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN]
7505
+** description for the X-th loop.
7506
+**
7507
+** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECT</dt>
7508
+** <dd>^The "int" variable pointed to by the T parameter will be set to the
7509
+** "select-id" for the X-th loop. The select-id identifies which query or
7510
+** subquery the loop is part of. The main query has a select-id of zero.
7511
+** The select-id is the same value as is output in the first column
7512
+** of an [EXPLAIN QUERY PLAN] query.
7513
+** </dl>
7514
+*/
7515
+#define SQLITE_SCANSTAT_NLOOP 0
7516
+#define SQLITE_SCANSTAT_NVISIT 1
7517
+#define SQLITE_SCANSTAT_EST 2
7518
+#define SQLITE_SCANSTAT_NAME 3
7519
+#define SQLITE_SCANSTAT_EXPLAIN 4
7520
+#define SQLITE_SCANSTAT_SELECTID 5
7521
+
7522
+/*
7523
+** CAPI3REF: Prepared Statement Scan Status
7524
+**
7525
+** Return status data for a single loop within query pStmt.
7526
+**
7527
+** The "iScanStatusOp" parameter determines which status information to return.
7528
+** The "iScanStatusOp" must be one of the [scanstatus options] or the behavior
7529
+** of this interface is undefined.
7530
+** ^The requested measurement is written into a variable pointed to by
7531
+** the "pOut" parameter.
7532
+** Parameter "idx" identifies the specific loop to retrieve statistics for.
7533
+** Loops are numbered starting from zero. ^If idx is out of range - less than
7534
+** zero or greater than or equal to the total number of loops used to implement
7535
+** the statement - a non-zero value is returned and the variable that pOut
7536
+** points to is unchanged.
7537
+**
7538
+** ^Statistics might not be available for all loops in all statements. ^In cases
7539
+** where there exist loops with no available statistics, this function behaves
7540
+** as if the loop did not exist - it returns non-zero and leave the variable
7541
+** that pOut points to unchanged.
7542
+**
7543
+** This API is only available if the library is built with pre-processor
7544
+** symbol [SQLITE_ENABLE_STMT_SCANSTATUS] defined.
7545
+**
7546
+** See also: [sqlite3_stmt_scanstatus_reset()]
7547
+*/
7548
+SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_stmt_scanstatus(
7549
+ sqlite3_stmt *pStmt, /* Prepared statement for which info desired */
7550
+ int idx, /* Index of loop to report on */
7551
+ int iScanStatusOp, /* Information desired. SQLITE_SCANSTAT_* */
7552
+ void *pOut /* Result written here */
7553
+);
7554
+
7555
+/*
7556
+** CAPI3REF: Zero Scan-Status Counters
7557
+**
7558
+** ^Zero all [sqlite3_stmt_scanstatus()] related event counters.
7559
+**
7560
+** This API is only available if the library is built with pre-processor
7561
+** symbol [SQLITE_ENABLE_STMT_SCANSTATUS] defined.
7562
+*/
7563
+SQLITE_API SQLITE_EXPERIMENTAL void sqlite3_stmt_scanstatus_reset(sqlite3_stmt*);
74147564
74157565
74167566
/*
74177567
** Undo the hack that converts floating point types to integer for
74187568
** builds on processors without floating point support.
74197569
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -55,11 +55,11 @@
55
56
57 /*
58 ** These no-op macros are used in front of interfaces to mark those
59 ** interfaces as either deprecated or experimental. New applications
60 ** should not use deprecated interfaces - they are support for backwards
61 ** compatibility only. Application writers should be aware that
62 ** experimental interfaces are subject to change in point releases.
63 **
64 ** These macros used to resolve to various kinds of compiler magic that
65 ** would generate warning messages when they were used. But that
@@ -105,13 +105,13 @@
105 **
106 ** See also: [sqlite3_libversion()],
107 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108 ** [sqlite_version()] and [sqlite_source_id()].
109 */
110 #define SQLITE_VERSION "3.8.7.1"
111 #define SQLITE_VERSION_NUMBER 3008007
112 #define SQLITE_SOURCE_ID "2014-10-29 01:27:43 83afe23e553e802c0947c80d0ffdd120423e7c52"
113
114 /*
115 ** CAPI3REF: Run-Time Library Version Numbers
116 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
117 **
@@ -1219,11 +1219,11 @@
1219 ** <li> SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED
1220 ** <li> SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE
1221 ** </ul>
1222 **
1223 ** When unlocking, the same SHARED or EXCLUSIVE flag must be supplied as
1224 ** was given no the corresponding lock.
1225 **
1226 ** The xShmLock method can transition between unlocked and SHARED or
1227 ** between unlocked and EXCLUSIVE. It cannot transition between SHARED
1228 ** and EXCLUSIVE.
1229 */
@@ -1502,30 +1502,32 @@
1502 ** it is not possible to set the Serialized [threading mode] and
1503 ** [sqlite3_config()] will return [SQLITE_ERROR] if called with the
1504 ** SQLITE_CONFIG_SERIALIZED configuration option.</dd>
1505 **
1506 ** [[SQLITE_CONFIG_MALLOC]] <dt>SQLITE_CONFIG_MALLOC</dt>
1507 ** <dd> ^(This option takes a single argument which is a pointer to an
1508 ** instance of the [sqlite3_mem_methods] structure. The argument specifies
 
1509 ** alternative low-level memory allocation routines to be used in place of
1510 ** the memory allocation routines built into SQLite.)^ ^SQLite makes
1511 ** its own private copy of the content of the [sqlite3_mem_methods] structure
1512 ** before the [sqlite3_config()] call returns.</dd>
1513 **
1514 ** [[SQLITE_CONFIG_GETMALLOC]] <dt>SQLITE_CONFIG_GETMALLOC</dt>
1515 ** <dd> ^(This option takes a single argument which is a pointer to an
1516 ** instance of the [sqlite3_mem_methods] structure. The [sqlite3_mem_methods]
 
1517 ** structure is filled with the currently defined memory allocation routines.)^
1518 ** This option can be used to overload the default memory allocation
1519 ** routines with a wrapper that simulations memory allocation failure or
1520 ** tracks memory usage, for example. </dd>
1521 **
1522 ** [[SQLITE_CONFIG_MEMSTATUS]] <dt>SQLITE_CONFIG_MEMSTATUS</dt>
1523 ** <dd> ^This option takes single argument of type int, interpreted as a
1524 ** boolean, which enables or disables the collection of memory allocation
1525 ** statistics. ^(When memory allocation statistics are disabled, the
1526 ** following SQLite interfaces become non-operational:
1527 ** <ul>
1528 ** <li> [sqlite3_memory_used()]
1529 ** <li> [sqlite3_memory_highwater()]
1530 ** <li> [sqlite3_soft_heap_limit64()]
1531 ** <li> [sqlite3_status()]
@@ -1534,78 +1536,92 @@
1534 ** compiled with [SQLITE_DEFAULT_MEMSTATUS]=0 in which case memory
1535 ** allocation statistics are disabled by default.
1536 ** </dd>
1537 **
1538 ** [[SQLITE_CONFIG_SCRATCH]] <dt>SQLITE_CONFIG_SCRATCH</dt>
1539 ** <dd> ^This option specifies a static memory buffer that SQLite can use for
1540 ** scratch memory. There are three arguments: A pointer an 8-byte
 
1541 ** aligned memory buffer from which the scratch allocations will be
1542 ** drawn, the size of each scratch allocation (sz),
1543 ** and the maximum number of scratch allocations (N). The sz
1544 ** argument must be a multiple of 16.
1545 ** The first argument must be a pointer to an 8-byte aligned buffer
1546 ** of at least sz*N bytes of memory.
1547 ** ^SQLite will use no more than two scratch buffers per thread. So
1548 ** N should be set to twice the expected maximum number of threads.
1549 ** ^SQLite will never require a scratch buffer that is more than 6
1550 ** times the database page size. ^If SQLite needs needs additional
1551 ** scratch memory beyond what is provided by this configuration option, then
1552 ** [sqlite3_malloc()] will be used to obtain the memory needed.</dd>
 
 
 
 
 
 
1553 **
1554 ** [[SQLITE_CONFIG_PAGECACHE]] <dt>SQLITE_CONFIG_PAGECACHE</dt>
1555 ** <dd> ^This option specifies a static memory buffer that SQLite can use for
1556 ** the database page cache with the default page cache implementation.
 
1557 ** This configuration should not be used if an application-define page
1558 ** cache implementation is loaded using the SQLITE_CONFIG_PCACHE2 option.
1559 ** There are three arguments to this option: A pointer to 8-byte aligned
 
 
1560 ** memory, the size of each page buffer (sz), and the number of pages (N).
1561 ** The sz argument should be the size of the largest database page
1562 ** (a power of two between 512 and 32768) plus a little extra for each
1563 ** page header. ^The page header size is 20 to 40 bytes depending on
1564 ** the host architecture. ^It is harmless, apart from the wasted memory,
1565 ** to make sz a little too large. The first
1566 ** argument should point to an allocation of at least sz*N bytes of memory.
 
 
 
 
1567 ** ^SQLite will use the memory provided by the first argument to satisfy its
1568 ** memory needs for the first N pages that it adds to cache. ^If additional
1569 ** page cache memory is needed beyond what is provided by this option, then
1570 ** SQLite goes to [sqlite3_malloc()] for the additional storage space.
1571 ** The pointer in the first argument must
1572 ** be aligned to an 8-byte boundary or subsequent behavior of SQLite
1573 ** will be undefined.</dd>
1574 **
1575 ** [[SQLITE_CONFIG_HEAP]] <dt>SQLITE_CONFIG_HEAP</dt>
1576 ** <dd> ^This option specifies a static memory buffer that SQLite will use
1577 ** for all of its dynamic memory allocation needs beyond those provided
1578 ** for by [SQLITE_CONFIG_SCRATCH] and [SQLITE_CONFIG_PAGECACHE].
1579 ** There are three arguments: An 8-byte aligned pointer to the memory,
 
 
 
 
 
1580 ** the number of bytes in the memory buffer, and the minimum allocation size.
1581 ** ^If the first pointer (the memory pointer) is NULL, then SQLite reverts
1582 ** to using its default memory allocator (the system malloc() implementation),
1583 ** undoing any prior invocation of [SQLITE_CONFIG_MALLOC]. ^If the
1584 ** memory pointer is not NULL and either [SQLITE_ENABLE_MEMSYS3] or
1585 ** [SQLITE_ENABLE_MEMSYS5] are defined, then the alternative memory
1586 ** allocator is engaged to handle all of SQLites memory allocation needs.
1587 ** The first pointer (the memory pointer) must be aligned to an 8-byte
1588 ** boundary or subsequent behavior of SQLite will be undefined.
1589 ** The minimum allocation size is capped at 2**12. Reasonable values
1590 ** for the minimum allocation size are 2**5 through 2**8.</dd>
1591 **
1592 ** [[SQLITE_CONFIG_MUTEX]] <dt>SQLITE_CONFIG_MUTEX</dt>
1593 ** <dd> ^(This option takes a single argument which is a pointer to an
1594 ** instance of the [sqlite3_mutex_methods] structure. The argument specifies
1595 ** alternative low-level mutex routines to be used in place
1596 ** the mutex routines built into SQLite.)^ ^SQLite makes a copy of the
1597 ** content of the [sqlite3_mutex_methods] structure before the call to
1598 ** [sqlite3_config()] returns. ^If SQLite is compiled with
1599 ** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
1600 ** the entire mutexing subsystem is omitted from the build and hence calls to
1601 ** [sqlite3_config()] with the SQLITE_CONFIG_MUTEX configuration option will
1602 ** return [SQLITE_ERROR].</dd>
1603 **
1604 ** [[SQLITE_CONFIG_GETMUTEX]] <dt>SQLITE_CONFIG_GETMUTEX</dt>
1605 ** <dd> ^(This option takes a single argument which is a pointer to an
1606 ** instance of the [sqlite3_mutex_methods] structure. The
1607 ** [sqlite3_mutex_methods]
1608 ** structure is filled with the currently defined mutex routines.)^
1609 ** This option can be used to overload the default mutex allocation
1610 ** routines with a wrapper used to track mutex usage for performance
1611 ** profiling or testing, for example. ^If SQLite is compiled with
@@ -1613,29 +1629,29 @@
1613 ** the entire mutexing subsystem is omitted from the build and hence calls to
1614 ** [sqlite3_config()] with the SQLITE_CONFIG_GETMUTEX configuration option will
1615 ** return [SQLITE_ERROR].</dd>
1616 **
1617 ** [[SQLITE_CONFIG_LOOKASIDE]] <dt>SQLITE_CONFIG_LOOKASIDE</dt>
1618 ** <dd> ^(This option takes two arguments that determine the default
1619 ** memory allocation for the lookaside memory allocator on each
1620 ** [database connection]. The first argument is the
1621 ** size of each lookaside buffer slot and the second is the number of
1622 ** slots allocated to each database connection.)^ ^(This option sets the
1623 ** <i>default</i> lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE]
1624 ** verb to [sqlite3_db_config()] can be used to change the lookaside
1625 ** configuration on individual connections.)^ </dd>
1626 **
1627 ** [[SQLITE_CONFIG_PCACHE2]] <dt>SQLITE_CONFIG_PCACHE2</dt>
1628 ** <dd> ^(This option takes a single argument which is a pointer to
1629 ** an [sqlite3_pcache_methods2] object. This object specifies the interface
1630 ** to a custom page cache implementation.)^ ^SQLite makes a copy of the
1631 ** object and uses it for page cache memory allocations.</dd>
1632 **
1633 ** [[SQLITE_CONFIG_GETPCACHE2]] <dt>SQLITE_CONFIG_GETPCACHE2</dt>
1634 ** <dd> ^(This option takes a single argument which is a pointer to an
1635 ** [sqlite3_pcache_methods2] object. SQLite copies of the current
1636 ** page cache implementation into that object.)^ </dd>
1637 **
1638 ** [[SQLITE_CONFIG_LOG]] <dt>SQLITE_CONFIG_LOG</dt>
1639 ** <dd> The SQLITE_CONFIG_LOG option is used to configure the SQLite
1640 ** global [error log].
1641 ** (^The SQLITE_CONFIG_LOG option takes two arguments: a pointer to a
@@ -1654,26 +1670,28 @@
1654 ** supplied by the application must not invoke any SQLite interface.
1655 ** In a multi-threaded application, the application-defined logger
1656 ** function must be threadsafe. </dd>
1657 **
1658 ** [[SQLITE_CONFIG_URI]] <dt>SQLITE_CONFIG_URI
1659 ** <dd>^(This option takes a single argument of type int. If non-zero, then
1660 ** URI handling is globally enabled. If the parameter is zero, then URI handling
1661 ** is globally disabled.)^ ^If URI handling is globally enabled, all filenames
1662 ** passed to [sqlite3_open()], [sqlite3_open_v2()], [sqlite3_open16()] or
 
1663 ** specified as part of [ATTACH] commands are interpreted as URIs, regardless
1664 ** of whether or not the [SQLITE_OPEN_URI] flag is set when the database
1665 ** connection is opened. ^If it is globally disabled, filenames are
1666 ** only interpreted as URIs if the SQLITE_OPEN_URI flag is set when the
1667 ** database connection is opened. ^(By default, URI handling is globally
1668 ** disabled. The default value may be changed by compiling with the
1669 ** [SQLITE_USE_URI] symbol defined.)^
1670 **
1671 ** [[SQLITE_CONFIG_COVERING_INDEX_SCAN]] <dt>SQLITE_CONFIG_COVERING_INDEX_SCAN
1672 ** <dd>^This option takes a single integer argument which is interpreted as
1673 ** a boolean in order to enable or disable the use of covering indices for
1674 ** full table scans in the query optimizer. ^The default setting is determined
 
1675 ** by the [SQLITE_ALLOW_COVERING_INDEX_SCAN] compile-time option, or is "on"
1676 ** if that compile-time option is omitted.
1677 ** The ability to disable the use of covering indices for full table scans
1678 ** is because some incorrectly coded legacy applications might malfunction
1679 ** when the optimization is enabled. Providing the ability to
@@ -1709,23 +1727,32 @@
1709 ** that are the default mmap size limit (the default setting for
1710 ** [PRAGMA mmap_size]) and the maximum allowed mmap size limit.
1711 ** ^The default setting can be overridden by each database connection using
1712 ** either the [PRAGMA mmap_size] command, or by using the
1713 ** [SQLITE_FCNTL_MMAP_SIZE] file control. ^(The maximum allowed mmap size
1714 ** cannot be changed at run-time. Nor may the maximum allowed mmap size
1715 ** exceed the compile-time maximum mmap size set by the
1716 ** [SQLITE_MAX_MMAP_SIZE] compile-time option.)^
1717 ** ^If either argument to this option is negative, then that argument is
1718 ** changed to its compile-time default.
1719 **
1720 ** [[SQLITE_CONFIG_WIN32_HEAPSIZE]]
1721 ** <dt>SQLITE_CONFIG_WIN32_HEAPSIZE
1722 ** <dd>^This option is only available if SQLite is compiled for Windows
1723 ** with the [SQLITE_WIN32_MALLOC] pre-processor macro defined.
1724 ** SQLITE_CONFIG_WIN32_HEAPSIZE takes a 32-bit unsigned integer value
1725 ** that specifies the maximum size of the created heap.
1726 ** </dl>
 
 
 
 
 
 
 
 
 
1727 */
1728 #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
1729 #define SQLITE_CONFIG_MULTITHREAD 2 /* nil */
1730 #define SQLITE_CONFIG_SERIALIZED 3 /* nil */
1731 #define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */
@@ -1746,10 +1773,11 @@
1746 #define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */
1747 #define SQLITE_CONFIG_COVERING_INDEX_SCAN 20 /* int */
1748 #define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */
1749 #define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */
1750 #define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */
 
1751
1752 /*
1753 ** CAPI3REF: Database Connection Configuration Options
1754 **
1755 ** These constants are the available integer configuration options that
@@ -1873,51 +1901,49 @@
1873 SQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*);
1874
1875 /*
1876 ** CAPI3REF: Count The Number Of Rows Modified
1877 **
1878 ** ^This function returns the number of database rows that were changed
1879 ** or inserted or deleted by the most recently completed SQL statement
1880 ** on the [database connection] specified by the first parameter.
1881 ** ^(Only changes that are directly specified by the [INSERT], [UPDATE],
1882 ** or [DELETE] statement are counted. Auxiliary changes caused by
1883 ** triggers or [foreign key actions] are not counted.)^ Use the
1884 ** [sqlite3_total_changes()] function to find the total number of changes
1885 ** including changes caused by triggers and foreign key actions.
1886 **
1887 ** ^Changes to a view that are simulated by an [INSTEAD OF trigger]
1888 ** are not counted. Only real table changes are counted.
1889 **
1890 ** ^(A "row change" is a change to a single row of a single table
1891 ** caused by an INSERT, DELETE, or UPDATE statement. Rows that
1892 ** are changed as side effects of [REPLACE] constraint resolution,
1893 ** rollback, ABORT processing, [DROP TABLE], or by any other
1894 ** mechanisms do not count as direct row changes.)^
1895 **
1896 ** A "trigger context" is a scope of execution that begins and
1897 ** ends with the script of a [CREATE TRIGGER | trigger].
1898 ** Most SQL statements are
1899 ** evaluated outside of any trigger. This is the "top level"
1900 ** trigger context. If a trigger fires from the top level, a
1901 ** new trigger context is entered for the duration of that one
1902 ** trigger. Subtriggers create subcontexts for their duration.
1903 **
1904 ** ^Calling [sqlite3_exec()] or [sqlite3_step()] recursively does
1905 ** not create a new trigger context.
1906 **
1907 ** ^This function returns the number of direct row changes in the
1908 ** most recent INSERT, UPDATE, or DELETE statement within the same
1909 ** trigger context.
1910 **
1911 ** ^Thus, when called from the top level, this function returns the
1912 ** number of changes in the most recent INSERT, UPDATE, or DELETE
1913 ** that also occurred at the top level. ^(Within the body of a trigger,
1914 ** the sqlite3_changes() interface can be called to find the number of
1915 ** changes in the most recently completed INSERT, UPDATE, or DELETE
1916 ** statement within the body of the same trigger.
1917 ** However, the number returned does not include changes
1918 ** caused by subtriggers since those have their own context.)^
1919 **
1920 ** See also the [sqlite3_total_changes()] interface, the
1921 ** [count_changes pragma], and the [changes() SQL function].
1922 **
1923 ** If a separate thread makes changes on the same database connection
@@ -1927,24 +1953,21 @@
1927 SQLITE_API int sqlite3_changes(sqlite3*);
1928
1929 /*
1930 ** CAPI3REF: Total Number Of Rows Modified
1931 **
1932 ** ^This function returns the number of row changes caused by [INSERT],
1933 ** [UPDATE] or [DELETE] statements since the [database connection] was opened.
1934 ** ^(The count returned by sqlite3_total_changes() includes all changes
1935 ** from all [CREATE TRIGGER | trigger] contexts and changes made by
1936 ** [foreign key actions]. However,
1937 ** the count does not include changes used to implement [REPLACE] constraints,
1938 ** do rollbacks or ABORT processing, or [DROP TABLE] processing. The
1939 ** count does not include rows of views that fire an [INSTEAD OF trigger],
1940 ** though if the INSTEAD OF trigger makes changes of its own, those changes
1941 ** are counted.)^
1942 ** ^The sqlite3_total_changes() function counts the changes as soon as
1943 ** the statement that makes them is completed (when the statement handle
1944 ** is passed to [sqlite3_reset()] or [sqlite3_finalize()]).
1945 **
1946 ** See also the [sqlite3_changes()] interface, the
1947 ** [count_changes pragma], and the [total_changes() SQL function].
1948 **
1949 ** If a separate thread makes changes on the same database connection
1950 ** while [sqlite3_total_changes()] is running then the value
@@ -2027,10 +2050,11 @@
2027 SQLITE_API int sqlite3_complete(const char *sql);
2028 SQLITE_API int sqlite3_complete16(const void *sql);
2029
2030 /*
2031 ** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors
 
2032 **
2033 ** ^The sqlite3_busy_handler(D,X,P) routine sets a callback function X
2034 ** that might be invoked with argument P whenever
2035 ** an attempt is made to access a database table associated with
2036 ** [database connection] D when another thread
@@ -2043,11 +2067,11 @@
2043 ** is not NULL, then the callback might be invoked with two arguments.
2044 **
2045 ** ^The first argument to the busy handler is a copy of the void* pointer which
2046 ** is the third argument to sqlite3_busy_handler(). ^The second argument to
2047 ** the busy handler callback is the number of times that the busy handler has
2048 ** been invoked for the same locking event. ^If the
2049 ** busy callback returns 0, then no additional attempts are made to
2050 ** access the database and [SQLITE_BUSY] is returned
2051 ** to the application.
2052 ** ^If the callback returns non-zero, then another attempt
2053 ** is made to access the database and the cycle repeats.
@@ -2418,17 +2442,18 @@
2418 ** already uses the largest possible [ROWID]. The PRNG is also used for
2419 ** the build-in random() and randomblob() SQL functions. This interface allows
2420 ** applications to access the same PRNG for other purposes.
2421 **
2422 ** ^A call to this routine stores N bytes of randomness into buffer P.
2423 ** ^If N is less than one, then P can be a NULL pointer.
2424 **
2425 ** ^If this routine has not been previously called or if the previous
2426 ** call had N less than one, then the PRNG is seeded using randomness
2427 ** obtained from the xRandomness method of the default [sqlite3_vfs] object.
2428 ** ^If the previous call to this routine had an N of 1 or more then
2429 ** the pseudo-randomness is generated
 
2430 ** internally and without recourse to the [sqlite3_vfs] xRandomness
2431 ** method.
2432 */
2433 SQLITE_API void sqlite3_randomness(int N, void *P);
2434
@@ -4146,13 +4171,13 @@
4146 ** CAPI3REF: Text Encodings
4147 **
4148 ** These constant define integer codes that represent the various
4149 ** text encodings supported by SQLite.
4150 */
4151 #define SQLITE_UTF8 1
4152 #define SQLITE_UTF16LE 2
4153 #define SQLITE_UTF16BE 3
4154 #define SQLITE_UTF16 4 /* Use native byte order */
4155 #define SQLITE_ANY 5 /* Deprecated */
4156 #define SQLITE_UTF16_ALIGNED 8 /* sqlite3_create_collation only */
4157
4158 /*
@@ -4497,11 +4522,12 @@
4497 ** If these routines are called from within the different thread
4498 ** than the one containing the application-defined function that received
4499 ** the [sqlite3_context] pointer, the results are undefined.
4500 */
4501 SQLITE_API void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));
4502 SQLITE_API void sqlite3_result_blob64(sqlite3_context*,const void*,sqlite3_uint64,void(*)(void*));
 
4503 SQLITE_API void sqlite3_result_double(sqlite3_context*, double);
4504 SQLITE_API void sqlite3_result_error(sqlite3_context*, const char*, int);
4505 SQLITE_API void sqlite3_result_error16(sqlite3_context*, const void*, int);
4506 SQLITE_API void sqlite3_result_error_toobig(sqlite3_context*);
4507 SQLITE_API void sqlite3_result_error_nomem(sqlite3_context*);
@@ -5638,31 +5664,47 @@
5638 ** in other words, the same BLOB that would be selected by:
5639 **
5640 ** <pre>
5641 ** SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow;
5642 ** </pre>)^
 
 
 
 
 
 
5643 **
5644 ** ^If the flags parameter is non-zero, then the BLOB is opened for read
5645 ** and write access. ^If it is zero, the BLOB is opened for read access.
5646 ** ^It is not possible to open a column that is part of an index or primary
5647 ** key for writing. ^If [foreign key constraints] are enabled, it is
5648 ** not possible to open a column that is part of a [child key] for writing.
5649 **
5650 ** ^Note that the database name is not the filename that contains
5651 ** the database but rather the symbolic name of the database that
5652 ** appears after the AS keyword when the database is connected using [ATTACH].
5653 ** ^For the main database file, the database name is "main".
5654 ** ^For TEMP tables, the database name is "temp".
5655 **
5656 ** ^(On success, [SQLITE_OK] is returned and the new [BLOB handle] is written
5657 ** to *ppBlob. Otherwise an [error code] is returned and *ppBlob is set
5658 ** to be a null pointer.)^
5659 ** ^This function sets the [database connection] error code and message
5660 ** accessible via [sqlite3_errcode()] and [sqlite3_errmsg()] and related
5661 ** functions. ^Note that the *ppBlob variable is always initialized in a
5662 ** way that makes it safe to invoke [sqlite3_blob_close()] on *ppBlob
5663 ** regardless of the success or failure of this routine.
 
 
 
 
 
 
 
 
 
 
5664 **
5665 ** ^(If the row that a BLOB handle points to is modified by an
5666 ** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects
5667 ** then the BLOB handle is marked as "expired".
5668 ** This is true if any column of the row is changed, even a column
@@ -5676,17 +5718,13 @@
5676 ** ^Use the [sqlite3_blob_bytes()] interface to determine the size of
5677 ** the opened blob. ^The size of a blob may not be changed by this
5678 ** interface. Use the [UPDATE] SQL command to change the size of a
5679 ** blob.
5680 **
5681 ** ^The [sqlite3_blob_open()] interface will fail for a [WITHOUT ROWID]
5682 ** table. Incremental BLOB I/O is not possible on [WITHOUT ROWID] tables.
5683 **
5684 ** ^The [sqlite3_bind_zeroblob()] and [sqlite3_result_zeroblob()] interfaces
5685 ** and the built-in [zeroblob] SQL function can be used, if desired,
5686 ** to create an empty, zero-filled blob in which to read or write using
5687 ** this interface.
5688 **
5689 ** To avoid a resource leak, every open [BLOB handle] should eventually
5690 ** be released by a call to [sqlite3_blob_close()].
5691 */
5692 SQLITE_API int sqlite3_blob_open(
@@ -5724,28 +5762,26 @@
5724 SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64);
5725
5726 /*
5727 ** CAPI3REF: Close A BLOB Handle
5728 **
5729 ** ^Closes an open [BLOB handle].
5730 **
5731 ** ^Closing a BLOB shall cause the current transaction to commit
5732 ** if there are no other BLOBs, no pending prepared statements, and the
5733 ** database connection is in [autocommit mode].
5734 ** ^If any writes were made to the BLOB, they might be held in cache
5735 ** until the close operation if they will fit.
5736 **
5737 ** ^(Closing the BLOB often forces the changes
5738 ** out to disk and so if any I/O errors occur, they will likely occur
5739 ** at the time when the BLOB is closed. Any errors that occur during
5740 ** closing are reported as a non-zero return value.)^
5741 **
5742 ** ^(The BLOB is closed unconditionally. Even if this routine returns
5743 ** an error code, the BLOB is still closed.)^
5744 **
5745 ** ^Calling this routine with a null pointer (such as would be returned
5746 ** by a failed call to [sqlite3_blob_open()]) is a harmless no-op.
5747 */
5748 SQLITE_API int sqlite3_blob_close(sqlite3_blob *);
5749
5750 /*
5751 ** CAPI3REF: Return The Size Of An Open BLOB
@@ -5791,36 +5827,39 @@
5791 SQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);
5792
5793 /*
5794 ** CAPI3REF: Write Data Into A BLOB Incrementally
5795 **
5796 ** ^This function is used to write data into an open [BLOB handle] from a
5797 ** caller-supplied buffer. ^N bytes of data are copied from the buffer Z
5798 ** into the open BLOB, starting at offset iOffset.
 
 
 
 
 
 
5799 **
5800 ** ^If the [BLOB handle] passed as the first argument was not opened for
5801 ** writing (the flags parameter to [sqlite3_blob_open()] was zero),
5802 ** this function returns [SQLITE_READONLY].
5803 **
5804 ** ^This function may only modify the contents of the BLOB; it is
5805 ** not possible to increase the size of a BLOB using this API.
5806 ** ^If offset iOffset is less than N bytes from the end of the BLOB,
5807 ** [SQLITE_ERROR] is returned and no data is written. ^If N is
5808 ** less than zero [SQLITE_ERROR] is returned and no data is written.
5809 ** The size of the BLOB (and hence the maximum value of N+iOffset)
5810 ** can be determined using the [sqlite3_blob_bytes()] interface.
5811 **
5812 ** ^An attempt to write to an expired [BLOB handle] fails with an
5813 ** error code of [SQLITE_ABORT]. ^Writes to the BLOB that occurred
5814 ** before the [BLOB handle] expired are not rolled back by the
5815 ** expiration of the handle, though of course those changes might
5816 ** have been overwritten by the statement that expired the BLOB handle
5817 ** or by other independent statements.
5818 **
5819 ** ^(On success, sqlite3_blob_write() returns SQLITE_OK.
5820 ** Otherwise, an [error code] or an [extended error code] is returned.)^
5821 **
5822 ** This routine only works on a [BLOB handle] which has been created
5823 ** by a prior successful call to [sqlite3_blob_open()] and which has not
5824 ** been closed by [sqlite3_blob_close()]. Passing any other pointer in
5825 ** to this routine results in undefined and probably undesirable behavior.
5826 **
@@ -5869,38 +5908,38 @@
5869 ** use by SQLite, code that links against SQLite is
5870 ** permitted to use any of these routines.
5871 **
5872 ** The SQLite source code contains multiple implementations
5873 ** of these mutex routines. An appropriate implementation
5874 ** is selected automatically at compile-time. ^(The following
5875 ** implementations are available in the SQLite core:
5876 **
5877 ** <ul>
5878 ** <li> SQLITE_MUTEX_PTHREADS
5879 ** <li> SQLITE_MUTEX_W32
5880 ** <li> SQLITE_MUTEX_NOOP
5881 ** </ul>)^
5882 **
5883 ** ^The SQLITE_MUTEX_NOOP implementation is a set of routines
5884 ** that does no real locking and is appropriate for use in
5885 ** a single-threaded application. ^The SQLITE_MUTEX_PTHREADS and
5886 ** SQLITE_MUTEX_W32 implementations are appropriate for use on Unix
5887 ** and Windows.
5888 **
5889 ** ^(If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor
5890 ** macro defined (with "-DSQLITE_MUTEX_APPDEF=1"), then no mutex
5891 ** implementation is included with the library. In this case the
5892 ** application must supply a custom mutex implementation using the
5893 ** [SQLITE_CONFIG_MUTEX] option of the sqlite3_config() function
5894 ** before calling sqlite3_initialize() or any other public sqlite3_
5895 ** function that calls sqlite3_initialize().)^
5896 **
5897 ** ^The sqlite3_mutex_alloc() routine allocates a new
5898 ** mutex and returns a pointer to it. ^If it returns NULL
5899 ** that means that a mutex could not be allocated. ^SQLite
5900 ** will unwind its stack and return an error. ^(The argument
5901 ** to sqlite3_mutex_alloc() is one of these integer constants:
5902 **
5903 ** <ul>
5904 ** <li> SQLITE_MUTEX_FAST
5905 ** <li> SQLITE_MUTEX_RECURSIVE
5906 ** <li> SQLITE_MUTEX_STATIC_MASTER
@@ -5909,68 +5948,64 @@
5909 ** <li> SQLITE_MUTEX_STATIC_PRNG
5910 ** <li> SQLITE_MUTEX_STATIC_LRU
5911 ** <li> SQLITE_MUTEX_STATIC_PMEM
5912 ** <li> SQLITE_MUTEX_STATIC_APP1
5913 ** <li> SQLITE_MUTEX_STATIC_APP2
5914 ** </ul>)^
 
5915 **
5916 ** ^The first two constants (SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE)
5917 ** cause sqlite3_mutex_alloc() to create
5918 ** a new mutex. ^The new mutex is recursive when SQLITE_MUTEX_RECURSIVE
5919 ** is used but not necessarily so when SQLITE_MUTEX_FAST is used.
5920 ** The mutex implementation does not need to make a distinction
5921 ** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does
5922 ** not want to. ^SQLite will only request a recursive mutex in
5923 ** cases where it really needs one. ^If a faster non-recursive mutex
5924 ** implementation is available on the host platform, the mutex subsystem
5925 ** might return such a mutex in response to SQLITE_MUTEX_FAST.
5926 **
5927 ** ^The other allowed parameters to sqlite3_mutex_alloc() (anything other
5928 ** than SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) each return
5929 ** a pointer to a static preexisting mutex. ^Six static mutexes are
5930 ** used by the current version of SQLite. Future versions of SQLite
5931 ** may add additional static mutexes. Static mutexes are for internal
5932 ** use by SQLite only. Applications that use SQLite mutexes should
5933 ** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or
5934 ** SQLITE_MUTEX_RECURSIVE.
5935 **
5936 ** ^Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST
5937 ** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc()
5938 ** returns a different mutex on every call. ^But for the static
5939 ** mutex types, the same mutex is returned on every call that has
5940 ** the same type number.
5941 **
5942 ** ^The sqlite3_mutex_free() routine deallocates a previously
5943 ** allocated dynamic mutex. ^SQLite is careful to deallocate every
5944 ** dynamic mutex that it allocates. The dynamic mutexes must not be in
5945 ** use when they are deallocated. Attempting to deallocate a static
5946 ** mutex results in undefined behavior. ^SQLite never deallocates
5947 ** a static mutex.
5948 **
5949 ** ^The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt
5950 ** to enter a mutex. ^If another thread is already within the mutex,
5951 ** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return
5952 ** SQLITE_BUSY. ^The sqlite3_mutex_try() interface returns [SQLITE_OK]
5953 ** upon successful entry. ^(Mutexes created using
5954 ** SQLITE_MUTEX_RECURSIVE can be entered multiple times by the same thread.
5955 ** In such cases the,
5956 ** mutex must be exited an equal number of times before another thread
5957 ** can enter.)^ ^(If the same thread tries to enter any other
5958 ** kind of mutex more than once, the behavior is undefined.
5959 ** SQLite will never exhibit
5960 ** such behavior in its own use of mutexes.)^
5961 **
5962 ** ^(Some systems (for example, Windows 95) do not support the operation
5963 ** implemented by sqlite3_mutex_try(). On those systems, sqlite3_mutex_try()
5964 ** will always return SQLITE_BUSY. The SQLite core only ever uses
5965 ** sqlite3_mutex_try() as an optimization so this is acceptable behavior.)^
 
5966 **
5967 ** ^The sqlite3_mutex_leave() routine exits a mutex that was
5968 ** previously entered by the same thread. ^(The behavior
5969 ** is undefined if the mutex is not currently entered by the
5970 ** calling thread or is not currently allocated. SQLite will
5971 ** never do either.)^
5972 **
5973 ** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(), or
5974 ** sqlite3_mutex_leave() is a NULL pointer, then all three routines
5975 ** behave as no-ops.
5976 **
@@ -5987,13 +6022,13 @@
5987 **
5988 ** An instance of this structure defines the low-level routines
5989 ** used to allocate and use mutexes.
5990 **
5991 ** Usually, the default mutex implementations provided by SQLite are
5992 ** sufficient, however the user has the option of substituting a custom
5993 ** implementation for specialized deployments or systems for which SQLite
5994 ** does not provide a suitable implementation. In this case, the user
5995 ** creates and populates an instance of this structure to pass
5996 ** to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option.
5997 ** Additionally, an instance of this structure can be used as an
5998 ** output variable when querying the system for the current mutex
5999 ** implementation, using the [SQLITE_CONFIG_GETMUTEX] option.
@@ -6030,17 +6065,17 @@
6030 ** by this structure are not required to handle this case, the results
6031 ** of passing a NULL pointer instead of a valid mutex handle are undefined
6032 ** (i.e. it is acceptable to provide an implementation that segfaults if
6033 ** it is passed a NULL pointer).
6034 **
6035 ** The xMutexInit() method must be threadsafe. ^It must be harmless to
6036 ** invoke xMutexInit() multiple times within the same process and without
6037 ** intervening calls to xMutexEnd(). Second and subsequent calls to
6038 ** xMutexInit() must be no-ops.
6039 **
6040 ** ^xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()]
6041 ** and its associates). ^Similarly, xMutexAlloc() must not use SQLite memory
6042 ** allocation for a static mutex. ^However xMutexAlloc() may use SQLite
6043 ** memory allocation for a fast or recursive mutex.
6044 **
6045 ** ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is
6046 ** called, but only if the prior call to xMutexInit returned SQLITE_OK.
@@ -6062,33 +6097,33 @@
6062
6063 /*
6064 ** CAPI3REF: Mutex Verification Routines
6065 **
6066 ** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routines
6067 ** are intended for use inside assert() statements. ^The SQLite core
6068 ** never uses these routines except inside an assert() and applications
6069 ** are advised to follow the lead of the core. ^The SQLite core only
6070 ** provides implementations for these routines when it is compiled
6071 ** with the SQLITE_DEBUG flag. ^External mutex implementations
6072 ** are only required to provide these routines if SQLITE_DEBUG is
6073 ** defined and if NDEBUG is not defined.
6074 **
6075 ** ^These routines should return true if the mutex in their argument
6076 ** is held or not held, respectively, by the calling thread.
6077 **
6078 ** ^The implementation is not required to provide versions of these
6079 ** routines that actually work. If the implementation does not provide working
6080 ** versions of these routines, it should at least provide stubs that always
6081 ** return true so that one does not get spurious assertion failures.
6082 **
6083 ** ^If the argument to sqlite3_mutex_held() is a NULL pointer then
6084 ** the routine should return 1. This seems counter-intuitive since
6085 ** clearly the mutex cannot be held if it does not exist. But
6086 ** the reason the mutex does not exist is because the build is not
6087 ** using mutexes. And we do not want the assert() containing the
6088 ** call to sqlite3_mutex_held() to fail, so a non-zero return is
6089 ** the appropriate thing to do. ^The sqlite3_mutex_notheld()
6090 ** interface should also return 1 when given a NULL pointer.
6091 */
6092 #ifndef NDEBUG
6093 SQLITE_API int sqlite3_mutex_held(sqlite3_mutex*);
6094 SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*);
@@ -6816,10 +6851,14 @@
6816 ** sqlite3_backup_init(D,N,S,M) identify the [database connection]
6817 ** and database name of the source database, respectively.
6818 ** ^The source and destination [database connections] (parameters S and D)
6819 ** must be different or else sqlite3_backup_init(D,N,S,M) will fail with
6820 ** an error.
 
 
 
 
6821 **
6822 ** ^If an error occurs within sqlite3_backup_init(D,N,S,M), then NULL is
6823 ** returned and an error code and error message are stored in the
6824 ** destination [database connection] D.
6825 ** ^The error code and message for the failed call to sqlite3_backup_init()
@@ -7210,101 +7249,118 @@
7210 SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
7211
7212 /*
7213 ** CAPI3REF: Checkpoint a database
7214 **
7215 ** ^The [sqlite3_wal_checkpoint(D,X)] interface causes database named X
7216 ** on [database connection] D to be [checkpointed]. ^If X is NULL or an
7217 ** empty string, then a checkpoint is run on all databases of
7218 ** connection D. ^If the database connection D is not in
7219 ** [WAL | write-ahead log mode] then this interface is a harmless no-op.
7220 ** ^The [sqlite3_wal_checkpoint(D,X)] interface initiates a
7221 ** [sqlite3_wal_checkpoint_v2|PASSIVE] checkpoint.
7222 ** Use the [sqlite3_wal_checkpoint_v2()] interface to get a FULL
7223 ** or RESET checkpoint.
7224 **
7225 ** ^The [wal_checkpoint pragma] can be used to invoke this interface
7226 ** from SQL. ^The [sqlite3_wal_autocheckpoint()] interface and the
7227 ** [wal_autocheckpoint pragma] can be used to cause this interface to be
7228 ** run whenever the WAL reaches a certain size threshold.
7229 **
7230 ** See also: [sqlite3_wal_checkpoint_v2()]
7231 */
7232 SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);
7233
7234 /*
7235 ** CAPI3REF: Checkpoint a database
7236 **
7237 ** Run a checkpoint operation on WAL database zDb attached to database
7238 ** handle db. The specific operation is determined by the value of the
7239 ** eMode parameter:
 
7240 **
7241 ** <dl>
7242 ** <dt>SQLITE_CHECKPOINT_PASSIVE<dd>
7243 ** Checkpoint as many frames as possible without waiting for any database
7244 ** readers or writers to finish. Sync the db file if all frames in the log
7245 ** are checkpointed. This mode is the same as calling
7246 ** sqlite3_wal_checkpoint(). The [sqlite3_busy_handler|busy-handler callback]
7247 ** is never invoked.
 
7248 **
7249 ** <dt>SQLITE_CHECKPOINT_FULL<dd>
7250 ** This mode blocks (it invokes the
7251 ** [sqlite3_busy_handler|busy-handler callback]) until there is no
7252 ** database writer and all readers are reading from the most recent database
7253 ** snapshot. It then checkpoints all frames in the log file and syncs the
7254 ** database file. This call blocks database writers while it is running,
7255 ** but not database readers.
7256 **
7257 ** <dt>SQLITE_CHECKPOINT_RESTART<dd>
7258 ** This mode works the same way as SQLITE_CHECKPOINT_FULL, except after
7259 ** checkpointing the log file it blocks (calls the
7260 ** [sqlite3_busy_handler|busy-handler callback])
7261 ** until all readers are reading from the database file only. This ensures
7262 ** that the next client to write to the database file restarts the log file
7263 ** from the beginning. This call blocks database writers while it is running,
7264 ** but not database readers.
 
 
 
 
 
7265 ** </dl>
7266 **
7267 ** If pnLog is not NULL, then *pnLog is set to the total number of frames in
7268 ** the log file before returning. If pnCkpt is not NULL, then *pnCkpt is set to
7269 ** the total number of checkpointed frames (including any that were already
7270 ** checkpointed when this function is called). *pnLog and *pnCkpt may be
7271 ** populated even if sqlite3_wal_checkpoint_v2() returns other than SQLITE_OK.
7272 ** If no values are available because of an error, they are both set to -1
7273 ** before returning to communicate this to the caller.
 
 
7274 **
7275 ** All calls obtain an exclusive "checkpoint" lock on the database file. If
7276 ** any other process is running a checkpoint operation at the same time, the
7277 ** lock cannot be obtained and SQLITE_BUSY is returned. Even if there is a
7278 ** busy-handler configured, it will not be invoked in this case.
7279 **
7280 ** The SQLITE_CHECKPOINT_FULL and RESTART modes also obtain the exclusive
7281 ** "writer" lock on the database file. If the writer lock cannot be obtained
7282 ** immediately, and a busy-handler is configured, it is invoked and the writer
7283 ** lock retried until either the busy-handler returns 0 or the lock is
7284 ** successfully obtained. The busy-handler is also invoked while waiting for
7285 ** database readers as described above. If the busy-handler returns 0 before
7286 ** the writer lock is obtained or while waiting for database readers, the
7287 ** checkpoint operation proceeds from that point in the same way as
7288 ** SQLITE_CHECKPOINT_PASSIVE - checkpointing as many frames as possible
7289 ** without blocking any further. SQLITE_BUSY is returned in this case.
7290 **
7291 ** If parameter zDb is NULL or points to a zero length string, then the
7292 ** specified operation is attempted on all WAL databases. In this case the
7293 ** values written to output parameters *pnLog and *pnCkpt are undefined. If
 
7294 ** an SQLITE_BUSY error is encountered when processing one or more of the
7295 ** attached WAL databases, the operation is still attempted on any remaining
7296 ** attached databases and SQLITE_BUSY is returned to the caller. If any other
7297 ** error occurs while processing an attached database, processing is abandoned
7298 ** and the error code returned to the caller immediately. If no error
7299 ** (SQLITE_BUSY or otherwise) is encountered while processing the attached
7300 ** databases, SQLITE_OK is returned.
7301 **
7302 ** If database zDb is the name of an attached database that is not in WAL
7303 ** mode, SQLITE_OK is returned and both *pnLog and *pnCkpt set to -1. If
7304 ** zDb is not NULL (or a zero length string) and is not the name of any
7305 ** attached database, SQLITE_ERROR is returned to the caller.
 
 
 
 
 
 
 
 
7306 */
7307 SQLITE_API int sqlite3_wal_checkpoint_v2(
7308 sqlite3 *db, /* Database handle */
7309 const char *zDb, /* Name of attached database (or NULL) */
7310 int eMode, /* SQLITE_CHECKPOINT_* value */
@@ -7311,20 +7367,22 @@
7311 int *pnLog, /* OUT: Size of WAL log in frames */
7312 int *pnCkpt /* OUT: Total number of frames checkpointed */
7313 );
7314
7315 /*
7316 ** CAPI3REF: Checkpoint operation parameters
 
7317 **
7318 ** These constants can be used as the 3rd parameter to
7319 ** [sqlite3_wal_checkpoint_v2()]. See the [sqlite3_wal_checkpoint_v2()]
7320 ** documentation for additional information about the meaning and use of
7321 ** each of these values.
7322 */
7323 #define SQLITE_CHECKPOINT_PASSIVE 0
7324 #define SQLITE_CHECKPOINT_FULL 1
7325 #define SQLITE_CHECKPOINT_RESTART 2
 
7326
7327 /*
7328 ** CAPI3REF: Virtual Table Interface Configuration
7329 **
7330 ** This function may be called by either the [xConnect] or [xCreate] method
@@ -7409,10 +7467,102 @@
7409 /* #define SQLITE_IGNORE 2 // Also used by sqlite3_authorizer() callback */
7410 #define SQLITE_FAIL 3
7411 /* #define SQLITE_ABORT 4 // Also an error code */
7412 #define SQLITE_REPLACE 5
7413
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7414
7415
7416 /*
7417 ** Undo the hack that converts floating point types to integer for
7418 ** builds on processors without floating point support.
7419
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -55,11 +55,11 @@
55
56
57 /*
58 ** These no-op macros are used in front of interfaces to mark those
59 ** interfaces as either deprecated or experimental. New applications
60 ** should not use deprecated interfaces - they are supported for backwards
61 ** compatibility only. Application writers should be aware that
62 ** experimental interfaces are subject to change in point releases.
63 **
64 ** These macros used to resolve to various kinds of compiler magic that
65 ** would generate warning messages when they were used. But that
@@ -105,13 +105,13 @@
105 **
106 ** See also: [sqlite3_libversion()],
107 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108 ** [sqlite_version()] and [sqlite_source_id()].
109 */
110 #define SQLITE_VERSION "3.8.8"
111 #define SQLITE_VERSION_NUMBER 3008008
112 #define SQLITE_SOURCE_ID "2014-12-06 14:56:49 6aeece19a235344be2537e66a3fe08b1febfb5a0"
113
114 /*
115 ** CAPI3REF: Run-Time Library Version Numbers
116 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
117 **
@@ -1219,11 +1219,11 @@
1219 ** <li> SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED
1220 ** <li> SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE
1221 ** </ul>
1222 **
1223 ** When unlocking, the same SHARED or EXCLUSIVE flag must be supplied as
1224 ** was given on the corresponding lock.
1225 **
1226 ** The xShmLock method can transition between unlocked and SHARED or
1227 ** between unlocked and EXCLUSIVE. It cannot transition between SHARED
1228 ** and EXCLUSIVE.
1229 */
@@ -1502,30 +1502,32 @@
1502 ** it is not possible to set the Serialized [threading mode] and
1503 ** [sqlite3_config()] will return [SQLITE_ERROR] if called with the
1504 ** SQLITE_CONFIG_SERIALIZED configuration option.</dd>
1505 **
1506 ** [[SQLITE_CONFIG_MALLOC]] <dt>SQLITE_CONFIG_MALLOC</dt>
1507 ** <dd> ^(The SQLITE_CONFIG_MALLOC option takes a single argument which is
1508 ** a pointer to an instance of the [sqlite3_mem_methods] structure.
1509 ** The argument specifies
1510 ** alternative low-level memory allocation routines to be used in place of
1511 ** the memory allocation routines built into SQLite.)^ ^SQLite makes
1512 ** its own private copy of the content of the [sqlite3_mem_methods] structure
1513 ** before the [sqlite3_config()] call returns.</dd>
1514 **
1515 ** [[SQLITE_CONFIG_GETMALLOC]] <dt>SQLITE_CONFIG_GETMALLOC</dt>
1516 ** <dd> ^(The SQLITE_CONFIG_GETMALLOC option takes a single argument which
1517 ** is a pointer to an instance of the [sqlite3_mem_methods] structure.
1518 ** The [sqlite3_mem_methods]
1519 ** structure is filled with the currently defined memory allocation routines.)^
1520 ** This option can be used to overload the default memory allocation
1521 ** routines with a wrapper that simulations memory allocation failure or
1522 ** tracks memory usage, for example. </dd>
1523 **
1524 ** [[SQLITE_CONFIG_MEMSTATUS]] <dt>SQLITE_CONFIG_MEMSTATUS</dt>
1525 ** <dd> ^The SQLITE_CONFIG_MEMSTATUS option takes single argument of type int,
1526 ** interpreted as a boolean, which enables or disables the collection of
1527 ** memory allocation statistics. ^(When memory allocation statistics are
1528 ** disabled, the following SQLite interfaces become non-operational:
1529 ** <ul>
1530 ** <li> [sqlite3_memory_used()]
1531 ** <li> [sqlite3_memory_highwater()]
1532 ** <li> [sqlite3_soft_heap_limit64()]
1533 ** <li> [sqlite3_status()]
@@ -1534,78 +1536,92 @@
1536 ** compiled with [SQLITE_DEFAULT_MEMSTATUS]=0 in which case memory
1537 ** allocation statistics are disabled by default.
1538 ** </dd>
1539 **
1540 ** [[SQLITE_CONFIG_SCRATCH]] <dt>SQLITE_CONFIG_SCRATCH</dt>
1541 ** <dd> ^The SQLITE_CONFIG_SCRATCH option specifies a static memory buffer
1542 ** that SQLite can use for scratch memory. ^(There are three arguments
1543 ** to SQLITE_CONFIG_SCRATCH: A pointer an 8-byte
1544 ** aligned memory buffer from which the scratch allocations will be
1545 ** drawn, the size of each scratch allocation (sz),
1546 ** and the maximum number of scratch allocations (N).)^
 
1547 ** The first argument must be a pointer to an 8-byte aligned buffer
1548 ** of at least sz*N bytes of memory.
1549 ** ^SQLite will not use more than one scratch buffers per thread.
1550 ** ^SQLite will never request a scratch buffer that is more than 6
1551 ** times the database page size.
1552 ** ^If SQLite needs needs additional
1553 ** scratch memory beyond what is provided by this configuration option, then
1554 ** [sqlite3_malloc()] will be used to obtain the memory needed.<p>
1555 ** ^When the application provides any amount of scratch memory using
1556 ** SQLITE_CONFIG_SCRATCH, SQLite avoids unnecessary large
1557 ** [sqlite3_malloc|heap allocations].
1558 ** This can help [Robson proof|prevent memory allocation failures] due to heap
1559 ** fragmentation in low-memory embedded systems.
1560 ** </dd>
1561 **
1562 ** [[SQLITE_CONFIG_PAGECACHE]] <dt>SQLITE_CONFIG_PAGECACHE</dt>
1563 ** <dd> ^The SQLITE_CONFIG_PAGECACHE option specifies a static memory buffer
1564 ** that SQLite can use for the database page cache with the default page
1565 ** cache implementation.
1566 ** This configuration should not be used if an application-define page
1567 ** cache implementation is loaded using the [SQLITE_CONFIG_PCACHE2]
1568 ** configuration option.
1569 ** ^There are three arguments to SQLITE_CONFIG_PAGECACHE: A pointer to
1570 ** 8-byte aligned
1571 ** memory, the size of each page buffer (sz), and the number of pages (N).
1572 ** The sz argument should be the size of the largest database page
1573 ** (a power of two between 512 and 32768) plus some extra bytes for each
1574 ** page header. ^The number of extra bytes needed by the page header
1575 ** can be determined using the [SQLITE_CONFIG_PCACHE_HDRSZ] option
1576 ** to [sqlite3_config()].
1577 ** ^It is harmless, apart from the wasted memory,
1578 ** for the sz parameter to be larger than necessary. The first
1579 ** argument should pointer to an 8-byte aligned block of memory that
1580 ** is at least sz*N bytes of memory, otherwise subsequent behavior is
1581 ** undefined.
1582 ** ^SQLite will use the memory provided by the first argument to satisfy its
1583 ** memory needs for the first N pages that it adds to cache. ^If additional
1584 ** page cache memory is needed beyond what is provided by this option, then
1585 ** SQLite goes to [sqlite3_malloc()] for the additional storage space.</dd>
 
 
 
1586 **
1587 ** [[SQLITE_CONFIG_HEAP]] <dt>SQLITE_CONFIG_HEAP</dt>
1588 ** <dd> ^The SQLITE_CONFIG_HEAP option specifies a static memory buffer
1589 ** that SQLite will use for all of its dynamic memory allocation needs
1590 ** beyond those provided for by [SQLITE_CONFIG_SCRATCH] and
1591 ** [SQLITE_CONFIG_PAGECACHE].
1592 ** ^The SQLITE_CONFIG_HEAP option is only available if SQLite is compiled
1593 ** with either [SQLITE_ENABLE_MEMSYS3] or [SQLITE_ENABLE_MEMSYS5] and returns
1594 ** [SQLITE_ERROR] if invoked otherwise.
1595 ** ^There are three arguments to SQLITE_CONFIG_HEAP:
1596 ** An 8-byte aligned pointer to the memory,
1597 ** the number of bytes in the memory buffer, and the minimum allocation size.
1598 ** ^If the first pointer (the memory pointer) is NULL, then SQLite reverts
1599 ** to using its default memory allocator (the system malloc() implementation),
1600 ** undoing any prior invocation of [SQLITE_CONFIG_MALLOC]. ^If the
1601 ** memory pointer is not NULL then the alternative memory
 
1602 ** allocator is engaged to handle all of SQLites memory allocation needs.
1603 ** The first pointer (the memory pointer) must be aligned to an 8-byte
1604 ** boundary or subsequent behavior of SQLite will be undefined.
1605 ** The minimum allocation size is capped at 2**12. Reasonable values
1606 ** for the minimum allocation size are 2**5 through 2**8.</dd>
1607 **
1608 ** [[SQLITE_CONFIG_MUTEX]] <dt>SQLITE_CONFIG_MUTEX</dt>
1609 ** <dd> ^(The SQLITE_CONFIG_MUTEX option takes a single argument which is a
1610 ** pointer to an instance of the [sqlite3_mutex_methods] structure.
1611 ** The argument specifies alternative low-level mutex routines to be used
1612 ** in place the mutex routines built into SQLite.)^ ^SQLite makes a copy of
1613 ** the content of the [sqlite3_mutex_methods] structure before the call to
1614 ** [sqlite3_config()] returns. ^If SQLite is compiled with
1615 ** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
1616 ** the entire mutexing subsystem is omitted from the build and hence calls to
1617 ** [sqlite3_config()] with the SQLITE_CONFIG_MUTEX configuration option will
1618 ** return [SQLITE_ERROR].</dd>
1619 **
1620 ** [[SQLITE_CONFIG_GETMUTEX]] <dt>SQLITE_CONFIG_GETMUTEX</dt>
1621 ** <dd> ^(The SQLITE_CONFIG_GETMUTEX option takes a single argument which
1622 ** is a pointer to an instance of the [sqlite3_mutex_methods] structure. The
1623 ** [sqlite3_mutex_methods]
1624 ** structure is filled with the currently defined mutex routines.)^
1625 ** This option can be used to overload the default mutex allocation
1626 ** routines with a wrapper used to track mutex usage for performance
1627 ** profiling or testing, for example. ^If SQLite is compiled with
@@ -1613,29 +1629,29 @@
1629 ** the entire mutexing subsystem is omitted from the build and hence calls to
1630 ** [sqlite3_config()] with the SQLITE_CONFIG_GETMUTEX configuration option will
1631 ** return [SQLITE_ERROR].</dd>
1632 **
1633 ** [[SQLITE_CONFIG_LOOKASIDE]] <dt>SQLITE_CONFIG_LOOKASIDE</dt>
1634 ** <dd> ^(The SQLITE_CONFIG_LOOKASIDE option takes two arguments that determine
1635 ** the default size of lookaside memory on each [database connection].
1636 ** The first argument is the
1637 ** size of each lookaside buffer slot and the second is the number of
1638 ** slots allocated to each database connection.)^ ^(SQLITE_CONFIG_LOOKASIDE
1639 ** sets the <i>default</i> lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE]
1640 ** option to [sqlite3_db_config()] can be used to change the lookaside
1641 ** configuration on individual connections.)^ </dd>
1642 **
1643 ** [[SQLITE_CONFIG_PCACHE2]] <dt>SQLITE_CONFIG_PCACHE2</dt>
1644 ** <dd> ^(The SQLITE_CONFIG_PCACHE2 option takes a single argument which is
1645 ** a pointer to an [sqlite3_pcache_methods2] object. This object specifies
1646 ** the interface to a custom page cache implementation.)^
1647 ** ^SQLite makes a copy of the [sqlite3_pcache_methods2] object.</dd>
1648 **
1649 ** [[SQLITE_CONFIG_GETPCACHE2]] <dt>SQLITE_CONFIG_GETPCACHE2</dt>
1650 ** <dd> ^(The SQLITE_CONFIG_GETPCACHE2 option takes a single argument which
1651 ** is a pointer to an [sqlite3_pcache_methods2] object. SQLite copies of
1652 ** the current page cache implementation into that object.)^ </dd>
1653 **
1654 ** [[SQLITE_CONFIG_LOG]] <dt>SQLITE_CONFIG_LOG</dt>
1655 ** <dd> The SQLITE_CONFIG_LOG option is used to configure the SQLite
1656 ** global [error log].
1657 ** (^The SQLITE_CONFIG_LOG option takes two arguments: a pointer to a
@@ -1654,26 +1670,28 @@
1670 ** supplied by the application must not invoke any SQLite interface.
1671 ** In a multi-threaded application, the application-defined logger
1672 ** function must be threadsafe. </dd>
1673 **
1674 ** [[SQLITE_CONFIG_URI]] <dt>SQLITE_CONFIG_URI
1675 ** <dd>^(The SQLITE_CONFIG_URI option takes a single argument of type int.
1676 ** If non-zero, then URI handling is globally enabled. If the parameter is zero,
1677 ** then URI handling is globally disabled.)^ ^If URI handling is globally
1678 ** enabled, all filenames passed to [sqlite3_open()], [sqlite3_open_v2()],
1679 ** [sqlite3_open16()] or
1680 ** specified as part of [ATTACH] commands are interpreted as URIs, regardless
1681 ** of whether or not the [SQLITE_OPEN_URI] flag is set when the database
1682 ** connection is opened. ^If it is globally disabled, filenames are
1683 ** only interpreted as URIs if the SQLITE_OPEN_URI flag is set when the
1684 ** database connection is opened. ^(By default, URI handling is globally
1685 ** disabled. The default value may be changed by compiling with the
1686 ** [SQLITE_USE_URI] symbol defined.)^
1687 **
1688 ** [[SQLITE_CONFIG_COVERING_INDEX_SCAN]] <dt>SQLITE_CONFIG_COVERING_INDEX_SCAN
1689 ** <dd>^The SQLITE_CONFIG_COVERING_INDEX_SCAN option takes a single integer
1690 ** argument which is interpreted as a boolean in order to enable or disable
1691 ** the use of covering indices for full table scans in the query optimizer.
1692 ** ^The default setting is determined
1693 ** by the [SQLITE_ALLOW_COVERING_INDEX_SCAN] compile-time option, or is "on"
1694 ** if that compile-time option is omitted.
1695 ** The ability to disable the use of covering indices for full table scans
1696 ** is because some incorrectly coded legacy applications might malfunction
1697 ** when the optimization is enabled. Providing the ability to
@@ -1709,23 +1727,32 @@
1727 ** that are the default mmap size limit (the default setting for
1728 ** [PRAGMA mmap_size]) and the maximum allowed mmap size limit.
1729 ** ^The default setting can be overridden by each database connection using
1730 ** either the [PRAGMA mmap_size] command, or by using the
1731 ** [SQLITE_FCNTL_MMAP_SIZE] file control. ^(The maximum allowed mmap size
1732 ** will be silently truncated if necessary so that it does not exceed the
1733 ** compile-time maximum mmap size set by the
1734 ** [SQLITE_MAX_MMAP_SIZE] compile-time option.)^
1735 ** ^If either argument to this option is negative, then that argument is
1736 ** changed to its compile-time default.
1737 **
1738 ** [[SQLITE_CONFIG_WIN32_HEAPSIZE]]
1739 ** <dt>SQLITE_CONFIG_WIN32_HEAPSIZE
1740 ** <dd>^The SQLITE_CONFIG_WIN32_HEAPSIZE option is only available if SQLite is
1741 ** compiled for Windows with the [SQLITE_WIN32_MALLOC] pre-processor macro
1742 ** defined. ^SQLITE_CONFIG_WIN32_HEAPSIZE takes a 32-bit unsigned integer value
1743 ** that specifies the maximum size of the created heap.
1744 ** </dl>
1745 **
1746 ** [[SQLITE_CONFIG_PCACHE_HDRSZ]]
1747 ** <dt>SQLITE_CONFIG_PCACHE_HDRSZ
1748 ** <dd>^The SQLITE_CONFIG_PCACHE_HDRSZ option takes a single parameter which
1749 ** is a pointer to an integer and writes into that integer the number of extra
1750 ** bytes per page required for each page in [SQLITE_CONFIG_PAGECACHE].
1751 ** The amount of extra space required can change depending on the compiler,
1752 ** target platform, and SQLite version.
1753 ** </dl>
1754 */
1755 #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
1756 #define SQLITE_CONFIG_MULTITHREAD 2 /* nil */
1757 #define SQLITE_CONFIG_SERIALIZED 3 /* nil */
1758 #define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */
@@ -1746,10 +1773,11 @@
1773 #define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */
1774 #define SQLITE_CONFIG_COVERING_INDEX_SCAN 20 /* int */
1775 #define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */
1776 #define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */
1777 #define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */
1778 #define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */
1779
1780 /*
1781 ** CAPI3REF: Database Connection Configuration Options
1782 **
1783 ** These constants are the available integer configuration options that
@@ -1873,51 +1901,49 @@
1901 SQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*);
1902
1903 /*
1904 ** CAPI3REF: Count The Number Of Rows Modified
1905 **
1906 ** ^This function returns the number of rows modified, inserted or
1907 ** deleted by the most recently completed INSERT, UPDATE or DELETE
1908 ** statement on the database connection specified by the only parameter.
1909 ** ^Executing any other type of SQL statement does not modify the value
1910 ** returned by this function.
1911 **
1912 ** ^Only changes made directly by the INSERT, UPDATE or DELETE statement are
1913 ** considered - auxiliary changes caused by [CREATE TRIGGER | triggers],
1914 ** [foreign key actions] or [REPLACE] constraint resolution are not counted.
1915 **
1916 ** Changes to a view that are intercepted by
1917 ** [INSTEAD OF trigger | INSTEAD OF triggers] are not counted. ^The value
1918 ** returned by sqlite3_changes() immediately after an INSERT, UPDATE or
1919 ** DELETE statement run on a view is always zero. Only changes made to real
1920 ** tables are counted.
1921 **
1922 ** Things are more complicated if the sqlite3_changes() function is
1923 ** executed while a trigger program is running. This may happen if the
1924 ** program uses the [changes() SQL function], or if some other callback
1925 ** function invokes sqlite3_changes() directly. Essentially:
1926 **
1927 ** <ul>
1928 ** <li> ^(Before entering a trigger program the value returned by
1929 ** sqlite3_changes() function is saved. After the trigger program
1930 ** has finished, the original value is restored.)^
1931 **
1932 ** <li> ^(Within a trigger program each INSERT, UPDATE and DELETE
1933 ** statement sets the value returned by sqlite3_changes()
1934 ** upon completion as normal. Of course, this value will not include
1935 ** any changes performed by sub-triggers, as the sqlite3_changes()
1936 ** value will be saved and restored after each sub-trigger has run.)^
1937 ** </ul>
1938 **
1939 ** ^This means that if the changes() SQL function (or similar) is used
1940 ** by the first INSERT, UPDATE or DELETE statement within a trigger, it
1941 ** returns the value as set when the calling statement began executing.
1942 ** ^If it is used by the second or subsequent such statement within a trigger
1943 ** program, the value returned reflects the number of rows modified by the
1944 ** previous INSERT, UPDATE or DELETE statement within the same trigger.
 
 
1945 **
1946 ** See also the [sqlite3_total_changes()] interface, the
1947 ** [count_changes pragma], and the [changes() SQL function].
1948 **
1949 ** If a separate thread makes changes on the same database connection
@@ -1927,24 +1953,21 @@
1953 SQLITE_API int sqlite3_changes(sqlite3*);
1954
1955 /*
1956 ** CAPI3REF: Total Number Of Rows Modified
1957 **
1958 ** ^This function returns the total number of rows inserted, modified or
1959 ** deleted by all [INSERT], [UPDATE] or [DELETE] statements completed
1960 ** since the database connection was opened, including those executed as
1961 ** part of trigger programs. ^Executing any other type of SQL statement
1962 ** does not affect the value returned by sqlite3_total_changes().
1963 **
1964 ** ^Changes made as part of [foreign key actions] are included in the
1965 ** count, but those made as part of REPLACE constraint resolution are
1966 ** not. ^Changes to a view that are intercepted by INSTEAD OF triggers
1967 ** are not counted.
1968 **
 
 
 
1969 ** See also the [sqlite3_changes()] interface, the
1970 ** [count_changes pragma], and the [total_changes() SQL function].
1971 **
1972 ** If a separate thread makes changes on the same database connection
1973 ** while [sqlite3_total_changes()] is running then the value
@@ -2027,10 +2050,11 @@
2050 SQLITE_API int sqlite3_complete(const char *sql);
2051 SQLITE_API int sqlite3_complete16(const void *sql);
2052
2053 /*
2054 ** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors
2055 ** KEYWORDS: {busy-handler callback} {busy handler}
2056 **
2057 ** ^The sqlite3_busy_handler(D,X,P) routine sets a callback function X
2058 ** that might be invoked with argument P whenever
2059 ** an attempt is made to access a database table associated with
2060 ** [database connection] D when another thread
@@ -2043,11 +2067,11 @@
2067 ** is not NULL, then the callback might be invoked with two arguments.
2068 **
2069 ** ^The first argument to the busy handler is a copy of the void* pointer which
2070 ** is the third argument to sqlite3_busy_handler(). ^The second argument to
2071 ** the busy handler callback is the number of times that the busy handler has
2072 ** been invoked previously for the same locking event. ^If the
2073 ** busy callback returns 0, then no additional attempts are made to
2074 ** access the database and [SQLITE_BUSY] is returned
2075 ** to the application.
2076 ** ^If the callback returns non-zero, then another attempt
2077 ** is made to access the database and the cycle repeats.
@@ -2418,17 +2442,18 @@
2442 ** already uses the largest possible [ROWID]. The PRNG is also used for
2443 ** the build-in random() and randomblob() SQL functions. This interface allows
2444 ** applications to access the same PRNG for other purposes.
2445 **
2446 ** ^A call to this routine stores N bytes of randomness into buffer P.
2447 ** ^The P parameter can be a NULL pointer.
2448 **
2449 ** ^If this routine has not been previously called or if the previous
2450 ** call had N less than one or a NULL pointer for P, then the PRNG is
2451 ** seeded using randomness obtained from the xRandomness method of
2452 ** the default [sqlite3_vfs] object.
2453 ** ^If the previous call to this routine had an N of 1 or more and a
2454 ** non-NULL P then the pseudo-randomness is generated
2455 ** internally and without recourse to the [sqlite3_vfs] xRandomness
2456 ** method.
2457 */
2458 SQLITE_API void sqlite3_randomness(int N, void *P);
2459
@@ -4146,13 +4171,13 @@
4171 ** CAPI3REF: Text Encodings
4172 **
4173 ** These constant define integer codes that represent the various
4174 ** text encodings supported by SQLite.
4175 */
4176 #define SQLITE_UTF8 1 /* IMP: R-37514-35566 */
4177 #define SQLITE_UTF16LE 2 /* IMP: R-03371-37637 */
4178 #define SQLITE_UTF16BE 3 /* IMP: R-51971-34154 */
4179 #define SQLITE_UTF16 4 /* Use native byte order */
4180 #define SQLITE_ANY 5 /* Deprecated */
4181 #define SQLITE_UTF16_ALIGNED 8 /* sqlite3_create_collation only */
4182
4183 /*
@@ -4497,11 +4522,12 @@
4522 ** If these routines are called from within the different thread
4523 ** than the one containing the application-defined function that received
4524 ** the [sqlite3_context] pointer, the results are undefined.
4525 */
4526 SQLITE_API void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));
4527 SQLITE_API void sqlite3_result_blob64(sqlite3_context*,const void*,
4528 sqlite3_uint64,void(*)(void*));
4529 SQLITE_API void sqlite3_result_double(sqlite3_context*, double);
4530 SQLITE_API void sqlite3_result_error(sqlite3_context*, const char*, int);
4531 SQLITE_API void sqlite3_result_error16(sqlite3_context*, const void*, int);
4532 SQLITE_API void sqlite3_result_error_toobig(sqlite3_context*);
4533 SQLITE_API void sqlite3_result_error_nomem(sqlite3_context*);
@@ -5638,31 +5664,47 @@
5664 ** in other words, the same BLOB that would be selected by:
5665 **
5666 ** <pre>
5667 ** SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow;
5668 ** </pre>)^
5669 **
5670 ** ^(Parameter zDb is not the filename that contains the database, but
5671 ** rather the symbolic name of the database. For attached databases, this is
5672 ** the name that appears after the AS keyword in the [ATTACH] statement.
5673 ** For the main database file, the database name is "main". For TEMP
5674 ** tables, the database name is "temp".)^
5675 **
5676 ** ^If the flags parameter is non-zero, then the BLOB is opened for read
5677 ** and write access. ^If the flags parameter is zero, the BLOB is opened for
5678 ** read-only access.
5679 **
5680 ** ^(On success, [SQLITE_OK] is returned and the new [BLOB handle] is stored
5681 ** in *ppBlob. Otherwise an [error code] is returned and, unless the error
5682 ** code is SQLITE_MISUSE, *ppBlob is set to NULL.)^ ^This means that, provided
5683 ** the API is not misused, it is always safe to call [sqlite3_blob_close()]
5684 ** on *ppBlob after this function it returns.
5685 **
5686 ** This function fails with SQLITE_ERROR if any of the following are true:
5687 ** <ul>
5688 ** <li> ^(Database zDb does not exist)^,
5689 ** <li> ^(Table zTable does not exist within database zDb)^,
5690 ** <li> ^(Table zTable is a WITHOUT ROWID table)^,
5691 ** <li> ^(Column zColumn does not exist)^,
5692 ** <li> ^(Row iRow is not present in the table)^,
5693 ** <li> ^(The specified column of row iRow contains a value that is not
5694 ** a TEXT or BLOB value)^,
5695 ** <li> ^(Column zColumn is part of an index, PRIMARY KEY or UNIQUE
5696 ** constraint and the blob is being opened for read/write access)^,
5697 ** <li> ^([foreign key constraints | Foreign key constraints] are enabled,
5698 ** column zColumn is part of a [child key] definition and the blob is
5699 ** being opened for read/write access)^.
5700 ** </ul>
5701 **
5702 ** ^Unless it returns SQLITE_MISUSE, this function sets the
5703 ** [database connection] error code and message accessible via
5704 ** [sqlite3_errcode()] and [sqlite3_errmsg()] and related functions.
5705 **
5706 **
5707 ** ^(If the row that a BLOB handle points to is modified by an
5708 ** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects
5709 ** then the BLOB handle is marked as "expired".
5710 ** This is true if any column of the row is changed, even a column
@@ -5676,17 +5718,13 @@
5718 ** ^Use the [sqlite3_blob_bytes()] interface to determine the size of
5719 ** the opened blob. ^The size of a blob may not be changed by this
5720 ** interface. Use the [UPDATE] SQL command to change the size of a
5721 ** blob.
5722 **
 
 
 
5723 ** ^The [sqlite3_bind_zeroblob()] and [sqlite3_result_zeroblob()] interfaces
5724 ** and the built-in [zeroblob] SQL function may be used to create a
5725 ** zero-filled blob to read or write using the incremental-blob interface.
 
5726 **
5727 ** To avoid a resource leak, every open [BLOB handle] should eventually
5728 ** be released by a call to [sqlite3_blob_close()].
5729 */
5730 SQLITE_API int sqlite3_blob_open(
@@ -5724,28 +5762,26 @@
5762 SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64);
5763
5764 /*
5765 ** CAPI3REF: Close A BLOB Handle
5766 **
5767 ** ^This function closes an open [BLOB handle]. ^(The BLOB handle is closed
5768 ** unconditionally. Even if this routine returns an error code, the
5769 ** handle is still closed.)^
5770 **
5771 ** ^If the blob handle being closed was opened for read-write access, and if
5772 ** the database is in auto-commit mode and there are no other open read-write
5773 ** blob handles or active write statements, the current transaction is
5774 ** committed. ^If an error occurs while committing the transaction, an error
5775 ** code is returned and the transaction rolled back.
5776 **
5777 ** Calling this function with an argument that is not a NULL pointer or an
5778 ** open blob handle results in undefined behaviour. ^Calling this routine
5779 ** with a null pointer (such as would be returned by a failed call to
5780 ** [sqlite3_blob_open()]) is a harmless no-op. ^Otherwise, if this function
5781 ** is passed a valid open blob handle, the values returned by the
5782 ** sqlite3_errcode() and sqlite3_errmsg() functions are set before returning.
 
 
5783 */
5784 SQLITE_API int sqlite3_blob_close(sqlite3_blob *);
5785
5786 /*
5787 ** CAPI3REF: Return The Size Of An Open BLOB
@@ -5791,36 +5827,39 @@
5827 SQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);
5828
5829 /*
5830 ** CAPI3REF: Write Data Into A BLOB Incrementally
5831 **
5832 ** ^(This function is used to write data into an open [BLOB handle] from a
5833 ** caller-supplied buffer. N bytes of data are copied from the buffer Z
5834 ** into the open BLOB, starting at offset iOffset.)^
5835 **
5836 ** ^(On success, sqlite3_blob_write() returns SQLITE_OK.
5837 ** Otherwise, an [error code] or an [extended error code] is returned.)^
5838 ** ^Unless SQLITE_MISUSE is returned, this function sets the
5839 ** [database connection] error code and message accessible via
5840 ** [sqlite3_errcode()] and [sqlite3_errmsg()] and related functions.
5841 **
5842 ** ^If the [BLOB handle] passed as the first argument was not opened for
5843 ** writing (the flags parameter to [sqlite3_blob_open()] was zero),
5844 ** this function returns [SQLITE_READONLY].
5845 **
5846 ** This function may only modify the contents of the BLOB; it is
5847 ** not possible to increase the size of a BLOB using this API.
5848 ** ^If offset iOffset is less than N bytes from the end of the BLOB,
5849 ** [SQLITE_ERROR] is returned and no data is written. The size of the
5850 ** BLOB (and hence the maximum value of N+iOffset) can be determined
5851 ** using the [sqlite3_blob_bytes()] interface. ^If N or iOffset are less
5852 ** than zero [SQLITE_ERROR] is returned and no data is written.
5853 **
5854 ** ^An attempt to write to an expired [BLOB handle] fails with an
5855 ** error code of [SQLITE_ABORT]. ^Writes to the BLOB that occurred
5856 ** before the [BLOB handle] expired are not rolled back by the
5857 ** expiration of the handle, though of course those changes might
5858 ** have been overwritten by the statement that expired the BLOB handle
5859 ** or by other independent statements.
5860 **
 
 
 
5861 ** This routine only works on a [BLOB handle] which has been created
5862 ** by a prior successful call to [sqlite3_blob_open()] and which has not
5863 ** been closed by [sqlite3_blob_close()]. Passing any other pointer in
5864 ** to this routine results in undefined and probably undesirable behavior.
5865 **
@@ -5869,38 +5908,38 @@
5908 ** use by SQLite, code that links against SQLite is
5909 ** permitted to use any of these routines.
5910 **
5911 ** The SQLite source code contains multiple implementations
5912 ** of these mutex routines. An appropriate implementation
5913 ** is selected automatically at compile-time. The following
5914 ** implementations are available in the SQLite core:
5915 **
5916 ** <ul>
5917 ** <li> SQLITE_MUTEX_PTHREADS
5918 ** <li> SQLITE_MUTEX_W32
5919 ** <li> SQLITE_MUTEX_NOOP
5920 ** </ul>
5921 **
5922 ** The SQLITE_MUTEX_NOOP implementation is a set of routines
5923 ** that does no real locking and is appropriate for use in
5924 ** a single-threaded application. The SQLITE_MUTEX_PTHREADS and
5925 ** SQLITE_MUTEX_W32 implementations are appropriate for use on Unix
5926 ** and Windows.
5927 **
5928 ** If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor
5929 ** macro defined (with "-DSQLITE_MUTEX_APPDEF=1"), then no mutex
5930 ** implementation is included with the library. In this case the
5931 ** application must supply a custom mutex implementation using the
5932 ** [SQLITE_CONFIG_MUTEX] option of the sqlite3_config() function
5933 ** before calling sqlite3_initialize() or any other public sqlite3_
5934 ** function that calls sqlite3_initialize().
5935 **
5936 ** ^The sqlite3_mutex_alloc() routine allocates a new
5937 ** mutex and returns a pointer to it. ^The sqlite3_mutex_alloc()
5938 ** routine returns NULL if it is unable to allocate the requested
5939 ** mutex. The argument to sqlite3_mutex_alloc() must one of these
5940 ** integer constants:
5941 **
5942 ** <ul>
5943 ** <li> SQLITE_MUTEX_FAST
5944 ** <li> SQLITE_MUTEX_RECURSIVE
5945 ** <li> SQLITE_MUTEX_STATIC_MASTER
@@ -5909,68 +5948,64 @@
5948 ** <li> SQLITE_MUTEX_STATIC_PRNG
5949 ** <li> SQLITE_MUTEX_STATIC_LRU
5950 ** <li> SQLITE_MUTEX_STATIC_PMEM
5951 ** <li> SQLITE_MUTEX_STATIC_APP1
5952 ** <li> SQLITE_MUTEX_STATIC_APP2
5953 ** <li> SQLITE_MUTEX_STATIC_APP3
5954 ** </ul>
5955 **
5956 ** ^The first two constants (SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE)
5957 ** cause sqlite3_mutex_alloc() to create
5958 ** a new mutex. ^The new mutex is recursive when SQLITE_MUTEX_RECURSIVE
5959 ** is used but not necessarily so when SQLITE_MUTEX_FAST is used.
5960 ** The mutex implementation does not need to make a distinction
5961 ** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does
5962 ** not want to. SQLite will only request a recursive mutex in
5963 ** cases where it really needs one. If a faster non-recursive mutex
5964 ** implementation is available on the host platform, the mutex subsystem
5965 ** might return such a mutex in response to SQLITE_MUTEX_FAST.
5966 **
5967 ** ^The other allowed parameters to sqlite3_mutex_alloc() (anything other
5968 ** than SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) each return
5969 ** a pointer to a static preexisting mutex. ^Nine static mutexes are
5970 ** used by the current version of SQLite. Future versions of SQLite
5971 ** may add additional static mutexes. Static mutexes are for internal
5972 ** use by SQLite only. Applications that use SQLite mutexes should
5973 ** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or
5974 ** SQLITE_MUTEX_RECURSIVE.
5975 **
5976 ** ^Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST
5977 ** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc()
5978 ** returns a different mutex on every call. ^For the static
5979 ** mutex types, the same mutex is returned on every call that has
5980 ** the same type number.
5981 **
5982 ** ^The sqlite3_mutex_free() routine deallocates a previously
5983 ** allocated dynamic mutex. Attempting to deallocate a static
5984 ** mutex results in undefined behavior.
 
 
 
5985 **
5986 ** ^The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt
5987 ** to enter a mutex. ^If another thread is already within the mutex,
5988 ** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return
5989 ** SQLITE_BUSY. ^The sqlite3_mutex_try() interface returns [SQLITE_OK]
5990 ** upon successful entry. ^(Mutexes created using
5991 ** SQLITE_MUTEX_RECURSIVE can be entered multiple times by the same thread.
5992 ** In such cases, the
5993 ** mutex must be exited an equal number of times before another thread
5994 ** can enter.)^ If the same thread tries to enter any mutex other
5995 ** than an SQLITE_MUTEX_RECURSIVE more than once, the behavior is undefined.
 
 
5996 **
5997 ** ^(Some systems (for example, Windows 95) do not support the operation
5998 ** implemented by sqlite3_mutex_try(). On those systems, sqlite3_mutex_try()
5999 ** will always return SQLITE_BUSY. The SQLite core only ever uses
6000 ** sqlite3_mutex_try() as an optimization so this is acceptable
6001 ** behavior.)^
6002 **
6003 ** ^The sqlite3_mutex_leave() routine exits a mutex that was
6004 ** previously entered by the same thread. The behavior
6005 ** is undefined if the mutex is not currently entered by the
6006 ** calling thread or is not currently allocated.
 
6007 **
6008 ** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(), or
6009 ** sqlite3_mutex_leave() is a NULL pointer, then all three routines
6010 ** behave as no-ops.
6011 **
@@ -5987,13 +6022,13 @@
6022 **
6023 ** An instance of this structure defines the low-level routines
6024 ** used to allocate and use mutexes.
6025 **
6026 ** Usually, the default mutex implementations provided by SQLite are
6027 ** sufficient, however the application has the option of substituting a custom
6028 ** implementation for specialized deployments or systems for which SQLite
6029 ** does not provide a suitable implementation. In this case, the application
6030 ** creates and populates an instance of this structure to pass
6031 ** to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option.
6032 ** Additionally, an instance of this structure can be used as an
6033 ** output variable when querying the system for the current mutex
6034 ** implementation, using the [SQLITE_CONFIG_GETMUTEX] option.
@@ -6030,17 +6065,17 @@
6065 ** by this structure are not required to handle this case, the results
6066 ** of passing a NULL pointer instead of a valid mutex handle are undefined
6067 ** (i.e. it is acceptable to provide an implementation that segfaults if
6068 ** it is passed a NULL pointer).
6069 **
6070 ** The xMutexInit() method must be threadsafe. It must be harmless to
6071 ** invoke xMutexInit() multiple times within the same process and without
6072 ** intervening calls to xMutexEnd(). Second and subsequent calls to
6073 ** xMutexInit() must be no-ops.
6074 **
6075 ** xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()]
6076 ** and its associates). Similarly, xMutexAlloc() must not use SQLite memory
6077 ** allocation for a static mutex. ^However xMutexAlloc() may use SQLite
6078 ** memory allocation for a fast or recursive mutex.
6079 **
6080 ** ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is
6081 ** called, but only if the prior call to xMutexInit returned SQLITE_OK.
@@ -6062,33 +6097,33 @@
6097
6098 /*
6099 ** CAPI3REF: Mutex Verification Routines
6100 **
6101 ** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routines
6102 ** are intended for use inside assert() statements. The SQLite core
6103 ** never uses these routines except inside an assert() and applications
6104 ** are advised to follow the lead of the core. The SQLite core only
6105 ** provides implementations for these routines when it is compiled
6106 ** with the SQLITE_DEBUG flag. External mutex implementations
6107 ** are only required to provide these routines if SQLITE_DEBUG is
6108 ** defined and if NDEBUG is not defined.
6109 **
6110 ** These routines should return true if the mutex in their argument
6111 ** is held or not held, respectively, by the calling thread.
6112 **
6113 ** The implementation is not required to provide versions of these
6114 ** routines that actually work. If the implementation does not provide working
6115 ** versions of these routines, it should at least provide stubs that always
6116 ** return true so that one does not get spurious assertion failures.
6117 **
6118 ** If the argument to sqlite3_mutex_held() is a NULL pointer then
6119 ** the routine should return 1. This seems counter-intuitive since
6120 ** clearly the mutex cannot be held if it does not exist. But
6121 ** the reason the mutex does not exist is because the build is not
6122 ** using mutexes. And we do not want the assert() containing the
6123 ** call to sqlite3_mutex_held() to fail, so a non-zero return is
6124 ** the appropriate thing to do. The sqlite3_mutex_notheld()
6125 ** interface should also return 1 when given a NULL pointer.
6126 */
6127 #ifndef NDEBUG
6128 SQLITE_API int sqlite3_mutex_held(sqlite3_mutex*);
6129 SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*);
@@ -6816,10 +6851,14 @@
6851 ** sqlite3_backup_init(D,N,S,M) identify the [database connection]
6852 ** and database name of the source database, respectively.
6853 ** ^The source and destination [database connections] (parameters S and D)
6854 ** must be different or else sqlite3_backup_init(D,N,S,M) will fail with
6855 ** an error.
6856 **
6857 ** ^A call to sqlite3_backup_init() will fail, returning SQLITE_ERROR, if
6858 ** there is already a read or read-write transaction open on the
6859 ** destination database.
6860 **
6861 ** ^If an error occurs within sqlite3_backup_init(D,N,S,M), then NULL is
6862 ** returned and an error code and error message are stored in the
6863 ** destination [database connection] D.
6864 ** ^The error code and message for the failed call to sqlite3_backup_init()
@@ -7210,101 +7249,118 @@
7249 SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
7250
7251 /*
7252 ** CAPI3REF: Checkpoint a database
7253 **
7254 ** ^(The sqlite3_wal_checkpoint(D,X) is equivalent to
7255 ** [sqlite3_wal_checkpoint_v2](D,X,[SQLITE_CHECKPOINT_PASSIVE],0,0).)^
7256 **
7257 ** In brief, sqlite3_wal_checkpoint(D,X) causes the content in the
7258 ** [write-ahead log] for database X on [database connection] D to be
7259 ** transferred into the database file and for the write-ahead log to
7260 ** be reset. See the [checkpointing] documentation for addition
7261 ** information.
7262 **
7263 ** This interface used to be the only way to cause a checkpoint to
7264 ** occur. But then the newer and more powerful [sqlite3_wal_checkpoint_v2()]
7265 ** interface was added. This interface is retained for backwards
7266 ** compatibility and as a convenience for applications that need to manually
7267 ** start a callback but which do not need the full power (and corresponding
7268 ** complication) of [sqlite3_wal_checkpoint_v2()].
 
7269 */
7270 SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);
7271
7272 /*
7273 ** CAPI3REF: Checkpoint a database
7274 **
7275 ** ^(The sqlite3_wal_checkpoint_v2(D,X,M,L,C) interface runs a checkpoint
7276 ** operation on database X of [database connection] D in mode M. Status
7277 ** information is written back into integers pointed to by L and C.)^
7278 ** ^(The M parameter must be a valid [checkpoint mode]:)^
7279 **
7280 ** <dl>
7281 ** <dt>SQLITE_CHECKPOINT_PASSIVE<dd>
7282 ** ^Checkpoint as many frames as possible without waiting for any database
7283 ** readers or writers to finish, then sync the database file if all frames
7284 ** in the log were checkpointed. ^The [busy-handler callback]
7285 ** is never invoked in the SQLITE_CHECKPOINT_PASSIVE mode.
7286 ** ^On the other hand, passive mode might leave the checkpoint unfinished
7287 ** if there are concurrent readers or writers.
7288 **
7289 ** <dt>SQLITE_CHECKPOINT_FULL<dd>
7290 ** ^This mode blocks (it invokes the
7291 ** [sqlite3_busy_handler|busy-handler callback]) until there is no
7292 ** database writer and all readers are reading from the most recent database
7293 ** snapshot. ^It then checkpoints all frames in the log file and syncs the
7294 ** database file. ^This mode blocks new database writers while it is pending,
7295 ** but new database readers are allowed to continue unimpeded.
7296 **
7297 ** <dt>SQLITE_CHECKPOINT_RESTART<dd>
7298 ** ^This mode works the same way as SQLITE_CHECKPOINT_FULL with the addition
7299 ** that after checkpointing the log file it blocks (calls the
7300 ** [busy-handler callback])
7301 ** until all readers are reading from the database file only. ^This ensures
7302 ** that the next writer will restart the log file from the beginning.
7303 ** ^Like SQLITE_CHECKPOINT_FULL, this mode blocks new
7304 ** database writer attempts while it is pending, but does not impede readers.
7305 **
7306 ** <dt>SQLITE_CHECKPOINT_TRUNCATE<dd>
7307 ** ^This mode works the same way as SQLITE_CHECKPOINT_RESTART with the
7308 ** addition that it also truncates the log file to zero bytes just prior
7309 ** to a successful return.
7310 ** </dl>
7311 **
7312 ** ^If pnLog is not NULL, then *pnLog is set to the total number of frames in
7313 ** the log file or to -1 if the checkpoint could not run because
7314 ** of an error or because the database is not in [WAL mode]. ^If pnCkpt is not
7315 ** NULL,then *pnCkpt is set to the total number of checkpointed frames in the
7316 ** log file (including any that were already checkpointed before the function
7317 ** was called) or to -1 if the checkpoint could not run due to an error or
7318 ** because the database is not in WAL mode. ^Note that upon successful
7319 ** completion of an SQLITE_CHECKPOINT_TRUNCATE, the log file will have been
7320 ** truncated to zero bytes and so both *pnLog and *pnCkpt will be set to zero.
7321 **
7322 ** ^All calls obtain an exclusive "checkpoint" lock on the database file. ^If
7323 ** any other process is running a checkpoint operation at the same time, the
7324 ** lock cannot be obtained and SQLITE_BUSY is returned. ^Even if there is a
7325 ** busy-handler configured, it will not be invoked in this case.
7326 **
7327 ** ^The SQLITE_CHECKPOINT_FULL, RESTART and TRUNCATE modes also obtain the
7328 ** exclusive "writer" lock on the database file. ^If the writer lock cannot be
7329 ** obtained immediately, and a busy-handler is configured, it is invoked and
7330 ** the writer lock retried until either the busy-handler returns 0 or the lock
7331 ** is successfully obtained. ^The busy-handler is also invoked while waiting for
7332 ** database readers as described above. ^If the busy-handler returns 0 before
7333 ** the writer lock is obtained or while waiting for database readers, the
7334 ** checkpoint operation proceeds from that point in the same way as
7335 ** SQLITE_CHECKPOINT_PASSIVE - checkpointing as many frames as possible
7336 ** without blocking any further. ^SQLITE_BUSY is returned in this case.
7337 **
7338 ** ^If parameter zDb is NULL or points to a zero length string, then the
7339 ** specified operation is attempted on all WAL databases [attached] to
7340 ** [database connection] db. In this case the
7341 ** values written to output parameters *pnLog and *pnCkpt are undefined. ^If
7342 ** an SQLITE_BUSY error is encountered when processing one or more of the
7343 ** attached WAL databases, the operation is still attempted on any remaining
7344 ** attached databases and SQLITE_BUSY is returned at the end. ^If any other
7345 ** error occurs while processing an attached database, processing is abandoned
7346 ** and the error code is returned to the caller immediately. ^If no error
7347 ** (SQLITE_BUSY or otherwise) is encountered while processing the attached
7348 ** databases, SQLITE_OK is returned.
7349 **
7350 ** ^If database zDb is the name of an attached database that is not in WAL
7351 ** mode, SQLITE_OK is returned and both *pnLog and *pnCkpt set to -1. ^If
7352 ** zDb is not NULL (or a zero length string) and is not the name of any
7353 ** attached database, SQLITE_ERROR is returned to the caller.
7354 **
7355 ** ^Unless it returns SQLITE_MISUSE,
7356 ** the sqlite3_wal_checkpoint_v2() interface
7357 ** sets the error information that is queried by
7358 ** [sqlite3_errcode()] and [sqlite3_errmsg()].
7359 **
7360 ** ^The [PRAGMA wal_checkpoint] command can be used to invoke this interface
7361 ** from SQL.
7362 */
7363 SQLITE_API int sqlite3_wal_checkpoint_v2(
7364 sqlite3 *db, /* Database handle */
7365 const char *zDb, /* Name of attached database (or NULL) */
7366 int eMode, /* SQLITE_CHECKPOINT_* value */
@@ -7311,20 +7367,22 @@
7367 int *pnLog, /* OUT: Size of WAL log in frames */
7368 int *pnCkpt /* OUT: Total number of frames checkpointed */
7369 );
7370
7371 /*
7372 ** CAPI3REF: Checkpoint Mode Values
7373 ** KEYWORDS: {checkpoint mode}
7374 **
7375 ** These constants define all valid values for the "checkpoint mode" passed
7376 ** as the third parameter to the [sqlite3_wal_checkpoint_v2()] interface.
7377 ** See the [sqlite3_wal_checkpoint_v2()] documentation for details on the
7378 ** meaning of each of these checkpoint modes.
7379 */
7380 #define SQLITE_CHECKPOINT_PASSIVE 0 /* Do as much as possible w/o blocking */
7381 #define SQLITE_CHECKPOINT_FULL 1 /* Wait for writers, then checkpoint */
7382 #define SQLITE_CHECKPOINT_RESTART 2 /* Like FULL but wait for for readers */
7383 #define SQLITE_CHECKPOINT_TRUNCATE 3 /* Like RESTART but also truncate WAL */
7384
7385 /*
7386 ** CAPI3REF: Virtual Table Interface Configuration
7387 **
7388 ** This function may be called by either the [xConnect] or [xCreate] method
@@ -7409,10 +7467,102 @@
7467 /* #define SQLITE_IGNORE 2 // Also used by sqlite3_authorizer() callback */
7468 #define SQLITE_FAIL 3
7469 /* #define SQLITE_ABORT 4 // Also an error code */
7470 #define SQLITE_REPLACE 5
7471
7472 /*
7473 ** CAPI3REF: Prepared Statement Scan Status Opcodes
7474 ** KEYWORDS: {scanstatus options}
7475 **
7476 ** The following constants can be used for the T parameter to the
7477 ** [sqlite3_stmt_scanstatus(S,X,T,V)] interface. Each constant designates a
7478 ** different metric for sqlite3_stmt_scanstatus() to return.
7479 **
7480 ** <dl>
7481 ** [[SQLITE_SCANSTAT_NLOOP]] <dt>SQLITE_SCANSTAT_NLOOP</dt>
7482 ** <dd>^The [sqlite3_int64] variable pointed to by the T parameter will be
7483 ** set to the total number of times that the X-th loop has run.</dd>
7484 **
7485 ** [[SQLITE_SCANSTAT_NVISIT]] <dt>SQLITE_SCANSTAT_NVISIT</dt>
7486 ** <dd>^The [sqlite3_int64] variable pointed to by the T parameter will be set
7487 ** to the total number of rows examined by all iterations of the X-th loop.</dd>
7488 **
7489 ** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt>
7490 ** <dd>^The "double" variable pointed to by the T parameter will be set to the
7491 ** query planner's estimate for the average number of rows output from each
7492 ** iteration of the X-th loop. If the query planner's estimates was accurate,
7493 ** then this value will approximate the quotient NVISIT/NLOOP and the
7494 ** product of this value for all prior loops with the same SELECTID will
7495 ** be the NLOOP value for the current loop.
7496 **
7497 ** [[SQLITE_SCANSTAT_NAME]] <dt>SQLITE_SCANSTAT_NAME</dt>
7498 ** <dd>^The "const char *" variable pointed to by the T parameter will be set
7499 ** to a zero-terminated UTF-8 string containing the name of the index or table
7500 ** used for the X-th loop.
7501 **
7502 ** [[SQLITE_SCANSTAT_EXPLAIN]] <dt>SQLITE_SCANSTAT_EXPLAIN</dt>
7503 ** <dd>^The "const char *" variable pointed to by the T parameter will be set
7504 ** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN]
7505 ** description for the X-th loop.
7506 **
7507 ** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECT</dt>
7508 ** <dd>^The "int" variable pointed to by the T parameter will be set to the
7509 ** "select-id" for the X-th loop. The select-id identifies which query or
7510 ** subquery the loop is part of. The main query has a select-id of zero.
7511 ** The select-id is the same value as is output in the first column
7512 ** of an [EXPLAIN QUERY PLAN] query.
7513 ** </dl>
7514 */
7515 #define SQLITE_SCANSTAT_NLOOP 0
7516 #define SQLITE_SCANSTAT_NVISIT 1
7517 #define SQLITE_SCANSTAT_EST 2
7518 #define SQLITE_SCANSTAT_NAME 3
7519 #define SQLITE_SCANSTAT_EXPLAIN 4
7520 #define SQLITE_SCANSTAT_SELECTID 5
7521
7522 /*
7523 ** CAPI3REF: Prepared Statement Scan Status
7524 **
7525 ** Return status data for a single loop within query pStmt.
7526 **
7527 ** The "iScanStatusOp" parameter determines which status information to return.
7528 ** The "iScanStatusOp" must be one of the [scanstatus options] or the behavior
7529 ** of this interface is undefined.
7530 ** ^The requested measurement is written into a variable pointed to by
7531 ** the "pOut" parameter.
7532 ** Parameter "idx" identifies the specific loop to retrieve statistics for.
7533 ** Loops are numbered starting from zero. ^If idx is out of range - less than
7534 ** zero or greater than or equal to the total number of loops used to implement
7535 ** the statement - a non-zero value is returned and the variable that pOut
7536 ** points to is unchanged.
7537 **
7538 ** ^Statistics might not be available for all loops in all statements. ^In cases
7539 ** where there exist loops with no available statistics, this function behaves
7540 ** as if the loop did not exist - it returns non-zero and leave the variable
7541 ** that pOut points to unchanged.
7542 **
7543 ** This API is only available if the library is built with pre-processor
7544 ** symbol [SQLITE_ENABLE_STMT_SCANSTATUS] defined.
7545 **
7546 ** See also: [sqlite3_stmt_scanstatus_reset()]
7547 */
7548 SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_stmt_scanstatus(
7549 sqlite3_stmt *pStmt, /* Prepared statement for which info desired */
7550 int idx, /* Index of loop to report on */
7551 int iScanStatusOp, /* Information desired. SQLITE_SCANSTAT_* */
7552 void *pOut /* Result written here */
7553 );
7554
7555 /*
7556 ** CAPI3REF: Zero Scan-Status Counters
7557 **
7558 ** ^Zero all [sqlite3_stmt_scanstatus()] related event counters.
7559 **
7560 ** This API is only available if the library is built with pre-processor
7561 ** symbol [SQLITE_ENABLE_STMT_SCANSTATUS] defined.
7562 */
7563 SQLITE_API SQLITE_EXPERIMENTAL void sqlite3_stmt_scanstatus_reset(sqlite3_stmt*);
7564
7565
7566 /*
7567 ** Undo the hack that converts floating point types to integer for
7568 ** builds on processors without floating point support.
7569
+2 -2
--- src/stat.c
+++ src/stat.c
@@ -226,19 +226,19 @@
226226
n = db_int(0, "SELECT count(*) FROM filename /*scan*/");
227227
fossil_print("%*s%d across all branches\n", colWidth, "files:", n);
228228
n = db_int(0, "SELECT count(*) FROM tag /*scan*/"
229229
" WHERE tagname GLOB 'wiki-*'");
230230
m = db_int(0, "SELECT COUNT(*) FROM event WHERE type='w'");
231
- fossil_print("%*s%d (%d changes)\n", colWidth, "wikipages:", n, m);
231
+ fossil_print("%*s%d (%d changes)\n", colWidth, "wiki-pages:", n, m);
232232
n = db_int(0, "SELECT count(*) FROM tag /*scan*/"
233233
" WHERE tagname GLOB 'tkt-*'");
234234
m = db_int(0, "SELECT COUNT(*) FROM event WHERE type='t'");
235235
fossil_print("%*s%d (%d changes)\n", colWidth, "tickets:", n, m);
236236
n = db_int(0, "SELECT COUNT(*) FROM event WHERE type='e'");
237237
fossil_print("%*s%d\n", colWidth, "events:", n);
238238
n = db_int(0, "SELECT COUNT(*) FROM event WHERE type='g'");
239
- fossil_print("%*s%d\n", colWidth, "tagchanges:", n);
239
+ fossil_print("%*s%d\n", colWidth, "tag-changes:", n);
240240
z = db_text(0, "SELECT datetime(mtime) || ' - about ' ||"
241241
" CAST(julianday('now') - mtime AS INTEGER)"
242242
" || ' days ago' FROM event "
243243
" ORDER BY mtime DESC LIMIT 1");
244244
fossil_print("%*s%s\n", colWidth, "latest-change:", z);
245245
--- src/stat.c
+++ src/stat.c
@@ -226,19 +226,19 @@
226 n = db_int(0, "SELECT count(*) FROM filename /*scan*/");
227 fossil_print("%*s%d across all branches\n", colWidth, "files:", n);
228 n = db_int(0, "SELECT count(*) FROM tag /*scan*/"
229 " WHERE tagname GLOB 'wiki-*'");
230 m = db_int(0, "SELECT COUNT(*) FROM event WHERE type='w'");
231 fossil_print("%*s%d (%d changes)\n", colWidth, "wikipages:", n, m);
232 n = db_int(0, "SELECT count(*) FROM tag /*scan*/"
233 " WHERE tagname GLOB 'tkt-*'");
234 m = db_int(0, "SELECT COUNT(*) FROM event WHERE type='t'");
235 fossil_print("%*s%d (%d changes)\n", colWidth, "tickets:", n, m);
236 n = db_int(0, "SELECT COUNT(*) FROM event WHERE type='e'");
237 fossil_print("%*s%d\n", colWidth, "events:", n);
238 n = db_int(0, "SELECT COUNT(*) FROM event WHERE type='g'");
239 fossil_print("%*s%d\n", colWidth, "tagchanges:", n);
240 z = db_text(0, "SELECT datetime(mtime) || ' - about ' ||"
241 " CAST(julianday('now') - mtime AS INTEGER)"
242 " || ' days ago' FROM event "
243 " ORDER BY mtime DESC LIMIT 1");
244 fossil_print("%*s%s\n", colWidth, "latest-change:", z);
245
--- src/stat.c
+++ src/stat.c
@@ -226,19 +226,19 @@
226 n = db_int(0, "SELECT count(*) FROM filename /*scan*/");
227 fossil_print("%*s%d across all branches\n", colWidth, "files:", n);
228 n = db_int(0, "SELECT count(*) FROM tag /*scan*/"
229 " WHERE tagname GLOB 'wiki-*'");
230 m = db_int(0, "SELECT COUNT(*) FROM event WHERE type='w'");
231 fossil_print("%*s%d (%d changes)\n", colWidth, "wiki-pages:", n, m);
232 n = db_int(0, "SELECT count(*) FROM tag /*scan*/"
233 " WHERE tagname GLOB 'tkt-*'");
234 m = db_int(0, "SELECT COUNT(*) FROM event WHERE type='t'");
235 fossil_print("%*s%d (%d changes)\n", colWidth, "tickets:", n, m);
236 n = db_int(0, "SELECT COUNT(*) FROM event WHERE type='e'");
237 fossil_print("%*s%d\n", colWidth, "events:", n);
238 n = db_int(0, "SELECT COUNT(*) FROM event WHERE type='g'");
239 fossil_print("%*s%d\n", colWidth, "tag-changes:", n);
240 z = db_text(0, "SELECT datetime(mtime) || ' - about ' ||"
241 " CAST(julianday('now') - mtime AS INTEGER)"
242 " || ' days ago' FROM event "
243 " ORDER BY mtime DESC LIMIT 1");
244 fossil_print("%*s%s\n", colWidth, "latest-change:", z);
245
+13
--- src/style.c
+++ src/style.c
@@ -301,10 +301,11 @@
301301
302302
/* Generate the header up through the main menu */
303303
Th_Store("project_name", db_get("project-name","Unnamed Fossil Project"));
304304
Th_Store("title", zTitle);
305305
Th_Store("baseurl", g.zBaseURL);
306
+ Th_Store("secureurl", login_wants_https_redirect()? g.zHttpsURL: g.zBaseURL);
306307
Th_Store("home", g.zTop);
307308
Th_Store("index_page", db_get("index-page","/home"));
308309
if( local_zCurrentPage==0 ) style_set_current_page("%T", g.zPath);
309310
Th_Store("current_page", local_zCurrentPage);
310311
Th_Store("csrf_token", g.zCsrfToken);
@@ -1208,10 +1209,20 @@
12081209
},
12091210
{ "#canvas", "timeline graph node colors",
12101211
@ color: black;
12111212
@ background-color: white;
12121213
},
1214
+ { "table.adminLogTable",
1215
+ "Class for the /admin_log table",
1216
+ @ text-align: left
1217
+ },
1218
+ { ".adminLogTable .adminTime",
1219
+ "Class for the /admin_log table",
1220
+ @ text-align: left
1221
+ @ vertical-align: top;
1222
+ @ white-space: nowrap;
1223
+ },
12131224
{ 0,
12141225
0,
12151226
0
12161227
}
12171228
};
@@ -1259,10 +1270,11 @@
12591270
12601271
/* Process through TH1 in order to give an opportunity to substitute
12611272
** variables such as $baseurl.
12621273
*/
12631274
Th_Store("baseurl", g.zBaseURL);
1275
+ Th_Store("secureurl", login_wants_https_redirect()? g.zHttpsURL: g.zBaseURL);
12641276
Th_Store("home", g.zTop);
12651277
image_url_var("logo");
12661278
image_url_var("background");
12671279
Th_Render(blob_str(&css));
12681280
@@ -1304,10 +1316,11 @@
13041316
}
13051317
#if !defined(_WIN32)
13061318
@ uid=%d(getuid()), gid=%d(getgid())<br />
13071319
#endif
13081320
@ g.zBaseURL = %h(g.zBaseURL)<br />
1321
+ @ g.zHttpsURL = %h(g.zHttpsURL)<br />
13091322
@ g.zTop = %h(g.zTop)<br />
13101323
for(i=0, c='a'; c<='z'; c++){
13111324
if( login_has_capability(&c, 1) ) zCap[i++] = c;
13121325
}
13131326
zCap[i] = 0;
13141327
--- src/style.c
+++ src/style.c
@@ -301,10 +301,11 @@
301
302 /* Generate the header up through the main menu */
303 Th_Store("project_name", db_get("project-name","Unnamed Fossil Project"));
304 Th_Store("title", zTitle);
305 Th_Store("baseurl", g.zBaseURL);
 
306 Th_Store("home", g.zTop);
307 Th_Store("index_page", db_get("index-page","/home"));
308 if( local_zCurrentPage==0 ) style_set_current_page("%T", g.zPath);
309 Th_Store("current_page", local_zCurrentPage);
310 Th_Store("csrf_token", g.zCsrfToken);
@@ -1208,10 +1209,20 @@
1208 },
1209 { "#canvas", "timeline graph node colors",
1210 @ color: black;
1211 @ background-color: white;
1212 },
 
 
 
 
 
 
 
 
 
 
1213 { 0,
1214 0,
1215 0
1216 }
1217 };
@@ -1259,10 +1270,11 @@
1259
1260 /* Process through TH1 in order to give an opportunity to substitute
1261 ** variables such as $baseurl.
1262 */
1263 Th_Store("baseurl", g.zBaseURL);
 
1264 Th_Store("home", g.zTop);
1265 image_url_var("logo");
1266 image_url_var("background");
1267 Th_Render(blob_str(&css));
1268
@@ -1304,10 +1316,11 @@
1304 }
1305 #if !defined(_WIN32)
1306 @ uid=%d(getuid()), gid=%d(getgid())<br />
1307 #endif
1308 @ g.zBaseURL = %h(g.zBaseURL)<br />
 
1309 @ g.zTop = %h(g.zTop)<br />
1310 for(i=0, c='a'; c<='z'; c++){
1311 if( login_has_capability(&c, 1) ) zCap[i++] = c;
1312 }
1313 zCap[i] = 0;
1314
--- src/style.c
+++ src/style.c
@@ -301,10 +301,11 @@
301
302 /* Generate the header up through the main menu */
303 Th_Store("project_name", db_get("project-name","Unnamed Fossil Project"));
304 Th_Store("title", zTitle);
305 Th_Store("baseurl", g.zBaseURL);
306 Th_Store("secureurl", login_wants_https_redirect()? g.zHttpsURL: g.zBaseURL);
307 Th_Store("home", g.zTop);
308 Th_Store("index_page", db_get("index-page","/home"));
309 if( local_zCurrentPage==0 ) style_set_current_page("%T", g.zPath);
310 Th_Store("current_page", local_zCurrentPage);
311 Th_Store("csrf_token", g.zCsrfToken);
@@ -1208,10 +1209,20 @@
1209 },
1210 { "#canvas", "timeline graph node colors",
1211 @ color: black;
1212 @ background-color: white;
1213 },
1214 { "table.adminLogTable",
1215 "Class for the /admin_log table",
1216 @ text-align: left
1217 },
1218 { ".adminLogTable .adminTime",
1219 "Class for the /admin_log table",
1220 @ text-align: left
1221 @ vertical-align: top;
1222 @ white-space: nowrap;
1223 },
1224 { 0,
1225 0,
1226 0
1227 }
1228 };
@@ -1259,10 +1270,11 @@
1270
1271 /* Process through TH1 in order to give an opportunity to substitute
1272 ** variables such as $baseurl.
1273 */
1274 Th_Store("baseurl", g.zBaseURL);
1275 Th_Store("secureurl", login_wants_https_redirect()? g.zHttpsURL: g.zBaseURL);
1276 Th_Store("home", g.zTop);
1277 image_url_var("logo");
1278 image_url_var("background");
1279 Th_Render(blob_str(&css));
1280
@@ -1304,10 +1316,11 @@
1316 }
1317 #if !defined(_WIN32)
1318 @ uid=%d(getuid()), gid=%d(getgid())<br />
1319 #endif
1320 @ g.zBaseURL = %h(g.zBaseURL)<br />
1321 @ g.zHttpsURL = %h(g.zHttpsURL)<br />
1322 @ g.zTop = %h(g.zTop)<br />
1323 for(i=0, c='a'; c<='z'; c++){
1324 if( login_has_capability(&c, 1) ) zCap[i++] = c;
1325 }
1326 zCap[i] = 0;
1327
+1 -1
--- src/tag.c
+++ src/tag.c
@@ -561,11 +561,11 @@
561561
);
562562
@ <ul>
563563
while( db_step(&q)==SQLITE_ROW ){
564564
const char *zName = db_column_text(&q, 0);
565565
if( g.perm.Hyperlink ){
566
- @ <li>%z(xhref("class='taglink'","%R/timeline?t=%T",zName))
566
+ @ <li>%z(xhref("class='taglink'","%R/timeline?t=%T&n=200",zName))
567567
@ %h(zName)</a></li>
568568
}else{
569569
@ <li><span class="tagDsp">%h(zName)</span></li>
570570
}
571571
}
572572
--- src/tag.c
+++ src/tag.c
@@ -561,11 +561,11 @@
561 );
562 @ <ul>
563 while( db_step(&q)==SQLITE_ROW ){
564 const char *zName = db_column_text(&q, 0);
565 if( g.perm.Hyperlink ){
566 @ <li>%z(xhref("class='taglink'","%R/timeline?t=%T",zName))
567 @ %h(zName)</a></li>
568 }else{
569 @ <li><span class="tagDsp">%h(zName)</span></li>
570 }
571 }
572
--- src/tag.c
+++ src/tag.c
@@ -561,11 +561,11 @@
561 );
562 @ <ul>
563 while( db_step(&q)==SQLITE_ROW ){
564 const char *zName = db_column_text(&q, 0);
565 if( g.perm.Hyperlink ){
566 @ <li>%z(xhref("class='taglink'","%R/timeline?t=%T&n=200",zName))
567 @ %h(zName)</a></li>
568 }else{
569 @ <li><span class="tagDsp">%h(zName)</span></li>
570 }
571 }
572
+68 -24
--- src/timeline.c
+++ src/timeline.c
@@ -20,10 +20,20 @@
2020
*/
2121
#include "config.h"
2222
#include <string.h>
2323
#include <time.h>
2424
#include "timeline.h"
25
+
26
+/*
27
+** Add an appropriate tag to the output if "rid" is unpublished (private)
28
+*/
29
+#define UNPUB_TAG "<em>(unpublished)</em>"
30
+void tag_private_status(int rid){
31
+ if( content_is_private(rid) ){
32
+ cgi_printf("%s", UNPUB_TAG);
33
+ }
34
+}
2535
2636
/*
2737
** Generate a hyperlink to a version.
2838
*/
2939
void hyperlink_to_uuid(const char *zUuid){
@@ -212,20 +222,21 @@
212222
int fchngQueryInit = 0; /* True if fchngQuery is initialized */
213223
Stmt fchngQuery; /* Query for file changes on check-ins */
214224
static Stmt qbranch;
215225
int pendingEndTr = 0; /* True if a </td></tr> is needed */
216226
int vid = 0; /* Current checkout version */
217
- int dateFormat = 0; /* 0: HH:MM 1: HH:MM:SS
218
- 2: YYYY-MM-DD HH:MM
219
- 3: YYMMDD HH:MM */
227
+ int dateFormat = 0; /* 0: HH:MM (default) */
228
+ const char *zDateFmt;
220229
221230
if( fossil_strcmp(g.zIpAddr, "127.0.0.1")==0 && db_open_local(0) ){
222231
vid = db_lget_int("checkout", 0);
223232
}
224233
zPrevDate[0] = 0;
225234
mxWikiLen = db_get_int("timeline-max-comment", 0);
226235
dateFormat = db_get_int("timeline-date-format", 0);
236
+ zDateFmt = P("datefmt");
237
+ if( zDateFmt ) dateFormat = atoi(zDateFmt);
227238
if( tmFlags & TIMELINE_GRAPH ){
228239
pGraph = graph_init();
229240
/* style is not moved to css, because this is
230241
** a technical div for the timeline graph
231242
*/
@@ -254,11 +265,13 @@
254265
const char *zBr = 0; /* Branch */
255266
int commentColumn = 3; /* Column containing comment text */
256267
int modPending; /* Pending moderation */
257268
char zTime[20];
258269
259
- if( zDate==0 ) zDate = "YYYY-MM-DD HH:MM:SS"; /* Something wrong with the repo */
270
+ if( zDate==0 ){
271
+ zDate = "YYYY-MM-DD HH:MM:SS"; /* Something wrong with the repo */
272
+ }
260273
modPending = moderation_pending(rid);
261274
if( tagid ){
262275
if( modPending ) tagid = -tagid;
263276
if( tagid==prevTagid ){
264277
if( tmFlags & TIMELINE_BRIEF ){
@@ -285,20 +298,30 @@
285298
}
286299
prevWasDivider = 1;
287300
continue;
288301
}
289302
prevWasDivider = 0;
303
+ /* Date format codes:
304
+ ** (0) HH:MM
305
+ ** (1) HH:MM:SS
306
+ ** (2) YYYY-MM-DD HH:MM
307
+ ** (3) YYMMDD HH:MM
308
+ ** (4) (off)
309
+ */
290310
if( dateFormat<2 ){
291311
if( fossil_strnicmp(zDate, zPrevDate, 10) ){
292312
sqlite3_snprintf(sizeof(zPrevDate), zPrevDate, "%.10s", zDate);
293313
@ <tr><td>
294314
@ <div class="divider timelineDate">%s(zPrevDate)</div>
295315
@ </td><td></td><td></td></tr>
296316
}
297317
memcpy(zTime, &zDate[11], 5+dateFormat*3);
298318
zTime[5+dateFormat*3] = 0;
299
- }else if(3==dateFormat){
319
+ }else if( 2==dateFormat ){
320
+ /* YYYY-MM-DD HH:MM */
321
+ sqlite3_snprintf(sizeof(zTime), zTime, "%.16s", zDate);
322
+ }else if( 3==dateFormat ){
300323
/* YYMMDD HH:MM */
301324
int pos = 0;
302325
zTime[pos++] = zDate[2]; zTime[pos++] = zDate[3]; /* YY */
303326
zTime[pos++] = zDate[5]; zTime[pos++] = zDate[6]; /* MM */
304327
zTime[pos++] = zDate[8]; zTime[pos++] = zDate[9]; /* DD */
@@ -306,12 +329,11 @@
306329
zTime[pos++] = zDate[11]; zTime[pos++] = zDate[12]; /* HH */
307330
zTime[pos++] = ':';
308331
zTime[pos++] = zDate[14]; zTime[pos++] = zDate[15]; /* MM */
309332
zTime[pos++] = 0;
310333
}else{
311
- /* YYYY-MM-DD HH:MM */
312
- sqlite3_snprintf(sizeof(zTime), zTime, "%.16s", zDate);
334
+ zTime[0] = 0;
313335
}
314336
if( rid == vid ){
315337
@ <tr class="timelineCurrent">
316338
}else {
317339
@ <tr>
@@ -405,11 +427,11 @@
405427
/* Generate the "user: USERNAME" at the end of the comment, together
406428
** with a hyperlink to another timeline for that user.
407429
*/
408430
if( zTagList && zTagList[0]==0 ) zTagList = 0;
409431
if( g.perm.Hyperlink && fossil_strcmp(zDispUser, zThisUser)!=0 ){
410
- char *zLink = mprintf("%R/timeline?u=%h&c=%t&nd", zDispUser, zDate);
432
+ char *zLink = mprintf("%R/timeline?u=%h&c=%t&nd&n=200", zDispUser, zDate);
411433
@ (user: %z(href("%z",zLink))%h(zDispUser)</a>%s(zTagList?",":"\051")
412434
}else{
413435
@ (user: %h(zDispUser)%s(zTagList?",":"\051")
414436
}
415437
@@ -430,11 +452,11 @@
430452
while( z && z[0] ){
431453
for(i=0; z[i] && (z[i]!=',' || z[i+1]!=' '); i++){}
432454
if( zThisTag==0 || memcmp(z, zThisTag, i)!=0 || zThisTag[i]!=0 ){
433455
blob_appendf(&links,
434456
"%z%#h</a>%.2s",
435
- href("%R/timeline?r=%#t&nd&c=%t",i,z,zDate), i,z, &z[i]
457
+ href("%R/timeline?r=%#t&nd&c=%t&n=200",i,z,zDate), i,z, &z[i]
436458
);
437459
}else{
438460
blob_appendf(&links, "%#h", i+2, z);
439461
}
440462
if( z[i]==0 ) break;
@@ -444,11 +466,11 @@
444466
blob_reset(&links);
445467
}else{
446468
@ tags: %h(zTagList))
447469
}
448470
}
449
-
471
+ tag_private_status(rid);
450472
451473
/* Generate extra hyperlinks at the end of the comment */
452474
if( xExtra ){
453475
xExtra(rid);
454476
}
@@ -459,11 +481,11 @@
459481
){
460482
int inUl = 0;
461483
if( !fchngQueryInit ){
462484
db_prepare(&fchngQuery,
463485
"SELECT (pid==0) AS isnew,"
464
- " (fid==0) AS isdel,"
486
+ " fid,"
465487
" (SELECT name FROM filename WHERE fnid=mlink.fnid) AS name,"
466488
" (SELECT uuid FROM blob WHERE rid=fid),"
467489
" (SELECT uuid FROM blob WHERE rid=pid),"
468490
" (SELECT name FROM filename WHERE fnid=mlink.pfnid) AS oldnm"
469491
" FROM mlink"
@@ -476,14 +498,16 @@
476498
}
477499
db_bind_int(&fchngQuery, ":mid", rid);
478500
while( db_step(&fchngQuery)==SQLITE_ROW ){
479501
const char *zFilename = db_column_text(&fchngQuery, 2);
480502
int isNew = db_column_int(&fchngQuery, 0);
481
- int isDel = db_column_int(&fchngQuery, 1);
503
+ int fid = db_column_int(&fchngQuery, 1);
504
+ int isDel = fid==0;
482505
const char *zOldName = db_column_text(&fchngQuery, 5);
483506
const char *zOld = db_column_text(&fchngQuery, 4);
484507
const char *zNew = db_column_text(&fchngQuery, 3);
508
+ const char *zUnpubTag = "";
485509
if( !inUl ){
486510
@ <ul class="filelist">
487511
inUl = 1;
488512
}
489513
if( (tmFlags & TIMELINE_FRENAMES)!=0 ){
@@ -490,23 +514,26 @@
490514
if( !isNew && !isDel && zOldName!=0 ){
491515
@ <li> %h(zOldName) &rarr; %h(zFilename)
492516
}
493517
continue;
494518
}
519
+ if( content_is_private(fid) ){
520
+ zUnpubTag = UNPUB_TAG;
521
+ }
495522
if( isNew ){
496
- @ <li> %h(zFilename) (new file) &nbsp;
523
+ @ <li> %h(zFilename) %s(zUnpubTag) (new file) &nbsp;
497524
@ %z(href("%R/artifact/%s",zNew))[view]</a></li>
498525
}else if( isDel ){
499526
@ <li> %h(zFilename) (deleted)</li>
500527
}else if( fossil_strcmp(zOld,zNew)==0 && zOldName!=0 ){
501
- @ <li> %h(zOldName) &rarr; %h(zFilename)
528
+ @ <li> %h(zOldName) &rarr; %h(zFilename) %s(zUnpubTag)
502529
@ %z(href("%R/artifact/%s",zNew))[view]</a></li>
503530
}else{
504531
if( zOldName!=0 ){
505
- @ <li> %h(zOldName) &rarr; %h(zFilename)
532
+ @ <li> %h(zOldName) &rarr; %h(zFilename) %s(zUnpubTag)
506533
}else{
507
- @ <li> %h(zFilename) &nbsp;
534
+ @ <li> %h(zFilename) &nbsp; %s(zUnpubTag)
508535
}
509536
@ %z(href("%R/fdiff?sbs=1&v1=%s&v2=%s",zOld,zNew))[diff]</a></li>
510537
}
511538
}
512539
db_reset(&fchngQuery);
@@ -1011,10 +1038,11 @@
10111038
** uf=FUUID Show only checkins that use given file version
10121039
** brbg Background color from branch name
10131040
** ubg Background color from user
10141041
** namechng Show only checkins that filename changes
10151042
** ym=YYYY-MM Shown only events for the given year/month.
1043
+** datefmt=N Override the date format
10161044
**
10171045
** p= and d= can appear individually or together. If either p= or d=
10181046
** appear, then u=, y=, a=, and b= are ignored.
10191047
**
10201048
** If a= and b= appear, only a= is used. If neither appear, the most
@@ -1038,11 +1066,11 @@
10381066
const char *zTagName = P("t"); /* Show events with this tag */
10391067
const char *zBrName = P("r"); /* Show events related to this tag */
10401068
const char *zSearch = P("s"); /* Search string */
10411069
const char *zUses = P("uf"); /* Only show checkins hold this file */
10421070
const char *zYearMonth = P("ym"); /* Show checkins for the given YYYY-MM */
1043
- const char *zYearWeek = P("yw"); /* Show checkins for the given YYYY-WW (weak-of-year) */
1071
+ const char *zYearWeek = P("yw"); /* Show checkins for the given YYYY-WW (week-of-year)*/
10441072
int useDividers = P("nd")==0; /* Show dividers if "nd" is missing */
10451073
int renameOnly = P("namechng")!=0; /* Show only checkins that rename files */
10461074
int tagid; /* Tag ID */
10471075
int tmFlags; /* Timeline flags */
10481076
const char *zThisTag = 0; /* Suppress links to this tag */
@@ -1075,16 +1103,22 @@
10751103
tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='sym-%q'",zBrName);
10761104
zThisTag = zBrName;
10771105
}else{
10781106
tagid = 0;
10791107
}
1108
+ if( tagid>0
1109
+ && db_int(0,"SELECT count(*) FROM tagxref WHERE tagid=%d",tagid)<=nEntry
1110
+ ){
1111
+ zCirca = zBefore = zAfter = 0;
1112
+ nEntry = -1;
1113
+ }
10801114
if( zType[0]=='a' ){
10811115
tmFlags = TIMELINE_BRIEF | TIMELINE_GRAPH;
10821116
}else{
10831117
tmFlags = TIMELINE_GRAPH;
10841118
}
1085
- url_add_parameter(&url, "n", mprintf("%d", nEntry));
1119
+ if( nEntry>0 ) url_add_parameter(&url, "n", mprintf("%d", nEntry));
10861120
if( P("ng")!=0 || zSearch!=0 ){
10871121
tmFlags &= ~TIMELINE_GRAPH;
10881122
url_add_parameter(&url, "ng", 0);
10891123
}
10901124
if( P("brbg")!=0 ){
@@ -1216,11 +1250,11 @@
12161250
url_add_parameter(&url, "d", zUuid);
12171251
}
12181252
if( nEntry>20 ){
12191253
timeline_submenu(&url, "20 Entries", "n", "20", 0);
12201254
}
1221
- if( nEntry<200 ){
1255
+ if( nEntry<200 && nEntry>0 ){
12221256
timeline_submenu(&url, "200 Entries", "n", "200", 0);
12231257
}
12241258
if( tmFlags & TIMELINE_FCHANGES ){
12251259
timeline_submenu(&url, "Hide Files", "v", 0, 0);
12261260
}else{
@@ -1360,10 +1394,16 @@
13601394
}else if( zType[0]=='g' ){
13611395
zEType = "tag";
13621396
}
13631397
}
13641398
if( zUser ){
1399
+ int n = db_int(0,"SELECT count(*) FROM event"
1400
+ " WHERE user=%Q OR euser=%Q", zUser, zUser);
1401
+ if( n<=nEntry ){
1402
+ zCirca = zBefore = zAfter = 0;
1403
+ nEntry = -1;
1404
+ }
13651405
blob_append_sql(&sql, " AND (event.user=%Q OR event.euser=%Q)",
13661406
zUser, zUser);
13671407
url_add_parameter(&url, "u", zUser);
13681408
zThisUser = zUser;
13691409
}
@@ -1381,11 +1421,11 @@
13811421
blob_append_sql(&sql,
13821422
" AND event.mtime>=%.17g AND event.mtime<=%.17g"
13831423
" ORDER BY event.mtime ASC", rAfter-ONE_SECOND, rBefore+ONE_SECOND);
13841424
url_add_parameter(&url, "a", zAfter);
13851425
url_add_parameter(&url, "b", zBefore);
1386
- nEntry = 1000000;
1426
+ nEntry = -1;
13871427
}else{
13881428
blob_append_sql(&sql,
13891429
" AND event.mtime>=%.17g ORDER BY event.mtime ASC",
13901430
rAfter-ONE_SECOND);
13911431
url_add_parameter(&url, "a", zAfter);
@@ -1412,19 +1452,19 @@
14121452
if( useDividers ) timeline_add_dividers(rCirca, 0);
14131453
url_add_parameter(&url, "c", zCirca);
14141454
}else{
14151455
blob_append_sql(&sql, " ORDER BY event.mtime DESC");
14161456
}
1417
- blob_append_sql(&sql, " LIMIT %d", nEntry);
1457
+ if( nEntry>0 ) blob_append_sql(&sql, " LIMIT %d", nEntry);
14181458
db_multi_exec("%s", blob_sql_text(&sql));
14191459
14201460
n = db_int(0, "SELECT count(*) FROM timeline WHERE etype!='div' /*scan*/");
14211461
if( zYearMonth ){
14221462
blob_appendf(&desc, "%s events for %h", zEType, zYearMonth);
14231463
}else if( zYearWeek ){
14241464
blob_appendf(&desc, "%s events for year/week %h", zEType, zYearWeek);
1425
- }else if( zAfter==0 && zBefore==0 && zCirca==0 ){
1465
+ }else if( zAfter==0 && zBefore==0 && zCirca==0 && nEntry>0 ){
14261466
blob_appendf(&desc, "%d most recent %ss", n, zEType);
14271467
}else{
14281468
blob_appendf(&desc, "%d %ss", n, zEType);
14291469
}
14301470
if( zUses ){
@@ -1494,11 +1534,11 @@
14941534
}
14951535
}
14961536
if( nEntry>20 ){
14971537
timeline_submenu(&url, "20 Entries", "n", "20", 0);
14981538
}
1499
- if( nEntry<200 ){
1539
+ if( nEntry<200 && nEntry>0 ){
15001540
timeline_submenu(&url, "200 Entries", "n", "200", 0);
15011541
}
15021542
if( zType[0]=='a' || zType[0]=='c' ){
15031543
if( tmFlags & TIMELINE_FCHANGES ){
15041544
timeline_submenu(&url, "Hide Files", "v", 0, 0);
@@ -1604,11 +1644,15 @@
16041644
sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], zBrType);
16051645
n = strlen(zPrefix);
16061646
}
16071647
if( fossil_strcmp(zCurrentUuid,zId)==0 ){
16081648
sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*CURRENT* ");
1609
- n += strlen(zPrefix);
1649
+ n += strlen(zPrefix+n);
1650
+ }
1651
+ if( content_is_private(rid) ){
1652
+ sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*UNPUBLISHED* ");
1653
+ n += strlen(zPrefix+n);
16101654
}
16111655
zFree = mprintf("[%S] %s%s", zId, zPrefix, zCom);
16121656
/* record another X lines */
16131657
nLine += comment_print(zFree, zCom, 9, width, g.comFmtFlags);
16141658
fossil_free(zFree);
16151659
--- src/timeline.c
+++ src/timeline.c
@@ -20,10 +20,20 @@
20 */
21 #include "config.h"
22 #include <string.h>
23 #include <time.h>
24 #include "timeline.h"
 
 
 
 
 
 
 
 
 
 
25
26 /*
27 ** Generate a hyperlink to a version.
28 */
29 void hyperlink_to_uuid(const char *zUuid){
@@ -212,20 +222,21 @@
212 int fchngQueryInit = 0; /* True if fchngQuery is initialized */
213 Stmt fchngQuery; /* Query for file changes on check-ins */
214 static Stmt qbranch;
215 int pendingEndTr = 0; /* True if a </td></tr> is needed */
216 int vid = 0; /* Current checkout version */
217 int dateFormat = 0; /* 0: HH:MM 1: HH:MM:SS
218 2: YYYY-MM-DD HH:MM
219 3: YYMMDD HH:MM */
220
221 if( fossil_strcmp(g.zIpAddr, "127.0.0.1")==0 && db_open_local(0) ){
222 vid = db_lget_int("checkout", 0);
223 }
224 zPrevDate[0] = 0;
225 mxWikiLen = db_get_int("timeline-max-comment", 0);
226 dateFormat = db_get_int("timeline-date-format", 0);
 
 
227 if( tmFlags & TIMELINE_GRAPH ){
228 pGraph = graph_init();
229 /* style is not moved to css, because this is
230 ** a technical div for the timeline graph
231 */
@@ -254,11 +265,13 @@
254 const char *zBr = 0; /* Branch */
255 int commentColumn = 3; /* Column containing comment text */
256 int modPending; /* Pending moderation */
257 char zTime[20];
258
259 if( zDate==0 ) zDate = "YYYY-MM-DD HH:MM:SS"; /* Something wrong with the repo */
 
 
260 modPending = moderation_pending(rid);
261 if( tagid ){
262 if( modPending ) tagid = -tagid;
263 if( tagid==prevTagid ){
264 if( tmFlags & TIMELINE_BRIEF ){
@@ -285,20 +298,30 @@
285 }
286 prevWasDivider = 1;
287 continue;
288 }
289 prevWasDivider = 0;
 
 
 
 
 
 
 
290 if( dateFormat<2 ){
291 if( fossil_strnicmp(zDate, zPrevDate, 10) ){
292 sqlite3_snprintf(sizeof(zPrevDate), zPrevDate, "%.10s", zDate);
293 @ <tr><td>
294 @ <div class="divider timelineDate">%s(zPrevDate)</div>
295 @ </td><td></td><td></td></tr>
296 }
297 memcpy(zTime, &zDate[11], 5+dateFormat*3);
298 zTime[5+dateFormat*3] = 0;
299 }else if(3==dateFormat){
 
 
 
300 /* YYMMDD HH:MM */
301 int pos = 0;
302 zTime[pos++] = zDate[2]; zTime[pos++] = zDate[3]; /* YY */
303 zTime[pos++] = zDate[5]; zTime[pos++] = zDate[6]; /* MM */
304 zTime[pos++] = zDate[8]; zTime[pos++] = zDate[9]; /* DD */
@@ -306,12 +329,11 @@
306 zTime[pos++] = zDate[11]; zTime[pos++] = zDate[12]; /* HH */
307 zTime[pos++] = ':';
308 zTime[pos++] = zDate[14]; zTime[pos++] = zDate[15]; /* MM */
309 zTime[pos++] = 0;
310 }else{
311 /* YYYY-MM-DD HH:MM */
312 sqlite3_snprintf(sizeof(zTime), zTime, "%.16s", zDate);
313 }
314 if( rid == vid ){
315 @ <tr class="timelineCurrent">
316 }else {
317 @ <tr>
@@ -405,11 +427,11 @@
405 /* Generate the "user: USERNAME" at the end of the comment, together
406 ** with a hyperlink to another timeline for that user.
407 */
408 if( zTagList && zTagList[0]==0 ) zTagList = 0;
409 if( g.perm.Hyperlink && fossil_strcmp(zDispUser, zThisUser)!=0 ){
410 char *zLink = mprintf("%R/timeline?u=%h&c=%t&nd", zDispUser, zDate);
411 @ (user: %z(href("%z",zLink))%h(zDispUser)</a>%s(zTagList?",":"\051")
412 }else{
413 @ (user: %h(zDispUser)%s(zTagList?",":"\051")
414 }
415
@@ -430,11 +452,11 @@
430 while( z && z[0] ){
431 for(i=0; z[i] && (z[i]!=',' || z[i+1]!=' '); i++){}
432 if( zThisTag==0 || memcmp(z, zThisTag, i)!=0 || zThisTag[i]!=0 ){
433 blob_appendf(&links,
434 "%z%#h</a>%.2s",
435 href("%R/timeline?r=%#t&nd&c=%t",i,z,zDate), i,z, &z[i]
436 );
437 }else{
438 blob_appendf(&links, "%#h", i+2, z);
439 }
440 if( z[i]==0 ) break;
@@ -444,11 +466,11 @@
444 blob_reset(&links);
445 }else{
446 @ tags: %h(zTagList))
447 }
448 }
449
450
451 /* Generate extra hyperlinks at the end of the comment */
452 if( xExtra ){
453 xExtra(rid);
454 }
@@ -459,11 +481,11 @@
459 ){
460 int inUl = 0;
461 if( !fchngQueryInit ){
462 db_prepare(&fchngQuery,
463 "SELECT (pid==0) AS isnew,"
464 " (fid==0) AS isdel,"
465 " (SELECT name FROM filename WHERE fnid=mlink.fnid) AS name,"
466 " (SELECT uuid FROM blob WHERE rid=fid),"
467 " (SELECT uuid FROM blob WHERE rid=pid),"
468 " (SELECT name FROM filename WHERE fnid=mlink.pfnid) AS oldnm"
469 " FROM mlink"
@@ -476,14 +498,16 @@
476 }
477 db_bind_int(&fchngQuery, ":mid", rid);
478 while( db_step(&fchngQuery)==SQLITE_ROW ){
479 const char *zFilename = db_column_text(&fchngQuery, 2);
480 int isNew = db_column_int(&fchngQuery, 0);
481 int isDel = db_column_int(&fchngQuery, 1);
 
482 const char *zOldName = db_column_text(&fchngQuery, 5);
483 const char *zOld = db_column_text(&fchngQuery, 4);
484 const char *zNew = db_column_text(&fchngQuery, 3);
 
485 if( !inUl ){
486 @ <ul class="filelist">
487 inUl = 1;
488 }
489 if( (tmFlags & TIMELINE_FRENAMES)!=0 ){
@@ -490,23 +514,26 @@
490 if( !isNew && !isDel && zOldName!=0 ){
491 @ <li> %h(zOldName) &rarr; %h(zFilename)
492 }
493 continue;
494 }
 
 
 
495 if( isNew ){
496 @ <li> %h(zFilename) (new file) &nbsp;
497 @ %z(href("%R/artifact/%s",zNew))[view]</a></li>
498 }else if( isDel ){
499 @ <li> %h(zFilename) (deleted)</li>
500 }else if( fossil_strcmp(zOld,zNew)==0 && zOldName!=0 ){
501 @ <li> %h(zOldName) &rarr; %h(zFilename)
502 @ %z(href("%R/artifact/%s",zNew))[view]</a></li>
503 }else{
504 if( zOldName!=0 ){
505 @ <li> %h(zOldName) &rarr; %h(zFilename)
506 }else{
507 @ <li> %h(zFilename) &nbsp;
508 }
509 @ %z(href("%R/fdiff?sbs=1&v1=%s&v2=%s",zOld,zNew))[diff]</a></li>
510 }
511 }
512 db_reset(&fchngQuery);
@@ -1011,10 +1038,11 @@
1011 ** uf=FUUID Show only checkins that use given file version
1012 ** brbg Background color from branch name
1013 ** ubg Background color from user
1014 ** namechng Show only checkins that filename changes
1015 ** ym=YYYY-MM Shown only events for the given year/month.
 
1016 **
1017 ** p= and d= can appear individually or together. If either p= or d=
1018 ** appear, then u=, y=, a=, and b= are ignored.
1019 **
1020 ** If a= and b= appear, only a= is used. If neither appear, the most
@@ -1038,11 +1066,11 @@
1038 const char *zTagName = P("t"); /* Show events with this tag */
1039 const char *zBrName = P("r"); /* Show events related to this tag */
1040 const char *zSearch = P("s"); /* Search string */
1041 const char *zUses = P("uf"); /* Only show checkins hold this file */
1042 const char *zYearMonth = P("ym"); /* Show checkins for the given YYYY-MM */
1043 const char *zYearWeek = P("yw"); /* Show checkins for the given YYYY-WW (weak-of-year) */
1044 int useDividers = P("nd")==0; /* Show dividers if "nd" is missing */
1045 int renameOnly = P("namechng")!=0; /* Show only checkins that rename files */
1046 int tagid; /* Tag ID */
1047 int tmFlags; /* Timeline flags */
1048 const char *zThisTag = 0; /* Suppress links to this tag */
@@ -1075,16 +1103,22 @@
1075 tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='sym-%q'",zBrName);
1076 zThisTag = zBrName;
1077 }else{
1078 tagid = 0;
1079 }
 
 
 
 
 
 
1080 if( zType[0]=='a' ){
1081 tmFlags = TIMELINE_BRIEF | TIMELINE_GRAPH;
1082 }else{
1083 tmFlags = TIMELINE_GRAPH;
1084 }
1085 url_add_parameter(&url, "n", mprintf("%d", nEntry));
1086 if( P("ng")!=0 || zSearch!=0 ){
1087 tmFlags &= ~TIMELINE_GRAPH;
1088 url_add_parameter(&url, "ng", 0);
1089 }
1090 if( P("brbg")!=0 ){
@@ -1216,11 +1250,11 @@
1216 url_add_parameter(&url, "d", zUuid);
1217 }
1218 if( nEntry>20 ){
1219 timeline_submenu(&url, "20 Entries", "n", "20", 0);
1220 }
1221 if( nEntry<200 ){
1222 timeline_submenu(&url, "200 Entries", "n", "200", 0);
1223 }
1224 if( tmFlags & TIMELINE_FCHANGES ){
1225 timeline_submenu(&url, "Hide Files", "v", 0, 0);
1226 }else{
@@ -1360,10 +1394,16 @@
1360 }else if( zType[0]=='g' ){
1361 zEType = "tag";
1362 }
1363 }
1364 if( zUser ){
 
 
 
 
 
 
1365 blob_append_sql(&sql, " AND (event.user=%Q OR event.euser=%Q)",
1366 zUser, zUser);
1367 url_add_parameter(&url, "u", zUser);
1368 zThisUser = zUser;
1369 }
@@ -1381,11 +1421,11 @@
1381 blob_append_sql(&sql,
1382 " AND event.mtime>=%.17g AND event.mtime<=%.17g"
1383 " ORDER BY event.mtime ASC", rAfter-ONE_SECOND, rBefore+ONE_SECOND);
1384 url_add_parameter(&url, "a", zAfter);
1385 url_add_parameter(&url, "b", zBefore);
1386 nEntry = 1000000;
1387 }else{
1388 blob_append_sql(&sql,
1389 " AND event.mtime>=%.17g ORDER BY event.mtime ASC",
1390 rAfter-ONE_SECOND);
1391 url_add_parameter(&url, "a", zAfter);
@@ -1412,19 +1452,19 @@
1412 if( useDividers ) timeline_add_dividers(rCirca, 0);
1413 url_add_parameter(&url, "c", zCirca);
1414 }else{
1415 blob_append_sql(&sql, " ORDER BY event.mtime DESC");
1416 }
1417 blob_append_sql(&sql, " LIMIT %d", nEntry);
1418 db_multi_exec("%s", blob_sql_text(&sql));
1419
1420 n = db_int(0, "SELECT count(*) FROM timeline WHERE etype!='div' /*scan*/");
1421 if( zYearMonth ){
1422 blob_appendf(&desc, "%s events for %h", zEType, zYearMonth);
1423 }else if( zYearWeek ){
1424 blob_appendf(&desc, "%s events for year/week %h", zEType, zYearWeek);
1425 }else if( zAfter==0 && zBefore==0 && zCirca==0 ){
1426 blob_appendf(&desc, "%d most recent %ss", n, zEType);
1427 }else{
1428 blob_appendf(&desc, "%d %ss", n, zEType);
1429 }
1430 if( zUses ){
@@ -1494,11 +1534,11 @@
1494 }
1495 }
1496 if( nEntry>20 ){
1497 timeline_submenu(&url, "20 Entries", "n", "20", 0);
1498 }
1499 if( nEntry<200 ){
1500 timeline_submenu(&url, "200 Entries", "n", "200", 0);
1501 }
1502 if( zType[0]=='a' || zType[0]=='c' ){
1503 if( tmFlags & TIMELINE_FCHANGES ){
1504 timeline_submenu(&url, "Hide Files", "v", 0, 0);
@@ -1604,11 +1644,15 @@
1604 sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], zBrType);
1605 n = strlen(zPrefix);
1606 }
1607 if( fossil_strcmp(zCurrentUuid,zId)==0 ){
1608 sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*CURRENT* ");
1609 n += strlen(zPrefix);
 
 
 
 
1610 }
1611 zFree = mprintf("[%S] %s%s", zId, zPrefix, zCom);
1612 /* record another X lines */
1613 nLine += comment_print(zFree, zCom, 9, width, g.comFmtFlags);
1614 fossil_free(zFree);
1615
--- src/timeline.c
+++ src/timeline.c
@@ -20,10 +20,20 @@
20 */
21 #include "config.h"
22 #include <string.h>
23 #include <time.h>
24 #include "timeline.h"
25
26 /*
27 ** Add an appropriate tag to the output if "rid" is unpublished (private)
28 */
29 #define UNPUB_TAG "<em>(unpublished)</em>"
30 void tag_private_status(int rid){
31 if( content_is_private(rid) ){
32 cgi_printf("%s", UNPUB_TAG);
33 }
34 }
35
36 /*
37 ** Generate a hyperlink to a version.
38 */
39 void hyperlink_to_uuid(const char *zUuid){
@@ -212,20 +222,21 @@
222 int fchngQueryInit = 0; /* True if fchngQuery is initialized */
223 Stmt fchngQuery; /* Query for file changes on check-ins */
224 static Stmt qbranch;
225 int pendingEndTr = 0; /* True if a </td></tr> is needed */
226 int vid = 0; /* Current checkout version */
227 int dateFormat = 0; /* 0: HH:MM (default) */
228 const char *zDateFmt;
 
229
230 if( fossil_strcmp(g.zIpAddr, "127.0.0.1")==0 && db_open_local(0) ){
231 vid = db_lget_int("checkout", 0);
232 }
233 zPrevDate[0] = 0;
234 mxWikiLen = db_get_int("timeline-max-comment", 0);
235 dateFormat = db_get_int("timeline-date-format", 0);
236 zDateFmt = P("datefmt");
237 if( zDateFmt ) dateFormat = atoi(zDateFmt);
238 if( tmFlags & TIMELINE_GRAPH ){
239 pGraph = graph_init();
240 /* style is not moved to css, because this is
241 ** a technical div for the timeline graph
242 */
@@ -254,11 +265,13 @@
265 const char *zBr = 0; /* Branch */
266 int commentColumn = 3; /* Column containing comment text */
267 int modPending; /* Pending moderation */
268 char zTime[20];
269
270 if( zDate==0 ){
271 zDate = "YYYY-MM-DD HH:MM:SS"; /* Something wrong with the repo */
272 }
273 modPending = moderation_pending(rid);
274 if( tagid ){
275 if( modPending ) tagid = -tagid;
276 if( tagid==prevTagid ){
277 if( tmFlags & TIMELINE_BRIEF ){
@@ -285,20 +298,30 @@
298 }
299 prevWasDivider = 1;
300 continue;
301 }
302 prevWasDivider = 0;
303 /* Date format codes:
304 ** (0) HH:MM
305 ** (1) HH:MM:SS
306 ** (2) YYYY-MM-DD HH:MM
307 ** (3) YYMMDD HH:MM
308 ** (4) (off)
309 */
310 if( dateFormat<2 ){
311 if( fossil_strnicmp(zDate, zPrevDate, 10) ){
312 sqlite3_snprintf(sizeof(zPrevDate), zPrevDate, "%.10s", zDate);
313 @ <tr><td>
314 @ <div class="divider timelineDate">%s(zPrevDate)</div>
315 @ </td><td></td><td></td></tr>
316 }
317 memcpy(zTime, &zDate[11], 5+dateFormat*3);
318 zTime[5+dateFormat*3] = 0;
319 }else if( 2==dateFormat ){
320 /* YYYY-MM-DD HH:MM */
321 sqlite3_snprintf(sizeof(zTime), zTime, "%.16s", zDate);
322 }else if( 3==dateFormat ){
323 /* YYMMDD HH:MM */
324 int pos = 0;
325 zTime[pos++] = zDate[2]; zTime[pos++] = zDate[3]; /* YY */
326 zTime[pos++] = zDate[5]; zTime[pos++] = zDate[6]; /* MM */
327 zTime[pos++] = zDate[8]; zTime[pos++] = zDate[9]; /* DD */
@@ -306,12 +329,11 @@
329 zTime[pos++] = zDate[11]; zTime[pos++] = zDate[12]; /* HH */
330 zTime[pos++] = ':';
331 zTime[pos++] = zDate[14]; zTime[pos++] = zDate[15]; /* MM */
332 zTime[pos++] = 0;
333 }else{
334 zTime[0] = 0;
 
335 }
336 if( rid == vid ){
337 @ <tr class="timelineCurrent">
338 }else {
339 @ <tr>
@@ -405,11 +427,11 @@
427 /* Generate the "user: USERNAME" at the end of the comment, together
428 ** with a hyperlink to another timeline for that user.
429 */
430 if( zTagList && zTagList[0]==0 ) zTagList = 0;
431 if( g.perm.Hyperlink && fossil_strcmp(zDispUser, zThisUser)!=0 ){
432 char *zLink = mprintf("%R/timeline?u=%h&c=%t&nd&n=200", zDispUser, zDate);
433 @ (user: %z(href("%z",zLink))%h(zDispUser)</a>%s(zTagList?",":"\051")
434 }else{
435 @ (user: %h(zDispUser)%s(zTagList?",":"\051")
436 }
437
@@ -430,11 +452,11 @@
452 while( z && z[0] ){
453 for(i=0; z[i] && (z[i]!=',' || z[i+1]!=' '); i++){}
454 if( zThisTag==0 || memcmp(z, zThisTag, i)!=0 || zThisTag[i]!=0 ){
455 blob_appendf(&links,
456 "%z%#h</a>%.2s",
457 href("%R/timeline?r=%#t&nd&c=%t&n=200",i,z,zDate), i,z, &z[i]
458 );
459 }else{
460 blob_appendf(&links, "%#h", i+2, z);
461 }
462 if( z[i]==0 ) break;
@@ -444,11 +466,11 @@
466 blob_reset(&links);
467 }else{
468 @ tags: %h(zTagList))
469 }
470 }
471 tag_private_status(rid);
472
473 /* Generate extra hyperlinks at the end of the comment */
474 if( xExtra ){
475 xExtra(rid);
476 }
@@ -459,11 +481,11 @@
481 ){
482 int inUl = 0;
483 if( !fchngQueryInit ){
484 db_prepare(&fchngQuery,
485 "SELECT (pid==0) AS isnew,"
486 " fid,"
487 " (SELECT name FROM filename WHERE fnid=mlink.fnid) AS name,"
488 " (SELECT uuid FROM blob WHERE rid=fid),"
489 " (SELECT uuid FROM blob WHERE rid=pid),"
490 " (SELECT name FROM filename WHERE fnid=mlink.pfnid) AS oldnm"
491 " FROM mlink"
@@ -476,14 +498,16 @@
498 }
499 db_bind_int(&fchngQuery, ":mid", rid);
500 while( db_step(&fchngQuery)==SQLITE_ROW ){
501 const char *zFilename = db_column_text(&fchngQuery, 2);
502 int isNew = db_column_int(&fchngQuery, 0);
503 int fid = db_column_int(&fchngQuery, 1);
504 int isDel = fid==0;
505 const char *zOldName = db_column_text(&fchngQuery, 5);
506 const char *zOld = db_column_text(&fchngQuery, 4);
507 const char *zNew = db_column_text(&fchngQuery, 3);
508 const char *zUnpubTag = "";
509 if( !inUl ){
510 @ <ul class="filelist">
511 inUl = 1;
512 }
513 if( (tmFlags & TIMELINE_FRENAMES)!=0 ){
@@ -490,23 +514,26 @@
514 if( !isNew && !isDel && zOldName!=0 ){
515 @ <li> %h(zOldName) &rarr; %h(zFilename)
516 }
517 continue;
518 }
519 if( content_is_private(fid) ){
520 zUnpubTag = UNPUB_TAG;
521 }
522 if( isNew ){
523 @ <li> %h(zFilename) %s(zUnpubTag) (new file) &nbsp;
524 @ %z(href("%R/artifact/%s",zNew))[view]</a></li>
525 }else if( isDel ){
526 @ <li> %h(zFilename) (deleted)</li>
527 }else if( fossil_strcmp(zOld,zNew)==0 && zOldName!=0 ){
528 @ <li> %h(zOldName) &rarr; %h(zFilename) %s(zUnpubTag)
529 @ %z(href("%R/artifact/%s",zNew))[view]</a></li>
530 }else{
531 if( zOldName!=0 ){
532 @ <li> %h(zOldName) &rarr; %h(zFilename) %s(zUnpubTag)
533 }else{
534 @ <li> %h(zFilename) &nbsp; %s(zUnpubTag)
535 }
536 @ %z(href("%R/fdiff?sbs=1&v1=%s&v2=%s",zOld,zNew))[diff]</a></li>
537 }
538 }
539 db_reset(&fchngQuery);
@@ -1011,10 +1038,11 @@
1038 ** uf=FUUID Show only checkins that use given file version
1039 ** brbg Background color from branch name
1040 ** ubg Background color from user
1041 ** namechng Show only checkins that filename changes
1042 ** ym=YYYY-MM Shown only events for the given year/month.
1043 ** datefmt=N Override the date format
1044 **
1045 ** p= and d= can appear individually or together. If either p= or d=
1046 ** appear, then u=, y=, a=, and b= are ignored.
1047 **
1048 ** If a= and b= appear, only a= is used. If neither appear, the most
@@ -1038,11 +1066,11 @@
1066 const char *zTagName = P("t"); /* Show events with this tag */
1067 const char *zBrName = P("r"); /* Show events related to this tag */
1068 const char *zSearch = P("s"); /* Search string */
1069 const char *zUses = P("uf"); /* Only show checkins hold this file */
1070 const char *zYearMonth = P("ym"); /* Show checkins for the given YYYY-MM */
1071 const char *zYearWeek = P("yw"); /* Show checkins for the given YYYY-WW (week-of-year)*/
1072 int useDividers = P("nd")==0; /* Show dividers if "nd" is missing */
1073 int renameOnly = P("namechng")!=0; /* Show only checkins that rename files */
1074 int tagid; /* Tag ID */
1075 int tmFlags; /* Timeline flags */
1076 const char *zThisTag = 0; /* Suppress links to this tag */
@@ -1075,16 +1103,22 @@
1103 tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='sym-%q'",zBrName);
1104 zThisTag = zBrName;
1105 }else{
1106 tagid = 0;
1107 }
1108 if( tagid>0
1109 && db_int(0,"SELECT count(*) FROM tagxref WHERE tagid=%d",tagid)<=nEntry
1110 ){
1111 zCirca = zBefore = zAfter = 0;
1112 nEntry = -1;
1113 }
1114 if( zType[0]=='a' ){
1115 tmFlags = TIMELINE_BRIEF | TIMELINE_GRAPH;
1116 }else{
1117 tmFlags = TIMELINE_GRAPH;
1118 }
1119 if( nEntry>0 ) url_add_parameter(&url, "n", mprintf("%d", nEntry));
1120 if( P("ng")!=0 || zSearch!=0 ){
1121 tmFlags &= ~TIMELINE_GRAPH;
1122 url_add_parameter(&url, "ng", 0);
1123 }
1124 if( P("brbg")!=0 ){
@@ -1216,11 +1250,11 @@
1250 url_add_parameter(&url, "d", zUuid);
1251 }
1252 if( nEntry>20 ){
1253 timeline_submenu(&url, "20 Entries", "n", "20", 0);
1254 }
1255 if( nEntry<200 && nEntry>0 ){
1256 timeline_submenu(&url, "200 Entries", "n", "200", 0);
1257 }
1258 if( tmFlags & TIMELINE_FCHANGES ){
1259 timeline_submenu(&url, "Hide Files", "v", 0, 0);
1260 }else{
@@ -1360,10 +1394,16 @@
1394 }else if( zType[0]=='g' ){
1395 zEType = "tag";
1396 }
1397 }
1398 if( zUser ){
1399 int n = db_int(0,"SELECT count(*) FROM event"
1400 " WHERE user=%Q OR euser=%Q", zUser, zUser);
1401 if( n<=nEntry ){
1402 zCirca = zBefore = zAfter = 0;
1403 nEntry = -1;
1404 }
1405 blob_append_sql(&sql, " AND (event.user=%Q OR event.euser=%Q)",
1406 zUser, zUser);
1407 url_add_parameter(&url, "u", zUser);
1408 zThisUser = zUser;
1409 }
@@ -1381,11 +1421,11 @@
1421 blob_append_sql(&sql,
1422 " AND event.mtime>=%.17g AND event.mtime<=%.17g"
1423 " ORDER BY event.mtime ASC", rAfter-ONE_SECOND, rBefore+ONE_SECOND);
1424 url_add_parameter(&url, "a", zAfter);
1425 url_add_parameter(&url, "b", zBefore);
1426 nEntry = -1;
1427 }else{
1428 blob_append_sql(&sql,
1429 " AND event.mtime>=%.17g ORDER BY event.mtime ASC",
1430 rAfter-ONE_SECOND);
1431 url_add_parameter(&url, "a", zAfter);
@@ -1412,19 +1452,19 @@
1452 if( useDividers ) timeline_add_dividers(rCirca, 0);
1453 url_add_parameter(&url, "c", zCirca);
1454 }else{
1455 blob_append_sql(&sql, " ORDER BY event.mtime DESC");
1456 }
1457 if( nEntry>0 ) blob_append_sql(&sql, " LIMIT %d", nEntry);
1458 db_multi_exec("%s", blob_sql_text(&sql));
1459
1460 n = db_int(0, "SELECT count(*) FROM timeline WHERE etype!='div' /*scan*/");
1461 if( zYearMonth ){
1462 blob_appendf(&desc, "%s events for %h", zEType, zYearMonth);
1463 }else if( zYearWeek ){
1464 blob_appendf(&desc, "%s events for year/week %h", zEType, zYearWeek);
1465 }else if( zAfter==0 && zBefore==0 && zCirca==0 && nEntry>0 ){
1466 blob_appendf(&desc, "%d most recent %ss", n, zEType);
1467 }else{
1468 blob_appendf(&desc, "%d %ss", n, zEType);
1469 }
1470 if( zUses ){
@@ -1494,11 +1534,11 @@
1534 }
1535 }
1536 if( nEntry>20 ){
1537 timeline_submenu(&url, "20 Entries", "n", "20", 0);
1538 }
1539 if( nEntry<200 && nEntry>0 ){
1540 timeline_submenu(&url, "200 Entries", "n", "200", 0);
1541 }
1542 if( zType[0]=='a' || zType[0]=='c' ){
1543 if( tmFlags & TIMELINE_FCHANGES ){
1544 timeline_submenu(&url, "Hide Files", "v", 0, 0);
@@ -1604,11 +1644,15 @@
1644 sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], zBrType);
1645 n = strlen(zPrefix);
1646 }
1647 if( fossil_strcmp(zCurrentUuid,zId)==0 ){
1648 sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*CURRENT* ");
1649 n += strlen(zPrefix+n);
1650 }
1651 if( content_is_private(rid) ){
1652 sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*UNPUBLISHED* ");
1653 n += strlen(zPrefix+n);
1654 }
1655 zFree = mprintf("[%S] %s%s", zId, zPrefix, zCom);
1656 /* record another X lines */
1657 nLine += comment_print(zFree, zCom, 9, width, g.comFmtFlags);
1658 fossil_free(zFree);
1659
+12 -3
--- src/utf8.c
+++ src/utf8.c
@@ -25,11 +25,11 @@
2525
#ifdef _WIN32
2626
# include <windows.h>
2727
#endif
2828
#include "cygsup.h"
2929
30
-#ifdef _WIN32
30
+#if defined(_WIN32) || defined(__CYGWIN__)
3131
/*
3232
** Translate MBCS to UTF-8. Return a pointer to the translated text.
3333
** Call fossil_mbcs_free() to deallocate any memory used to store the
3434
** returned pointer when done.
3535
*/
@@ -309,10 +309,11 @@
309309
int fossil_utf8_to_console(const char *zUtf8, int nByte, int toStdErr){
310310
#ifdef _WIN32
311311
int nChar, written = 0;
312312
wchar_t *zUnicode; /* Unicode version of zUtf8 */
313313
DWORD dummy;
314
+ Blob blob;
314315
315316
static int istty[2] = { -1, -1 };
316317
if( istty[toStdErr] == -1 ){
317318
istty[toStdErr] = _isatty(toStdErr + 1) != 0;
318319
}
@@ -319,16 +320,24 @@
319320
if( !istty[toStdErr] ){
320321
/* stdout/stderr is not a console. */
321322
return -1;
322323
}
323324
324
- nChar = MultiByteToWideChar(CP_UTF8, 0, zUtf8, nByte, NULL, 0);
325
+ /* If blob to be written to the Windows console is not
326
+ * UTF-8, convert it to UTF-8 first.
327
+ */
328
+ blob_init(&blob, zUtf8, nByte);
329
+ blob_to_utf8_no_bom(&blob, 1);
330
+ nChar = MultiByteToWideChar(CP_UTF8, 0, blob_buffer(&blob),
331
+ blob_size(&blob), NULL, 0);
325332
zUnicode = malloc( (nChar + 1) *sizeof(zUnicode[0]) );
326333
if( zUnicode==0 ){
327334
return 0;
328335
}
329
- nChar = MultiByteToWideChar(CP_UTF8, 0, zUtf8, nByte, zUnicode, nChar);
336
+ nChar = MultiByteToWideChar(CP_UTF8, 0, blob_buffer(&blob),
337
+ blob_size(&blob), zUnicode, nChar);
338
+ blob_reset(&blob);
330339
/* Split WriteConsoleW call into multiple chunks, if necessary. See:
331340
* <https://connect.microsoft.com/VisualStudio/feedback/details/635230> */
332341
while( written < nChar ){
333342
int size = nChar-written;
334343
if( size > 26000 ) size = 26000;
335344
--- src/utf8.c
+++ src/utf8.c
@@ -25,11 +25,11 @@
25 #ifdef _WIN32
26 # include <windows.h>
27 #endif
28 #include "cygsup.h"
29
30 #ifdef _WIN32
31 /*
32 ** Translate MBCS to UTF-8. Return a pointer to the translated text.
33 ** Call fossil_mbcs_free() to deallocate any memory used to store the
34 ** returned pointer when done.
35 */
@@ -309,10 +309,11 @@
309 int fossil_utf8_to_console(const char *zUtf8, int nByte, int toStdErr){
310 #ifdef _WIN32
311 int nChar, written = 0;
312 wchar_t *zUnicode; /* Unicode version of zUtf8 */
313 DWORD dummy;
 
314
315 static int istty[2] = { -1, -1 };
316 if( istty[toStdErr] == -1 ){
317 istty[toStdErr] = _isatty(toStdErr + 1) != 0;
318 }
@@ -319,16 +320,24 @@
319 if( !istty[toStdErr] ){
320 /* stdout/stderr is not a console. */
321 return -1;
322 }
323
324 nChar = MultiByteToWideChar(CP_UTF8, 0, zUtf8, nByte, NULL, 0);
 
 
 
 
 
 
325 zUnicode = malloc( (nChar + 1) *sizeof(zUnicode[0]) );
326 if( zUnicode==0 ){
327 return 0;
328 }
329 nChar = MultiByteToWideChar(CP_UTF8, 0, zUtf8, nByte, zUnicode, nChar);
 
 
330 /* Split WriteConsoleW call into multiple chunks, if necessary. See:
331 * <https://connect.microsoft.com/VisualStudio/feedback/details/635230> */
332 while( written < nChar ){
333 int size = nChar-written;
334 if( size > 26000 ) size = 26000;
335
--- src/utf8.c
+++ src/utf8.c
@@ -25,11 +25,11 @@
25 #ifdef _WIN32
26 # include <windows.h>
27 #endif
28 #include "cygsup.h"
29
30 #if defined(_WIN32) || defined(__CYGWIN__)
31 /*
32 ** Translate MBCS to UTF-8. Return a pointer to the translated text.
33 ** Call fossil_mbcs_free() to deallocate any memory used to store the
34 ** returned pointer when done.
35 */
@@ -309,10 +309,11 @@
309 int fossil_utf8_to_console(const char *zUtf8, int nByte, int toStdErr){
310 #ifdef _WIN32
311 int nChar, written = 0;
312 wchar_t *zUnicode; /* Unicode version of zUtf8 */
313 DWORD dummy;
314 Blob blob;
315
316 static int istty[2] = { -1, -1 };
317 if( istty[toStdErr] == -1 ){
318 istty[toStdErr] = _isatty(toStdErr + 1) != 0;
319 }
@@ -319,16 +320,24 @@
320 if( !istty[toStdErr] ){
321 /* stdout/stderr is not a console. */
322 return -1;
323 }
324
325 /* If blob to be written to the Windows console is not
326 * UTF-8, convert it to UTF-8 first.
327 */
328 blob_init(&blob, zUtf8, nByte);
329 blob_to_utf8_no_bom(&blob, 1);
330 nChar = MultiByteToWideChar(CP_UTF8, 0, blob_buffer(&blob),
331 blob_size(&blob), NULL, 0);
332 zUnicode = malloc( (nChar + 1) *sizeof(zUnicode[0]) );
333 if( zUnicode==0 ){
334 return 0;
335 }
336 nChar = MultiByteToWideChar(CP_UTF8, 0, blob_buffer(&blob),
337 blob_size(&blob), zUnicode, nChar);
338 blob_reset(&blob);
339 /* Split WriteConsoleW call into multiple chunks, if necessary. See:
340 * <https://connect.microsoft.com/VisualStudio/feedback/details/635230> */
341 while( written < nChar ){
342 int size = nChar-written;
343 if( size > 26000 ) size = 26000;
344
--- win/Makefile.PellesCGMake
+++ win/Makefile.PellesCGMake
@@ -145,11 +145,11 @@
145145
builtin_data.h: $(EXTRA_FILES) mkbuiltin.exe
146146
mkbuiltin.exe $(EXTRA_FILES) >$@
147147
148148
# extracting version info from manifest
149149
VERSION.h: version.exe ..\manifest.uuid ..\manifest ..\VERSION
150
- version.exe ..\manifest.uuid ..\manifest ..\VERSION > $@
150
+ version.exe ..\manifest.uuid ..\manifest ..\VERSION >$@
151151
152152
# generate the simplified headers
153153
headers: makeheaders.exe page_index.h builtin_data.h VERSION.h ../src/sqlite3.h ../src/th.h VERSION.h
154154
makeheaders.exe $(foreach ts,$(TRANSLATEDSRC),$(ts):$(ts:_.c=.h)) ../src/sqlite3.h ../src/th.h VERSION.h
155155
echo Done >$@
156156
--- win/Makefile.PellesCGMake
+++ win/Makefile.PellesCGMake
@@ -145,11 +145,11 @@
145 builtin_data.h: $(EXTRA_FILES) mkbuiltin.exe
146 mkbuiltin.exe $(EXTRA_FILES) >$@
147
148 # extracting version info from manifest
149 VERSION.h: version.exe ..\manifest.uuid ..\manifest ..\VERSION
150 version.exe ..\manifest.uuid ..\manifest ..\VERSION > $@
151
152 # generate the simplified headers
153 headers: makeheaders.exe page_index.h builtin_data.h VERSION.h ../src/sqlite3.h ../src/th.h VERSION.h
154 makeheaders.exe $(foreach ts,$(TRANSLATEDSRC),$(ts):$(ts:_.c=.h)) ../src/sqlite3.h ../src/th.h VERSION.h
155 echo Done >$@
156
--- win/Makefile.PellesCGMake
+++ win/Makefile.PellesCGMake
@@ -145,11 +145,11 @@
145 builtin_data.h: $(EXTRA_FILES) mkbuiltin.exe
146 mkbuiltin.exe $(EXTRA_FILES) >$@
147
148 # extracting version info from manifest
149 VERSION.h: version.exe ..\manifest.uuid ..\manifest ..\VERSION
150 version.exe ..\manifest.uuid ..\manifest ..\VERSION >$@
151
152 # generate the simplified headers
153 headers: makeheaders.exe page_index.h builtin_data.h VERSION.h ../src/sqlite3.h ../src/th.h VERSION.h
154 makeheaders.exe $(foreach ts,$(TRANSLATEDSRC),$(ts):$(ts:_.c=.h)) ../src/sqlite3.h ../src/th.h VERSION.h
155 echo Done >$@
156
+28 -4
--- win/Makefile.dmc
+++ win/Makefile.dmc
@@ -28,13 +28,13 @@
2828
2929
SQLITE_OPTIONS = -DNDEBUG=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_OMIT_DEPRECATED -DSQLITE_ENABLE_EXPLAIN_COMMENTS
3030
3131
SHELL_OPTIONS = -Dmain=sqlite3_shell -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=fossil_open -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen
3232
33
-SRC = add_.c allrepo_.c attach_.c bag_.c bisect_.c blob_.c branch_.c browse_.c builtin_.c cache_.c captcha_.c cgi_.c checkin_.c checkout_.c clearsign_.c clone_.c comformat_.c configure_.c content_.c db_.c delta_.c deltacmd_.c descendants_.c diff_.c diffcmd_.c doc_.c encode_.c event_.c export_.c file_.c finfo_.c fusefs_.c glob_.c graph_.c gzip_.c http_.c http_socket_.c http_ssl_.c http_transport_.c import_.c info_.c json_.c json_artifact_.c json_branch_.c json_config_.c json_diff_.c json_dir_.c json_finfo_.c json_login_.c json_query_.c json_report_.c json_status_.c json_tag_.c json_timeline_.c json_user_.c json_wiki_.c leaf_.c loadctrl_.c login_.c lookslike_.c main_.c manifest_.c markdown_.c markdown_html_.c md5_.c merge_.c merge3_.c moderate_.c name_.c path_.c pivot_.c popen_.c pqueue_.c printf_.c rebuild_.c regexp_.c report_.c rss_.c schema_.c search_.c setup_.c sha1_.c shun_.c skins_.c sqlcmd_.c stash_.c stat_.c style_.c sync_.c tag_.c tar_.c th_main_.c timeline_.c tkt_.c tktsetup_.c undo_.c unicode_.c update_.c url_.c user_.c utf8_.c util_.c verify_.c vfile_.c wiki_.c wikiformat_.c winfile_.c winhttp_.c wysiwyg_.c xfer_.c xfersetup_.c zip_.c
33
+SRC = add_.c allrepo_.c attach_.c bag_.c bisect_.c blob_.c branch_.c browse_.c builtin_.c bundle_.c cache_.c captcha_.c cgi_.c checkin_.c checkout_.c clearsign_.c clone_.c comformat_.c configure_.c content_.c db_.c delta_.c deltacmd_.c descendants_.c diff_.c diffcmd_.c doc_.c encode_.c event_.c export_.c file_.c finfo_.c foci_.c fusefs_.c glob_.c graph_.c gzip_.c http_.c http_socket_.c http_ssl_.c http_transport_.c import_.c info_.c json_.c json_artifact_.c json_branch_.c json_config_.c json_diff_.c json_dir_.c json_finfo_.c json_login_.c json_query_.c json_report_.c json_status_.c json_tag_.c json_timeline_.c json_user_.c json_wiki_.c leaf_.c loadctrl_.c login_.c lookslike_.c main_.c manifest_.c markdown_.c markdown_html_.c md5_.c merge_.c merge3_.c moderate_.c name_.c path_.c pivot_.c popen_.c pqueue_.c printf_.c publish_.c purge_.c rebuild_.c regexp_.c report_.c rss_.c schema_.c search_.c setup_.c sha1_.c shun_.c skins_.c sqlcmd_.c stash_.c stat_.c style_.c sync_.c tag_.c tar_.c th_main_.c timeline_.c tkt_.c tktsetup_.c undo_.c unicode_.c update_.c url_.c user_.c utf8_.c util_.c verify_.c vfile_.c wiki_.c wikiformat_.c winfile_.c winhttp_.c wysiwyg_.c xfer_.c xfersetup_.c zip_.c
3434
35
-OBJ = $(OBJDIR)\add$O $(OBJDIR)\allrepo$O $(OBJDIR)\attach$O $(OBJDIR)\bag$O $(OBJDIR)\bisect$O $(OBJDIR)\blob$O $(OBJDIR)\branch$O $(OBJDIR)\browse$O $(OBJDIR)\builtin$O $(OBJDIR)\cache$O $(OBJDIR)\captcha$O $(OBJDIR)\cgi$O $(OBJDIR)\checkin$O $(OBJDIR)\checkout$O $(OBJDIR)\clearsign$O $(OBJDIR)\clone$O $(OBJDIR)\comformat$O $(OBJDIR)\configure$O $(OBJDIR)\content$O $(OBJDIR)\db$O $(OBJDIR)\delta$O $(OBJDIR)\deltacmd$O $(OBJDIR)\descendants$O $(OBJDIR)\diff$O $(OBJDIR)\diffcmd$O $(OBJDIR)\doc$O $(OBJDIR)\encode$O $(OBJDIR)\event$O $(OBJDIR)\export$O $(OBJDIR)\file$O $(OBJDIR)\finfo$O $(OBJDIR)\fusefs$O $(OBJDIR)\glob$O $(OBJDIR)\graph$O $(OBJDIR)\gzip$O $(OBJDIR)\http$O $(OBJDIR)\http_socket$O $(OBJDIR)\http_ssl$O $(OBJDIR)\http_transport$O $(OBJDIR)\import$O $(OBJDIR)\info$O $(OBJDIR)\json$O $(OBJDIR)\json_artifact$O $(OBJDIR)\json_branch$O $(OBJDIR)\json_config$O $(OBJDIR)\json_diff$O $(OBJDIR)\json_dir$O $(OBJDIR)\json_finfo$O $(OBJDIR)\json_login$O $(OBJDIR)\json_query$O $(OBJDIR)\json_report$O $(OBJDIR)\json_status$O $(OBJDIR)\json_tag$O $(OBJDIR)\json_timeline$O $(OBJDIR)\json_user$O $(OBJDIR)\json_wiki$O $(OBJDIR)\leaf$O $(OBJDIR)\loadctrl$O $(OBJDIR)\login$O $(OBJDIR)\lookslike$O $(OBJDIR)\main$O $(OBJDIR)\manifest$O $(OBJDIR)\markdown$O $(OBJDIR)\markdown_html$O $(OBJDIR)\md5$O $(OBJDIR)\merge$O $(OBJDIR)\merge3$O $(OBJDIR)\moderate$O $(OBJDIR)\name$O $(OBJDIR)\path$O $(OBJDIR)\pivot$O $(OBJDIR)\popen$O $(OBJDIR)\pqueue$O $(OBJDIR)\printf$O $(OBJDIR)\rebuild$O $(OBJDIR)\regexp$O $(OBJDIR)\report$O $(OBJDIR)\rss$O $(OBJDIR)\schema$O $(OBJDIR)\search$O $(OBJDIR)\setup$O $(OBJDIR)\sha1$O $(OBJDIR)\shun$O $(OBJDIR)\skins$O $(OBJDIR)\sqlcmd$O $(OBJDIR)\stash$O $(OBJDIR)\stat$O $(OBJDIR)\style$O $(OBJDIR)\sync$O $(OBJDIR)\tag$O $(OBJDIR)\tar$O $(OBJDIR)\th_main$O $(OBJDIR)\timeline$O $(OBJDIR)\tkt$O $(OBJDIR)\tktsetup$O $(OBJDIR)\undo$O $(OBJDIR)\unicode$O $(OBJDIR)\update$O $(OBJDIR)\url$O $(OBJDIR)\user$O $(OBJDIR)\utf8$O $(OBJDIR)\util$O $(OBJDIR)\verify$O $(OBJDIR)\vfile$O $(OBJDIR)\wiki$O $(OBJDIR)\wikiformat$O $(OBJDIR)\winfile$O $(OBJDIR)\winhttp$O $(OBJDIR)\wysiwyg$O $(OBJDIR)\xfer$O $(OBJDIR)\xfersetup$O $(OBJDIR)\zip$O $(OBJDIR)\shell$O $(OBJDIR)\sqlite3$O $(OBJDIR)\th$O $(OBJDIR)\th_lang$O
35
+OBJ = $(OBJDIR)\add$O $(OBJDIR)\allrepo$O $(OBJDIR)\attach$O $(OBJDIR)\bag$O $(OBJDIR)\bisect$O $(OBJDIR)\blob$O $(OBJDIR)\branch$O $(OBJDIR)\browse$O $(OBJDIR)\builtin$O $(OBJDIR)\bundle$O $(OBJDIR)\cache$O $(OBJDIR)\captcha$O $(OBJDIR)\cgi$O $(OBJDIR)\checkin$O $(OBJDIR)\checkout$O $(OBJDIR)\clearsign$O $(OBJDIR)\clone$O $(OBJDIR)\comformat$O $(OBJDIR)\configure$O $(OBJDIR)\content$O $(OBJDIR)\db$O $(OBJDIR)\delta$O $(OBJDIR)\deltacmd$O $(OBJDIR)\descendants$O $(OBJDIR)\diff$O $(OBJDIR)\diffcmd$O $(OBJDIR)\doc$O $(OBJDIR)\encode$O $(OBJDIR)\event$O $(OBJDIR)\export$O $(OBJDIR)\file$O $(OBJDIR)\finfo$O $(OBJDIR)\foci$O $(OBJDIR)\fusefs$O $(OBJDIR)\glob$O $(OBJDIR)\graph$O $(OBJDIR)\gzip$O $(OBJDIR)\http$O $(OBJDIR)\http_socket$O $(OBJDIR)\http_ssl$O $(OBJDIR)\http_transport$O $(OBJDIR)\import$O $(OBJDIR)\info$O $(OBJDIR)\json$O $(OBJDIR)\json_artifact$O $(OBJDIR)\json_branch$O $(OBJDIR)\json_config$O $(OBJDIR)\json_diff$O $(OBJDIR)\json_dir$O $(OBJDIR)\json_finfo$O $(OBJDIR)\json_login$O $(OBJDIR)\json_query$O $(OBJDIR)\json_report$O $(OBJDIR)\json_status$O $(OBJDIR)\json_tag$O $(OBJDIR)\json_timeline$O $(OBJDIR)\json_user$O $(OBJDIR)\json_wiki$O $(OBJDIR)\leaf$O $(OBJDIR)\loadctrl$O $(OBJDIR)\login$O $(OBJDIR)\lookslike$O $(OBJDIR)\main$O $(OBJDIR)\manifest$O $(OBJDIR)\markdown$O $(OBJDIR)\markdown_html$O $(OBJDIR)\md5$O $(OBJDIR)\merge$O $(OBJDIR)\merge3$O $(OBJDIR)\moderate$O $(OBJDIR)\name$O $(OBJDIR)\path$O $(OBJDIR)\pivot$O $(OBJDIR)\popen$O $(OBJDIR)\pqueue$O $(OBJDIR)\printf$O $(OBJDIR)\publish$O $(OBJDIR)\purge$O $(OBJDIR)\rebuild$O $(OBJDIR)\regexp$O $(OBJDIR)\report$O $(OBJDIR)\rss$O $(OBJDIR)\schema$O $(OBJDIR)\search$O $(OBJDIR)\setup$O $(OBJDIR)\sha1$O $(OBJDIR)\shun$O $(OBJDIR)\skins$O $(OBJDIR)\sqlcmd$O $(OBJDIR)\stash$O $(OBJDIR)\stat$O $(OBJDIR)\style$O $(OBJDIR)\sync$O $(OBJDIR)\tag$O $(OBJDIR)\tar$O $(OBJDIR)\th_main$O $(OBJDIR)\timeline$O $(OBJDIR)\tkt$O $(OBJDIR)\tktsetup$O $(OBJDIR)\undo$O $(OBJDIR)\unicode$O $(OBJDIR)\update$O $(OBJDIR)\url$O $(OBJDIR)\user$O $(OBJDIR)\utf8$O $(OBJDIR)\util$O $(OBJDIR)\verify$O $(OBJDIR)\vfile$O $(OBJDIR)\wiki$O $(OBJDIR)\wikiformat$O $(OBJDIR)\winfile$O $(OBJDIR)\winhttp$O $(OBJDIR)\wysiwyg$O $(OBJDIR)\xfer$O $(OBJDIR)\xfersetup$O $(OBJDIR)\zip$O $(OBJDIR)\shell$O $(OBJDIR)\sqlite3$O $(OBJDIR)\th$O $(OBJDIR)\th_lang$O
3636
3737
3838
RC=$(DMDIR)\bin\rcc
3939
RCFLAGS=-32 -w1 -I$(SRCDIR) /D__DMC__
4040
@@ -49,11 +49,11 @@
4949
5050
$(OBJDIR)\fossil.res: $B\win\fossil.rc
5151
$(RC) $(RCFLAGS) -o$@ $**
5252
5353
$(OBJDIR)\link: $B\win\Makefile.dmc $(OBJDIR)\fossil.res
54
- +echo add allrepo attach bag bisect blob branch browse builtin cache captcha cgi checkin checkout clearsign clone comformat configure content db delta deltacmd descendants diff diffcmd doc encode event export file finfo fusefs glob graph gzip http http_socket http_ssl http_transport import info json json_artifact json_branch json_config json_diff json_dir json_finfo json_login json_query json_report json_status json_tag json_timeline json_user json_wiki leaf loadctrl login lookslike main manifest markdown markdown_html md5 merge merge3 moderate name path pivot popen pqueue printf rebuild regexp report rss schema search setup sha1 shun skins sqlcmd stash stat style sync tag tar th_main timeline tkt tktsetup undo unicode update url user utf8 util verify vfile wiki wikiformat winfile winhttp wysiwyg xfer xfersetup zip shell sqlite3 th th_lang > $@
54
+ +echo add allrepo attach bag bisect blob branch browse builtin bundle cache captcha cgi checkin checkout clearsign clone comformat configure content db delta deltacmd descendants diff diffcmd doc encode event export file finfo foci fusefs glob graph gzip http http_socket http_ssl http_transport import info json json_artifact json_branch json_config json_diff json_dir json_finfo json_login json_query json_report json_status json_tag json_timeline json_user json_wiki leaf loadctrl login lookslike main manifest markdown markdown_html md5 merge merge3 moderate name path pivot popen pqueue printf publish purge rebuild regexp report rss schema search setup sha1 shun skins sqlcmd stash stat style sync tag tar th_main timeline tkt tktsetup undo unicode update url user utf8 util verify vfile wiki wikiformat winfile winhttp wysiwyg xfer xfersetup zip shell sqlite3 th th_lang > $@
5555
+echo fossil >> $@
5656
+echo fossil >> $@
5757
+echo $(LIBS) >> $@
5858
+echo. >> $@
5959
+echo fossil >> $@
@@ -176,10 +176,16 @@
176176
$(OBJDIR)\builtin$O : builtin_.c builtin.h
177177
$(TCC) -o$@ -c builtin_.c
178178
179179
builtin_.c : $(SRCDIR)\builtin.c
180180
+translate$E $** > $@
181
+
182
+$(OBJDIR)\bundle$O : bundle_.c bundle.h
183
+ $(TCC) -o$@ -c bundle_.c
184
+
185
+bundle_.c : $(SRCDIR)\bundle.c
186
+ +translate$E $** > $@
181187
182188
$(OBJDIR)\cache$O : cache_.c cache.h
183189
$(TCC) -o$@ -c cache_.c
184190
185191
cache_.c : $(SRCDIR)\cache.c
@@ -308,10 +314,16 @@
308314
$(OBJDIR)\finfo$O : finfo_.c finfo.h
309315
$(TCC) -o$@ -c finfo_.c
310316
311317
finfo_.c : $(SRCDIR)\finfo.c
312318
+translate$E $** > $@
319
+
320
+$(OBJDIR)\foci$O : foci_.c foci.h
321
+ $(TCC) -o$@ -c foci_.c
322
+
323
+foci_.c : $(SRCDIR)\foci.c
324
+ +translate$E $** > $@
313325
314326
$(OBJDIR)\fusefs$O : fusefs_.c fusefs.h
315327
$(TCC) -o$@ -c fusefs_.c
316328
317329
fusefs_.c : $(SRCDIR)\fusefs.c
@@ -566,10 +578,22 @@
566578
$(OBJDIR)\printf$O : printf_.c printf.h
567579
$(TCC) -o$@ -c printf_.c
568580
569581
printf_.c : $(SRCDIR)\printf.c
570582
+translate$E $** > $@
583
+
584
+$(OBJDIR)\publish$O : publish_.c publish.h
585
+ $(TCC) -o$@ -c publish_.c
586
+
587
+publish_.c : $(SRCDIR)\publish.c
588
+ +translate$E $** > $@
589
+
590
+$(OBJDIR)\purge$O : purge_.c purge.h
591
+ $(TCC) -o$@ -c purge_.c
592
+
593
+purge_.c : $(SRCDIR)\purge.c
594
+ +translate$E $** > $@
571595
572596
$(OBJDIR)\rebuild$O : rebuild_.c rebuild.h
573597
$(TCC) -o$@ -c rebuild_.c
574598
575599
rebuild_.c : $(SRCDIR)\rebuild.c
@@ -796,7 +820,7 @@
796820
797821
zip_.c : $(SRCDIR)\zip.c
798822
+translate$E $** > $@
799823
800824
headers: makeheaders$E page_index.h builtin_data.h VERSION.h
801
- +makeheaders$E add_.c:add.h allrepo_.c:allrepo.h attach_.c:attach.h bag_.c:bag.h bisect_.c:bisect.h blob_.c:blob.h branch_.c:branch.h browse_.c:browse.h builtin_.c:builtin.h cache_.c:cache.h captcha_.c:captcha.h cgi_.c:cgi.h checkin_.c:checkin.h checkout_.c:checkout.h clearsign_.c:clearsign.h clone_.c:clone.h comformat_.c:comformat.h configure_.c:configure.h content_.c:content.h db_.c:db.h delta_.c:delta.h deltacmd_.c:deltacmd.h descendants_.c:descendants.h diff_.c:diff.h diffcmd_.c:diffcmd.h doc_.c:doc.h encode_.c:encode.h event_.c:event.h export_.c:export.h file_.c:file.h finfo_.c:finfo.h fusefs_.c:fusefs.h glob_.c:glob.h graph_.c:graph.h gzip_.c:gzip.h http_.c:http.h http_socket_.c:http_socket.h http_ssl_.c:http_ssl.h http_transport_.c:http_transport.h import_.c:import.h info_.c:info.h json_.c:json.h json_artifact_.c:json_artifact.h json_branch_.c:json_branch.h json_config_.c:json_config.h json_diff_.c:json_diff.h json_dir_.c:json_dir.h json_finfo_.c:json_finfo.h json_login_.c:json_login.h json_query_.c:json_query.h json_report_.c:json_report.h json_status_.c:json_status.h json_tag_.c:json_tag.h json_timeline_.c:json_timeline.h json_user_.c:json_user.h json_wiki_.c:json_wiki.h leaf_.c:leaf.h loadctrl_.c:loadctrl.h login_.c:login.h lookslike_.c:lookslike.h main_.c:main.h manifest_.c:manifest.h markdown_.c:markdown.h markdown_html_.c:markdown_html.h md5_.c:md5.h merge_.c:merge.h merge3_.c:merge3.h moderate_.c:moderate.h name_.c:name.h path_.c:path.h pivot_.c:pivot.h popen_.c:popen.h pqueue_.c:pqueue.h printf_.c:printf.h rebuild_.c:rebuild.h regexp_.c:regexp.h report_.c:report.h rss_.c:rss.h schema_.c:schema.h search_.c:search.h setup_.c:setup.h sha1_.c:sha1.h shun_.c:shun.h skins_.c:skins.h sqlcmd_.c:sqlcmd.h stash_.c:stash.h stat_.c:stat.h style_.c:style.h sync_.c:sync.h tag_.c:tag.h tar_.c:tar.h th_main_.c:th_main.h timeline_.c:timeline.h tkt_.c:tkt.h tktsetup_.c:tktsetup.h undo_.c:undo.h unicode_.c:unicode.h update_.c:update.h url_.c:url.h user_.c:user.h utf8_.c:utf8.h util_.c:util.h verify_.c:verify.h vfile_.c:vfile.h wiki_.c:wiki.h wikiformat_.c:wikiformat.h winfile_.c:winfile.h winhttp_.c:winhttp.h wysiwyg_.c:wysiwyg.h xfer_.c:xfer.h xfersetup_.c:xfersetup.h zip_.c:zip.h $(SRCDIR)\sqlite3.h $(SRCDIR)\th.h VERSION.h $(SRCDIR)\cson_amalgamation.h
825
+ +makeheaders$E add_.c:add.h allrepo_.c:allrepo.h attach_.c:attach.h bag_.c:bag.h bisect_.c:bisect.h blob_.c:blob.h branch_.c:branch.h browse_.c:browse.h builtin_.c:builtin.h bundle_.c:bundle.h cache_.c:cache.h captcha_.c:captcha.h cgi_.c:cgi.h checkin_.c:checkin.h checkout_.c:checkout.h clearsign_.c:clearsign.h clone_.c:clone.h comformat_.c:comformat.h configure_.c:configure.h content_.c:content.h db_.c:db.h delta_.c:delta.h deltacmd_.c:deltacmd.h descendants_.c:descendants.h diff_.c:diff.h diffcmd_.c:diffcmd.h doc_.c:doc.h encode_.c:encode.h event_.c:event.h export_.c:export.h file_.c:file.h finfo_.c:finfo.h foci_.c:foci.h fusefs_.c:fusefs.h glob_.c:glob.h graph_.c:graph.h gzip_.c:gzip.h http_.c:http.h http_socket_.c:http_socket.h http_ssl_.c:http_ssl.h http_transport_.c:http_transport.h import_.c:import.h info_.c:info.h json_.c:json.h json_artifact_.c:json_artifact.h json_branch_.c:json_branch.h json_config_.c:json_config.h json_diff_.c:json_diff.h json_dir_.c:json_dir.h json_finfo_.c:json_finfo.h json_login_.c:json_login.h json_query_.c:json_query.h json_report_.c:json_report.h json_status_.c:json_status.h json_tag_.c:json_tag.h json_timeline_.c:json_timeline.h json_user_.c:json_user.h json_wiki_.c:json_wiki.h leaf_.c:leaf.h loadctrl_.c:loadctrl.h login_.c:login.h lookslike_.c:lookslike.h main_.c:main.h manifest_.c:manifest.h markdown_.c:markdown.h markdown_html_.c:markdown_html.h md5_.c:md5.h merge_.c:merge.h merge3_.c:merge3.h moderate_.c:moderate.h name_.c:name.h path_.c:path.h pivot_.c:pivot.h popen_.c:popen.h pqueue_.c:pqueue.h printf_.c:printf.h publish_.c:publish.h purge_.c:purge.h rebuild_.c:rebuild.h regexp_.c:regexp.h report_.c:report.h rss_.c:rss.h schema_.c:schema.h search_.c:search.h setup_.c:setup.h sha1_.c:sha1.h shun_.c:shun.h skins_.c:skins.h sqlcmd_.c:sqlcmd.h stash_.c:stash.h stat_.c:stat.h style_.c:style.h sync_.c:sync.h tag_.c:tag.h tar_.c:tar.h th_main_.c:th_main.h timeline_.c:timeline.h tkt_.c:tkt.h tktsetup_.c:tktsetup.h undo_.c:undo.h unicode_.c:unicode.h update_.c:update.h url_.c:url.h user_.c:user.h utf8_.c:utf8.h util_.c:util.h verify_.c:verify.h vfile_.c:vfile.h wiki_.c:wiki.h wikiformat_.c:wikiformat.h winfile_.c:winfile.h winhttp_.c:winhttp.h wysiwyg_.c:wysiwyg.h xfer_.c:xfer.h xfersetup_.c:xfersetup.h zip_.c:zip.h $(SRCDIR)\sqlite3.h $(SRCDIR)\th.h VERSION.h $(SRCDIR)\cson_amalgamation.h
802826
@copy /Y nul: headers
803827
--- win/Makefile.dmc
+++ win/Makefile.dmc
@@ -28,13 +28,13 @@
28
29 SQLITE_OPTIONS = -DNDEBUG=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_OMIT_DEPRECATED -DSQLITE_ENABLE_EXPLAIN_COMMENTS
30
31 SHELL_OPTIONS = -Dmain=sqlite3_shell -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=fossil_open -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen
32
33 SRC = add_.c allrepo_.c attach_.c bag_.c bisect_.c blob_.c branch_.c browse_.c builtin_.c cache_.c captcha_.c cgi_.c checkin_.c checkout_.c clearsign_.c clone_.c comformat_.c configure_.c content_.c db_.c delta_.c deltacmd_.c descendants_.c diff_.c diffcmd_.c doc_.c encode_.c event_.c export_.c file_.c finfo_.c fusefs_.c glob_.c graph_.c gzip_.c http_.c http_socket_.c http_ssl_.c http_transport_.c import_.c info_.c json_.c json_artifact_.c json_branch_.c json_config_.c json_diff_.c json_dir_.c json_finfo_.c json_login_.c json_query_.c json_report_.c json_status_.c json_tag_.c json_timeline_.c json_user_.c json_wiki_.c leaf_.c loadctrl_.c login_.c lookslike_.c main_.c manifest_.c markdown_.c markdown_html_.c md5_.c merge_.c merge3_.c moderate_.c name_.c path_.c pivot_.c popen_.c pqueue_.c printf_.c rebuild_.c regexp_.c report_.c rss_.c schema_.c search_.c setup_.c sha1_.c shun_.c skins_.c sqlcmd_.c stash_.c stat_.c style_.c sync_.c tag_.c tar_.c th_main_.c timeline_.c tkt_.c tktsetup_.c undo_.c unicode_.c update_.c url_.c user_.c utf8_.c util_.c verify_.c vfile_.c wiki_.c wikiformat_.c winfile_.c winhttp_.c wysiwyg_.c xfer_.c xfersetup_.c zip_.c
34
35 OBJ = $(OBJDIR)\add$O $(OBJDIR)\allrepo$O $(OBJDIR)\attach$O $(OBJDIR)\bag$O $(OBJDIR)\bisect$O $(OBJDIR)\blob$O $(OBJDIR)\branch$O $(OBJDIR)\browse$O $(OBJDIR)\builtin$O $(OBJDIR)\cache$O $(OBJDIR)\captcha$O $(OBJDIR)\cgi$O $(OBJDIR)\checkin$O $(OBJDIR)\checkout$O $(OBJDIR)\clearsign$O $(OBJDIR)\clone$O $(OBJDIR)\comformat$O $(OBJDIR)\configure$O $(OBJDIR)\content$O $(OBJDIR)\db$O $(OBJDIR)\delta$O $(OBJDIR)\deltacmd$O $(OBJDIR)\descendants$O $(OBJDIR)\diff$O $(OBJDIR)\diffcmd$O $(OBJDIR)\doc$O $(OBJDIR)\encode$O $(OBJDIR)\event$O $(OBJDIR)\export$O $(OBJDIR)\file$O $(OBJDIR)\finfo$O $(OBJDIR)\fusefs$O $(OBJDIR)\glob$O $(OBJDIR)\graph$O $(OBJDIR)\gzip$O $(OBJDIR)\http$O $(OBJDIR)\http_socket$O $(OBJDIR)\http_ssl$O $(OBJDIR)\http_transport$O $(OBJDIR)\import$O $(OBJDIR)\info$O $(OBJDIR)\json$O $(OBJDIR)\json_artifact$O $(OBJDIR)\json_branch$O $(OBJDIR)\json_config$O $(OBJDIR)\json_diff$O $(OBJDIR)\json_dir$O $(OBJDIR)\json_finfo$O $(OBJDIR)\json_login$O $(OBJDIR)\json_query$O $(OBJDIR)\json_report$O $(OBJDIR)\json_status$O $(OBJDIR)\json_tag$O $(OBJDIR)\json_timeline$O $(OBJDIR)\json_user$O $(OBJDIR)\json_wiki$O $(OBJDIR)\leaf$O $(OBJDIR)\loadctrl$O $(OBJDIR)\login$O $(OBJDIR)\lookslike$O $(OBJDIR)\main$O $(OBJDIR)\manifest$O $(OBJDIR)\markdown$O $(OBJDIR)\markdown_html$O $(OBJDIR)\md5$O $(OBJDIR)\merge$O $(OBJDIR)\merge3$O $(OBJDIR)\moderate$O $(OBJDIR)\name$O $(OBJDIR)\path$O $(OBJDIR)\pivot$O $(OBJDIR)\popen$O $(OBJDIR)\pqueue$O $(OBJDIR)\printf$O $(OBJDIR)\rebuild$O $(OBJDIR)\regexp$O $(OBJDIR)\report$O $(OBJDIR)\rss$O $(OBJDIR)\schema$O $(OBJDIR)\search$O $(OBJDIR)\setup$O $(OBJDIR)\sha1$O $(OBJDIR)\shun$O $(OBJDIR)\skins$O $(OBJDIR)\sqlcmd$O $(OBJDIR)\stash$O $(OBJDIR)\stat$O $(OBJDIR)\style$O $(OBJDIR)\sync$O $(OBJDIR)\tag$O $(OBJDIR)\tar$O $(OBJDIR)\th_main$O $(OBJDIR)\timeline$O $(OBJDIR)\tkt$O $(OBJDIR)\tktsetup$O $(OBJDIR)\undo$O $(OBJDIR)\unicode$O $(OBJDIR)\update$O $(OBJDIR)\url$O $(OBJDIR)\user$O $(OBJDIR)\utf8$O $(OBJDIR)\util$O $(OBJDIR)\verify$O $(OBJDIR)\vfile$O $(OBJDIR)\wiki$O $(OBJDIR)\wikiformat$O $(OBJDIR)\winfile$O $(OBJDIR)\winhttp$O $(OBJDIR)\wysiwyg$O $(OBJDIR)\xfer$O $(OBJDIR)\xfersetup$O $(OBJDIR)\zip$O $(OBJDIR)\shell$O $(OBJDIR)\sqlite3$O $(OBJDIR)\th$O $(OBJDIR)\th_lang$O
36
37
38 RC=$(DMDIR)\bin\rcc
39 RCFLAGS=-32 -w1 -I$(SRCDIR) /D__DMC__
40
@@ -49,11 +49,11 @@
49
50 $(OBJDIR)\fossil.res: $B\win\fossil.rc
51 $(RC) $(RCFLAGS) -o$@ $**
52
53 $(OBJDIR)\link: $B\win\Makefile.dmc $(OBJDIR)\fossil.res
54 +echo add allrepo attach bag bisect blob branch browse builtin cache captcha cgi checkin checkout clearsign clone comformat configure content db delta deltacmd descendants diff diffcmd doc encode event export file finfo fusefs glob graph gzip http http_socket http_ssl http_transport import info json json_artifact json_branch json_config json_diff json_dir json_finfo json_login json_query json_report json_status json_tag json_timeline json_user json_wiki leaf loadctrl login lookslike main manifest markdown markdown_html md5 merge merge3 moderate name path pivot popen pqueue printf rebuild regexp report rss schema search setup sha1 shun skins sqlcmd stash stat style sync tag tar th_main timeline tkt tktsetup undo unicode update url user utf8 util verify vfile wiki wikiformat winfile winhttp wysiwyg xfer xfersetup zip shell sqlite3 th th_lang > $@
55 +echo fossil >> $@
56 +echo fossil >> $@
57 +echo $(LIBS) >> $@
58 +echo. >> $@
59 +echo fossil >> $@
@@ -176,10 +176,16 @@
176 $(OBJDIR)\builtin$O : builtin_.c builtin.h
177 $(TCC) -o$@ -c builtin_.c
178
179 builtin_.c : $(SRCDIR)\builtin.c
180 +translate$E $** > $@
 
 
 
 
 
 
181
182 $(OBJDIR)\cache$O : cache_.c cache.h
183 $(TCC) -o$@ -c cache_.c
184
185 cache_.c : $(SRCDIR)\cache.c
@@ -308,10 +314,16 @@
308 $(OBJDIR)\finfo$O : finfo_.c finfo.h
309 $(TCC) -o$@ -c finfo_.c
310
311 finfo_.c : $(SRCDIR)\finfo.c
312 +translate$E $** > $@
 
 
 
 
 
 
313
314 $(OBJDIR)\fusefs$O : fusefs_.c fusefs.h
315 $(TCC) -o$@ -c fusefs_.c
316
317 fusefs_.c : $(SRCDIR)\fusefs.c
@@ -566,10 +578,22 @@
566 $(OBJDIR)\printf$O : printf_.c printf.h
567 $(TCC) -o$@ -c printf_.c
568
569 printf_.c : $(SRCDIR)\printf.c
570 +translate$E $** > $@
 
 
 
 
 
 
 
 
 
 
 
 
571
572 $(OBJDIR)\rebuild$O : rebuild_.c rebuild.h
573 $(TCC) -o$@ -c rebuild_.c
574
575 rebuild_.c : $(SRCDIR)\rebuild.c
@@ -796,7 +820,7 @@
796
797 zip_.c : $(SRCDIR)\zip.c
798 +translate$E $** > $@
799
800 headers: makeheaders$E page_index.h builtin_data.h VERSION.h
801 +makeheaders$E add_.c:add.h allrepo_.c:allrepo.h attach_.c:attach.h bag_.c:bag.h bisect_.c:bisect.h blob_.c:blob.h branch_.c:branch.h browse_.c:browse.h builtin_.c:builtin.h cache_.c:cache.h captcha_.c:captcha.h cgi_.c:cgi.h checkin_.c:checkin.h checkout_.c:checkout.h clearsign_.c:clearsign.h clone_.c:clone.h comformat_.c:comformat.h configure_.c:configure.h content_.c:content.h db_.c:db.h delta_.c:delta.h deltacmd_.c:deltacmd.h descendants_.c:descendants.h diff_.c:diff.h diffcmd_.c:diffcmd.h doc_.c:doc.h encode_.c:encode.h event_.c:event.h export_.c:export.h file_.c:file.h finfo_.c:finfo.h fusefs_.c:fusefs.h glob_.c:glob.h graph_.c:graph.h gzip_.c:gzip.h http_.c:http.h http_socket_.c:http_socket.h http_ssl_.c:http_ssl.h http_transport_.c:http_transport.h import_.c:import.h info_.c:info.h json_.c:json.h json_artifact_.c:json_artifact.h json_branch_.c:json_branch.h json_config_.c:json_config.h json_diff_.c:json_diff.h json_dir_.c:json_dir.h json_finfo_.c:json_finfo.h json_login_.c:json_login.h json_query_.c:json_query.h json_report_.c:json_report.h json_status_.c:json_status.h json_tag_.c:json_tag.h json_timeline_.c:json_timeline.h json_user_.c:json_user.h json_wiki_.c:json_wiki.h leaf_.c:leaf.h loadctrl_.c:loadctrl.h login_.c:login.h lookslike_.c:lookslike.h main_.c:main.h manifest_.c:manifest.h markdown_.c:markdown.h markdown_html_.c:markdown_html.h md5_.c:md5.h merge_.c:merge.h merge3_.c:merge3.h moderate_.c:moderate.h name_.c:name.h path_.c:path.h pivot_.c:pivot.h popen_.c:popen.h pqueue_.c:pqueue.h printf_.c:printf.h rebuild_.c:rebuild.h regexp_.c:regexp.h report_.c:report.h rss_.c:rss.h schema_.c:schema.h search_.c:search.h setup_.c:setup.h sha1_.c:sha1.h shun_.c:shun.h skins_.c:skins.h sqlcmd_.c:sqlcmd.h stash_.c:stash.h stat_.c:stat.h style_.c:style.h sync_.c:sync.h tag_.c:tag.h tar_.c:tar.h th_main_.c:th_main.h timeline_.c:timeline.h tkt_.c:tkt.h tktsetup_.c:tktsetup.h undo_.c:undo.h unicode_.c:unicode.h update_.c:update.h url_.c:url.h user_.c:user.h utf8_.c:utf8.h util_.c:util.h verify_.c:verify.h vfile_.c:vfile.h wiki_.c:wiki.h wikiformat_.c:wikiformat.h winfile_.c:winfile.h winhttp_.c:winhttp.h wysiwyg_.c:wysiwyg.h xfer_.c:xfer.h xfersetup_.c:xfersetup.h zip_.c:zip.h $(SRCDIR)\sqlite3.h $(SRCDIR)\th.h VERSION.h $(SRCDIR)\cson_amalgamation.h
802 @copy /Y nul: headers
803
--- win/Makefile.dmc
+++ win/Makefile.dmc
@@ -28,13 +28,13 @@
28
29 SQLITE_OPTIONS = -DNDEBUG=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_OMIT_DEPRECATED -DSQLITE_ENABLE_EXPLAIN_COMMENTS
30
31 SHELL_OPTIONS = -Dmain=sqlite3_shell -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=fossil_open -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen
32
33 SRC = add_.c allrepo_.c attach_.c bag_.c bisect_.c blob_.c branch_.c browse_.c builtin_.c bundle_.c cache_.c captcha_.c cgi_.c checkin_.c checkout_.c clearsign_.c clone_.c comformat_.c configure_.c content_.c db_.c delta_.c deltacmd_.c descendants_.c diff_.c diffcmd_.c doc_.c encode_.c event_.c export_.c file_.c finfo_.c foci_.c fusefs_.c glob_.c graph_.c gzip_.c http_.c http_socket_.c http_ssl_.c http_transport_.c import_.c info_.c json_.c json_artifact_.c json_branch_.c json_config_.c json_diff_.c json_dir_.c json_finfo_.c json_login_.c json_query_.c json_report_.c json_status_.c json_tag_.c json_timeline_.c json_user_.c json_wiki_.c leaf_.c loadctrl_.c login_.c lookslike_.c main_.c manifest_.c markdown_.c markdown_html_.c md5_.c merge_.c merge3_.c moderate_.c name_.c path_.c pivot_.c popen_.c pqueue_.c printf_.c publish_.c purge_.c rebuild_.c regexp_.c report_.c rss_.c schema_.c search_.c setup_.c sha1_.c shun_.c skins_.c sqlcmd_.c stash_.c stat_.c style_.c sync_.c tag_.c tar_.c th_main_.c timeline_.c tkt_.c tktsetup_.c undo_.c unicode_.c update_.c url_.c user_.c utf8_.c util_.c verify_.c vfile_.c wiki_.c wikiformat_.c winfile_.c winhttp_.c wysiwyg_.c xfer_.c xfersetup_.c zip_.c
34
35 OBJ = $(OBJDIR)\add$O $(OBJDIR)\allrepo$O $(OBJDIR)\attach$O $(OBJDIR)\bag$O $(OBJDIR)\bisect$O $(OBJDIR)\blob$O $(OBJDIR)\branch$O $(OBJDIR)\browse$O $(OBJDIR)\builtin$O $(OBJDIR)\bundle$O $(OBJDIR)\cache$O $(OBJDIR)\captcha$O $(OBJDIR)\cgi$O $(OBJDIR)\checkin$O $(OBJDIR)\checkout$O $(OBJDIR)\clearsign$O $(OBJDIR)\clone$O $(OBJDIR)\comformat$O $(OBJDIR)\configure$O $(OBJDIR)\content$O $(OBJDIR)\db$O $(OBJDIR)\delta$O $(OBJDIR)\deltacmd$O $(OBJDIR)\descendants$O $(OBJDIR)\diff$O $(OBJDIR)\diffcmd$O $(OBJDIR)\doc$O $(OBJDIR)\encode$O $(OBJDIR)\event$O $(OBJDIR)\export$O $(OBJDIR)\file$O $(OBJDIR)\finfo$O $(OBJDIR)\foci$O $(OBJDIR)\fusefs$O $(OBJDIR)\glob$O $(OBJDIR)\graph$O $(OBJDIR)\gzip$O $(OBJDIR)\http$O $(OBJDIR)\http_socket$O $(OBJDIR)\http_ssl$O $(OBJDIR)\http_transport$O $(OBJDIR)\import$O $(OBJDIR)\info$O $(OBJDIR)\json$O $(OBJDIR)\json_artifact$O $(OBJDIR)\json_branch$O $(OBJDIR)\json_config$O $(OBJDIR)\json_diff$O $(OBJDIR)\json_dir$O $(OBJDIR)\json_finfo$O $(OBJDIR)\json_login$O $(OBJDIR)\json_query$O $(OBJDIR)\json_report$O $(OBJDIR)\json_status$O $(OBJDIR)\json_tag$O $(OBJDIR)\json_timeline$O $(OBJDIR)\json_user$O $(OBJDIR)\json_wiki$O $(OBJDIR)\leaf$O $(OBJDIR)\loadctrl$O $(OBJDIR)\login$O $(OBJDIR)\lookslike$O $(OBJDIR)\main$O $(OBJDIR)\manifest$O $(OBJDIR)\markdown$O $(OBJDIR)\markdown_html$O $(OBJDIR)\md5$O $(OBJDIR)\merge$O $(OBJDIR)\merge3$O $(OBJDIR)\moderate$O $(OBJDIR)\name$O $(OBJDIR)\path$O $(OBJDIR)\pivot$O $(OBJDIR)\popen$O $(OBJDIR)\pqueue$O $(OBJDIR)\printf$O $(OBJDIR)\publish$O $(OBJDIR)\purge$O $(OBJDIR)\rebuild$O $(OBJDIR)\regexp$O $(OBJDIR)\report$O $(OBJDIR)\rss$O $(OBJDIR)\schema$O $(OBJDIR)\search$O $(OBJDIR)\setup$O $(OBJDIR)\sha1$O $(OBJDIR)\shun$O $(OBJDIR)\skins$O $(OBJDIR)\sqlcmd$O $(OBJDIR)\stash$O $(OBJDIR)\stat$O $(OBJDIR)\style$O $(OBJDIR)\sync$O $(OBJDIR)\tag$O $(OBJDIR)\tar$O $(OBJDIR)\th_main$O $(OBJDIR)\timeline$O $(OBJDIR)\tkt$O $(OBJDIR)\tktsetup$O $(OBJDIR)\undo$O $(OBJDIR)\unicode$O $(OBJDIR)\update$O $(OBJDIR)\url$O $(OBJDIR)\user$O $(OBJDIR)\utf8$O $(OBJDIR)\util$O $(OBJDIR)\verify$O $(OBJDIR)\vfile$O $(OBJDIR)\wiki$O $(OBJDIR)\wikiformat$O $(OBJDIR)\winfile$O $(OBJDIR)\winhttp$O $(OBJDIR)\wysiwyg$O $(OBJDIR)\xfer$O $(OBJDIR)\xfersetup$O $(OBJDIR)\zip$O $(OBJDIR)\shell$O $(OBJDIR)\sqlite3$O $(OBJDIR)\th$O $(OBJDIR)\th_lang$O
36
37
38 RC=$(DMDIR)\bin\rcc
39 RCFLAGS=-32 -w1 -I$(SRCDIR) /D__DMC__
40
@@ -49,11 +49,11 @@
49
50 $(OBJDIR)\fossil.res: $B\win\fossil.rc
51 $(RC) $(RCFLAGS) -o$@ $**
52
53 $(OBJDIR)\link: $B\win\Makefile.dmc $(OBJDIR)\fossil.res
54 +echo add allrepo attach bag bisect blob branch browse builtin bundle cache captcha cgi checkin checkout clearsign clone comformat configure content db delta deltacmd descendants diff diffcmd doc encode event export file finfo foci fusefs glob graph gzip http http_socket http_ssl http_transport import info json json_artifact json_branch json_config json_diff json_dir json_finfo json_login json_query json_report json_status json_tag json_timeline json_user json_wiki leaf loadctrl login lookslike main manifest markdown markdown_html md5 merge merge3 moderate name path pivot popen pqueue printf publish purge rebuild regexp report rss schema search setup sha1 shun skins sqlcmd stash stat style sync tag tar th_main timeline tkt tktsetup undo unicode update url user utf8 util verify vfile wiki wikiformat winfile winhttp wysiwyg xfer xfersetup zip shell sqlite3 th th_lang > $@
55 +echo fossil >> $@
56 +echo fossil >> $@
57 +echo $(LIBS) >> $@
58 +echo. >> $@
59 +echo fossil >> $@
@@ -176,10 +176,16 @@
176 $(OBJDIR)\builtin$O : builtin_.c builtin.h
177 $(TCC) -o$@ -c builtin_.c
178
179 builtin_.c : $(SRCDIR)\builtin.c
180 +translate$E $** > $@
181
182 $(OBJDIR)\bundle$O : bundle_.c bundle.h
183 $(TCC) -o$@ -c bundle_.c
184
185 bundle_.c : $(SRCDIR)\bundle.c
186 +translate$E $** > $@
187
188 $(OBJDIR)\cache$O : cache_.c cache.h
189 $(TCC) -o$@ -c cache_.c
190
191 cache_.c : $(SRCDIR)\cache.c
@@ -308,10 +314,16 @@
314 $(OBJDIR)\finfo$O : finfo_.c finfo.h
315 $(TCC) -o$@ -c finfo_.c
316
317 finfo_.c : $(SRCDIR)\finfo.c
318 +translate$E $** > $@
319
320 $(OBJDIR)\foci$O : foci_.c foci.h
321 $(TCC) -o$@ -c foci_.c
322
323 foci_.c : $(SRCDIR)\foci.c
324 +translate$E $** > $@
325
326 $(OBJDIR)\fusefs$O : fusefs_.c fusefs.h
327 $(TCC) -o$@ -c fusefs_.c
328
329 fusefs_.c : $(SRCDIR)\fusefs.c
@@ -566,10 +578,22 @@
578 $(OBJDIR)\printf$O : printf_.c printf.h
579 $(TCC) -o$@ -c printf_.c
580
581 printf_.c : $(SRCDIR)\printf.c
582 +translate$E $** > $@
583
584 $(OBJDIR)\publish$O : publish_.c publish.h
585 $(TCC) -o$@ -c publish_.c
586
587 publish_.c : $(SRCDIR)\publish.c
588 +translate$E $** > $@
589
590 $(OBJDIR)\purge$O : purge_.c purge.h
591 $(TCC) -o$@ -c purge_.c
592
593 purge_.c : $(SRCDIR)\purge.c
594 +translate$E $** > $@
595
596 $(OBJDIR)\rebuild$O : rebuild_.c rebuild.h
597 $(TCC) -o$@ -c rebuild_.c
598
599 rebuild_.c : $(SRCDIR)\rebuild.c
@@ -796,7 +820,7 @@
820
821 zip_.c : $(SRCDIR)\zip.c
822 +translate$E $** > $@
823
824 headers: makeheaders$E page_index.h builtin_data.h VERSION.h
825 +makeheaders$E add_.c:add.h allrepo_.c:allrepo.h attach_.c:attach.h bag_.c:bag.h bisect_.c:bisect.h blob_.c:blob.h branch_.c:branch.h browse_.c:browse.h builtin_.c:builtin.h bundle_.c:bundle.h cache_.c:cache.h captcha_.c:captcha.h cgi_.c:cgi.h checkin_.c:checkin.h checkout_.c:checkout.h clearsign_.c:clearsign.h clone_.c:clone.h comformat_.c:comformat.h configure_.c:configure.h content_.c:content.h db_.c:db.h delta_.c:delta.h deltacmd_.c:deltacmd.h descendants_.c:descendants.h diff_.c:diff.h diffcmd_.c:diffcmd.h doc_.c:doc.h encode_.c:encode.h event_.c:event.h export_.c:export.h file_.c:file.h finfo_.c:finfo.h foci_.c:foci.h fusefs_.c:fusefs.h glob_.c:glob.h graph_.c:graph.h gzip_.c:gzip.h http_.c:http.h http_socket_.c:http_socket.h http_ssl_.c:http_ssl.h http_transport_.c:http_transport.h import_.c:import.h info_.c:info.h json_.c:json.h json_artifact_.c:json_artifact.h json_branch_.c:json_branch.h json_config_.c:json_config.h json_diff_.c:json_diff.h json_dir_.c:json_dir.h json_finfo_.c:json_finfo.h json_login_.c:json_login.h json_query_.c:json_query.h json_report_.c:json_report.h json_status_.c:json_status.h json_tag_.c:json_tag.h json_timeline_.c:json_timeline.h json_user_.c:json_user.h json_wiki_.c:json_wiki.h leaf_.c:leaf.h loadctrl_.c:loadctrl.h login_.c:login.h lookslike_.c:lookslike.h main_.c:main.h manifest_.c:manifest.h markdown_.c:markdown.h markdown_html_.c:markdown_html.h md5_.c:md5.h merge_.c:merge.h merge3_.c:merge3.h moderate_.c:moderate.h name_.c:name.h path_.c:path.h pivot_.c:pivot.h popen_.c:popen.h pqueue_.c:pqueue.h printf_.c:printf.h publish_.c:publish.h purge_.c:purge.h rebuild_.c:rebuild.h regexp_.c:regexp.h report_.c:report.h rss_.c:rss.h schema_.c:schema.h search_.c:search.h setup_.c:setup.h sha1_.c:sha1.h shun_.c:shun.h skins_.c:skins.h sqlcmd_.c:sqlcmd.h stash_.c:stash.h stat_.c:stat.h style_.c:style.h sync_.c:sync.h tag_.c:tag.h tar_.c:tar.h th_main_.c:th_main.h timeline_.c:timeline.h tkt_.c:tkt.h tktsetup_.c:tktsetup.h undo_.c:undo.h unicode_.c:unicode.h update_.c:update.h url_.c:url.h user_.c:user.h utf8_.c:utf8.h util_.c:util.h verify_.c:verify.h vfile_.c:vfile.h wiki_.c:wiki.h wikiformat_.c:wikiformat.h winfile_.c:winfile.h winhttp_.c:winhttp.h wysiwyg_.c:wysiwyg.h xfer_.c:xfer.h xfersetup_.c:xfersetup.h zip_.c:zip.h $(SRCDIR)\sqlite3.h $(SRCDIR)\th.h VERSION.h $(SRCDIR)\cson_amalgamation.h
826 @copy /Y nul: headers
827
+208 -137
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -94,23 +94,40 @@
9494
ifndef MINGW_IS_32BIT_ONLY
9595
ifeq (,$(findstring w64-mingw32,$(PREFIX)))
9696
MINGW_IS_32BIT_ONLY = 1
9797
endif
9898
endif
99
-ifeq (,$(findstring x86_64-w64-mingw32,$(PREFIX)))
100
-SSLCONFIG = mingw
101
-else
102
-SSLCONFIG = mingw64
103
-endif
104
-ifndef FOSSIL_ENABLE_MINIZ
105
-SSLCONFIG += --with-zlib-lib=$(PWD)/$(ZLIBDIR) --with-zlib-include=$(PWD)/$(ZLIBDIR) zlib
106
-endif
10799
108100
#### The directories where the zlib include and library files are located.
109101
#
110102
ZINCDIR = $(SRCDIR)/../compat/zlib
111103
ZLIBDIR = $(SRCDIR)/../compat/zlib
104
+
105
+ifndef X64
106
+ifneq (,$(findstring x86_64-w64-mingw32,$(PREFIX)))
107
+X64 = 1
108
+endif
109
+endif
110
+
111
+ifndef X64
112
+SSLCONFIG = mingw
113
+ifndef FOSSIL_ENABLE_MINIZ
114
+ZLIBCONFIG = LOC="-DASMV -DASMINF" OBJA="inffas86.o match.o"
115
+LIBTARGETS = $(ZLIBDIR)/inffas86.o $(ZLIBDIR)/match.o
116
+else
117
+ZLIBCONFIG =
118
+LIBTARGETS =
119
+endif
120
+else
121
+SSLCONFIG = mingw64
122
+ZLIBCONFIG =
123
+LIBTARGETS =
124
+endif
125
+
126
+ifndef FOSSIL_ENABLE_MINIZ
127
+SSLCONFIG += --with-zlib-lib=$(PWD)/$(ZLIBDIR) --with-zlib-include=$(PWD)/$(ZLIBDIR) zlib
128
+endif
112129
113130
#### The directories where the OpenSSL include and library files are located.
114131
# The recommended usage here is to use the Sysinternals junction tool
115132
# to create a hard link between an "openssl-1.x" sub-directory of the
116133
# Fossil source code directory and the target OpenSSL source directory.
@@ -340,10 +357,11 @@
340357
$(SRCDIR)/bisect.c \
341358
$(SRCDIR)/blob.c \
342359
$(SRCDIR)/branch.c \
343360
$(SRCDIR)/browse.c \
344361
$(SRCDIR)/builtin.c \
362
+ $(SRCDIR)/bundle.c \
345363
$(SRCDIR)/cache.c \
346364
$(SRCDIR)/captcha.c \
347365
$(SRCDIR)/cgi.c \
348366
$(SRCDIR)/checkin.c \
349367
$(SRCDIR)/checkout.c \
@@ -362,10 +380,11 @@
362380
$(SRCDIR)/encode.c \
363381
$(SRCDIR)/event.c \
364382
$(SRCDIR)/export.c \
365383
$(SRCDIR)/file.c \
366384
$(SRCDIR)/finfo.c \
385
+ $(SRCDIR)/foci.c \
367386
$(SRCDIR)/fusefs.c \
368387
$(SRCDIR)/glob.c \
369388
$(SRCDIR)/graph.c \
370389
$(SRCDIR)/gzip.c \
371390
$(SRCDIR)/http.c \
@@ -405,10 +424,12 @@
405424
$(SRCDIR)/path.c \
406425
$(SRCDIR)/pivot.c \
407426
$(SRCDIR)/popen.c \
408427
$(SRCDIR)/pqueue.c \
409428
$(SRCDIR)/printf.c \
429
+ $(SRCDIR)/publish.c \
430
+ $(SRCDIR)/purge.c \
410431
$(SRCDIR)/rebuild.c \
411432
$(SRCDIR)/regexp.c \
412433
$(SRCDIR)/report.c \
413434
$(SRCDIR)/rss.c \
414435
$(SRCDIR)/schema.c \
@@ -457,10 +478,11 @@
457478
$(OBJDIR)/bisect_.c \
458479
$(OBJDIR)/blob_.c \
459480
$(OBJDIR)/branch_.c \
460481
$(OBJDIR)/browse_.c \
461482
$(OBJDIR)/builtin_.c \
483
+ $(OBJDIR)/bundle_.c \
462484
$(OBJDIR)/cache_.c \
463485
$(OBJDIR)/captcha_.c \
464486
$(OBJDIR)/cgi_.c \
465487
$(OBJDIR)/checkin_.c \
466488
$(OBJDIR)/checkout_.c \
@@ -479,10 +501,11 @@
479501
$(OBJDIR)/encode_.c \
480502
$(OBJDIR)/event_.c \
481503
$(OBJDIR)/export_.c \
482504
$(OBJDIR)/file_.c \
483505
$(OBJDIR)/finfo_.c \
506
+ $(OBJDIR)/foci_.c \
484507
$(OBJDIR)/fusefs_.c \
485508
$(OBJDIR)/glob_.c \
486509
$(OBJDIR)/graph_.c \
487510
$(OBJDIR)/gzip_.c \
488511
$(OBJDIR)/http_.c \
@@ -522,10 +545,12 @@
522545
$(OBJDIR)/path_.c \
523546
$(OBJDIR)/pivot_.c \
524547
$(OBJDIR)/popen_.c \
525548
$(OBJDIR)/pqueue_.c \
526549
$(OBJDIR)/printf_.c \
550
+ $(OBJDIR)/publish_.c \
551
+ $(OBJDIR)/purge_.c \
527552
$(OBJDIR)/rebuild_.c \
528553
$(OBJDIR)/regexp_.c \
529554
$(OBJDIR)/report_.c \
530555
$(OBJDIR)/rss_.c \
531556
$(OBJDIR)/schema_.c \
@@ -571,10 +596,11 @@
571596
$(OBJDIR)/bisect.o \
572597
$(OBJDIR)/blob.o \
573598
$(OBJDIR)/branch.o \
574599
$(OBJDIR)/browse.o \
575600
$(OBJDIR)/builtin.o \
601
+ $(OBJDIR)/bundle.o \
576602
$(OBJDIR)/cache.o \
577603
$(OBJDIR)/captcha.o \
578604
$(OBJDIR)/cgi.o \
579605
$(OBJDIR)/checkin.o \
580606
$(OBJDIR)/checkout.o \
@@ -593,10 +619,11 @@
593619
$(OBJDIR)/encode.o \
594620
$(OBJDIR)/event.o \
595621
$(OBJDIR)/export.o \
596622
$(OBJDIR)/file.o \
597623
$(OBJDIR)/finfo.o \
624
+ $(OBJDIR)/foci.o \
598625
$(OBJDIR)/fusefs.o \
599626
$(OBJDIR)/glob.o \
600627
$(OBJDIR)/graph.o \
601628
$(OBJDIR)/gzip.o \
602629
$(OBJDIR)/http.o \
@@ -636,10 +663,12 @@
636663
$(OBJDIR)/path.o \
637664
$(OBJDIR)/pivot.o \
638665
$(OBJDIR)/popen.o \
639666
$(OBJDIR)/pqueue.o \
640667
$(OBJDIR)/printf.o \
668
+ $(OBJDIR)/publish.o \
669
+ $(OBJDIR)/purge.o \
641670
$(OBJDIR)/rebuild.o \
642671
$(OBJDIR)/regexp.o \
643672
$(OBJDIR)/report.o \
644673
$(OBJDIR)/rss.o \
645674
$(OBJDIR)/schema.o \
@@ -677,11 +706,10 @@
677706
$(OBJDIR)/xfersetup.o \
678707
$(OBJDIR)/zip.o
679708
680709
APPNAME = fossil.exe
681710
APPTARGETS =
682
-LIBTARGETS =
683711
684712
#### If the USE_WINDOWS variable exists, it is assumed that we are building
685713
# inside of a Windows-style shell; otherwise, it is assumed that we are
686714
# building inside of a Unix-style shell. Note that the "move" command is
687715
# broken when attempting to use it from the Windows shell via MinGW make
@@ -749,35 +777,35 @@
749777
else
750778
$(MKDIR) $(OBJDIR)
751779
endif
752780
753781
$(TRANSLATE): $(SRCDIR)/translate.c
754
- $(BCC) -o $(TRANSLATE) $(SRCDIR)/translate.c
782
+ $(BCC) -o $@ $(SRCDIR)/translate.c
755783
756784
$(MAKEHEADERS): $(SRCDIR)/makeheaders.c
757
- $(BCC) -o $(MAKEHEADERS) $(SRCDIR)/makeheaders.c
785
+ $(BCC) -o $@ $(SRCDIR)/makeheaders.c
758786
759787
$(MKINDEX): $(SRCDIR)/mkindex.c
760
- $(BCC) -o $(MKINDEX) $(SRCDIR)/mkindex.c
788
+ $(BCC) -o $@ $(SRCDIR)/mkindex.c
761789
762790
$(MKBUILTIN): $(SRCDIR)/mkbuiltin.c
763
- $(BCC) -o $(MKBUILTIN) $(SRCDIR)/mkbuiltin.c
791
+ $(BCC) -o $@ $(SRCDIR)/mkbuiltin.c
764792
765793
$(MKVERSION): $(SRCDIR)/mkversion.c
766
- $(BCC) -o $(MKVERSION) $(SRCDIR)/mkversion.c
794
+ $(BCC) -o $@ $(SRCDIR)/mkversion.c
767795
768796
$(CODECHECK1): $(SRCDIR)/codecheck1.c
769
- $(BCC) -o $(CODECHECK1) $(SRCDIR)/codecheck1.c
797
+ $(BCC) -o $@ $(SRCDIR)/codecheck1.c
770798
771799
# WARNING. DANGER. Running the test suite modifies the repository the
772800
# build is done from, i.e. the checkout belongs to. Do not sync/push
773801
# the repository after running the tests.
774802
test: $(OBJDIR) $(APPNAME)
775803
$(TCLSH) $(SRCDIR)/../test/tester.tcl $(APPNAME)
776804
777805
$(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(MKVERSION)
778
- $(MKVERSION) $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION >$(OBJDIR)/VERSION.h
806
+ $(MKVERSION) $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION >$@
779807
780808
# The USE_SYSTEM_SQLITE variable may be undefined, set to 0, or set
781809
# to 1. If it is set to 1, then there is no need to build or link
782810
# the sqlite3.o object. Instead, the system SQLite will be linked
783811
# using -lsqlite3.
@@ -802,14 +830,21 @@
802830
$(OBJDIR)/th_tcl.o \
803831
$(OBJDIR)/cson_amalgamation.o
804832
805833
806834
zlib:
807
- $(MAKE) -C $(ZLIBDIR) PREFIX=$(PREFIX) -f win32/Makefile.gcc libz.a
835
+ $(MAKE) -C $(ZLIBDIR) PREFIX=$(PREFIX) $(ZLIBCONFIG) -f win32/Makefile.gcc libz.a
808836
809837
clean-zlib:
810838
$(MAKE) -C $(ZLIBDIR) PREFIX=$(PREFIX) -f win32/Makefile.gcc clean
839
+
840
+$(ZLIBDIR)/inffas86.o:
841
+ $(TCC) -c -o $@ -DASMINF -I$(ZLIBDIR) -O3 $(ZLIBDIR)/contrib/inflate86/inffas86.c
842
+
843
+$(ZLIBDIR)/match.o:
844
+ $(TCC) -c -o $@ -DASMV $(ZLIBDIR)/contrib/asm686/match.S
845
+
811846
812847
ifndef FOSSIL_ENABLE_MINIZ
813848
LIBTARGETS += zlib
814849
endif
815850
@@ -833,11 +868,11 @@
833868
APPTARGETS += openssl
834869
endif
835870
836871
$(APPNAME): $(OBJDIR)/headers $(CODECHECK1) $(OBJ) $(EXTRAOBJ) $(OBJDIR)/fossil.o $(APPTARGETS)
837872
$(CODECHECK1) $(TRANS_SRC)
838
- $(TCC) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB) $(OBJDIR)/fossil.o
873
+ $(TCC) -o $@ $(OBJ) $(EXTRAOBJ) $(LIB) $(OBJDIR)/fossil.o
839874
840875
# This rule prevents make from using its default rules to try build
841876
# an executable named "manifest" out of the file named "manifest.c"
842877
#
843878
$(SRCDIR)/../manifest:
@@ -872,10 +907,11 @@
872907
$(OBJDIR)/bisect_.c:$(OBJDIR)/bisect.h \
873908
$(OBJDIR)/blob_.c:$(OBJDIR)/blob.h \
874909
$(OBJDIR)/branch_.c:$(OBJDIR)/branch.h \
875910
$(OBJDIR)/browse_.c:$(OBJDIR)/browse.h \
876911
$(OBJDIR)/builtin_.c:$(OBJDIR)/builtin.h \
912
+ $(OBJDIR)/bundle_.c:$(OBJDIR)/bundle.h \
877913
$(OBJDIR)/cache_.c:$(OBJDIR)/cache.h \
878914
$(OBJDIR)/captcha_.c:$(OBJDIR)/captcha.h \
879915
$(OBJDIR)/cgi_.c:$(OBJDIR)/cgi.h \
880916
$(OBJDIR)/checkin_.c:$(OBJDIR)/checkin.h \
881917
$(OBJDIR)/checkout_.c:$(OBJDIR)/checkout.h \
@@ -894,10 +930,11 @@
894930
$(OBJDIR)/encode_.c:$(OBJDIR)/encode.h \
895931
$(OBJDIR)/event_.c:$(OBJDIR)/event.h \
896932
$(OBJDIR)/export_.c:$(OBJDIR)/export.h \
897933
$(OBJDIR)/file_.c:$(OBJDIR)/file.h \
898934
$(OBJDIR)/finfo_.c:$(OBJDIR)/finfo.h \
935
+ $(OBJDIR)/foci_.c:$(OBJDIR)/foci.h \
899936
$(OBJDIR)/fusefs_.c:$(OBJDIR)/fusefs.h \
900937
$(OBJDIR)/glob_.c:$(OBJDIR)/glob.h \
901938
$(OBJDIR)/graph_.c:$(OBJDIR)/graph.h \
902939
$(OBJDIR)/gzip_.c:$(OBJDIR)/gzip.h \
903940
$(OBJDIR)/http_.c:$(OBJDIR)/http.h \
@@ -937,10 +974,12 @@
937974
$(OBJDIR)/path_.c:$(OBJDIR)/path.h \
938975
$(OBJDIR)/pivot_.c:$(OBJDIR)/pivot.h \
939976
$(OBJDIR)/popen_.c:$(OBJDIR)/popen.h \
940977
$(OBJDIR)/pqueue_.c:$(OBJDIR)/pqueue.h \
941978
$(OBJDIR)/printf_.c:$(OBJDIR)/printf.h \
979
+ $(OBJDIR)/publish_.c:$(OBJDIR)/publish.h \
980
+ $(OBJDIR)/purge_.c:$(OBJDIR)/purge.h \
942981
$(OBJDIR)/rebuild_.c:$(OBJDIR)/rebuild.h \
943982
$(OBJDIR)/regexp_.c:$(OBJDIR)/regexp.h \
944983
$(OBJDIR)/report_.c:$(OBJDIR)/report.h \
945984
$(OBJDIR)/rss_.c:$(OBJDIR)/rss.h \
946985
$(OBJDIR)/schema_.c:$(OBJDIR)/schema.h \
@@ -985,899 +1024,931 @@
9851024
$(OBJDIR)/headers: Makefile
9861025
9871026
Makefile:
9881027
9891028
$(OBJDIR)/add_.c: $(SRCDIR)/add.c $(TRANSLATE)
990
- $(TRANSLATE) $(SRCDIR)/add.c >$(OBJDIR)/add_.c
1029
+ $(TRANSLATE) $(SRCDIR)/add.c >$@
9911030
9921031
$(OBJDIR)/add.o: $(OBJDIR)/add_.c $(OBJDIR)/add.h $(SRCDIR)/config.h
9931032
$(XTCC) -o $(OBJDIR)/add.o -c $(OBJDIR)/add_.c
9941033
9951034
$(OBJDIR)/add.h: $(OBJDIR)/headers
9961035
9971036
$(OBJDIR)/allrepo_.c: $(SRCDIR)/allrepo.c $(TRANSLATE)
998
- $(TRANSLATE) $(SRCDIR)/allrepo.c >$(OBJDIR)/allrepo_.c
1037
+ $(TRANSLATE) $(SRCDIR)/allrepo.c >$@
9991038
10001039
$(OBJDIR)/allrepo.o: $(OBJDIR)/allrepo_.c $(OBJDIR)/allrepo.h $(SRCDIR)/config.h
10011040
$(XTCC) -o $(OBJDIR)/allrepo.o -c $(OBJDIR)/allrepo_.c
10021041
10031042
$(OBJDIR)/allrepo.h: $(OBJDIR)/headers
10041043
10051044
$(OBJDIR)/attach_.c: $(SRCDIR)/attach.c $(TRANSLATE)
1006
- $(TRANSLATE) $(SRCDIR)/attach.c >$(OBJDIR)/attach_.c
1045
+ $(TRANSLATE) $(SRCDIR)/attach.c >$@
10071046
10081047
$(OBJDIR)/attach.o: $(OBJDIR)/attach_.c $(OBJDIR)/attach.h $(SRCDIR)/config.h
10091048
$(XTCC) -o $(OBJDIR)/attach.o -c $(OBJDIR)/attach_.c
10101049
10111050
$(OBJDIR)/attach.h: $(OBJDIR)/headers
10121051
10131052
$(OBJDIR)/bag_.c: $(SRCDIR)/bag.c $(TRANSLATE)
1014
- $(TRANSLATE) $(SRCDIR)/bag.c >$(OBJDIR)/bag_.c
1053
+ $(TRANSLATE) $(SRCDIR)/bag.c >$@
10151054
10161055
$(OBJDIR)/bag.o: $(OBJDIR)/bag_.c $(OBJDIR)/bag.h $(SRCDIR)/config.h
10171056
$(XTCC) -o $(OBJDIR)/bag.o -c $(OBJDIR)/bag_.c
10181057
10191058
$(OBJDIR)/bag.h: $(OBJDIR)/headers
10201059
10211060
$(OBJDIR)/bisect_.c: $(SRCDIR)/bisect.c $(TRANSLATE)
1022
- $(TRANSLATE) $(SRCDIR)/bisect.c >$(OBJDIR)/bisect_.c
1061
+ $(TRANSLATE) $(SRCDIR)/bisect.c >$@
10231062
10241063
$(OBJDIR)/bisect.o: $(OBJDIR)/bisect_.c $(OBJDIR)/bisect.h $(SRCDIR)/config.h
10251064
$(XTCC) -o $(OBJDIR)/bisect.o -c $(OBJDIR)/bisect_.c
10261065
10271066
$(OBJDIR)/bisect.h: $(OBJDIR)/headers
10281067
10291068
$(OBJDIR)/blob_.c: $(SRCDIR)/blob.c $(TRANSLATE)
1030
- $(TRANSLATE) $(SRCDIR)/blob.c >$(OBJDIR)/blob_.c
1069
+ $(TRANSLATE) $(SRCDIR)/blob.c >$@
10311070
10321071
$(OBJDIR)/blob.o: $(OBJDIR)/blob_.c $(OBJDIR)/blob.h $(SRCDIR)/config.h
10331072
$(XTCC) -o $(OBJDIR)/blob.o -c $(OBJDIR)/blob_.c
10341073
10351074
$(OBJDIR)/blob.h: $(OBJDIR)/headers
10361075
10371076
$(OBJDIR)/branch_.c: $(SRCDIR)/branch.c $(TRANSLATE)
1038
- $(TRANSLATE) $(SRCDIR)/branch.c >$(OBJDIR)/branch_.c
1077
+ $(TRANSLATE) $(SRCDIR)/branch.c >$@
10391078
10401079
$(OBJDIR)/branch.o: $(OBJDIR)/branch_.c $(OBJDIR)/branch.h $(SRCDIR)/config.h
10411080
$(XTCC) -o $(OBJDIR)/branch.o -c $(OBJDIR)/branch_.c
10421081
10431082
$(OBJDIR)/branch.h: $(OBJDIR)/headers
10441083
10451084
$(OBJDIR)/browse_.c: $(SRCDIR)/browse.c $(TRANSLATE)
1046
- $(TRANSLATE) $(SRCDIR)/browse.c >$(OBJDIR)/browse_.c
1085
+ $(TRANSLATE) $(SRCDIR)/browse.c >$@
10471086
10481087
$(OBJDIR)/browse.o: $(OBJDIR)/browse_.c $(OBJDIR)/browse.h $(SRCDIR)/config.h
10491088
$(XTCC) -o $(OBJDIR)/browse.o -c $(OBJDIR)/browse_.c
10501089
10511090
$(OBJDIR)/browse.h: $(OBJDIR)/headers
10521091
10531092
$(OBJDIR)/builtin_.c: $(SRCDIR)/builtin.c $(TRANSLATE)
1054
- $(TRANSLATE) $(SRCDIR)/builtin.c >$(OBJDIR)/builtin_.c
1093
+ $(TRANSLATE) $(SRCDIR)/builtin.c >$@
10551094
10561095
$(OBJDIR)/builtin.o: $(OBJDIR)/builtin_.c $(OBJDIR)/builtin.h $(OBJDIR)/builtin_data.h $(SRCDIR)/config.h
10571096
$(XTCC) -o $(OBJDIR)/builtin.o -c $(OBJDIR)/builtin_.c
10581097
10591098
$(OBJDIR)/builtin.h: $(OBJDIR)/headers
1099
+
1100
+$(OBJDIR)/bundle_.c: $(SRCDIR)/bundle.c $(TRANSLATE)
1101
+ $(TRANSLATE) $(SRCDIR)/bundle.c >$@
1102
+
1103
+$(OBJDIR)/bundle.o: $(OBJDIR)/bundle_.c $(OBJDIR)/bundle.h $(SRCDIR)/config.h
1104
+ $(XTCC) -o $(OBJDIR)/bundle.o -c $(OBJDIR)/bundle_.c
1105
+
1106
+$(OBJDIR)/bundle.h: $(OBJDIR)/headers
10601107
10611108
$(OBJDIR)/cache_.c: $(SRCDIR)/cache.c $(TRANSLATE)
1062
- $(TRANSLATE) $(SRCDIR)/cache.c >$(OBJDIR)/cache_.c
1109
+ $(TRANSLATE) $(SRCDIR)/cache.c >$@
10631110
10641111
$(OBJDIR)/cache.o: $(OBJDIR)/cache_.c $(OBJDIR)/cache.h $(SRCDIR)/config.h
10651112
$(XTCC) -o $(OBJDIR)/cache.o -c $(OBJDIR)/cache_.c
10661113
10671114
$(OBJDIR)/cache.h: $(OBJDIR)/headers
10681115
10691116
$(OBJDIR)/captcha_.c: $(SRCDIR)/captcha.c $(TRANSLATE)
1070
- $(TRANSLATE) $(SRCDIR)/captcha.c >$(OBJDIR)/captcha_.c
1117
+ $(TRANSLATE) $(SRCDIR)/captcha.c >$@
10711118
10721119
$(OBJDIR)/captcha.o: $(OBJDIR)/captcha_.c $(OBJDIR)/captcha.h $(SRCDIR)/config.h
10731120
$(XTCC) -o $(OBJDIR)/captcha.o -c $(OBJDIR)/captcha_.c
10741121
10751122
$(OBJDIR)/captcha.h: $(OBJDIR)/headers
10761123
10771124
$(OBJDIR)/cgi_.c: $(SRCDIR)/cgi.c $(TRANSLATE)
1078
- $(TRANSLATE) $(SRCDIR)/cgi.c >$(OBJDIR)/cgi_.c
1125
+ $(TRANSLATE) $(SRCDIR)/cgi.c >$@
10791126
10801127
$(OBJDIR)/cgi.o: $(OBJDIR)/cgi_.c $(OBJDIR)/cgi.h $(SRCDIR)/config.h
10811128
$(XTCC) -o $(OBJDIR)/cgi.o -c $(OBJDIR)/cgi_.c
10821129
10831130
$(OBJDIR)/cgi.h: $(OBJDIR)/headers
10841131
10851132
$(OBJDIR)/checkin_.c: $(SRCDIR)/checkin.c $(TRANSLATE)
1086
- $(TRANSLATE) $(SRCDIR)/checkin.c >$(OBJDIR)/checkin_.c
1133
+ $(TRANSLATE) $(SRCDIR)/checkin.c >$@
10871134
10881135
$(OBJDIR)/checkin.o: $(OBJDIR)/checkin_.c $(OBJDIR)/checkin.h $(SRCDIR)/config.h
10891136
$(XTCC) -o $(OBJDIR)/checkin.o -c $(OBJDIR)/checkin_.c
10901137
10911138
$(OBJDIR)/checkin.h: $(OBJDIR)/headers
10921139
10931140
$(OBJDIR)/checkout_.c: $(SRCDIR)/checkout.c $(TRANSLATE)
1094
- $(TRANSLATE) $(SRCDIR)/checkout.c >$(OBJDIR)/checkout_.c
1141
+ $(TRANSLATE) $(SRCDIR)/checkout.c >$@
10951142
10961143
$(OBJDIR)/checkout.o: $(OBJDIR)/checkout_.c $(OBJDIR)/checkout.h $(SRCDIR)/config.h
10971144
$(XTCC) -o $(OBJDIR)/checkout.o -c $(OBJDIR)/checkout_.c
10981145
10991146
$(OBJDIR)/checkout.h: $(OBJDIR)/headers
11001147
11011148
$(OBJDIR)/clearsign_.c: $(SRCDIR)/clearsign.c $(TRANSLATE)
1102
- $(TRANSLATE) $(SRCDIR)/clearsign.c >$(OBJDIR)/clearsign_.c
1149
+ $(TRANSLATE) $(SRCDIR)/clearsign.c >$@
11031150
11041151
$(OBJDIR)/clearsign.o: $(OBJDIR)/clearsign_.c $(OBJDIR)/clearsign.h $(SRCDIR)/config.h
11051152
$(XTCC) -o $(OBJDIR)/clearsign.o -c $(OBJDIR)/clearsign_.c
11061153
11071154
$(OBJDIR)/clearsign.h: $(OBJDIR)/headers
11081155
11091156
$(OBJDIR)/clone_.c: $(SRCDIR)/clone.c $(TRANSLATE)
1110
- $(TRANSLATE) $(SRCDIR)/clone.c >$(OBJDIR)/clone_.c
1157
+ $(TRANSLATE) $(SRCDIR)/clone.c >$@
11111158
11121159
$(OBJDIR)/clone.o: $(OBJDIR)/clone_.c $(OBJDIR)/clone.h $(SRCDIR)/config.h
11131160
$(XTCC) -o $(OBJDIR)/clone.o -c $(OBJDIR)/clone_.c
11141161
11151162
$(OBJDIR)/clone.h: $(OBJDIR)/headers
11161163
11171164
$(OBJDIR)/comformat_.c: $(SRCDIR)/comformat.c $(TRANSLATE)
1118
- $(TRANSLATE) $(SRCDIR)/comformat.c >$(OBJDIR)/comformat_.c
1165
+ $(TRANSLATE) $(SRCDIR)/comformat.c >$@
11191166
11201167
$(OBJDIR)/comformat.o: $(OBJDIR)/comformat_.c $(OBJDIR)/comformat.h $(SRCDIR)/config.h
11211168
$(XTCC) -o $(OBJDIR)/comformat.o -c $(OBJDIR)/comformat_.c
11221169
11231170
$(OBJDIR)/comformat.h: $(OBJDIR)/headers
11241171
11251172
$(OBJDIR)/configure_.c: $(SRCDIR)/configure.c $(TRANSLATE)
1126
- $(TRANSLATE) $(SRCDIR)/configure.c >$(OBJDIR)/configure_.c
1173
+ $(TRANSLATE) $(SRCDIR)/configure.c >$@
11271174
11281175
$(OBJDIR)/configure.o: $(OBJDIR)/configure_.c $(OBJDIR)/configure.h $(SRCDIR)/config.h
11291176
$(XTCC) -o $(OBJDIR)/configure.o -c $(OBJDIR)/configure_.c
11301177
11311178
$(OBJDIR)/configure.h: $(OBJDIR)/headers
11321179
11331180
$(OBJDIR)/content_.c: $(SRCDIR)/content.c $(TRANSLATE)
1134
- $(TRANSLATE) $(SRCDIR)/content.c >$(OBJDIR)/content_.c
1181
+ $(TRANSLATE) $(SRCDIR)/content.c >$@
11351182
11361183
$(OBJDIR)/content.o: $(OBJDIR)/content_.c $(OBJDIR)/content.h $(SRCDIR)/config.h
11371184
$(XTCC) -o $(OBJDIR)/content.o -c $(OBJDIR)/content_.c
11381185
11391186
$(OBJDIR)/content.h: $(OBJDIR)/headers
11401187
11411188
$(OBJDIR)/db_.c: $(SRCDIR)/db.c $(TRANSLATE)
1142
- $(TRANSLATE) $(SRCDIR)/db.c >$(OBJDIR)/db_.c
1189
+ $(TRANSLATE) $(SRCDIR)/db.c >$@
11431190
11441191
$(OBJDIR)/db.o: $(OBJDIR)/db_.c $(OBJDIR)/db.h $(SRCDIR)/config.h
11451192
$(XTCC) -o $(OBJDIR)/db.o -c $(OBJDIR)/db_.c
11461193
11471194
$(OBJDIR)/db.h: $(OBJDIR)/headers
11481195
11491196
$(OBJDIR)/delta_.c: $(SRCDIR)/delta.c $(TRANSLATE)
1150
- $(TRANSLATE) $(SRCDIR)/delta.c >$(OBJDIR)/delta_.c
1197
+ $(TRANSLATE) $(SRCDIR)/delta.c >$@
11511198
11521199
$(OBJDIR)/delta.o: $(OBJDIR)/delta_.c $(OBJDIR)/delta.h $(SRCDIR)/config.h
11531200
$(XTCC) -o $(OBJDIR)/delta.o -c $(OBJDIR)/delta_.c
11541201
11551202
$(OBJDIR)/delta.h: $(OBJDIR)/headers
11561203
11571204
$(OBJDIR)/deltacmd_.c: $(SRCDIR)/deltacmd.c $(TRANSLATE)
1158
- $(TRANSLATE) $(SRCDIR)/deltacmd.c >$(OBJDIR)/deltacmd_.c
1205
+ $(TRANSLATE) $(SRCDIR)/deltacmd.c >$@
11591206
11601207
$(OBJDIR)/deltacmd.o: $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h $(SRCDIR)/config.h
11611208
$(XTCC) -o $(OBJDIR)/deltacmd.o -c $(OBJDIR)/deltacmd_.c
11621209
11631210
$(OBJDIR)/deltacmd.h: $(OBJDIR)/headers
11641211
11651212
$(OBJDIR)/descendants_.c: $(SRCDIR)/descendants.c $(TRANSLATE)
1166
- $(TRANSLATE) $(SRCDIR)/descendants.c >$(OBJDIR)/descendants_.c
1213
+ $(TRANSLATE) $(SRCDIR)/descendants.c >$@
11671214
11681215
$(OBJDIR)/descendants.o: $(OBJDIR)/descendants_.c $(OBJDIR)/descendants.h $(SRCDIR)/config.h
11691216
$(XTCC) -o $(OBJDIR)/descendants.o -c $(OBJDIR)/descendants_.c
11701217
11711218
$(OBJDIR)/descendants.h: $(OBJDIR)/headers
11721219
11731220
$(OBJDIR)/diff_.c: $(SRCDIR)/diff.c $(TRANSLATE)
1174
- $(TRANSLATE) $(SRCDIR)/diff.c >$(OBJDIR)/diff_.c
1221
+ $(TRANSLATE) $(SRCDIR)/diff.c >$@
11751222
11761223
$(OBJDIR)/diff.o: $(OBJDIR)/diff_.c $(OBJDIR)/diff.h $(SRCDIR)/config.h
11771224
$(XTCC) -o $(OBJDIR)/diff.o -c $(OBJDIR)/diff_.c
11781225
11791226
$(OBJDIR)/diff.h: $(OBJDIR)/headers
11801227
11811228
$(OBJDIR)/diffcmd_.c: $(SRCDIR)/diffcmd.c $(TRANSLATE)
1182
- $(TRANSLATE) $(SRCDIR)/diffcmd.c >$(OBJDIR)/diffcmd_.c
1229
+ $(TRANSLATE) $(SRCDIR)/diffcmd.c >$@
11831230
11841231
$(OBJDIR)/diffcmd.o: $(OBJDIR)/diffcmd_.c $(OBJDIR)/diffcmd.h $(SRCDIR)/config.h
11851232
$(XTCC) -o $(OBJDIR)/diffcmd.o -c $(OBJDIR)/diffcmd_.c
11861233
11871234
$(OBJDIR)/diffcmd.h: $(OBJDIR)/headers
11881235
11891236
$(OBJDIR)/doc_.c: $(SRCDIR)/doc.c $(TRANSLATE)
1190
- $(TRANSLATE) $(SRCDIR)/doc.c >$(OBJDIR)/doc_.c
1237
+ $(TRANSLATE) $(SRCDIR)/doc.c >$@
11911238
11921239
$(OBJDIR)/doc.o: $(OBJDIR)/doc_.c $(OBJDIR)/doc.h $(SRCDIR)/config.h
11931240
$(XTCC) -o $(OBJDIR)/doc.o -c $(OBJDIR)/doc_.c
11941241
11951242
$(OBJDIR)/doc.h: $(OBJDIR)/headers
11961243
11971244
$(OBJDIR)/encode_.c: $(SRCDIR)/encode.c $(TRANSLATE)
1198
- $(TRANSLATE) $(SRCDIR)/encode.c >$(OBJDIR)/encode_.c
1245
+ $(TRANSLATE) $(SRCDIR)/encode.c >$@
11991246
12001247
$(OBJDIR)/encode.o: $(OBJDIR)/encode_.c $(OBJDIR)/encode.h $(SRCDIR)/config.h
12011248
$(XTCC) -o $(OBJDIR)/encode.o -c $(OBJDIR)/encode_.c
12021249
12031250
$(OBJDIR)/encode.h: $(OBJDIR)/headers
12041251
12051252
$(OBJDIR)/event_.c: $(SRCDIR)/event.c $(TRANSLATE)
1206
- $(TRANSLATE) $(SRCDIR)/event.c >$(OBJDIR)/event_.c
1253
+ $(TRANSLATE) $(SRCDIR)/event.c >$@
12071254
12081255
$(OBJDIR)/event.o: $(OBJDIR)/event_.c $(OBJDIR)/event.h $(SRCDIR)/config.h
12091256
$(XTCC) -o $(OBJDIR)/event.o -c $(OBJDIR)/event_.c
12101257
12111258
$(OBJDIR)/event.h: $(OBJDIR)/headers
12121259
12131260
$(OBJDIR)/export_.c: $(SRCDIR)/export.c $(TRANSLATE)
1214
- $(TRANSLATE) $(SRCDIR)/export.c >$(OBJDIR)/export_.c
1261
+ $(TRANSLATE) $(SRCDIR)/export.c >$@
12151262
12161263
$(OBJDIR)/export.o: $(OBJDIR)/export_.c $(OBJDIR)/export.h $(SRCDIR)/config.h
12171264
$(XTCC) -o $(OBJDIR)/export.o -c $(OBJDIR)/export_.c
12181265
12191266
$(OBJDIR)/export.h: $(OBJDIR)/headers
12201267
12211268
$(OBJDIR)/file_.c: $(SRCDIR)/file.c $(TRANSLATE)
1222
- $(TRANSLATE) $(SRCDIR)/file.c >$(OBJDIR)/file_.c
1269
+ $(TRANSLATE) $(SRCDIR)/file.c >$@
12231270
12241271
$(OBJDIR)/file.o: $(OBJDIR)/file_.c $(OBJDIR)/file.h $(SRCDIR)/config.h
12251272
$(XTCC) -o $(OBJDIR)/file.o -c $(OBJDIR)/file_.c
12261273
12271274
$(OBJDIR)/file.h: $(OBJDIR)/headers
12281275
12291276
$(OBJDIR)/finfo_.c: $(SRCDIR)/finfo.c $(TRANSLATE)
1230
- $(TRANSLATE) $(SRCDIR)/finfo.c >$(OBJDIR)/finfo_.c
1277
+ $(TRANSLATE) $(SRCDIR)/finfo.c >$@
12311278
12321279
$(OBJDIR)/finfo.o: $(OBJDIR)/finfo_.c $(OBJDIR)/finfo.h $(SRCDIR)/config.h
12331280
$(XTCC) -o $(OBJDIR)/finfo.o -c $(OBJDIR)/finfo_.c
12341281
12351282
$(OBJDIR)/finfo.h: $(OBJDIR)/headers
1283
+
1284
+$(OBJDIR)/foci_.c: $(SRCDIR)/foci.c $(TRANSLATE)
1285
+ $(TRANSLATE) $(SRCDIR)/foci.c >$@
1286
+
1287
+$(OBJDIR)/foci.o: $(OBJDIR)/foci_.c $(OBJDIR)/foci.h $(SRCDIR)/config.h
1288
+ $(XTCC) -o $(OBJDIR)/foci.o -c $(OBJDIR)/foci_.c
1289
+
1290
+$(OBJDIR)/foci.h: $(OBJDIR)/headers
12361291
12371292
$(OBJDIR)/fusefs_.c: $(SRCDIR)/fusefs.c $(TRANSLATE)
1238
- $(TRANSLATE) $(SRCDIR)/fusefs.c >$(OBJDIR)/fusefs_.c
1293
+ $(TRANSLATE) $(SRCDIR)/fusefs.c >$@
12391294
12401295
$(OBJDIR)/fusefs.o: $(OBJDIR)/fusefs_.c $(OBJDIR)/fusefs.h $(SRCDIR)/config.h
12411296
$(XTCC) -o $(OBJDIR)/fusefs.o -c $(OBJDIR)/fusefs_.c
12421297
12431298
$(OBJDIR)/fusefs.h: $(OBJDIR)/headers
12441299
12451300
$(OBJDIR)/glob_.c: $(SRCDIR)/glob.c $(TRANSLATE)
1246
- $(TRANSLATE) $(SRCDIR)/glob.c >$(OBJDIR)/glob_.c
1301
+ $(TRANSLATE) $(SRCDIR)/glob.c >$@
12471302
12481303
$(OBJDIR)/glob.o: $(OBJDIR)/glob_.c $(OBJDIR)/glob.h $(SRCDIR)/config.h
12491304
$(XTCC) -o $(OBJDIR)/glob.o -c $(OBJDIR)/glob_.c
12501305
12511306
$(OBJDIR)/glob.h: $(OBJDIR)/headers
12521307
12531308
$(OBJDIR)/graph_.c: $(SRCDIR)/graph.c $(TRANSLATE)
1254
- $(TRANSLATE) $(SRCDIR)/graph.c >$(OBJDIR)/graph_.c
1309
+ $(TRANSLATE) $(SRCDIR)/graph.c >$@
12551310
12561311
$(OBJDIR)/graph.o: $(OBJDIR)/graph_.c $(OBJDIR)/graph.h $(SRCDIR)/config.h
12571312
$(XTCC) -o $(OBJDIR)/graph.o -c $(OBJDIR)/graph_.c
12581313
12591314
$(OBJDIR)/graph.h: $(OBJDIR)/headers
12601315
12611316
$(OBJDIR)/gzip_.c: $(SRCDIR)/gzip.c $(TRANSLATE)
1262
- $(TRANSLATE) $(SRCDIR)/gzip.c >$(OBJDIR)/gzip_.c
1317
+ $(TRANSLATE) $(SRCDIR)/gzip.c >$@
12631318
12641319
$(OBJDIR)/gzip.o: $(OBJDIR)/gzip_.c $(OBJDIR)/gzip.h $(SRCDIR)/config.h
12651320
$(XTCC) -o $(OBJDIR)/gzip.o -c $(OBJDIR)/gzip_.c
12661321
12671322
$(OBJDIR)/gzip.h: $(OBJDIR)/headers
12681323
12691324
$(OBJDIR)/http_.c: $(SRCDIR)/http.c $(TRANSLATE)
1270
- $(TRANSLATE) $(SRCDIR)/http.c >$(OBJDIR)/http_.c
1325
+ $(TRANSLATE) $(SRCDIR)/http.c >$@
12711326
12721327
$(OBJDIR)/http.o: $(OBJDIR)/http_.c $(OBJDIR)/http.h $(SRCDIR)/config.h
12731328
$(XTCC) -o $(OBJDIR)/http.o -c $(OBJDIR)/http_.c
12741329
12751330
$(OBJDIR)/http.h: $(OBJDIR)/headers
12761331
12771332
$(OBJDIR)/http_socket_.c: $(SRCDIR)/http_socket.c $(TRANSLATE)
1278
- $(TRANSLATE) $(SRCDIR)/http_socket.c >$(OBJDIR)/http_socket_.c
1333
+ $(TRANSLATE) $(SRCDIR)/http_socket.c >$@
12791334
12801335
$(OBJDIR)/http_socket.o: $(OBJDIR)/http_socket_.c $(OBJDIR)/http_socket.h $(SRCDIR)/config.h
12811336
$(XTCC) -o $(OBJDIR)/http_socket.o -c $(OBJDIR)/http_socket_.c
12821337
12831338
$(OBJDIR)/http_socket.h: $(OBJDIR)/headers
12841339
12851340
$(OBJDIR)/http_ssl_.c: $(SRCDIR)/http_ssl.c $(TRANSLATE)
1286
- $(TRANSLATE) $(SRCDIR)/http_ssl.c >$(OBJDIR)/http_ssl_.c
1341
+ $(TRANSLATE) $(SRCDIR)/http_ssl.c >$@
12871342
12881343
$(OBJDIR)/http_ssl.o: $(OBJDIR)/http_ssl_.c $(OBJDIR)/http_ssl.h $(SRCDIR)/config.h
12891344
$(XTCC) -o $(OBJDIR)/http_ssl.o -c $(OBJDIR)/http_ssl_.c
12901345
12911346
$(OBJDIR)/http_ssl.h: $(OBJDIR)/headers
12921347
12931348
$(OBJDIR)/http_transport_.c: $(SRCDIR)/http_transport.c $(TRANSLATE)
1294
- $(TRANSLATE) $(SRCDIR)/http_transport.c >$(OBJDIR)/http_transport_.c
1349
+ $(TRANSLATE) $(SRCDIR)/http_transport.c >$@
12951350
12961351
$(OBJDIR)/http_transport.o: $(OBJDIR)/http_transport_.c $(OBJDIR)/http_transport.h $(SRCDIR)/config.h
12971352
$(XTCC) -o $(OBJDIR)/http_transport.o -c $(OBJDIR)/http_transport_.c
12981353
12991354
$(OBJDIR)/http_transport.h: $(OBJDIR)/headers
13001355
13011356
$(OBJDIR)/import_.c: $(SRCDIR)/import.c $(TRANSLATE)
1302
- $(TRANSLATE) $(SRCDIR)/import.c >$(OBJDIR)/import_.c
1357
+ $(TRANSLATE) $(SRCDIR)/import.c >$@
13031358
13041359
$(OBJDIR)/import.o: $(OBJDIR)/import_.c $(OBJDIR)/import.h $(SRCDIR)/config.h
13051360
$(XTCC) -o $(OBJDIR)/import.o -c $(OBJDIR)/import_.c
13061361
13071362
$(OBJDIR)/import.h: $(OBJDIR)/headers
13081363
13091364
$(OBJDIR)/info_.c: $(SRCDIR)/info.c $(TRANSLATE)
1310
- $(TRANSLATE) $(SRCDIR)/info.c >$(OBJDIR)/info_.c
1365
+ $(TRANSLATE) $(SRCDIR)/info.c >$@
13111366
13121367
$(OBJDIR)/info.o: $(OBJDIR)/info_.c $(OBJDIR)/info.h $(SRCDIR)/config.h
13131368
$(XTCC) -o $(OBJDIR)/info.o -c $(OBJDIR)/info_.c
13141369
13151370
$(OBJDIR)/info.h: $(OBJDIR)/headers
13161371
13171372
$(OBJDIR)/json_.c: $(SRCDIR)/json.c $(TRANSLATE)
1318
- $(TRANSLATE) $(SRCDIR)/json.c >$(OBJDIR)/json_.c
1373
+ $(TRANSLATE) $(SRCDIR)/json.c >$@
13191374
13201375
$(OBJDIR)/json.o: $(OBJDIR)/json_.c $(OBJDIR)/json.h $(SRCDIR)/config.h
13211376
$(XTCC) -o $(OBJDIR)/json.o -c $(OBJDIR)/json_.c
13221377
13231378
$(OBJDIR)/json.h: $(OBJDIR)/headers
13241379
13251380
$(OBJDIR)/json_artifact_.c: $(SRCDIR)/json_artifact.c $(TRANSLATE)
1326
- $(TRANSLATE) $(SRCDIR)/json_artifact.c >$(OBJDIR)/json_artifact_.c
1381
+ $(TRANSLATE) $(SRCDIR)/json_artifact.c >$@
13271382
13281383
$(OBJDIR)/json_artifact.o: $(OBJDIR)/json_artifact_.c $(OBJDIR)/json_artifact.h $(SRCDIR)/config.h
13291384
$(XTCC) -o $(OBJDIR)/json_artifact.o -c $(OBJDIR)/json_artifact_.c
13301385
13311386
$(OBJDIR)/json_artifact.h: $(OBJDIR)/headers
13321387
13331388
$(OBJDIR)/json_branch_.c: $(SRCDIR)/json_branch.c $(TRANSLATE)
1334
- $(TRANSLATE) $(SRCDIR)/json_branch.c >$(OBJDIR)/json_branch_.c
1389
+ $(TRANSLATE) $(SRCDIR)/json_branch.c >$@
13351390
13361391
$(OBJDIR)/json_branch.o: $(OBJDIR)/json_branch_.c $(OBJDIR)/json_branch.h $(SRCDIR)/config.h
13371392
$(XTCC) -o $(OBJDIR)/json_branch.o -c $(OBJDIR)/json_branch_.c
13381393
13391394
$(OBJDIR)/json_branch.h: $(OBJDIR)/headers
13401395
13411396
$(OBJDIR)/json_config_.c: $(SRCDIR)/json_config.c $(TRANSLATE)
1342
- $(TRANSLATE) $(SRCDIR)/json_config.c >$(OBJDIR)/json_config_.c
1397
+ $(TRANSLATE) $(SRCDIR)/json_config.c >$@
13431398
13441399
$(OBJDIR)/json_config.o: $(OBJDIR)/json_config_.c $(OBJDIR)/json_config.h $(SRCDIR)/config.h
13451400
$(XTCC) -o $(OBJDIR)/json_config.o -c $(OBJDIR)/json_config_.c
13461401
13471402
$(OBJDIR)/json_config.h: $(OBJDIR)/headers
13481403
13491404
$(OBJDIR)/json_diff_.c: $(SRCDIR)/json_diff.c $(TRANSLATE)
1350
- $(TRANSLATE) $(SRCDIR)/json_diff.c >$(OBJDIR)/json_diff_.c
1405
+ $(TRANSLATE) $(SRCDIR)/json_diff.c >$@
13511406
13521407
$(OBJDIR)/json_diff.o: $(OBJDIR)/json_diff_.c $(OBJDIR)/json_diff.h $(SRCDIR)/config.h
13531408
$(XTCC) -o $(OBJDIR)/json_diff.o -c $(OBJDIR)/json_diff_.c
13541409
13551410
$(OBJDIR)/json_diff.h: $(OBJDIR)/headers
13561411
13571412
$(OBJDIR)/json_dir_.c: $(SRCDIR)/json_dir.c $(TRANSLATE)
1358
- $(TRANSLATE) $(SRCDIR)/json_dir.c >$(OBJDIR)/json_dir_.c
1413
+ $(TRANSLATE) $(SRCDIR)/json_dir.c >$@
13591414
13601415
$(OBJDIR)/json_dir.o: $(OBJDIR)/json_dir_.c $(OBJDIR)/json_dir.h $(SRCDIR)/config.h
13611416
$(XTCC) -o $(OBJDIR)/json_dir.o -c $(OBJDIR)/json_dir_.c
13621417
13631418
$(OBJDIR)/json_dir.h: $(OBJDIR)/headers
13641419
13651420
$(OBJDIR)/json_finfo_.c: $(SRCDIR)/json_finfo.c $(TRANSLATE)
1366
- $(TRANSLATE) $(SRCDIR)/json_finfo.c >$(OBJDIR)/json_finfo_.c
1421
+ $(TRANSLATE) $(SRCDIR)/json_finfo.c >$@
13671422
13681423
$(OBJDIR)/json_finfo.o: $(OBJDIR)/json_finfo_.c $(OBJDIR)/json_finfo.h $(SRCDIR)/config.h
13691424
$(XTCC) -o $(OBJDIR)/json_finfo.o -c $(OBJDIR)/json_finfo_.c
13701425
13711426
$(OBJDIR)/json_finfo.h: $(OBJDIR)/headers
13721427
13731428
$(OBJDIR)/json_login_.c: $(SRCDIR)/json_login.c $(TRANSLATE)
1374
- $(TRANSLATE) $(SRCDIR)/json_login.c >$(OBJDIR)/json_login_.c
1429
+ $(TRANSLATE) $(SRCDIR)/json_login.c >$@
13751430
13761431
$(OBJDIR)/json_login.o: $(OBJDIR)/json_login_.c $(OBJDIR)/json_login.h $(SRCDIR)/config.h
13771432
$(XTCC) -o $(OBJDIR)/json_login.o -c $(OBJDIR)/json_login_.c
13781433
13791434
$(OBJDIR)/json_login.h: $(OBJDIR)/headers
13801435
13811436
$(OBJDIR)/json_query_.c: $(SRCDIR)/json_query.c $(TRANSLATE)
1382
- $(TRANSLATE) $(SRCDIR)/json_query.c >$(OBJDIR)/json_query_.c
1437
+ $(TRANSLATE) $(SRCDIR)/json_query.c >$@
13831438
13841439
$(OBJDIR)/json_query.o: $(OBJDIR)/json_query_.c $(OBJDIR)/json_query.h $(SRCDIR)/config.h
13851440
$(XTCC) -o $(OBJDIR)/json_query.o -c $(OBJDIR)/json_query_.c
13861441
13871442
$(OBJDIR)/json_query.h: $(OBJDIR)/headers
13881443
13891444
$(OBJDIR)/json_report_.c: $(SRCDIR)/json_report.c $(TRANSLATE)
1390
- $(TRANSLATE) $(SRCDIR)/json_report.c >$(OBJDIR)/json_report_.c
1445
+ $(TRANSLATE) $(SRCDIR)/json_report.c >$@
13911446
13921447
$(OBJDIR)/json_report.o: $(OBJDIR)/json_report_.c $(OBJDIR)/json_report.h $(SRCDIR)/config.h
13931448
$(XTCC) -o $(OBJDIR)/json_report.o -c $(OBJDIR)/json_report_.c
13941449
13951450
$(OBJDIR)/json_report.h: $(OBJDIR)/headers
13961451
13971452
$(OBJDIR)/json_status_.c: $(SRCDIR)/json_status.c $(TRANSLATE)
1398
- $(TRANSLATE) $(SRCDIR)/json_status.c >$(OBJDIR)/json_status_.c
1453
+ $(TRANSLATE) $(SRCDIR)/json_status.c >$@
13991454
14001455
$(OBJDIR)/json_status.o: $(OBJDIR)/json_status_.c $(OBJDIR)/json_status.h $(SRCDIR)/config.h
14011456
$(XTCC) -o $(OBJDIR)/json_status.o -c $(OBJDIR)/json_status_.c
14021457
14031458
$(OBJDIR)/json_status.h: $(OBJDIR)/headers
14041459
14051460
$(OBJDIR)/json_tag_.c: $(SRCDIR)/json_tag.c $(TRANSLATE)
1406
- $(TRANSLATE) $(SRCDIR)/json_tag.c >$(OBJDIR)/json_tag_.c
1461
+ $(TRANSLATE) $(SRCDIR)/json_tag.c >$@
14071462
14081463
$(OBJDIR)/json_tag.o: $(OBJDIR)/json_tag_.c $(OBJDIR)/json_tag.h $(SRCDIR)/config.h
14091464
$(XTCC) -o $(OBJDIR)/json_tag.o -c $(OBJDIR)/json_tag_.c
14101465
14111466
$(OBJDIR)/json_tag.h: $(OBJDIR)/headers
14121467
14131468
$(OBJDIR)/json_timeline_.c: $(SRCDIR)/json_timeline.c $(TRANSLATE)
1414
- $(TRANSLATE) $(SRCDIR)/json_timeline.c >$(OBJDIR)/json_timeline_.c
1469
+ $(TRANSLATE) $(SRCDIR)/json_timeline.c >$@
14151470
14161471
$(OBJDIR)/json_timeline.o: $(OBJDIR)/json_timeline_.c $(OBJDIR)/json_timeline.h $(SRCDIR)/config.h
14171472
$(XTCC) -o $(OBJDIR)/json_timeline.o -c $(OBJDIR)/json_timeline_.c
14181473
14191474
$(OBJDIR)/json_timeline.h: $(OBJDIR)/headers
14201475
14211476
$(OBJDIR)/json_user_.c: $(SRCDIR)/json_user.c $(TRANSLATE)
1422
- $(TRANSLATE) $(SRCDIR)/json_user.c >$(OBJDIR)/json_user_.c
1477
+ $(TRANSLATE) $(SRCDIR)/json_user.c >$@
14231478
14241479
$(OBJDIR)/json_user.o: $(OBJDIR)/json_user_.c $(OBJDIR)/json_user.h $(SRCDIR)/config.h
14251480
$(XTCC) -o $(OBJDIR)/json_user.o -c $(OBJDIR)/json_user_.c
14261481
14271482
$(OBJDIR)/json_user.h: $(OBJDIR)/headers
14281483
14291484
$(OBJDIR)/json_wiki_.c: $(SRCDIR)/json_wiki.c $(TRANSLATE)
1430
- $(TRANSLATE) $(SRCDIR)/json_wiki.c >$(OBJDIR)/json_wiki_.c
1485
+ $(TRANSLATE) $(SRCDIR)/json_wiki.c >$@
14311486
14321487
$(OBJDIR)/json_wiki.o: $(OBJDIR)/json_wiki_.c $(OBJDIR)/json_wiki.h $(SRCDIR)/config.h
14331488
$(XTCC) -o $(OBJDIR)/json_wiki.o -c $(OBJDIR)/json_wiki_.c
14341489
14351490
$(OBJDIR)/json_wiki.h: $(OBJDIR)/headers
14361491
14371492
$(OBJDIR)/leaf_.c: $(SRCDIR)/leaf.c $(TRANSLATE)
1438
- $(TRANSLATE) $(SRCDIR)/leaf.c >$(OBJDIR)/leaf_.c
1493
+ $(TRANSLATE) $(SRCDIR)/leaf.c >$@
14391494
14401495
$(OBJDIR)/leaf.o: $(OBJDIR)/leaf_.c $(OBJDIR)/leaf.h $(SRCDIR)/config.h
14411496
$(XTCC) -o $(OBJDIR)/leaf.o -c $(OBJDIR)/leaf_.c
14421497
14431498
$(OBJDIR)/leaf.h: $(OBJDIR)/headers
14441499
14451500
$(OBJDIR)/loadctrl_.c: $(SRCDIR)/loadctrl.c $(TRANSLATE)
1446
- $(TRANSLATE) $(SRCDIR)/loadctrl.c >$(OBJDIR)/loadctrl_.c
1501
+ $(TRANSLATE) $(SRCDIR)/loadctrl.c >$@
14471502
14481503
$(OBJDIR)/loadctrl.o: $(OBJDIR)/loadctrl_.c $(OBJDIR)/loadctrl.h $(SRCDIR)/config.h
14491504
$(XTCC) -o $(OBJDIR)/loadctrl.o -c $(OBJDIR)/loadctrl_.c
14501505
14511506
$(OBJDIR)/loadctrl.h: $(OBJDIR)/headers
14521507
14531508
$(OBJDIR)/login_.c: $(SRCDIR)/login.c $(TRANSLATE)
1454
- $(TRANSLATE) $(SRCDIR)/login.c >$(OBJDIR)/login_.c
1509
+ $(TRANSLATE) $(SRCDIR)/login.c >$@
14551510
14561511
$(OBJDIR)/login.o: $(OBJDIR)/login_.c $(OBJDIR)/login.h $(SRCDIR)/config.h
14571512
$(XTCC) -o $(OBJDIR)/login.o -c $(OBJDIR)/login_.c
14581513
14591514
$(OBJDIR)/login.h: $(OBJDIR)/headers
14601515
14611516
$(OBJDIR)/lookslike_.c: $(SRCDIR)/lookslike.c $(TRANSLATE)
1462
- $(TRANSLATE) $(SRCDIR)/lookslike.c >$(OBJDIR)/lookslike_.c
1517
+ $(TRANSLATE) $(SRCDIR)/lookslike.c >$@
14631518
14641519
$(OBJDIR)/lookslike.o: $(OBJDIR)/lookslike_.c $(OBJDIR)/lookslike.h $(SRCDIR)/config.h
14651520
$(XTCC) -o $(OBJDIR)/lookslike.o -c $(OBJDIR)/lookslike_.c
14661521
14671522
$(OBJDIR)/lookslike.h: $(OBJDIR)/headers
14681523
14691524
$(OBJDIR)/main_.c: $(SRCDIR)/main.c $(TRANSLATE)
1470
- $(TRANSLATE) $(SRCDIR)/main.c >$(OBJDIR)/main_.c
1525
+ $(TRANSLATE) $(SRCDIR)/main.c >$@
14711526
14721527
$(OBJDIR)/main.o: $(OBJDIR)/main_.c $(OBJDIR)/main.h $(OBJDIR)/page_index.h $(SRCDIR)/config.h
14731528
$(XTCC) -o $(OBJDIR)/main.o -c $(OBJDIR)/main_.c
14741529
14751530
$(OBJDIR)/main.h: $(OBJDIR)/headers
14761531
14771532
$(OBJDIR)/manifest_.c: $(SRCDIR)/manifest.c $(TRANSLATE)
1478
- $(TRANSLATE) $(SRCDIR)/manifest.c >$(OBJDIR)/manifest_.c
1533
+ $(TRANSLATE) $(SRCDIR)/manifest.c >$@
14791534
14801535
$(OBJDIR)/manifest.o: $(OBJDIR)/manifest_.c $(OBJDIR)/manifest.h $(SRCDIR)/config.h
14811536
$(XTCC) -o $(OBJDIR)/manifest.o -c $(OBJDIR)/manifest_.c
14821537
14831538
$(OBJDIR)/manifest.h: $(OBJDIR)/headers
14841539
14851540
$(OBJDIR)/markdown_.c: $(SRCDIR)/markdown.c $(TRANSLATE)
1486
- $(TRANSLATE) $(SRCDIR)/markdown.c >$(OBJDIR)/markdown_.c
1541
+ $(TRANSLATE) $(SRCDIR)/markdown.c >$@
14871542
14881543
$(OBJDIR)/markdown.o: $(OBJDIR)/markdown_.c $(OBJDIR)/markdown.h $(SRCDIR)/config.h
14891544
$(XTCC) -o $(OBJDIR)/markdown.o -c $(OBJDIR)/markdown_.c
14901545
14911546
$(OBJDIR)/markdown.h: $(OBJDIR)/headers
14921547
14931548
$(OBJDIR)/markdown_html_.c: $(SRCDIR)/markdown_html.c $(TRANSLATE)
1494
- $(TRANSLATE) $(SRCDIR)/markdown_html.c >$(OBJDIR)/markdown_html_.c
1549
+ $(TRANSLATE) $(SRCDIR)/markdown_html.c >$@
14951550
14961551
$(OBJDIR)/markdown_html.o: $(OBJDIR)/markdown_html_.c $(OBJDIR)/markdown_html.h $(SRCDIR)/config.h
14971552
$(XTCC) -o $(OBJDIR)/markdown_html.o -c $(OBJDIR)/markdown_html_.c
14981553
14991554
$(OBJDIR)/markdown_html.h: $(OBJDIR)/headers
15001555
15011556
$(OBJDIR)/md5_.c: $(SRCDIR)/md5.c $(TRANSLATE)
1502
- $(TRANSLATE) $(SRCDIR)/md5.c >$(OBJDIR)/md5_.c
1557
+ $(TRANSLATE) $(SRCDIR)/md5.c >$@
15031558
15041559
$(OBJDIR)/md5.o: $(OBJDIR)/md5_.c $(OBJDIR)/md5.h $(SRCDIR)/config.h
15051560
$(XTCC) -o $(OBJDIR)/md5.o -c $(OBJDIR)/md5_.c
15061561
15071562
$(OBJDIR)/md5.h: $(OBJDIR)/headers
15081563
15091564
$(OBJDIR)/merge_.c: $(SRCDIR)/merge.c $(TRANSLATE)
1510
- $(TRANSLATE) $(SRCDIR)/merge.c >$(OBJDIR)/merge_.c
1565
+ $(TRANSLATE) $(SRCDIR)/merge.c >$@
15111566
15121567
$(OBJDIR)/merge.o: $(OBJDIR)/merge_.c $(OBJDIR)/merge.h $(SRCDIR)/config.h
15131568
$(XTCC) -o $(OBJDIR)/merge.o -c $(OBJDIR)/merge_.c
15141569
15151570
$(OBJDIR)/merge.h: $(OBJDIR)/headers
15161571
15171572
$(OBJDIR)/merge3_.c: $(SRCDIR)/merge3.c $(TRANSLATE)
1518
- $(TRANSLATE) $(SRCDIR)/merge3.c >$(OBJDIR)/merge3_.c
1573
+ $(TRANSLATE) $(SRCDIR)/merge3.c >$@
15191574
15201575
$(OBJDIR)/merge3.o: $(OBJDIR)/merge3_.c $(OBJDIR)/merge3.h $(SRCDIR)/config.h
15211576
$(XTCC) -o $(OBJDIR)/merge3.o -c $(OBJDIR)/merge3_.c
15221577
15231578
$(OBJDIR)/merge3.h: $(OBJDIR)/headers
15241579
15251580
$(OBJDIR)/moderate_.c: $(SRCDIR)/moderate.c $(TRANSLATE)
1526
- $(TRANSLATE) $(SRCDIR)/moderate.c >$(OBJDIR)/moderate_.c
1581
+ $(TRANSLATE) $(SRCDIR)/moderate.c >$@
15271582
15281583
$(OBJDIR)/moderate.o: $(OBJDIR)/moderate_.c $(OBJDIR)/moderate.h $(SRCDIR)/config.h
15291584
$(XTCC) -o $(OBJDIR)/moderate.o -c $(OBJDIR)/moderate_.c
15301585
15311586
$(OBJDIR)/moderate.h: $(OBJDIR)/headers
15321587
15331588
$(OBJDIR)/name_.c: $(SRCDIR)/name.c $(TRANSLATE)
1534
- $(TRANSLATE) $(SRCDIR)/name.c >$(OBJDIR)/name_.c
1589
+ $(TRANSLATE) $(SRCDIR)/name.c >$@
15351590
15361591
$(OBJDIR)/name.o: $(OBJDIR)/name_.c $(OBJDIR)/name.h $(SRCDIR)/config.h
15371592
$(XTCC) -o $(OBJDIR)/name.o -c $(OBJDIR)/name_.c
15381593
15391594
$(OBJDIR)/name.h: $(OBJDIR)/headers
15401595
15411596
$(OBJDIR)/path_.c: $(SRCDIR)/path.c $(TRANSLATE)
1542
- $(TRANSLATE) $(SRCDIR)/path.c >$(OBJDIR)/path_.c
1597
+ $(TRANSLATE) $(SRCDIR)/path.c >$@
15431598
15441599
$(OBJDIR)/path.o: $(OBJDIR)/path_.c $(OBJDIR)/path.h $(SRCDIR)/config.h
15451600
$(XTCC) -o $(OBJDIR)/path.o -c $(OBJDIR)/path_.c
15461601
15471602
$(OBJDIR)/path.h: $(OBJDIR)/headers
15481603
15491604
$(OBJDIR)/pivot_.c: $(SRCDIR)/pivot.c $(TRANSLATE)
1550
- $(TRANSLATE) $(SRCDIR)/pivot.c >$(OBJDIR)/pivot_.c
1605
+ $(TRANSLATE) $(SRCDIR)/pivot.c >$@
15511606
15521607
$(OBJDIR)/pivot.o: $(OBJDIR)/pivot_.c $(OBJDIR)/pivot.h $(SRCDIR)/config.h
15531608
$(XTCC) -o $(OBJDIR)/pivot.o -c $(OBJDIR)/pivot_.c
15541609
15551610
$(OBJDIR)/pivot.h: $(OBJDIR)/headers
15561611
15571612
$(OBJDIR)/popen_.c: $(SRCDIR)/popen.c $(TRANSLATE)
1558
- $(TRANSLATE) $(SRCDIR)/popen.c >$(OBJDIR)/popen_.c
1613
+ $(TRANSLATE) $(SRCDIR)/popen.c >$@
15591614
15601615
$(OBJDIR)/popen.o: $(OBJDIR)/popen_.c $(OBJDIR)/popen.h $(SRCDIR)/config.h
15611616
$(XTCC) -o $(OBJDIR)/popen.o -c $(OBJDIR)/popen_.c
15621617
15631618
$(OBJDIR)/popen.h: $(OBJDIR)/headers
15641619
15651620
$(OBJDIR)/pqueue_.c: $(SRCDIR)/pqueue.c $(TRANSLATE)
1566
- $(TRANSLATE) $(SRCDIR)/pqueue.c >$(OBJDIR)/pqueue_.c
1621
+ $(TRANSLATE) $(SRCDIR)/pqueue.c >$@
15671622
15681623
$(OBJDIR)/pqueue.o: $(OBJDIR)/pqueue_.c $(OBJDIR)/pqueue.h $(SRCDIR)/config.h
15691624
$(XTCC) -o $(OBJDIR)/pqueue.o -c $(OBJDIR)/pqueue_.c
15701625
15711626
$(OBJDIR)/pqueue.h: $(OBJDIR)/headers
15721627
15731628
$(OBJDIR)/printf_.c: $(SRCDIR)/printf.c $(TRANSLATE)
1574
- $(TRANSLATE) $(SRCDIR)/printf.c >$(OBJDIR)/printf_.c
1629
+ $(TRANSLATE) $(SRCDIR)/printf.c >$@
15751630
15761631
$(OBJDIR)/printf.o: $(OBJDIR)/printf_.c $(OBJDIR)/printf.h $(SRCDIR)/config.h
15771632
$(XTCC) -o $(OBJDIR)/printf.o -c $(OBJDIR)/printf_.c
15781633
15791634
$(OBJDIR)/printf.h: $(OBJDIR)/headers
1635
+
1636
+$(OBJDIR)/publish_.c: $(SRCDIR)/publish.c $(TRANSLATE)
1637
+ $(TRANSLATE) $(SRCDIR)/publish.c >$@
1638
+
1639
+$(OBJDIR)/publish.o: $(OBJDIR)/publish_.c $(OBJDIR)/publish.h $(SRCDIR)/config.h
1640
+ $(XTCC) -o $(OBJDIR)/publish.o -c $(OBJDIR)/publish_.c
1641
+
1642
+$(OBJDIR)/publish.h: $(OBJDIR)/headers
1643
+
1644
+$(OBJDIR)/purge_.c: $(SRCDIR)/purge.c $(TRANSLATE)
1645
+ $(TRANSLATE) $(SRCDIR)/purge.c >$@
1646
+
1647
+$(OBJDIR)/purge.o: $(OBJDIR)/purge_.c $(OBJDIR)/purge.h $(SRCDIR)/config.h
1648
+ $(XTCC) -o $(OBJDIR)/purge.o -c $(OBJDIR)/purge_.c
1649
+
1650
+$(OBJDIR)/purge.h: $(OBJDIR)/headers
15801651
15811652
$(OBJDIR)/rebuild_.c: $(SRCDIR)/rebuild.c $(TRANSLATE)
1582
- $(TRANSLATE) $(SRCDIR)/rebuild.c >$(OBJDIR)/rebuild_.c
1653
+ $(TRANSLATE) $(SRCDIR)/rebuild.c >$@
15831654
15841655
$(OBJDIR)/rebuild.o: $(OBJDIR)/rebuild_.c $(OBJDIR)/rebuild.h $(SRCDIR)/config.h
15851656
$(XTCC) -o $(OBJDIR)/rebuild.o -c $(OBJDIR)/rebuild_.c
15861657
15871658
$(OBJDIR)/rebuild.h: $(OBJDIR)/headers
15881659
15891660
$(OBJDIR)/regexp_.c: $(SRCDIR)/regexp.c $(TRANSLATE)
1590
- $(TRANSLATE) $(SRCDIR)/regexp.c >$(OBJDIR)/regexp_.c
1661
+ $(TRANSLATE) $(SRCDIR)/regexp.c >$@
15911662
15921663
$(OBJDIR)/regexp.o: $(OBJDIR)/regexp_.c $(OBJDIR)/regexp.h $(SRCDIR)/config.h
15931664
$(XTCC) -o $(OBJDIR)/regexp.o -c $(OBJDIR)/regexp_.c
15941665
15951666
$(OBJDIR)/regexp.h: $(OBJDIR)/headers
15961667
15971668
$(OBJDIR)/report_.c: $(SRCDIR)/report.c $(TRANSLATE)
1598
- $(TRANSLATE) $(SRCDIR)/report.c >$(OBJDIR)/report_.c
1669
+ $(TRANSLATE) $(SRCDIR)/report.c >$@
15991670
16001671
$(OBJDIR)/report.o: $(OBJDIR)/report_.c $(OBJDIR)/report.h $(SRCDIR)/config.h
16011672
$(XTCC) -o $(OBJDIR)/report.o -c $(OBJDIR)/report_.c
16021673
16031674
$(OBJDIR)/report.h: $(OBJDIR)/headers
16041675
16051676
$(OBJDIR)/rss_.c: $(SRCDIR)/rss.c $(TRANSLATE)
1606
- $(TRANSLATE) $(SRCDIR)/rss.c >$(OBJDIR)/rss_.c
1677
+ $(TRANSLATE) $(SRCDIR)/rss.c >$@
16071678
16081679
$(OBJDIR)/rss.o: $(OBJDIR)/rss_.c $(OBJDIR)/rss.h $(SRCDIR)/config.h
16091680
$(XTCC) -o $(OBJDIR)/rss.o -c $(OBJDIR)/rss_.c
16101681
16111682
$(OBJDIR)/rss.h: $(OBJDIR)/headers
16121683
16131684
$(OBJDIR)/schema_.c: $(SRCDIR)/schema.c $(TRANSLATE)
1614
- $(TRANSLATE) $(SRCDIR)/schema.c >$(OBJDIR)/schema_.c
1685
+ $(TRANSLATE) $(SRCDIR)/schema.c >$@
16151686
16161687
$(OBJDIR)/schema.o: $(OBJDIR)/schema_.c $(OBJDIR)/schema.h $(SRCDIR)/config.h
16171688
$(XTCC) -o $(OBJDIR)/schema.o -c $(OBJDIR)/schema_.c
16181689
16191690
$(OBJDIR)/schema.h: $(OBJDIR)/headers
16201691
16211692
$(OBJDIR)/search_.c: $(SRCDIR)/search.c $(TRANSLATE)
1622
- $(TRANSLATE) $(SRCDIR)/search.c >$(OBJDIR)/search_.c
1693
+ $(TRANSLATE) $(SRCDIR)/search.c >$@
16231694
16241695
$(OBJDIR)/search.o: $(OBJDIR)/search_.c $(OBJDIR)/search.h $(SRCDIR)/config.h
16251696
$(XTCC) -o $(OBJDIR)/search.o -c $(OBJDIR)/search_.c
16261697
16271698
$(OBJDIR)/search.h: $(OBJDIR)/headers
16281699
16291700
$(OBJDIR)/setup_.c: $(SRCDIR)/setup.c $(TRANSLATE)
1630
- $(TRANSLATE) $(SRCDIR)/setup.c >$(OBJDIR)/setup_.c
1701
+ $(TRANSLATE) $(SRCDIR)/setup.c >$@
16311702
16321703
$(OBJDIR)/setup.o: $(OBJDIR)/setup_.c $(OBJDIR)/setup.h $(SRCDIR)/config.h
16331704
$(XTCC) -o $(OBJDIR)/setup.o -c $(OBJDIR)/setup_.c
16341705
16351706
$(OBJDIR)/setup.h: $(OBJDIR)/headers
16361707
16371708
$(OBJDIR)/sha1_.c: $(SRCDIR)/sha1.c $(TRANSLATE)
1638
- $(TRANSLATE) $(SRCDIR)/sha1.c >$(OBJDIR)/sha1_.c
1709
+ $(TRANSLATE) $(SRCDIR)/sha1.c >$@
16391710
16401711
$(OBJDIR)/sha1.o: $(OBJDIR)/sha1_.c $(OBJDIR)/sha1.h $(SRCDIR)/config.h
16411712
$(XTCC) -o $(OBJDIR)/sha1.o -c $(OBJDIR)/sha1_.c
16421713
16431714
$(OBJDIR)/sha1.h: $(OBJDIR)/headers
16441715
16451716
$(OBJDIR)/shun_.c: $(SRCDIR)/shun.c $(TRANSLATE)
1646
- $(TRANSLATE) $(SRCDIR)/shun.c >$(OBJDIR)/shun_.c
1717
+ $(TRANSLATE) $(SRCDIR)/shun.c >$@
16471718
16481719
$(OBJDIR)/shun.o: $(OBJDIR)/shun_.c $(OBJDIR)/shun.h $(SRCDIR)/config.h
16491720
$(XTCC) -o $(OBJDIR)/shun.o -c $(OBJDIR)/shun_.c
16501721
16511722
$(OBJDIR)/shun.h: $(OBJDIR)/headers
16521723
16531724
$(OBJDIR)/skins_.c: $(SRCDIR)/skins.c $(TRANSLATE)
1654
- $(TRANSLATE) $(SRCDIR)/skins.c >$(OBJDIR)/skins_.c
1725
+ $(TRANSLATE) $(SRCDIR)/skins.c >$@
16551726
16561727
$(OBJDIR)/skins.o: $(OBJDIR)/skins_.c $(OBJDIR)/skins.h $(SRCDIR)/config.h
16571728
$(XTCC) -o $(OBJDIR)/skins.o -c $(OBJDIR)/skins_.c
16581729
16591730
$(OBJDIR)/skins.h: $(OBJDIR)/headers
16601731
16611732
$(OBJDIR)/sqlcmd_.c: $(SRCDIR)/sqlcmd.c $(TRANSLATE)
1662
- $(TRANSLATE) $(SRCDIR)/sqlcmd.c >$(OBJDIR)/sqlcmd_.c
1733
+ $(TRANSLATE) $(SRCDIR)/sqlcmd.c >$@
16631734
16641735
$(OBJDIR)/sqlcmd.o: $(OBJDIR)/sqlcmd_.c $(OBJDIR)/sqlcmd.h $(SRCDIR)/config.h
16651736
$(XTCC) -o $(OBJDIR)/sqlcmd.o -c $(OBJDIR)/sqlcmd_.c
16661737
16671738
$(OBJDIR)/sqlcmd.h: $(OBJDIR)/headers
16681739
16691740
$(OBJDIR)/stash_.c: $(SRCDIR)/stash.c $(TRANSLATE)
1670
- $(TRANSLATE) $(SRCDIR)/stash.c >$(OBJDIR)/stash_.c
1741
+ $(TRANSLATE) $(SRCDIR)/stash.c >$@
16711742
16721743
$(OBJDIR)/stash.o: $(OBJDIR)/stash_.c $(OBJDIR)/stash.h $(SRCDIR)/config.h
16731744
$(XTCC) -o $(OBJDIR)/stash.o -c $(OBJDIR)/stash_.c
16741745
16751746
$(OBJDIR)/stash.h: $(OBJDIR)/headers
16761747
16771748
$(OBJDIR)/stat_.c: $(SRCDIR)/stat.c $(TRANSLATE)
1678
- $(TRANSLATE) $(SRCDIR)/stat.c >$(OBJDIR)/stat_.c
1749
+ $(TRANSLATE) $(SRCDIR)/stat.c >$@
16791750
16801751
$(OBJDIR)/stat.o: $(OBJDIR)/stat_.c $(OBJDIR)/stat.h $(SRCDIR)/config.h
16811752
$(XTCC) -o $(OBJDIR)/stat.o -c $(OBJDIR)/stat_.c
16821753
16831754
$(OBJDIR)/stat.h: $(OBJDIR)/headers
16841755
16851756
$(OBJDIR)/style_.c: $(SRCDIR)/style.c $(TRANSLATE)
1686
- $(TRANSLATE) $(SRCDIR)/style.c >$(OBJDIR)/style_.c
1757
+ $(TRANSLATE) $(SRCDIR)/style.c >$@
16871758
16881759
$(OBJDIR)/style.o: $(OBJDIR)/style_.c $(OBJDIR)/style.h $(SRCDIR)/config.h
16891760
$(XTCC) -o $(OBJDIR)/style.o -c $(OBJDIR)/style_.c
16901761
16911762
$(OBJDIR)/style.h: $(OBJDIR)/headers
16921763
16931764
$(OBJDIR)/sync_.c: $(SRCDIR)/sync.c $(TRANSLATE)
1694
- $(TRANSLATE) $(SRCDIR)/sync.c >$(OBJDIR)/sync_.c
1765
+ $(TRANSLATE) $(SRCDIR)/sync.c >$@
16951766
16961767
$(OBJDIR)/sync.o: $(OBJDIR)/sync_.c $(OBJDIR)/sync.h $(SRCDIR)/config.h
16971768
$(XTCC) -o $(OBJDIR)/sync.o -c $(OBJDIR)/sync_.c
16981769
16991770
$(OBJDIR)/sync.h: $(OBJDIR)/headers
17001771
17011772
$(OBJDIR)/tag_.c: $(SRCDIR)/tag.c $(TRANSLATE)
1702
- $(TRANSLATE) $(SRCDIR)/tag.c >$(OBJDIR)/tag_.c
1773
+ $(TRANSLATE) $(SRCDIR)/tag.c >$@
17031774
17041775
$(OBJDIR)/tag.o: $(OBJDIR)/tag_.c $(OBJDIR)/tag.h $(SRCDIR)/config.h
17051776
$(XTCC) -o $(OBJDIR)/tag.o -c $(OBJDIR)/tag_.c
17061777
17071778
$(OBJDIR)/tag.h: $(OBJDIR)/headers
17081779
17091780
$(OBJDIR)/tar_.c: $(SRCDIR)/tar.c $(TRANSLATE)
1710
- $(TRANSLATE) $(SRCDIR)/tar.c >$(OBJDIR)/tar_.c
1781
+ $(TRANSLATE) $(SRCDIR)/tar.c >$@
17111782
17121783
$(OBJDIR)/tar.o: $(OBJDIR)/tar_.c $(OBJDIR)/tar.h $(SRCDIR)/config.h
17131784
$(XTCC) -o $(OBJDIR)/tar.o -c $(OBJDIR)/tar_.c
17141785
17151786
$(OBJDIR)/tar.h: $(OBJDIR)/headers
17161787
17171788
$(OBJDIR)/th_main_.c: $(SRCDIR)/th_main.c $(TRANSLATE)
1718
- $(TRANSLATE) $(SRCDIR)/th_main.c >$(OBJDIR)/th_main_.c
1789
+ $(TRANSLATE) $(SRCDIR)/th_main.c >$@
17191790
17201791
$(OBJDIR)/th_main.o: $(OBJDIR)/th_main_.c $(OBJDIR)/th_main.h $(SRCDIR)/config.h
17211792
$(XTCC) -o $(OBJDIR)/th_main.o -c $(OBJDIR)/th_main_.c
17221793
17231794
$(OBJDIR)/th_main.h: $(OBJDIR)/headers
17241795
17251796
$(OBJDIR)/timeline_.c: $(SRCDIR)/timeline.c $(TRANSLATE)
1726
- $(TRANSLATE) $(SRCDIR)/timeline.c >$(OBJDIR)/timeline_.c
1797
+ $(TRANSLATE) $(SRCDIR)/timeline.c >$@
17271798
17281799
$(OBJDIR)/timeline.o: $(OBJDIR)/timeline_.c $(OBJDIR)/timeline.h $(SRCDIR)/config.h
17291800
$(XTCC) -o $(OBJDIR)/timeline.o -c $(OBJDIR)/timeline_.c
17301801
17311802
$(OBJDIR)/timeline.h: $(OBJDIR)/headers
17321803
17331804
$(OBJDIR)/tkt_.c: $(SRCDIR)/tkt.c $(TRANSLATE)
1734
- $(TRANSLATE) $(SRCDIR)/tkt.c >$(OBJDIR)/tkt_.c
1805
+ $(TRANSLATE) $(SRCDIR)/tkt.c >$@
17351806
17361807
$(OBJDIR)/tkt.o: $(OBJDIR)/tkt_.c $(OBJDIR)/tkt.h $(SRCDIR)/config.h
17371808
$(XTCC) -o $(OBJDIR)/tkt.o -c $(OBJDIR)/tkt_.c
17381809
17391810
$(OBJDIR)/tkt.h: $(OBJDIR)/headers
17401811
17411812
$(OBJDIR)/tktsetup_.c: $(SRCDIR)/tktsetup.c $(TRANSLATE)
1742
- $(TRANSLATE) $(SRCDIR)/tktsetup.c >$(OBJDIR)/tktsetup_.c
1813
+ $(TRANSLATE) $(SRCDIR)/tktsetup.c >$@
17431814
17441815
$(OBJDIR)/tktsetup.o: $(OBJDIR)/tktsetup_.c $(OBJDIR)/tktsetup.h $(SRCDIR)/config.h
17451816
$(XTCC) -o $(OBJDIR)/tktsetup.o -c $(OBJDIR)/tktsetup_.c
17461817
17471818
$(OBJDIR)/tktsetup.h: $(OBJDIR)/headers
17481819
17491820
$(OBJDIR)/undo_.c: $(SRCDIR)/undo.c $(TRANSLATE)
1750
- $(TRANSLATE) $(SRCDIR)/undo.c >$(OBJDIR)/undo_.c
1821
+ $(TRANSLATE) $(SRCDIR)/undo.c >$@
17511822
17521823
$(OBJDIR)/undo.o: $(OBJDIR)/undo_.c $(OBJDIR)/undo.h $(SRCDIR)/config.h
17531824
$(XTCC) -o $(OBJDIR)/undo.o -c $(OBJDIR)/undo_.c
17541825
17551826
$(OBJDIR)/undo.h: $(OBJDIR)/headers
17561827
17571828
$(OBJDIR)/unicode_.c: $(SRCDIR)/unicode.c $(TRANSLATE)
1758
- $(TRANSLATE) $(SRCDIR)/unicode.c >$(OBJDIR)/unicode_.c
1829
+ $(TRANSLATE) $(SRCDIR)/unicode.c >$@
17591830
17601831
$(OBJDIR)/unicode.o: $(OBJDIR)/unicode_.c $(OBJDIR)/unicode.h $(SRCDIR)/config.h
17611832
$(XTCC) -o $(OBJDIR)/unicode.o -c $(OBJDIR)/unicode_.c
17621833
17631834
$(OBJDIR)/unicode.h: $(OBJDIR)/headers
17641835
17651836
$(OBJDIR)/update_.c: $(SRCDIR)/update.c $(TRANSLATE)
1766
- $(TRANSLATE) $(SRCDIR)/update.c >$(OBJDIR)/update_.c
1837
+ $(TRANSLATE) $(SRCDIR)/update.c >$@
17671838
17681839
$(OBJDIR)/update.o: $(OBJDIR)/update_.c $(OBJDIR)/update.h $(SRCDIR)/config.h
17691840
$(XTCC) -o $(OBJDIR)/update.o -c $(OBJDIR)/update_.c
17701841
17711842
$(OBJDIR)/update.h: $(OBJDIR)/headers
17721843
17731844
$(OBJDIR)/url_.c: $(SRCDIR)/url.c $(TRANSLATE)
1774
- $(TRANSLATE) $(SRCDIR)/url.c >$(OBJDIR)/url_.c
1845
+ $(TRANSLATE) $(SRCDIR)/url.c >$@
17751846
17761847
$(OBJDIR)/url.o: $(OBJDIR)/url_.c $(OBJDIR)/url.h $(SRCDIR)/config.h
17771848
$(XTCC) -o $(OBJDIR)/url.o -c $(OBJDIR)/url_.c
17781849
17791850
$(OBJDIR)/url.h: $(OBJDIR)/headers
17801851
17811852
$(OBJDIR)/user_.c: $(SRCDIR)/user.c $(TRANSLATE)
1782
- $(TRANSLATE) $(SRCDIR)/user.c >$(OBJDIR)/user_.c
1853
+ $(TRANSLATE) $(SRCDIR)/user.c >$@
17831854
17841855
$(OBJDIR)/user.o: $(OBJDIR)/user_.c $(OBJDIR)/user.h $(SRCDIR)/config.h
17851856
$(XTCC) -o $(OBJDIR)/user.o -c $(OBJDIR)/user_.c
17861857
17871858
$(OBJDIR)/user.h: $(OBJDIR)/headers
17881859
17891860
$(OBJDIR)/utf8_.c: $(SRCDIR)/utf8.c $(TRANSLATE)
1790
- $(TRANSLATE) $(SRCDIR)/utf8.c >$(OBJDIR)/utf8_.c
1861
+ $(TRANSLATE) $(SRCDIR)/utf8.c >$@
17911862
17921863
$(OBJDIR)/utf8.o: $(OBJDIR)/utf8_.c $(OBJDIR)/utf8.h $(SRCDIR)/config.h
17931864
$(XTCC) -o $(OBJDIR)/utf8.o -c $(OBJDIR)/utf8_.c
17941865
17951866
$(OBJDIR)/utf8.h: $(OBJDIR)/headers
17961867
17971868
$(OBJDIR)/util_.c: $(SRCDIR)/util.c $(TRANSLATE)
1798
- $(TRANSLATE) $(SRCDIR)/util.c >$(OBJDIR)/util_.c
1869
+ $(TRANSLATE) $(SRCDIR)/util.c >$@
17991870
18001871
$(OBJDIR)/util.o: $(OBJDIR)/util_.c $(OBJDIR)/util.h $(SRCDIR)/config.h
18011872
$(XTCC) -o $(OBJDIR)/util.o -c $(OBJDIR)/util_.c
18021873
18031874
$(OBJDIR)/util.h: $(OBJDIR)/headers
18041875
18051876
$(OBJDIR)/verify_.c: $(SRCDIR)/verify.c $(TRANSLATE)
1806
- $(TRANSLATE) $(SRCDIR)/verify.c >$(OBJDIR)/verify_.c
1877
+ $(TRANSLATE) $(SRCDIR)/verify.c >$@
18071878
18081879
$(OBJDIR)/verify.o: $(OBJDIR)/verify_.c $(OBJDIR)/verify.h $(SRCDIR)/config.h
18091880
$(XTCC) -o $(OBJDIR)/verify.o -c $(OBJDIR)/verify_.c
18101881
18111882
$(OBJDIR)/verify.h: $(OBJDIR)/headers
18121883
18131884
$(OBJDIR)/vfile_.c: $(SRCDIR)/vfile.c $(TRANSLATE)
1814
- $(TRANSLATE) $(SRCDIR)/vfile.c >$(OBJDIR)/vfile_.c
1885
+ $(TRANSLATE) $(SRCDIR)/vfile.c >$@
18151886
18161887
$(OBJDIR)/vfile.o: $(OBJDIR)/vfile_.c $(OBJDIR)/vfile.h $(SRCDIR)/config.h
18171888
$(XTCC) -o $(OBJDIR)/vfile.o -c $(OBJDIR)/vfile_.c
18181889
18191890
$(OBJDIR)/vfile.h: $(OBJDIR)/headers
18201891
18211892
$(OBJDIR)/wiki_.c: $(SRCDIR)/wiki.c $(TRANSLATE)
1822
- $(TRANSLATE) $(SRCDIR)/wiki.c >$(OBJDIR)/wiki_.c
1893
+ $(TRANSLATE) $(SRCDIR)/wiki.c >$@
18231894
18241895
$(OBJDIR)/wiki.o: $(OBJDIR)/wiki_.c $(OBJDIR)/wiki.h $(SRCDIR)/config.h
18251896
$(XTCC) -o $(OBJDIR)/wiki.o -c $(OBJDIR)/wiki_.c
18261897
18271898
$(OBJDIR)/wiki.h: $(OBJDIR)/headers
18281899
18291900
$(OBJDIR)/wikiformat_.c: $(SRCDIR)/wikiformat.c $(TRANSLATE)
1830
- $(TRANSLATE) $(SRCDIR)/wikiformat.c >$(OBJDIR)/wikiformat_.c
1901
+ $(TRANSLATE) $(SRCDIR)/wikiformat.c >$@
18311902
18321903
$(OBJDIR)/wikiformat.o: $(OBJDIR)/wikiformat_.c $(OBJDIR)/wikiformat.h $(SRCDIR)/config.h
18331904
$(XTCC) -o $(OBJDIR)/wikiformat.o -c $(OBJDIR)/wikiformat_.c
18341905
18351906
$(OBJDIR)/wikiformat.h: $(OBJDIR)/headers
18361907
18371908
$(OBJDIR)/winfile_.c: $(SRCDIR)/winfile.c $(TRANSLATE)
1838
- $(TRANSLATE) $(SRCDIR)/winfile.c >$(OBJDIR)/winfile_.c
1909
+ $(TRANSLATE) $(SRCDIR)/winfile.c >$@
18391910
18401911
$(OBJDIR)/winfile.o: $(OBJDIR)/winfile_.c $(OBJDIR)/winfile.h $(SRCDIR)/config.h
18411912
$(XTCC) -o $(OBJDIR)/winfile.o -c $(OBJDIR)/winfile_.c
18421913
18431914
$(OBJDIR)/winfile.h: $(OBJDIR)/headers
18441915
18451916
$(OBJDIR)/winhttp_.c: $(SRCDIR)/winhttp.c $(TRANSLATE)
1846
- $(TRANSLATE) $(SRCDIR)/winhttp.c >$(OBJDIR)/winhttp_.c
1917
+ $(TRANSLATE) $(SRCDIR)/winhttp.c >$@
18471918
18481919
$(OBJDIR)/winhttp.o: $(OBJDIR)/winhttp_.c $(OBJDIR)/winhttp.h $(SRCDIR)/config.h
18491920
$(XTCC) -o $(OBJDIR)/winhttp.o -c $(OBJDIR)/winhttp_.c
18501921
18511922
$(OBJDIR)/winhttp.h: $(OBJDIR)/headers
18521923
18531924
$(OBJDIR)/wysiwyg_.c: $(SRCDIR)/wysiwyg.c $(TRANSLATE)
1854
- $(TRANSLATE) $(SRCDIR)/wysiwyg.c >$(OBJDIR)/wysiwyg_.c
1925
+ $(TRANSLATE) $(SRCDIR)/wysiwyg.c >$@
18551926
18561927
$(OBJDIR)/wysiwyg.o: $(OBJDIR)/wysiwyg_.c $(OBJDIR)/wysiwyg.h $(SRCDIR)/config.h
18571928
$(XTCC) -o $(OBJDIR)/wysiwyg.o -c $(OBJDIR)/wysiwyg_.c
18581929
18591930
$(OBJDIR)/wysiwyg.h: $(OBJDIR)/headers
18601931
18611932
$(OBJDIR)/xfer_.c: $(SRCDIR)/xfer.c $(TRANSLATE)
1862
- $(TRANSLATE) $(SRCDIR)/xfer.c >$(OBJDIR)/xfer_.c
1933
+ $(TRANSLATE) $(SRCDIR)/xfer.c >$@
18631934
18641935
$(OBJDIR)/xfer.o: $(OBJDIR)/xfer_.c $(OBJDIR)/xfer.h $(SRCDIR)/config.h
18651936
$(XTCC) -o $(OBJDIR)/xfer.o -c $(OBJDIR)/xfer_.c
18661937
18671938
$(OBJDIR)/xfer.h: $(OBJDIR)/headers
18681939
18691940
$(OBJDIR)/xfersetup_.c: $(SRCDIR)/xfersetup.c $(TRANSLATE)
1870
- $(TRANSLATE) $(SRCDIR)/xfersetup.c >$(OBJDIR)/xfersetup_.c
1941
+ $(TRANSLATE) $(SRCDIR)/xfersetup.c >$@
18711942
18721943
$(OBJDIR)/xfersetup.o: $(OBJDIR)/xfersetup_.c $(OBJDIR)/xfersetup.h $(SRCDIR)/config.h
18731944
$(XTCC) -o $(OBJDIR)/xfersetup.o -c $(OBJDIR)/xfersetup_.c
18741945
18751946
$(OBJDIR)/xfersetup.h: $(OBJDIR)/headers
18761947
18771948
$(OBJDIR)/zip_.c: $(SRCDIR)/zip.c $(TRANSLATE)
1878
- $(TRANSLATE) $(SRCDIR)/zip.c >$(OBJDIR)/zip_.c
1949
+ $(TRANSLATE) $(SRCDIR)/zip.c >$@
18791950
18801951
$(OBJDIR)/zip.o: $(OBJDIR)/zip_.c $(OBJDIR)/zip.h $(SRCDIR)/config.h
18811952
$(XTCC) -o $(OBJDIR)/zip.o -c $(OBJDIR)/zip_.c
18821953
18831954
$(OBJDIR)/zip.h: $(OBJDIR)/headers
@@ -1906,27 +1977,27 @@
19061977
MINIZ_OPTIONS = -DMINIZ_NO_STDIO \
19071978
-DMINIZ_NO_TIME \
19081979
-DMINIZ_NO_ARCHIVE_APIS
19091980
19101981
$(OBJDIR)/sqlite3.o: $(SRCDIR)/sqlite3.c $(SRCDIR)/../win/Makefile.mingw
1911
- $(XTCC) $(SQLITE_OPTIONS) $(SQLITE_CFLAGS) -c $(SRCDIR)/sqlite3.c -o $(OBJDIR)/sqlite3.o
1982
+ $(XTCC) $(SQLITE_OPTIONS) $(SQLITE_CFLAGS) -c $(SRCDIR)/sqlite3.c -o $@
19121983
19131984
$(OBJDIR)/cson_amalgamation.o: $(SRCDIR)/cson_amalgamation.c
1914
- $(XTCC) -c $(SRCDIR)/cson_amalgamation.c -o $(OBJDIR)/cson_amalgamation.o
1985
+ $(XTCC) -c $(SRCDIR)/cson_amalgamation.c -o $@
19151986
19161987
$(OBJDIR)/json.o $(OBJDIR)/json_artifact.o $(OBJDIR)/json_branch.o $(OBJDIR)/json_config.o $(OBJDIR)/json_diff.o $(OBJDIR)/json_dir.o $(OBJDIR)/jsos_finfo.o $(OBJDIR)/json_login.o $(OBJDIR)/json_query.o $(OBJDIR)/json_report.o $(OBJDIR)/json_status.o $(OBJDIR)/json_tag.o $(OBJDIR)/json_timeline.o $(OBJDIR)/json_user.o $(OBJDIR)/json_wiki.o : $(SRCDIR)/json_detail.h
19171988
19181989
$(OBJDIR)/shell.o: $(SRCDIR)/shell.c $(SRCDIR)/sqlite3.h $(SRCDIR)/../win/Makefile.mingw
1919
- $(XTCC) $(SHELL_OPTIONS) $(SHELL_CFLAGS) -c $(SRCDIR)/shell.c -o $(OBJDIR)/shell.o
1990
+ $(XTCC) $(SHELL_OPTIONS) $(SHELL_CFLAGS) -c $(SRCDIR)/shell.c -o $@
19201991
19211992
$(OBJDIR)/th.o: $(SRCDIR)/th.c
1922
- $(XTCC) -c $(SRCDIR)/th.c -o $(OBJDIR)/th.o
1993
+ $(XTCC) -c $(SRCDIR)/th.c -o $@
19231994
19241995
$(OBJDIR)/th_lang.o: $(SRCDIR)/th_lang.c
1925
- $(XTCC) -c $(SRCDIR)/th_lang.c -o $(OBJDIR)/th_lang.o
1996
+ $(XTCC) -c $(SRCDIR)/th_lang.c -o $@
19261997
19271998
$(OBJDIR)/th_tcl.o: $(SRCDIR)/th_tcl.c
1928
- $(XTCC) -c $(SRCDIR)/th_tcl.c -o $(OBJDIR)/th_tcl.o
1999
+ $(XTCC) -c $(SRCDIR)/th_tcl.c -o $@
19292000
19302001
$(OBJDIR)/miniz.o: $(SRCDIR)/miniz.c
1931
- $(XTCC) $(MINIZ_OPTIONS) -c $(SRCDIR)/miniz.c -o $(OBJDIR)/miniz.o
2002
+ $(XTCC) $(MINIZ_OPTIONS) -c $(SRCDIR)/miniz.c -o $@
19322003
19332004
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -94,23 +94,40 @@
94 ifndef MINGW_IS_32BIT_ONLY
95 ifeq (,$(findstring w64-mingw32,$(PREFIX)))
96 MINGW_IS_32BIT_ONLY = 1
97 endif
98 endif
99 ifeq (,$(findstring x86_64-w64-mingw32,$(PREFIX)))
100 SSLCONFIG = mingw
101 else
102 SSLCONFIG = mingw64
103 endif
104 ifndef FOSSIL_ENABLE_MINIZ
105 SSLCONFIG += --with-zlib-lib=$(PWD)/$(ZLIBDIR) --with-zlib-include=$(PWD)/$(ZLIBDIR) zlib
106 endif
107
108 #### The directories where the zlib include and library files are located.
109 #
110 ZINCDIR = $(SRCDIR)/../compat/zlib
111 ZLIBDIR = $(SRCDIR)/../compat/zlib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
113 #### The directories where the OpenSSL include and library files are located.
114 # The recommended usage here is to use the Sysinternals junction tool
115 # to create a hard link between an "openssl-1.x" sub-directory of the
116 # Fossil source code directory and the target OpenSSL source directory.
@@ -340,10 +357,11 @@
340 $(SRCDIR)/bisect.c \
341 $(SRCDIR)/blob.c \
342 $(SRCDIR)/branch.c \
343 $(SRCDIR)/browse.c \
344 $(SRCDIR)/builtin.c \
 
345 $(SRCDIR)/cache.c \
346 $(SRCDIR)/captcha.c \
347 $(SRCDIR)/cgi.c \
348 $(SRCDIR)/checkin.c \
349 $(SRCDIR)/checkout.c \
@@ -362,10 +380,11 @@
362 $(SRCDIR)/encode.c \
363 $(SRCDIR)/event.c \
364 $(SRCDIR)/export.c \
365 $(SRCDIR)/file.c \
366 $(SRCDIR)/finfo.c \
 
367 $(SRCDIR)/fusefs.c \
368 $(SRCDIR)/glob.c \
369 $(SRCDIR)/graph.c \
370 $(SRCDIR)/gzip.c \
371 $(SRCDIR)/http.c \
@@ -405,10 +424,12 @@
405 $(SRCDIR)/path.c \
406 $(SRCDIR)/pivot.c \
407 $(SRCDIR)/popen.c \
408 $(SRCDIR)/pqueue.c \
409 $(SRCDIR)/printf.c \
 
 
410 $(SRCDIR)/rebuild.c \
411 $(SRCDIR)/regexp.c \
412 $(SRCDIR)/report.c \
413 $(SRCDIR)/rss.c \
414 $(SRCDIR)/schema.c \
@@ -457,10 +478,11 @@
457 $(OBJDIR)/bisect_.c \
458 $(OBJDIR)/blob_.c \
459 $(OBJDIR)/branch_.c \
460 $(OBJDIR)/browse_.c \
461 $(OBJDIR)/builtin_.c \
 
462 $(OBJDIR)/cache_.c \
463 $(OBJDIR)/captcha_.c \
464 $(OBJDIR)/cgi_.c \
465 $(OBJDIR)/checkin_.c \
466 $(OBJDIR)/checkout_.c \
@@ -479,10 +501,11 @@
479 $(OBJDIR)/encode_.c \
480 $(OBJDIR)/event_.c \
481 $(OBJDIR)/export_.c \
482 $(OBJDIR)/file_.c \
483 $(OBJDIR)/finfo_.c \
 
484 $(OBJDIR)/fusefs_.c \
485 $(OBJDIR)/glob_.c \
486 $(OBJDIR)/graph_.c \
487 $(OBJDIR)/gzip_.c \
488 $(OBJDIR)/http_.c \
@@ -522,10 +545,12 @@
522 $(OBJDIR)/path_.c \
523 $(OBJDIR)/pivot_.c \
524 $(OBJDIR)/popen_.c \
525 $(OBJDIR)/pqueue_.c \
526 $(OBJDIR)/printf_.c \
 
 
527 $(OBJDIR)/rebuild_.c \
528 $(OBJDIR)/regexp_.c \
529 $(OBJDIR)/report_.c \
530 $(OBJDIR)/rss_.c \
531 $(OBJDIR)/schema_.c \
@@ -571,10 +596,11 @@
571 $(OBJDIR)/bisect.o \
572 $(OBJDIR)/blob.o \
573 $(OBJDIR)/branch.o \
574 $(OBJDIR)/browse.o \
575 $(OBJDIR)/builtin.o \
 
576 $(OBJDIR)/cache.o \
577 $(OBJDIR)/captcha.o \
578 $(OBJDIR)/cgi.o \
579 $(OBJDIR)/checkin.o \
580 $(OBJDIR)/checkout.o \
@@ -593,10 +619,11 @@
593 $(OBJDIR)/encode.o \
594 $(OBJDIR)/event.o \
595 $(OBJDIR)/export.o \
596 $(OBJDIR)/file.o \
597 $(OBJDIR)/finfo.o \
 
598 $(OBJDIR)/fusefs.o \
599 $(OBJDIR)/glob.o \
600 $(OBJDIR)/graph.o \
601 $(OBJDIR)/gzip.o \
602 $(OBJDIR)/http.o \
@@ -636,10 +663,12 @@
636 $(OBJDIR)/path.o \
637 $(OBJDIR)/pivot.o \
638 $(OBJDIR)/popen.o \
639 $(OBJDIR)/pqueue.o \
640 $(OBJDIR)/printf.o \
 
 
641 $(OBJDIR)/rebuild.o \
642 $(OBJDIR)/regexp.o \
643 $(OBJDIR)/report.o \
644 $(OBJDIR)/rss.o \
645 $(OBJDIR)/schema.o \
@@ -677,11 +706,10 @@
677 $(OBJDIR)/xfersetup.o \
678 $(OBJDIR)/zip.o
679
680 APPNAME = fossil.exe
681 APPTARGETS =
682 LIBTARGETS =
683
684 #### If the USE_WINDOWS variable exists, it is assumed that we are building
685 # inside of a Windows-style shell; otherwise, it is assumed that we are
686 # building inside of a Unix-style shell. Note that the "move" command is
687 # broken when attempting to use it from the Windows shell via MinGW make
@@ -749,35 +777,35 @@
749 else
750 $(MKDIR) $(OBJDIR)
751 endif
752
753 $(TRANSLATE): $(SRCDIR)/translate.c
754 $(BCC) -o $(TRANSLATE) $(SRCDIR)/translate.c
755
756 $(MAKEHEADERS): $(SRCDIR)/makeheaders.c
757 $(BCC) -o $(MAKEHEADERS) $(SRCDIR)/makeheaders.c
758
759 $(MKINDEX): $(SRCDIR)/mkindex.c
760 $(BCC) -o $(MKINDEX) $(SRCDIR)/mkindex.c
761
762 $(MKBUILTIN): $(SRCDIR)/mkbuiltin.c
763 $(BCC) -o $(MKBUILTIN) $(SRCDIR)/mkbuiltin.c
764
765 $(MKVERSION): $(SRCDIR)/mkversion.c
766 $(BCC) -o $(MKVERSION) $(SRCDIR)/mkversion.c
767
768 $(CODECHECK1): $(SRCDIR)/codecheck1.c
769 $(BCC) -o $(CODECHECK1) $(SRCDIR)/codecheck1.c
770
771 # WARNING. DANGER. Running the test suite modifies the repository the
772 # build is done from, i.e. the checkout belongs to. Do not sync/push
773 # the repository after running the tests.
774 test: $(OBJDIR) $(APPNAME)
775 $(TCLSH) $(SRCDIR)/../test/tester.tcl $(APPNAME)
776
777 $(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(MKVERSION)
778 $(MKVERSION) $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION >$(OBJDIR)/VERSION.h
779
780 # The USE_SYSTEM_SQLITE variable may be undefined, set to 0, or set
781 # to 1. If it is set to 1, then there is no need to build or link
782 # the sqlite3.o object. Instead, the system SQLite will be linked
783 # using -lsqlite3.
@@ -802,14 +830,21 @@
802 $(OBJDIR)/th_tcl.o \
803 $(OBJDIR)/cson_amalgamation.o
804
805
806 zlib:
807 $(MAKE) -C $(ZLIBDIR) PREFIX=$(PREFIX) -f win32/Makefile.gcc libz.a
808
809 clean-zlib:
810 $(MAKE) -C $(ZLIBDIR) PREFIX=$(PREFIX) -f win32/Makefile.gcc clean
 
 
 
 
 
 
 
811
812 ifndef FOSSIL_ENABLE_MINIZ
813 LIBTARGETS += zlib
814 endif
815
@@ -833,11 +868,11 @@
833 APPTARGETS += openssl
834 endif
835
836 $(APPNAME): $(OBJDIR)/headers $(CODECHECK1) $(OBJ) $(EXTRAOBJ) $(OBJDIR)/fossil.o $(APPTARGETS)
837 $(CODECHECK1) $(TRANS_SRC)
838 $(TCC) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB) $(OBJDIR)/fossil.o
839
840 # This rule prevents make from using its default rules to try build
841 # an executable named "manifest" out of the file named "manifest.c"
842 #
843 $(SRCDIR)/../manifest:
@@ -872,10 +907,11 @@
872 $(OBJDIR)/bisect_.c:$(OBJDIR)/bisect.h \
873 $(OBJDIR)/blob_.c:$(OBJDIR)/blob.h \
874 $(OBJDIR)/branch_.c:$(OBJDIR)/branch.h \
875 $(OBJDIR)/browse_.c:$(OBJDIR)/browse.h \
876 $(OBJDIR)/builtin_.c:$(OBJDIR)/builtin.h \
 
877 $(OBJDIR)/cache_.c:$(OBJDIR)/cache.h \
878 $(OBJDIR)/captcha_.c:$(OBJDIR)/captcha.h \
879 $(OBJDIR)/cgi_.c:$(OBJDIR)/cgi.h \
880 $(OBJDIR)/checkin_.c:$(OBJDIR)/checkin.h \
881 $(OBJDIR)/checkout_.c:$(OBJDIR)/checkout.h \
@@ -894,10 +930,11 @@
894 $(OBJDIR)/encode_.c:$(OBJDIR)/encode.h \
895 $(OBJDIR)/event_.c:$(OBJDIR)/event.h \
896 $(OBJDIR)/export_.c:$(OBJDIR)/export.h \
897 $(OBJDIR)/file_.c:$(OBJDIR)/file.h \
898 $(OBJDIR)/finfo_.c:$(OBJDIR)/finfo.h \
 
899 $(OBJDIR)/fusefs_.c:$(OBJDIR)/fusefs.h \
900 $(OBJDIR)/glob_.c:$(OBJDIR)/glob.h \
901 $(OBJDIR)/graph_.c:$(OBJDIR)/graph.h \
902 $(OBJDIR)/gzip_.c:$(OBJDIR)/gzip.h \
903 $(OBJDIR)/http_.c:$(OBJDIR)/http.h \
@@ -937,10 +974,12 @@
937 $(OBJDIR)/path_.c:$(OBJDIR)/path.h \
938 $(OBJDIR)/pivot_.c:$(OBJDIR)/pivot.h \
939 $(OBJDIR)/popen_.c:$(OBJDIR)/popen.h \
940 $(OBJDIR)/pqueue_.c:$(OBJDIR)/pqueue.h \
941 $(OBJDIR)/printf_.c:$(OBJDIR)/printf.h \
 
 
942 $(OBJDIR)/rebuild_.c:$(OBJDIR)/rebuild.h \
943 $(OBJDIR)/regexp_.c:$(OBJDIR)/regexp.h \
944 $(OBJDIR)/report_.c:$(OBJDIR)/report.h \
945 $(OBJDIR)/rss_.c:$(OBJDIR)/rss.h \
946 $(OBJDIR)/schema_.c:$(OBJDIR)/schema.h \
@@ -985,899 +1024,931 @@
985 $(OBJDIR)/headers: Makefile
986
987 Makefile:
988
989 $(OBJDIR)/add_.c: $(SRCDIR)/add.c $(TRANSLATE)
990 $(TRANSLATE) $(SRCDIR)/add.c >$(OBJDIR)/add_.c
991
992 $(OBJDIR)/add.o: $(OBJDIR)/add_.c $(OBJDIR)/add.h $(SRCDIR)/config.h
993 $(XTCC) -o $(OBJDIR)/add.o -c $(OBJDIR)/add_.c
994
995 $(OBJDIR)/add.h: $(OBJDIR)/headers
996
997 $(OBJDIR)/allrepo_.c: $(SRCDIR)/allrepo.c $(TRANSLATE)
998 $(TRANSLATE) $(SRCDIR)/allrepo.c >$(OBJDIR)/allrepo_.c
999
1000 $(OBJDIR)/allrepo.o: $(OBJDIR)/allrepo_.c $(OBJDIR)/allrepo.h $(SRCDIR)/config.h
1001 $(XTCC) -o $(OBJDIR)/allrepo.o -c $(OBJDIR)/allrepo_.c
1002
1003 $(OBJDIR)/allrepo.h: $(OBJDIR)/headers
1004
1005 $(OBJDIR)/attach_.c: $(SRCDIR)/attach.c $(TRANSLATE)
1006 $(TRANSLATE) $(SRCDIR)/attach.c >$(OBJDIR)/attach_.c
1007
1008 $(OBJDIR)/attach.o: $(OBJDIR)/attach_.c $(OBJDIR)/attach.h $(SRCDIR)/config.h
1009 $(XTCC) -o $(OBJDIR)/attach.o -c $(OBJDIR)/attach_.c
1010
1011 $(OBJDIR)/attach.h: $(OBJDIR)/headers
1012
1013 $(OBJDIR)/bag_.c: $(SRCDIR)/bag.c $(TRANSLATE)
1014 $(TRANSLATE) $(SRCDIR)/bag.c >$(OBJDIR)/bag_.c
1015
1016 $(OBJDIR)/bag.o: $(OBJDIR)/bag_.c $(OBJDIR)/bag.h $(SRCDIR)/config.h
1017 $(XTCC) -o $(OBJDIR)/bag.o -c $(OBJDIR)/bag_.c
1018
1019 $(OBJDIR)/bag.h: $(OBJDIR)/headers
1020
1021 $(OBJDIR)/bisect_.c: $(SRCDIR)/bisect.c $(TRANSLATE)
1022 $(TRANSLATE) $(SRCDIR)/bisect.c >$(OBJDIR)/bisect_.c
1023
1024 $(OBJDIR)/bisect.o: $(OBJDIR)/bisect_.c $(OBJDIR)/bisect.h $(SRCDIR)/config.h
1025 $(XTCC) -o $(OBJDIR)/bisect.o -c $(OBJDIR)/bisect_.c
1026
1027 $(OBJDIR)/bisect.h: $(OBJDIR)/headers
1028
1029 $(OBJDIR)/blob_.c: $(SRCDIR)/blob.c $(TRANSLATE)
1030 $(TRANSLATE) $(SRCDIR)/blob.c >$(OBJDIR)/blob_.c
1031
1032 $(OBJDIR)/blob.o: $(OBJDIR)/blob_.c $(OBJDIR)/blob.h $(SRCDIR)/config.h
1033 $(XTCC) -o $(OBJDIR)/blob.o -c $(OBJDIR)/blob_.c
1034
1035 $(OBJDIR)/blob.h: $(OBJDIR)/headers
1036
1037 $(OBJDIR)/branch_.c: $(SRCDIR)/branch.c $(TRANSLATE)
1038 $(TRANSLATE) $(SRCDIR)/branch.c >$(OBJDIR)/branch_.c
1039
1040 $(OBJDIR)/branch.o: $(OBJDIR)/branch_.c $(OBJDIR)/branch.h $(SRCDIR)/config.h
1041 $(XTCC) -o $(OBJDIR)/branch.o -c $(OBJDIR)/branch_.c
1042
1043 $(OBJDIR)/branch.h: $(OBJDIR)/headers
1044
1045 $(OBJDIR)/browse_.c: $(SRCDIR)/browse.c $(TRANSLATE)
1046 $(TRANSLATE) $(SRCDIR)/browse.c >$(OBJDIR)/browse_.c
1047
1048 $(OBJDIR)/browse.o: $(OBJDIR)/browse_.c $(OBJDIR)/browse.h $(SRCDIR)/config.h
1049 $(XTCC) -o $(OBJDIR)/browse.o -c $(OBJDIR)/browse_.c
1050
1051 $(OBJDIR)/browse.h: $(OBJDIR)/headers
1052
1053 $(OBJDIR)/builtin_.c: $(SRCDIR)/builtin.c $(TRANSLATE)
1054 $(TRANSLATE) $(SRCDIR)/builtin.c >$(OBJDIR)/builtin_.c
1055
1056 $(OBJDIR)/builtin.o: $(OBJDIR)/builtin_.c $(OBJDIR)/builtin.h $(OBJDIR)/builtin_data.h $(SRCDIR)/config.h
1057 $(XTCC) -o $(OBJDIR)/builtin.o -c $(OBJDIR)/builtin_.c
1058
1059 $(OBJDIR)/builtin.h: $(OBJDIR)/headers
 
 
 
 
 
 
 
 
1060
1061 $(OBJDIR)/cache_.c: $(SRCDIR)/cache.c $(TRANSLATE)
1062 $(TRANSLATE) $(SRCDIR)/cache.c >$(OBJDIR)/cache_.c
1063
1064 $(OBJDIR)/cache.o: $(OBJDIR)/cache_.c $(OBJDIR)/cache.h $(SRCDIR)/config.h
1065 $(XTCC) -o $(OBJDIR)/cache.o -c $(OBJDIR)/cache_.c
1066
1067 $(OBJDIR)/cache.h: $(OBJDIR)/headers
1068
1069 $(OBJDIR)/captcha_.c: $(SRCDIR)/captcha.c $(TRANSLATE)
1070 $(TRANSLATE) $(SRCDIR)/captcha.c >$(OBJDIR)/captcha_.c
1071
1072 $(OBJDIR)/captcha.o: $(OBJDIR)/captcha_.c $(OBJDIR)/captcha.h $(SRCDIR)/config.h
1073 $(XTCC) -o $(OBJDIR)/captcha.o -c $(OBJDIR)/captcha_.c
1074
1075 $(OBJDIR)/captcha.h: $(OBJDIR)/headers
1076
1077 $(OBJDIR)/cgi_.c: $(SRCDIR)/cgi.c $(TRANSLATE)
1078 $(TRANSLATE) $(SRCDIR)/cgi.c >$(OBJDIR)/cgi_.c
1079
1080 $(OBJDIR)/cgi.o: $(OBJDIR)/cgi_.c $(OBJDIR)/cgi.h $(SRCDIR)/config.h
1081 $(XTCC) -o $(OBJDIR)/cgi.o -c $(OBJDIR)/cgi_.c
1082
1083 $(OBJDIR)/cgi.h: $(OBJDIR)/headers
1084
1085 $(OBJDIR)/checkin_.c: $(SRCDIR)/checkin.c $(TRANSLATE)
1086 $(TRANSLATE) $(SRCDIR)/checkin.c >$(OBJDIR)/checkin_.c
1087
1088 $(OBJDIR)/checkin.o: $(OBJDIR)/checkin_.c $(OBJDIR)/checkin.h $(SRCDIR)/config.h
1089 $(XTCC) -o $(OBJDIR)/checkin.o -c $(OBJDIR)/checkin_.c
1090
1091 $(OBJDIR)/checkin.h: $(OBJDIR)/headers
1092
1093 $(OBJDIR)/checkout_.c: $(SRCDIR)/checkout.c $(TRANSLATE)
1094 $(TRANSLATE) $(SRCDIR)/checkout.c >$(OBJDIR)/checkout_.c
1095
1096 $(OBJDIR)/checkout.o: $(OBJDIR)/checkout_.c $(OBJDIR)/checkout.h $(SRCDIR)/config.h
1097 $(XTCC) -o $(OBJDIR)/checkout.o -c $(OBJDIR)/checkout_.c
1098
1099 $(OBJDIR)/checkout.h: $(OBJDIR)/headers
1100
1101 $(OBJDIR)/clearsign_.c: $(SRCDIR)/clearsign.c $(TRANSLATE)
1102 $(TRANSLATE) $(SRCDIR)/clearsign.c >$(OBJDIR)/clearsign_.c
1103
1104 $(OBJDIR)/clearsign.o: $(OBJDIR)/clearsign_.c $(OBJDIR)/clearsign.h $(SRCDIR)/config.h
1105 $(XTCC) -o $(OBJDIR)/clearsign.o -c $(OBJDIR)/clearsign_.c
1106
1107 $(OBJDIR)/clearsign.h: $(OBJDIR)/headers
1108
1109 $(OBJDIR)/clone_.c: $(SRCDIR)/clone.c $(TRANSLATE)
1110 $(TRANSLATE) $(SRCDIR)/clone.c >$(OBJDIR)/clone_.c
1111
1112 $(OBJDIR)/clone.o: $(OBJDIR)/clone_.c $(OBJDIR)/clone.h $(SRCDIR)/config.h
1113 $(XTCC) -o $(OBJDIR)/clone.o -c $(OBJDIR)/clone_.c
1114
1115 $(OBJDIR)/clone.h: $(OBJDIR)/headers
1116
1117 $(OBJDIR)/comformat_.c: $(SRCDIR)/comformat.c $(TRANSLATE)
1118 $(TRANSLATE) $(SRCDIR)/comformat.c >$(OBJDIR)/comformat_.c
1119
1120 $(OBJDIR)/comformat.o: $(OBJDIR)/comformat_.c $(OBJDIR)/comformat.h $(SRCDIR)/config.h
1121 $(XTCC) -o $(OBJDIR)/comformat.o -c $(OBJDIR)/comformat_.c
1122
1123 $(OBJDIR)/comformat.h: $(OBJDIR)/headers
1124
1125 $(OBJDIR)/configure_.c: $(SRCDIR)/configure.c $(TRANSLATE)
1126 $(TRANSLATE) $(SRCDIR)/configure.c >$(OBJDIR)/configure_.c
1127
1128 $(OBJDIR)/configure.o: $(OBJDIR)/configure_.c $(OBJDIR)/configure.h $(SRCDIR)/config.h
1129 $(XTCC) -o $(OBJDIR)/configure.o -c $(OBJDIR)/configure_.c
1130
1131 $(OBJDIR)/configure.h: $(OBJDIR)/headers
1132
1133 $(OBJDIR)/content_.c: $(SRCDIR)/content.c $(TRANSLATE)
1134 $(TRANSLATE) $(SRCDIR)/content.c >$(OBJDIR)/content_.c
1135
1136 $(OBJDIR)/content.o: $(OBJDIR)/content_.c $(OBJDIR)/content.h $(SRCDIR)/config.h
1137 $(XTCC) -o $(OBJDIR)/content.o -c $(OBJDIR)/content_.c
1138
1139 $(OBJDIR)/content.h: $(OBJDIR)/headers
1140
1141 $(OBJDIR)/db_.c: $(SRCDIR)/db.c $(TRANSLATE)
1142 $(TRANSLATE) $(SRCDIR)/db.c >$(OBJDIR)/db_.c
1143
1144 $(OBJDIR)/db.o: $(OBJDIR)/db_.c $(OBJDIR)/db.h $(SRCDIR)/config.h
1145 $(XTCC) -o $(OBJDIR)/db.o -c $(OBJDIR)/db_.c
1146
1147 $(OBJDIR)/db.h: $(OBJDIR)/headers
1148
1149 $(OBJDIR)/delta_.c: $(SRCDIR)/delta.c $(TRANSLATE)
1150 $(TRANSLATE) $(SRCDIR)/delta.c >$(OBJDIR)/delta_.c
1151
1152 $(OBJDIR)/delta.o: $(OBJDIR)/delta_.c $(OBJDIR)/delta.h $(SRCDIR)/config.h
1153 $(XTCC) -o $(OBJDIR)/delta.o -c $(OBJDIR)/delta_.c
1154
1155 $(OBJDIR)/delta.h: $(OBJDIR)/headers
1156
1157 $(OBJDIR)/deltacmd_.c: $(SRCDIR)/deltacmd.c $(TRANSLATE)
1158 $(TRANSLATE) $(SRCDIR)/deltacmd.c >$(OBJDIR)/deltacmd_.c
1159
1160 $(OBJDIR)/deltacmd.o: $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h $(SRCDIR)/config.h
1161 $(XTCC) -o $(OBJDIR)/deltacmd.o -c $(OBJDIR)/deltacmd_.c
1162
1163 $(OBJDIR)/deltacmd.h: $(OBJDIR)/headers
1164
1165 $(OBJDIR)/descendants_.c: $(SRCDIR)/descendants.c $(TRANSLATE)
1166 $(TRANSLATE) $(SRCDIR)/descendants.c >$(OBJDIR)/descendants_.c
1167
1168 $(OBJDIR)/descendants.o: $(OBJDIR)/descendants_.c $(OBJDIR)/descendants.h $(SRCDIR)/config.h
1169 $(XTCC) -o $(OBJDIR)/descendants.o -c $(OBJDIR)/descendants_.c
1170
1171 $(OBJDIR)/descendants.h: $(OBJDIR)/headers
1172
1173 $(OBJDIR)/diff_.c: $(SRCDIR)/diff.c $(TRANSLATE)
1174 $(TRANSLATE) $(SRCDIR)/diff.c >$(OBJDIR)/diff_.c
1175
1176 $(OBJDIR)/diff.o: $(OBJDIR)/diff_.c $(OBJDIR)/diff.h $(SRCDIR)/config.h
1177 $(XTCC) -o $(OBJDIR)/diff.o -c $(OBJDIR)/diff_.c
1178
1179 $(OBJDIR)/diff.h: $(OBJDIR)/headers
1180
1181 $(OBJDIR)/diffcmd_.c: $(SRCDIR)/diffcmd.c $(TRANSLATE)
1182 $(TRANSLATE) $(SRCDIR)/diffcmd.c >$(OBJDIR)/diffcmd_.c
1183
1184 $(OBJDIR)/diffcmd.o: $(OBJDIR)/diffcmd_.c $(OBJDIR)/diffcmd.h $(SRCDIR)/config.h
1185 $(XTCC) -o $(OBJDIR)/diffcmd.o -c $(OBJDIR)/diffcmd_.c
1186
1187 $(OBJDIR)/diffcmd.h: $(OBJDIR)/headers
1188
1189 $(OBJDIR)/doc_.c: $(SRCDIR)/doc.c $(TRANSLATE)
1190 $(TRANSLATE) $(SRCDIR)/doc.c >$(OBJDIR)/doc_.c
1191
1192 $(OBJDIR)/doc.o: $(OBJDIR)/doc_.c $(OBJDIR)/doc.h $(SRCDIR)/config.h
1193 $(XTCC) -o $(OBJDIR)/doc.o -c $(OBJDIR)/doc_.c
1194
1195 $(OBJDIR)/doc.h: $(OBJDIR)/headers
1196
1197 $(OBJDIR)/encode_.c: $(SRCDIR)/encode.c $(TRANSLATE)
1198 $(TRANSLATE) $(SRCDIR)/encode.c >$(OBJDIR)/encode_.c
1199
1200 $(OBJDIR)/encode.o: $(OBJDIR)/encode_.c $(OBJDIR)/encode.h $(SRCDIR)/config.h
1201 $(XTCC) -o $(OBJDIR)/encode.o -c $(OBJDIR)/encode_.c
1202
1203 $(OBJDIR)/encode.h: $(OBJDIR)/headers
1204
1205 $(OBJDIR)/event_.c: $(SRCDIR)/event.c $(TRANSLATE)
1206 $(TRANSLATE) $(SRCDIR)/event.c >$(OBJDIR)/event_.c
1207
1208 $(OBJDIR)/event.o: $(OBJDIR)/event_.c $(OBJDIR)/event.h $(SRCDIR)/config.h
1209 $(XTCC) -o $(OBJDIR)/event.o -c $(OBJDIR)/event_.c
1210
1211 $(OBJDIR)/event.h: $(OBJDIR)/headers
1212
1213 $(OBJDIR)/export_.c: $(SRCDIR)/export.c $(TRANSLATE)
1214 $(TRANSLATE) $(SRCDIR)/export.c >$(OBJDIR)/export_.c
1215
1216 $(OBJDIR)/export.o: $(OBJDIR)/export_.c $(OBJDIR)/export.h $(SRCDIR)/config.h
1217 $(XTCC) -o $(OBJDIR)/export.o -c $(OBJDIR)/export_.c
1218
1219 $(OBJDIR)/export.h: $(OBJDIR)/headers
1220
1221 $(OBJDIR)/file_.c: $(SRCDIR)/file.c $(TRANSLATE)
1222 $(TRANSLATE) $(SRCDIR)/file.c >$(OBJDIR)/file_.c
1223
1224 $(OBJDIR)/file.o: $(OBJDIR)/file_.c $(OBJDIR)/file.h $(SRCDIR)/config.h
1225 $(XTCC) -o $(OBJDIR)/file.o -c $(OBJDIR)/file_.c
1226
1227 $(OBJDIR)/file.h: $(OBJDIR)/headers
1228
1229 $(OBJDIR)/finfo_.c: $(SRCDIR)/finfo.c $(TRANSLATE)
1230 $(TRANSLATE) $(SRCDIR)/finfo.c >$(OBJDIR)/finfo_.c
1231
1232 $(OBJDIR)/finfo.o: $(OBJDIR)/finfo_.c $(OBJDIR)/finfo.h $(SRCDIR)/config.h
1233 $(XTCC) -o $(OBJDIR)/finfo.o -c $(OBJDIR)/finfo_.c
1234
1235 $(OBJDIR)/finfo.h: $(OBJDIR)/headers
 
 
 
 
 
 
 
 
1236
1237 $(OBJDIR)/fusefs_.c: $(SRCDIR)/fusefs.c $(TRANSLATE)
1238 $(TRANSLATE) $(SRCDIR)/fusefs.c >$(OBJDIR)/fusefs_.c
1239
1240 $(OBJDIR)/fusefs.o: $(OBJDIR)/fusefs_.c $(OBJDIR)/fusefs.h $(SRCDIR)/config.h
1241 $(XTCC) -o $(OBJDIR)/fusefs.o -c $(OBJDIR)/fusefs_.c
1242
1243 $(OBJDIR)/fusefs.h: $(OBJDIR)/headers
1244
1245 $(OBJDIR)/glob_.c: $(SRCDIR)/glob.c $(TRANSLATE)
1246 $(TRANSLATE) $(SRCDIR)/glob.c >$(OBJDIR)/glob_.c
1247
1248 $(OBJDIR)/glob.o: $(OBJDIR)/glob_.c $(OBJDIR)/glob.h $(SRCDIR)/config.h
1249 $(XTCC) -o $(OBJDIR)/glob.o -c $(OBJDIR)/glob_.c
1250
1251 $(OBJDIR)/glob.h: $(OBJDIR)/headers
1252
1253 $(OBJDIR)/graph_.c: $(SRCDIR)/graph.c $(TRANSLATE)
1254 $(TRANSLATE) $(SRCDIR)/graph.c >$(OBJDIR)/graph_.c
1255
1256 $(OBJDIR)/graph.o: $(OBJDIR)/graph_.c $(OBJDIR)/graph.h $(SRCDIR)/config.h
1257 $(XTCC) -o $(OBJDIR)/graph.o -c $(OBJDIR)/graph_.c
1258
1259 $(OBJDIR)/graph.h: $(OBJDIR)/headers
1260
1261 $(OBJDIR)/gzip_.c: $(SRCDIR)/gzip.c $(TRANSLATE)
1262 $(TRANSLATE) $(SRCDIR)/gzip.c >$(OBJDIR)/gzip_.c
1263
1264 $(OBJDIR)/gzip.o: $(OBJDIR)/gzip_.c $(OBJDIR)/gzip.h $(SRCDIR)/config.h
1265 $(XTCC) -o $(OBJDIR)/gzip.o -c $(OBJDIR)/gzip_.c
1266
1267 $(OBJDIR)/gzip.h: $(OBJDIR)/headers
1268
1269 $(OBJDIR)/http_.c: $(SRCDIR)/http.c $(TRANSLATE)
1270 $(TRANSLATE) $(SRCDIR)/http.c >$(OBJDIR)/http_.c
1271
1272 $(OBJDIR)/http.o: $(OBJDIR)/http_.c $(OBJDIR)/http.h $(SRCDIR)/config.h
1273 $(XTCC) -o $(OBJDIR)/http.o -c $(OBJDIR)/http_.c
1274
1275 $(OBJDIR)/http.h: $(OBJDIR)/headers
1276
1277 $(OBJDIR)/http_socket_.c: $(SRCDIR)/http_socket.c $(TRANSLATE)
1278 $(TRANSLATE) $(SRCDIR)/http_socket.c >$(OBJDIR)/http_socket_.c
1279
1280 $(OBJDIR)/http_socket.o: $(OBJDIR)/http_socket_.c $(OBJDIR)/http_socket.h $(SRCDIR)/config.h
1281 $(XTCC) -o $(OBJDIR)/http_socket.o -c $(OBJDIR)/http_socket_.c
1282
1283 $(OBJDIR)/http_socket.h: $(OBJDIR)/headers
1284
1285 $(OBJDIR)/http_ssl_.c: $(SRCDIR)/http_ssl.c $(TRANSLATE)
1286 $(TRANSLATE) $(SRCDIR)/http_ssl.c >$(OBJDIR)/http_ssl_.c
1287
1288 $(OBJDIR)/http_ssl.o: $(OBJDIR)/http_ssl_.c $(OBJDIR)/http_ssl.h $(SRCDIR)/config.h
1289 $(XTCC) -o $(OBJDIR)/http_ssl.o -c $(OBJDIR)/http_ssl_.c
1290
1291 $(OBJDIR)/http_ssl.h: $(OBJDIR)/headers
1292
1293 $(OBJDIR)/http_transport_.c: $(SRCDIR)/http_transport.c $(TRANSLATE)
1294 $(TRANSLATE) $(SRCDIR)/http_transport.c >$(OBJDIR)/http_transport_.c
1295
1296 $(OBJDIR)/http_transport.o: $(OBJDIR)/http_transport_.c $(OBJDIR)/http_transport.h $(SRCDIR)/config.h
1297 $(XTCC) -o $(OBJDIR)/http_transport.o -c $(OBJDIR)/http_transport_.c
1298
1299 $(OBJDIR)/http_transport.h: $(OBJDIR)/headers
1300
1301 $(OBJDIR)/import_.c: $(SRCDIR)/import.c $(TRANSLATE)
1302 $(TRANSLATE) $(SRCDIR)/import.c >$(OBJDIR)/import_.c
1303
1304 $(OBJDIR)/import.o: $(OBJDIR)/import_.c $(OBJDIR)/import.h $(SRCDIR)/config.h
1305 $(XTCC) -o $(OBJDIR)/import.o -c $(OBJDIR)/import_.c
1306
1307 $(OBJDIR)/import.h: $(OBJDIR)/headers
1308
1309 $(OBJDIR)/info_.c: $(SRCDIR)/info.c $(TRANSLATE)
1310 $(TRANSLATE) $(SRCDIR)/info.c >$(OBJDIR)/info_.c
1311
1312 $(OBJDIR)/info.o: $(OBJDIR)/info_.c $(OBJDIR)/info.h $(SRCDIR)/config.h
1313 $(XTCC) -o $(OBJDIR)/info.o -c $(OBJDIR)/info_.c
1314
1315 $(OBJDIR)/info.h: $(OBJDIR)/headers
1316
1317 $(OBJDIR)/json_.c: $(SRCDIR)/json.c $(TRANSLATE)
1318 $(TRANSLATE) $(SRCDIR)/json.c >$(OBJDIR)/json_.c
1319
1320 $(OBJDIR)/json.o: $(OBJDIR)/json_.c $(OBJDIR)/json.h $(SRCDIR)/config.h
1321 $(XTCC) -o $(OBJDIR)/json.o -c $(OBJDIR)/json_.c
1322
1323 $(OBJDIR)/json.h: $(OBJDIR)/headers
1324
1325 $(OBJDIR)/json_artifact_.c: $(SRCDIR)/json_artifact.c $(TRANSLATE)
1326 $(TRANSLATE) $(SRCDIR)/json_artifact.c >$(OBJDIR)/json_artifact_.c
1327
1328 $(OBJDIR)/json_artifact.o: $(OBJDIR)/json_artifact_.c $(OBJDIR)/json_artifact.h $(SRCDIR)/config.h
1329 $(XTCC) -o $(OBJDIR)/json_artifact.o -c $(OBJDIR)/json_artifact_.c
1330
1331 $(OBJDIR)/json_artifact.h: $(OBJDIR)/headers
1332
1333 $(OBJDIR)/json_branch_.c: $(SRCDIR)/json_branch.c $(TRANSLATE)
1334 $(TRANSLATE) $(SRCDIR)/json_branch.c >$(OBJDIR)/json_branch_.c
1335
1336 $(OBJDIR)/json_branch.o: $(OBJDIR)/json_branch_.c $(OBJDIR)/json_branch.h $(SRCDIR)/config.h
1337 $(XTCC) -o $(OBJDIR)/json_branch.o -c $(OBJDIR)/json_branch_.c
1338
1339 $(OBJDIR)/json_branch.h: $(OBJDIR)/headers
1340
1341 $(OBJDIR)/json_config_.c: $(SRCDIR)/json_config.c $(TRANSLATE)
1342 $(TRANSLATE) $(SRCDIR)/json_config.c >$(OBJDIR)/json_config_.c
1343
1344 $(OBJDIR)/json_config.o: $(OBJDIR)/json_config_.c $(OBJDIR)/json_config.h $(SRCDIR)/config.h
1345 $(XTCC) -o $(OBJDIR)/json_config.o -c $(OBJDIR)/json_config_.c
1346
1347 $(OBJDIR)/json_config.h: $(OBJDIR)/headers
1348
1349 $(OBJDIR)/json_diff_.c: $(SRCDIR)/json_diff.c $(TRANSLATE)
1350 $(TRANSLATE) $(SRCDIR)/json_diff.c >$(OBJDIR)/json_diff_.c
1351
1352 $(OBJDIR)/json_diff.o: $(OBJDIR)/json_diff_.c $(OBJDIR)/json_diff.h $(SRCDIR)/config.h
1353 $(XTCC) -o $(OBJDIR)/json_diff.o -c $(OBJDIR)/json_diff_.c
1354
1355 $(OBJDIR)/json_diff.h: $(OBJDIR)/headers
1356
1357 $(OBJDIR)/json_dir_.c: $(SRCDIR)/json_dir.c $(TRANSLATE)
1358 $(TRANSLATE) $(SRCDIR)/json_dir.c >$(OBJDIR)/json_dir_.c
1359
1360 $(OBJDIR)/json_dir.o: $(OBJDIR)/json_dir_.c $(OBJDIR)/json_dir.h $(SRCDIR)/config.h
1361 $(XTCC) -o $(OBJDIR)/json_dir.o -c $(OBJDIR)/json_dir_.c
1362
1363 $(OBJDIR)/json_dir.h: $(OBJDIR)/headers
1364
1365 $(OBJDIR)/json_finfo_.c: $(SRCDIR)/json_finfo.c $(TRANSLATE)
1366 $(TRANSLATE) $(SRCDIR)/json_finfo.c >$(OBJDIR)/json_finfo_.c
1367
1368 $(OBJDIR)/json_finfo.o: $(OBJDIR)/json_finfo_.c $(OBJDIR)/json_finfo.h $(SRCDIR)/config.h
1369 $(XTCC) -o $(OBJDIR)/json_finfo.o -c $(OBJDIR)/json_finfo_.c
1370
1371 $(OBJDIR)/json_finfo.h: $(OBJDIR)/headers
1372
1373 $(OBJDIR)/json_login_.c: $(SRCDIR)/json_login.c $(TRANSLATE)
1374 $(TRANSLATE) $(SRCDIR)/json_login.c >$(OBJDIR)/json_login_.c
1375
1376 $(OBJDIR)/json_login.o: $(OBJDIR)/json_login_.c $(OBJDIR)/json_login.h $(SRCDIR)/config.h
1377 $(XTCC) -o $(OBJDIR)/json_login.o -c $(OBJDIR)/json_login_.c
1378
1379 $(OBJDIR)/json_login.h: $(OBJDIR)/headers
1380
1381 $(OBJDIR)/json_query_.c: $(SRCDIR)/json_query.c $(TRANSLATE)
1382 $(TRANSLATE) $(SRCDIR)/json_query.c >$(OBJDIR)/json_query_.c
1383
1384 $(OBJDIR)/json_query.o: $(OBJDIR)/json_query_.c $(OBJDIR)/json_query.h $(SRCDIR)/config.h
1385 $(XTCC) -o $(OBJDIR)/json_query.o -c $(OBJDIR)/json_query_.c
1386
1387 $(OBJDIR)/json_query.h: $(OBJDIR)/headers
1388
1389 $(OBJDIR)/json_report_.c: $(SRCDIR)/json_report.c $(TRANSLATE)
1390 $(TRANSLATE) $(SRCDIR)/json_report.c >$(OBJDIR)/json_report_.c
1391
1392 $(OBJDIR)/json_report.o: $(OBJDIR)/json_report_.c $(OBJDIR)/json_report.h $(SRCDIR)/config.h
1393 $(XTCC) -o $(OBJDIR)/json_report.o -c $(OBJDIR)/json_report_.c
1394
1395 $(OBJDIR)/json_report.h: $(OBJDIR)/headers
1396
1397 $(OBJDIR)/json_status_.c: $(SRCDIR)/json_status.c $(TRANSLATE)
1398 $(TRANSLATE) $(SRCDIR)/json_status.c >$(OBJDIR)/json_status_.c
1399
1400 $(OBJDIR)/json_status.o: $(OBJDIR)/json_status_.c $(OBJDIR)/json_status.h $(SRCDIR)/config.h
1401 $(XTCC) -o $(OBJDIR)/json_status.o -c $(OBJDIR)/json_status_.c
1402
1403 $(OBJDIR)/json_status.h: $(OBJDIR)/headers
1404
1405 $(OBJDIR)/json_tag_.c: $(SRCDIR)/json_tag.c $(TRANSLATE)
1406 $(TRANSLATE) $(SRCDIR)/json_tag.c >$(OBJDIR)/json_tag_.c
1407
1408 $(OBJDIR)/json_tag.o: $(OBJDIR)/json_tag_.c $(OBJDIR)/json_tag.h $(SRCDIR)/config.h
1409 $(XTCC) -o $(OBJDIR)/json_tag.o -c $(OBJDIR)/json_tag_.c
1410
1411 $(OBJDIR)/json_tag.h: $(OBJDIR)/headers
1412
1413 $(OBJDIR)/json_timeline_.c: $(SRCDIR)/json_timeline.c $(TRANSLATE)
1414 $(TRANSLATE) $(SRCDIR)/json_timeline.c >$(OBJDIR)/json_timeline_.c
1415
1416 $(OBJDIR)/json_timeline.o: $(OBJDIR)/json_timeline_.c $(OBJDIR)/json_timeline.h $(SRCDIR)/config.h
1417 $(XTCC) -o $(OBJDIR)/json_timeline.o -c $(OBJDIR)/json_timeline_.c
1418
1419 $(OBJDIR)/json_timeline.h: $(OBJDIR)/headers
1420
1421 $(OBJDIR)/json_user_.c: $(SRCDIR)/json_user.c $(TRANSLATE)
1422 $(TRANSLATE) $(SRCDIR)/json_user.c >$(OBJDIR)/json_user_.c
1423
1424 $(OBJDIR)/json_user.o: $(OBJDIR)/json_user_.c $(OBJDIR)/json_user.h $(SRCDIR)/config.h
1425 $(XTCC) -o $(OBJDIR)/json_user.o -c $(OBJDIR)/json_user_.c
1426
1427 $(OBJDIR)/json_user.h: $(OBJDIR)/headers
1428
1429 $(OBJDIR)/json_wiki_.c: $(SRCDIR)/json_wiki.c $(TRANSLATE)
1430 $(TRANSLATE) $(SRCDIR)/json_wiki.c >$(OBJDIR)/json_wiki_.c
1431
1432 $(OBJDIR)/json_wiki.o: $(OBJDIR)/json_wiki_.c $(OBJDIR)/json_wiki.h $(SRCDIR)/config.h
1433 $(XTCC) -o $(OBJDIR)/json_wiki.o -c $(OBJDIR)/json_wiki_.c
1434
1435 $(OBJDIR)/json_wiki.h: $(OBJDIR)/headers
1436
1437 $(OBJDIR)/leaf_.c: $(SRCDIR)/leaf.c $(TRANSLATE)
1438 $(TRANSLATE) $(SRCDIR)/leaf.c >$(OBJDIR)/leaf_.c
1439
1440 $(OBJDIR)/leaf.o: $(OBJDIR)/leaf_.c $(OBJDIR)/leaf.h $(SRCDIR)/config.h
1441 $(XTCC) -o $(OBJDIR)/leaf.o -c $(OBJDIR)/leaf_.c
1442
1443 $(OBJDIR)/leaf.h: $(OBJDIR)/headers
1444
1445 $(OBJDIR)/loadctrl_.c: $(SRCDIR)/loadctrl.c $(TRANSLATE)
1446 $(TRANSLATE) $(SRCDIR)/loadctrl.c >$(OBJDIR)/loadctrl_.c
1447
1448 $(OBJDIR)/loadctrl.o: $(OBJDIR)/loadctrl_.c $(OBJDIR)/loadctrl.h $(SRCDIR)/config.h
1449 $(XTCC) -o $(OBJDIR)/loadctrl.o -c $(OBJDIR)/loadctrl_.c
1450
1451 $(OBJDIR)/loadctrl.h: $(OBJDIR)/headers
1452
1453 $(OBJDIR)/login_.c: $(SRCDIR)/login.c $(TRANSLATE)
1454 $(TRANSLATE) $(SRCDIR)/login.c >$(OBJDIR)/login_.c
1455
1456 $(OBJDIR)/login.o: $(OBJDIR)/login_.c $(OBJDIR)/login.h $(SRCDIR)/config.h
1457 $(XTCC) -o $(OBJDIR)/login.o -c $(OBJDIR)/login_.c
1458
1459 $(OBJDIR)/login.h: $(OBJDIR)/headers
1460
1461 $(OBJDIR)/lookslike_.c: $(SRCDIR)/lookslike.c $(TRANSLATE)
1462 $(TRANSLATE) $(SRCDIR)/lookslike.c >$(OBJDIR)/lookslike_.c
1463
1464 $(OBJDIR)/lookslike.o: $(OBJDIR)/lookslike_.c $(OBJDIR)/lookslike.h $(SRCDIR)/config.h
1465 $(XTCC) -o $(OBJDIR)/lookslike.o -c $(OBJDIR)/lookslike_.c
1466
1467 $(OBJDIR)/lookslike.h: $(OBJDIR)/headers
1468
1469 $(OBJDIR)/main_.c: $(SRCDIR)/main.c $(TRANSLATE)
1470 $(TRANSLATE) $(SRCDIR)/main.c >$(OBJDIR)/main_.c
1471
1472 $(OBJDIR)/main.o: $(OBJDIR)/main_.c $(OBJDIR)/main.h $(OBJDIR)/page_index.h $(SRCDIR)/config.h
1473 $(XTCC) -o $(OBJDIR)/main.o -c $(OBJDIR)/main_.c
1474
1475 $(OBJDIR)/main.h: $(OBJDIR)/headers
1476
1477 $(OBJDIR)/manifest_.c: $(SRCDIR)/manifest.c $(TRANSLATE)
1478 $(TRANSLATE) $(SRCDIR)/manifest.c >$(OBJDIR)/manifest_.c
1479
1480 $(OBJDIR)/manifest.o: $(OBJDIR)/manifest_.c $(OBJDIR)/manifest.h $(SRCDIR)/config.h
1481 $(XTCC) -o $(OBJDIR)/manifest.o -c $(OBJDIR)/manifest_.c
1482
1483 $(OBJDIR)/manifest.h: $(OBJDIR)/headers
1484
1485 $(OBJDIR)/markdown_.c: $(SRCDIR)/markdown.c $(TRANSLATE)
1486 $(TRANSLATE) $(SRCDIR)/markdown.c >$(OBJDIR)/markdown_.c
1487
1488 $(OBJDIR)/markdown.o: $(OBJDIR)/markdown_.c $(OBJDIR)/markdown.h $(SRCDIR)/config.h
1489 $(XTCC) -o $(OBJDIR)/markdown.o -c $(OBJDIR)/markdown_.c
1490
1491 $(OBJDIR)/markdown.h: $(OBJDIR)/headers
1492
1493 $(OBJDIR)/markdown_html_.c: $(SRCDIR)/markdown_html.c $(TRANSLATE)
1494 $(TRANSLATE) $(SRCDIR)/markdown_html.c >$(OBJDIR)/markdown_html_.c
1495
1496 $(OBJDIR)/markdown_html.o: $(OBJDIR)/markdown_html_.c $(OBJDIR)/markdown_html.h $(SRCDIR)/config.h
1497 $(XTCC) -o $(OBJDIR)/markdown_html.o -c $(OBJDIR)/markdown_html_.c
1498
1499 $(OBJDIR)/markdown_html.h: $(OBJDIR)/headers
1500
1501 $(OBJDIR)/md5_.c: $(SRCDIR)/md5.c $(TRANSLATE)
1502 $(TRANSLATE) $(SRCDIR)/md5.c >$(OBJDIR)/md5_.c
1503
1504 $(OBJDIR)/md5.o: $(OBJDIR)/md5_.c $(OBJDIR)/md5.h $(SRCDIR)/config.h
1505 $(XTCC) -o $(OBJDIR)/md5.o -c $(OBJDIR)/md5_.c
1506
1507 $(OBJDIR)/md5.h: $(OBJDIR)/headers
1508
1509 $(OBJDIR)/merge_.c: $(SRCDIR)/merge.c $(TRANSLATE)
1510 $(TRANSLATE) $(SRCDIR)/merge.c >$(OBJDIR)/merge_.c
1511
1512 $(OBJDIR)/merge.o: $(OBJDIR)/merge_.c $(OBJDIR)/merge.h $(SRCDIR)/config.h
1513 $(XTCC) -o $(OBJDIR)/merge.o -c $(OBJDIR)/merge_.c
1514
1515 $(OBJDIR)/merge.h: $(OBJDIR)/headers
1516
1517 $(OBJDIR)/merge3_.c: $(SRCDIR)/merge3.c $(TRANSLATE)
1518 $(TRANSLATE) $(SRCDIR)/merge3.c >$(OBJDIR)/merge3_.c
1519
1520 $(OBJDIR)/merge3.o: $(OBJDIR)/merge3_.c $(OBJDIR)/merge3.h $(SRCDIR)/config.h
1521 $(XTCC) -o $(OBJDIR)/merge3.o -c $(OBJDIR)/merge3_.c
1522
1523 $(OBJDIR)/merge3.h: $(OBJDIR)/headers
1524
1525 $(OBJDIR)/moderate_.c: $(SRCDIR)/moderate.c $(TRANSLATE)
1526 $(TRANSLATE) $(SRCDIR)/moderate.c >$(OBJDIR)/moderate_.c
1527
1528 $(OBJDIR)/moderate.o: $(OBJDIR)/moderate_.c $(OBJDIR)/moderate.h $(SRCDIR)/config.h
1529 $(XTCC) -o $(OBJDIR)/moderate.o -c $(OBJDIR)/moderate_.c
1530
1531 $(OBJDIR)/moderate.h: $(OBJDIR)/headers
1532
1533 $(OBJDIR)/name_.c: $(SRCDIR)/name.c $(TRANSLATE)
1534 $(TRANSLATE) $(SRCDIR)/name.c >$(OBJDIR)/name_.c
1535
1536 $(OBJDIR)/name.o: $(OBJDIR)/name_.c $(OBJDIR)/name.h $(SRCDIR)/config.h
1537 $(XTCC) -o $(OBJDIR)/name.o -c $(OBJDIR)/name_.c
1538
1539 $(OBJDIR)/name.h: $(OBJDIR)/headers
1540
1541 $(OBJDIR)/path_.c: $(SRCDIR)/path.c $(TRANSLATE)
1542 $(TRANSLATE) $(SRCDIR)/path.c >$(OBJDIR)/path_.c
1543
1544 $(OBJDIR)/path.o: $(OBJDIR)/path_.c $(OBJDIR)/path.h $(SRCDIR)/config.h
1545 $(XTCC) -o $(OBJDIR)/path.o -c $(OBJDIR)/path_.c
1546
1547 $(OBJDIR)/path.h: $(OBJDIR)/headers
1548
1549 $(OBJDIR)/pivot_.c: $(SRCDIR)/pivot.c $(TRANSLATE)
1550 $(TRANSLATE) $(SRCDIR)/pivot.c >$(OBJDIR)/pivot_.c
1551
1552 $(OBJDIR)/pivot.o: $(OBJDIR)/pivot_.c $(OBJDIR)/pivot.h $(SRCDIR)/config.h
1553 $(XTCC) -o $(OBJDIR)/pivot.o -c $(OBJDIR)/pivot_.c
1554
1555 $(OBJDIR)/pivot.h: $(OBJDIR)/headers
1556
1557 $(OBJDIR)/popen_.c: $(SRCDIR)/popen.c $(TRANSLATE)
1558 $(TRANSLATE) $(SRCDIR)/popen.c >$(OBJDIR)/popen_.c
1559
1560 $(OBJDIR)/popen.o: $(OBJDIR)/popen_.c $(OBJDIR)/popen.h $(SRCDIR)/config.h
1561 $(XTCC) -o $(OBJDIR)/popen.o -c $(OBJDIR)/popen_.c
1562
1563 $(OBJDIR)/popen.h: $(OBJDIR)/headers
1564
1565 $(OBJDIR)/pqueue_.c: $(SRCDIR)/pqueue.c $(TRANSLATE)
1566 $(TRANSLATE) $(SRCDIR)/pqueue.c >$(OBJDIR)/pqueue_.c
1567
1568 $(OBJDIR)/pqueue.o: $(OBJDIR)/pqueue_.c $(OBJDIR)/pqueue.h $(SRCDIR)/config.h
1569 $(XTCC) -o $(OBJDIR)/pqueue.o -c $(OBJDIR)/pqueue_.c
1570
1571 $(OBJDIR)/pqueue.h: $(OBJDIR)/headers
1572
1573 $(OBJDIR)/printf_.c: $(SRCDIR)/printf.c $(TRANSLATE)
1574 $(TRANSLATE) $(SRCDIR)/printf.c >$(OBJDIR)/printf_.c
1575
1576 $(OBJDIR)/printf.o: $(OBJDIR)/printf_.c $(OBJDIR)/printf.h $(SRCDIR)/config.h
1577 $(XTCC) -o $(OBJDIR)/printf.o -c $(OBJDIR)/printf_.c
1578
1579 $(OBJDIR)/printf.h: $(OBJDIR)/headers
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1580
1581 $(OBJDIR)/rebuild_.c: $(SRCDIR)/rebuild.c $(TRANSLATE)
1582 $(TRANSLATE) $(SRCDIR)/rebuild.c >$(OBJDIR)/rebuild_.c
1583
1584 $(OBJDIR)/rebuild.o: $(OBJDIR)/rebuild_.c $(OBJDIR)/rebuild.h $(SRCDIR)/config.h
1585 $(XTCC) -o $(OBJDIR)/rebuild.o -c $(OBJDIR)/rebuild_.c
1586
1587 $(OBJDIR)/rebuild.h: $(OBJDIR)/headers
1588
1589 $(OBJDIR)/regexp_.c: $(SRCDIR)/regexp.c $(TRANSLATE)
1590 $(TRANSLATE) $(SRCDIR)/regexp.c >$(OBJDIR)/regexp_.c
1591
1592 $(OBJDIR)/regexp.o: $(OBJDIR)/regexp_.c $(OBJDIR)/regexp.h $(SRCDIR)/config.h
1593 $(XTCC) -o $(OBJDIR)/regexp.o -c $(OBJDIR)/regexp_.c
1594
1595 $(OBJDIR)/regexp.h: $(OBJDIR)/headers
1596
1597 $(OBJDIR)/report_.c: $(SRCDIR)/report.c $(TRANSLATE)
1598 $(TRANSLATE) $(SRCDIR)/report.c >$(OBJDIR)/report_.c
1599
1600 $(OBJDIR)/report.o: $(OBJDIR)/report_.c $(OBJDIR)/report.h $(SRCDIR)/config.h
1601 $(XTCC) -o $(OBJDIR)/report.o -c $(OBJDIR)/report_.c
1602
1603 $(OBJDIR)/report.h: $(OBJDIR)/headers
1604
1605 $(OBJDIR)/rss_.c: $(SRCDIR)/rss.c $(TRANSLATE)
1606 $(TRANSLATE) $(SRCDIR)/rss.c >$(OBJDIR)/rss_.c
1607
1608 $(OBJDIR)/rss.o: $(OBJDIR)/rss_.c $(OBJDIR)/rss.h $(SRCDIR)/config.h
1609 $(XTCC) -o $(OBJDIR)/rss.o -c $(OBJDIR)/rss_.c
1610
1611 $(OBJDIR)/rss.h: $(OBJDIR)/headers
1612
1613 $(OBJDIR)/schema_.c: $(SRCDIR)/schema.c $(TRANSLATE)
1614 $(TRANSLATE) $(SRCDIR)/schema.c >$(OBJDIR)/schema_.c
1615
1616 $(OBJDIR)/schema.o: $(OBJDIR)/schema_.c $(OBJDIR)/schema.h $(SRCDIR)/config.h
1617 $(XTCC) -o $(OBJDIR)/schema.o -c $(OBJDIR)/schema_.c
1618
1619 $(OBJDIR)/schema.h: $(OBJDIR)/headers
1620
1621 $(OBJDIR)/search_.c: $(SRCDIR)/search.c $(TRANSLATE)
1622 $(TRANSLATE) $(SRCDIR)/search.c >$(OBJDIR)/search_.c
1623
1624 $(OBJDIR)/search.o: $(OBJDIR)/search_.c $(OBJDIR)/search.h $(SRCDIR)/config.h
1625 $(XTCC) -o $(OBJDIR)/search.o -c $(OBJDIR)/search_.c
1626
1627 $(OBJDIR)/search.h: $(OBJDIR)/headers
1628
1629 $(OBJDIR)/setup_.c: $(SRCDIR)/setup.c $(TRANSLATE)
1630 $(TRANSLATE) $(SRCDIR)/setup.c >$(OBJDIR)/setup_.c
1631
1632 $(OBJDIR)/setup.o: $(OBJDIR)/setup_.c $(OBJDIR)/setup.h $(SRCDIR)/config.h
1633 $(XTCC) -o $(OBJDIR)/setup.o -c $(OBJDIR)/setup_.c
1634
1635 $(OBJDIR)/setup.h: $(OBJDIR)/headers
1636
1637 $(OBJDIR)/sha1_.c: $(SRCDIR)/sha1.c $(TRANSLATE)
1638 $(TRANSLATE) $(SRCDIR)/sha1.c >$(OBJDIR)/sha1_.c
1639
1640 $(OBJDIR)/sha1.o: $(OBJDIR)/sha1_.c $(OBJDIR)/sha1.h $(SRCDIR)/config.h
1641 $(XTCC) -o $(OBJDIR)/sha1.o -c $(OBJDIR)/sha1_.c
1642
1643 $(OBJDIR)/sha1.h: $(OBJDIR)/headers
1644
1645 $(OBJDIR)/shun_.c: $(SRCDIR)/shun.c $(TRANSLATE)
1646 $(TRANSLATE) $(SRCDIR)/shun.c >$(OBJDIR)/shun_.c
1647
1648 $(OBJDIR)/shun.o: $(OBJDIR)/shun_.c $(OBJDIR)/shun.h $(SRCDIR)/config.h
1649 $(XTCC) -o $(OBJDIR)/shun.o -c $(OBJDIR)/shun_.c
1650
1651 $(OBJDIR)/shun.h: $(OBJDIR)/headers
1652
1653 $(OBJDIR)/skins_.c: $(SRCDIR)/skins.c $(TRANSLATE)
1654 $(TRANSLATE) $(SRCDIR)/skins.c >$(OBJDIR)/skins_.c
1655
1656 $(OBJDIR)/skins.o: $(OBJDIR)/skins_.c $(OBJDIR)/skins.h $(SRCDIR)/config.h
1657 $(XTCC) -o $(OBJDIR)/skins.o -c $(OBJDIR)/skins_.c
1658
1659 $(OBJDIR)/skins.h: $(OBJDIR)/headers
1660
1661 $(OBJDIR)/sqlcmd_.c: $(SRCDIR)/sqlcmd.c $(TRANSLATE)
1662 $(TRANSLATE) $(SRCDIR)/sqlcmd.c >$(OBJDIR)/sqlcmd_.c
1663
1664 $(OBJDIR)/sqlcmd.o: $(OBJDIR)/sqlcmd_.c $(OBJDIR)/sqlcmd.h $(SRCDIR)/config.h
1665 $(XTCC) -o $(OBJDIR)/sqlcmd.o -c $(OBJDIR)/sqlcmd_.c
1666
1667 $(OBJDIR)/sqlcmd.h: $(OBJDIR)/headers
1668
1669 $(OBJDIR)/stash_.c: $(SRCDIR)/stash.c $(TRANSLATE)
1670 $(TRANSLATE) $(SRCDIR)/stash.c >$(OBJDIR)/stash_.c
1671
1672 $(OBJDIR)/stash.o: $(OBJDIR)/stash_.c $(OBJDIR)/stash.h $(SRCDIR)/config.h
1673 $(XTCC) -o $(OBJDIR)/stash.o -c $(OBJDIR)/stash_.c
1674
1675 $(OBJDIR)/stash.h: $(OBJDIR)/headers
1676
1677 $(OBJDIR)/stat_.c: $(SRCDIR)/stat.c $(TRANSLATE)
1678 $(TRANSLATE) $(SRCDIR)/stat.c >$(OBJDIR)/stat_.c
1679
1680 $(OBJDIR)/stat.o: $(OBJDIR)/stat_.c $(OBJDIR)/stat.h $(SRCDIR)/config.h
1681 $(XTCC) -o $(OBJDIR)/stat.o -c $(OBJDIR)/stat_.c
1682
1683 $(OBJDIR)/stat.h: $(OBJDIR)/headers
1684
1685 $(OBJDIR)/style_.c: $(SRCDIR)/style.c $(TRANSLATE)
1686 $(TRANSLATE) $(SRCDIR)/style.c >$(OBJDIR)/style_.c
1687
1688 $(OBJDIR)/style.o: $(OBJDIR)/style_.c $(OBJDIR)/style.h $(SRCDIR)/config.h
1689 $(XTCC) -o $(OBJDIR)/style.o -c $(OBJDIR)/style_.c
1690
1691 $(OBJDIR)/style.h: $(OBJDIR)/headers
1692
1693 $(OBJDIR)/sync_.c: $(SRCDIR)/sync.c $(TRANSLATE)
1694 $(TRANSLATE) $(SRCDIR)/sync.c >$(OBJDIR)/sync_.c
1695
1696 $(OBJDIR)/sync.o: $(OBJDIR)/sync_.c $(OBJDIR)/sync.h $(SRCDIR)/config.h
1697 $(XTCC) -o $(OBJDIR)/sync.o -c $(OBJDIR)/sync_.c
1698
1699 $(OBJDIR)/sync.h: $(OBJDIR)/headers
1700
1701 $(OBJDIR)/tag_.c: $(SRCDIR)/tag.c $(TRANSLATE)
1702 $(TRANSLATE) $(SRCDIR)/tag.c >$(OBJDIR)/tag_.c
1703
1704 $(OBJDIR)/tag.o: $(OBJDIR)/tag_.c $(OBJDIR)/tag.h $(SRCDIR)/config.h
1705 $(XTCC) -o $(OBJDIR)/tag.o -c $(OBJDIR)/tag_.c
1706
1707 $(OBJDIR)/tag.h: $(OBJDIR)/headers
1708
1709 $(OBJDIR)/tar_.c: $(SRCDIR)/tar.c $(TRANSLATE)
1710 $(TRANSLATE) $(SRCDIR)/tar.c >$(OBJDIR)/tar_.c
1711
1712 $(OBJDIR)/tar.o: $(OBJDIR)/tar_.c $(OBJDIR)/tar.h $(SRCDIR)/config.h
1713 $(XTCC) -o $(OBJDIR)/tar.o -c $(OBJDIR)/tar_.c
1714
1715 $(OBJDIR)/tar.h: $(OBJDIR)/headers
1716
1717 $(OBJDIR)/th_main_.c: $(SRCDIR)/th_main.c $(TRANSLATE)
1718 $(TRANSLATE) $(SRCDIR)/th_main.c >$(OBJDIR)/th_main_.c
1719
1720 $(OBJDIR)/th_main.o: $(OBJDIR)/th_main_.c $(OBJDIR)/th_main.h $(SRCDIR)/config.h
1721 $(XTCC) -o $(OBJDIR)/th_main.o -c $(OBJDIR)/th_main_.c
1722
1723 $(OBJDIR)/th_main.h: $(OBJDIR)/headers
1724
1725 $(OBJDIR)/timeline_.c: $(SRCDIR)/timeline.c $(TRANSLATE)
1726 $(TRANSLATE) $(SRCDIR)/timeline.c >$(OBJDIR)/timeline_.c
1727
1728 $(OBJDIR)/timeline.o: $(OBJDIR)/timeline_.c $(OBJDIR)/timeline.h $(SRCDIR)/config.h
1729 $(XTCC) -o $(OBJDIR)/timeline.o -c $(OBJDIR)/timeline_.c
1730
1731 $(OBJDIR)/timeline.h: $(OBJDIR)/headers
1732
1733 $(OBJDIR)/tkt_.c: $(SRCDIR)/tkt.c $(TRANSLATE)
1734 $(TRANSLATE) $(SRCDIR)/tkt.c >$(OBJDIR)/tkt_.c
1735
1736 $(OBJDIR)/tkt.o: $(OBJDIR)/tkt_.c $(OBJDIR)/tkt.h $(SRCDIR)/config.h
1737 $(XTCC) -o $(OBJDIR)/tkt.o -c $(OBJDIR)/tkt_.c
1738
1739 $(OBJDIR)/tkt.h: $(OBJDIR)/headers
1740
1741 $(OBJDIR)/tktsetup_.c: $(SRCDIR)/tktsetup.c $(TRANSLATE)
1742 $(TRANSLATE) $(SRCDIR)/tktsetup.c >$(OBJDIR)/tktsetup_.c
1743
1744 $(OBJDIR)/tktsetup.o: $(OBJDIR)/tktsetup_.c $(OBJDIR)/tktsetup.h $(SRCDIR)/config.h
1745 $(XTCC) -o $(OBJDIR)/tktsetup.o -c $(OBJDIR)/tktsetup_.c
1746
1747 $(OBJDIR)/tktsetup.h: $(OBJDIR)/headers
1748
1749 $(OBJDIR)/undo_.c: $(SRCDIR)/undo.c $(TRANSLATE)
1750 $(TRANSLATE) $(SRCDIR)/undo.c >$(OBJDIR)/undo_.c
1751
1752 $(OBJDIR)/undo.o: $(OBJDIR)/undo_.c $(OBJDIR)/undo.h $(SRCDIR)/config.h
1753 $(XTCC) -o $(OBJDIR)/undo.o -c $(OBJDIR)/undo_.c
1754
1755 $(OBJDIR)/undo.h: $(OBJDIR)/headers
1756
1757 $(OBJDIR)/unicode_.c: $(SRCDIR)/unicode.c $(TRANSLATE)
1758 $(TRANSLATE) $(SRCDIR)/unicode.c >$(OBJDIR)/unicode_.c
1759
1760 $(OBJDIR)/unicode.o: $(OBJDIR)/unicode_.c $(OBJDIR)/unicode.h $(SRCDIR)/config.h
1761 $(XTCC) -o $(OBJDIR)/unicode.o -c $(OBJDIR)/unicode_.c
1762
1763 $(OBJDIR)/unicode.h: $(OBJDIR)/headers
1764
1765 $(OBJDIR)/update_.c: $(SRCDIR)/update.c $(TRANSLATE)
1766 $(TRANSLATE) $(SRCDIR)/update.c >$(OBJDIR)/update_.c
1767
1768 $(OBJDIR)/update.o: $(OBJDIR)/update_.c $(OBJDIR)/update.h $(SRCDIR)/config.h
1769 $(XTCC) -o $(OBJDIR)/update.o -c $(OBJDIR)/update_.c
1770
1771 $(OBJDIR)/update.h: $(OBJDIR)/headers
1772
1773 $(OBJDIR)/url_.c: $(SRCDIR)/url.c $(TRANSLATE)
1774 $(TRANSLATE) $(SRCDIR)/url.c >$(OBJDIR)/url_.c
1775
1776 $(OBJDIR)/url.o: $(OBJDIR)/url_.c $(OBJDIR)/url.h $(SRCDIR)/config.h
1777 $(XTCC) -o $(OBJDIR)/url.o -c $(OBJDIR)/url_.c
1778
1779 $(OBJDIR)/url.h: $(OBJDIR)/headers
1780
1781 $(OBJDIR)/user_.c: $(SRCDIR)/user.c $(TRANSLATE)
1782 $(TRANSLATE) $(SRCDIR)/user.c >$(OBJDIR)/user_.c
1783
1784 $(OBJDIR)/user.o: $(OBJDIR)/user_.c $(OBJDIR)/user.h $(SRCDIR)/config.h
1785 $(XTCC) -o $(OBJDIR)/user.o -c $(OBJDIR)/user_.c
1786
1787 $(OBJDIR)/user.h: $(OBJDIR)/headers
1788
1789 $(OBJDIR)/utf8_.c: $(SRCDIR)/utf8.c $(TRANSLATE)
1790 $(TRANSLATE) $(SRCDIR)/utf8.c >$(OBJDIR)/utf8_.c
1791
1792 $(OBJDIR)/utf8.o: $(OBJDIR)/utf8_.c $(OBJDIR)/utf8.h $(SRCDIR)/config.h
1793 $(XTCC) -o $(OBJDIR)/utf8.o -c $(OBJDIR)/utf8_.c
1794
1795 $(OBJDIR)/utf8.h: $(OBJDIR)/headers
1796
1797 $(OBJDIR)/util_.c: $(SRCDIR)/util.c $(TRANSLATE)
1798 $(TRANSLATE) $(SRCDIR)/util.c >$(OBJDIR)/util_.c
1799
1800 $(OBJDIR)/util.o: $(OBJDIR)/util_.c $(OBJDIR)/util.h $(SRCDIR)/config.h
1801 $(XTCC) -o $(OBJDIR)/util.o -c $(OBJDIR)/util_.c
1802
1803 $(OBJDIR)/util.h: $(OBJDIR)/headers
1804
1805 $(OBJDIR)/verify_.c: $(SRCDIR)/verify.c $(TRANSLATE)
1806 $(TRANSLATE) $(SRCDIR)/verify.c >$(OBJDIR)/verify_.c
1807
1808 $(OBJDIR)/verify.o: $(OBJDIR)/verify_.c $(OBJDIR)/verify.h $(SRCDIR)/config.h
1809 $(XTCC) -o $(OBJDIR)/verify.o -c $(OBJDIR)/verify_.c
1810
1811 $(OBJDIR)/verify.h: $(OBJDIR)/headers
1812
1813 $(OBJDIR)/vfile_.c: $(SRCDIR)/vfile.c $(TRANSLATE)
1814 $(TRANSLATE) $(SRCDIR)/vfile.c >$(OBJDIR)/vfile_.c
1815
1816 $(OBJDIR)/vfile.o: $(OBJDIR)/vfile_.c $(OBJDIR)/vfile.h $(SRCDIR)/config.h
1817 $(XTCC) -o $(OBJDIR)/vfile.o -c $(OBJDIR)/vfile_.c
1818
1819 $(OBJDIR)/vfile.h: $(OBJDIR)/headers
1820
1821 $(OBJDIR)/wiki_.c: $(SRCDIR)/wiki.c $(TRANSLATE)
1822 $(TRANSLATE) $(SRCDIR)/wiki.c >$(OBJDIR)/wiki_.c
1823
1824 $(OBJDIR)/wiki.o: $(OBJDIR)/wiki_.c $(OBJDIR)/wiki.h $(SRCDIR)/config.h
1825 $(XTCC) -o $(OBJDIR)/wiki.o -c $(OBJDIR)/wiki_.c
1826
1827 $(OBJDIR)/wiki.h: $(OBJDIR)/headers
1828
1829 $(OBJDIR)/wikiformat_.c: $(SRCDIR)/wikiformat.c $(TRANSLATE)
1830 $(TRANSLATE) $(SRCDIR)/wikiformat.c >$(OBJDIR)/wikiformat_.c
1831
1832 $(OBJDIR)/wikiformat.o: $(OBJDIR)/wikiformat_.c $(OBJDIR)/wikiformat.h $(SRCDIR)/config.h
1833 $(XTCC) -o $(OBJDIR)/wikiformat.o -c $(OBJDIR)/wikiformat_.c
1834
1835 $(OBJDIR)/wikiformat.h: $(OBJDIR)/headers
1836
1837 $(OBJDIR)/winfile_.c: $(SRCDIR)/winfile.c $(TRANSLATE)
1838 $(TRANSLATE) $(SRCDIR)/winfile.c >$(OBJDIR)/winfile_.c
1839
1840 $(OBJDIR)/winfile.o: $(OBJDIR)/winfile_.c $(OBJDIR)/winfile.h $(SRCDIR)/config.h
1841 $(XTCC) -o $(OBJDIR)/winfile.o -c $(OBJDIR)/winfile_.c
1842
1843 $(OBJDIR)/winfile.h: $(OBJDIR)/headers
1844
1845 $(OBJDIR)/winhttp_.c: $(SRCDIR)/winhttp.c $(TRANSLATE)
1846 $(TRANSLATE) $(SRCDIR)/winhttp.c >$(OBJDIR)/winhttp_.c
1847
1848 $(OBJDIR)/winhttp.o: $(OBJDIR)/winhttp_.c $(OBJDIR)/winhttp.h $(SRCDIR)/config.h
1849 $(XTCC) -o $(OBJDIR)/winhttp.o -c $(OBJDIR)/winhttp_.c
1850
1851 $(OBJDIR)/winhttp.h: $(OBJDIR)/headers
1852
1853 $(OBJDIR)/wysiwyg_.c: $(SRCDIR)/wysiwyg.c $(TRANSLATE)
1854 $(TRANSLATE) $(SRCDIR)/wysiwyg.c >$(OBJDIR)/wysiwyg_.c
1855
1856 $(OBJDIR)/wysiwyg.o: $(OBJDIR)/wysiwyg_.c $(OBJDIR)/wysiwyg.h $(SRCDIR)/config.h
1857 $(XTCC) -o $(OBJDIR)/wysiwyg.o -c $(OBJDIR)/wysiwyg_.c
1858
1859 $(OBJDIR)/wysiwyg.h: $(OBJDIR)/headers
1860
1861 $(OBJDIR)/xfer_.c: $(SRCDIR)/xfer.c $(TRANSLATE)
1862 $(TRANSLATE) $(SRCDIR)/xfer.c >$(OBJDIR)/xfer_.c
1863
1864 $(OBJDIR)/xfer.o: $(OBJDIR)/xfer_.c $(OBJDIR)/xfer.h $(SRCDIR)/config.h
1865 $(XTCC) -o $(OBJDIR)/xfer.o -c $(OBJDIR)/xfer_.c
1866
1867 $(OBJDIR)/xfer.h: $(OBJDIR)/headers
1868
1869 $(OBJDIR)/xfersetup_.c: $(SRCDIR)/xfersetup.c $(TRANSLATE)
1870 $(TRANSLATE) $(SRCDIR)/xfersetup.c >$(OBJDIR)/xfersetup_.c
1871
1872 $(OBJDIR)/xfersetup.o: $(OBJDIR)/xfersetup_.c $(OBJDIR)/xfersetup.h $(SRCDIR)/config.h
1873 $(XTCC) -o $(OBJDIR)/xfersetup.o -c $(OBJDIR)/xfersetup_.c
1874
1875 $(OBJDIR)/xfersetup.h: $(OBJDIR)/headers
1876
1877 $(OBJDIR)/zip_.c: $(SRCDIR)/zip.c $(TRANSLATE)
1878 $(TRANSLATE) $(SRCDIR)/zip.c >$(OBJDIR)/zip_.c
1879
1880 $(OBJDIR)/zip.o: $(OBJDIR)/zip_.c $(OBJDIR)/zip.h $(SRCDIR)/config.h
1881 $(XTCC) -o $(OBJDIR)/zip.o -c $(OBJDIR)/zip_.c
1882
1883 $(OBJDIR)/zip.h: $(OBJDIR)/headers
@@ -1906,27 +1977,27 @@
1906 MINIZ_OPTIONS = -DMINIZ_NO_STDIO \
1907 -DMINIZ_NO_TIME \
1908 -DMINIZ_NO_ARCHIVE_APIS
1909
1910 $(OBJDIR)/sqlite3.o: $(SRCDIR)/sqlite3.c $(SRCDIR)/../win/Makefile.mingw
1911 $(XTCC) $(SQLITE_OPTIONS) $(SQLITE_CFLAGS) -c $(SRCDIR)/sqlite3.c -o $(OBJDIR)/sqlite3.o
1912
1913 $(OBJDIR)/cson_amalgamation.o: $(SRCDIR)/cson_amalgamation.c
1914 $(XTCC) -c $(SRCDIR)/cson_amalgamation.c -o $(OBJDIR)/cson_amalgamation.o
1915
1916 $(OBJDIR)/json.o $(OBJDIR)/json_artifact.o $(OBJDIR)/json_branch.o $(OBJDIR)/json_config.o $(OBJDIR)/json_diff.o $(OBJDIR)/json_dir.o $(OBJDIR)/jsos_finfo.o $(OBJDIR)/json_login.o $(OBJDIR)/json_query.o $(OBJDIR)/json_report.o $(OBJDIR)/json_status.o $(OBJDIR)/json_tag.o $(OBJDIR)/json_timeline.o $(OBJDIR)/json_user.o $(OBJDIR)/json_wiki.o : $(SRCDIR)/json_detail.h
1917
1918 $(OBJDIR)/shell.o: $(SRCDIR)/shell.c $(SRCDIR)/sqlite3.h $(SRCDIR)/../win/Makefile.mingw
1919 $(XTCC) $(SHELL_OPTIONS) $(SHELL_CFLAGS) -c $(SRCDIR)/shell.c -o $(OBJDIR)/shell.o
1920
1921 $(OBJDIR)/th.o: $(SRCDIR)/th.c
1922 $(XTCC) -c $(SRCDIR)/th.c -o $(OBJDIR)/th.o
1923
1924 $(OBJDIR)/th_lang.o: $(SRCDIR)/th_lang.c
1925 $(XTCC) -c $(SRCDIR)/th_lang.c -o $(OBJDIR)/th_lang.o
1926
1927 $(OBJDIR)/th_tcl.o: $(SRCDIR)/th_tcl.c
1928 $(XTCC) -c $(SRCDIR)/th_tcl.c -o $(OBJDIR)/th_tcl.o
1929
1930 $(OBJDIR)/miniz.o: $(SRCDIR)/miniz.c
1931 $(XTCC) $(MINIZ_OPTIONS) -c $(SRCDIR)/miniz.c -o $(OBJDIR)/miniz.o
1932
1933
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -94,23 +94,40 @@
94 ifndef MINGW_IS_32BIT_ONLY
95 ifeq (,$(findstring w64-mingw32,$(PREFIX)))
96 MINGW_IS_32BIT_ONLY = 1
97 endif
98 endif
 
 
 
 
 
 
 
 
99
100 #### The directories where the zlib include and library files are located.
101 #
102 ZINCDIR = $(SRCDIR)/../compat/zlib
103 ZLIBDIR = $(SRCDIR)/../compat/zlib
104
105 ifndef X64
106 ifneq (,$(findstring x86_64-w64-mingw32,$(PREFIX)))
107 X64 = 1
108 endif
109 endif
110
111 ifndef X64
112 SSLCONFIG = mingw
113 ifndef FOSSIL_ENABLE_MINIZ
114 ZLIBCONFIG = LOC="-DASMV -DASMINF" OBJA="inffas86.o match.o"
115 LIBTARGETS = $(ZLIBDIR)/inffas86.o $(ZLIBDIR)/match.o
116 else
117 ZLIBCONFIG =
118 LIBTARGETS =
119 endif
120 else
121 SSLCONFIG = mingw64
122 ZLIBCONFIG =
123 LIBTARGETS =
124 endif
125
126 ifndef FOSSIL_ENABLE_MINIZ
127 SSLCONFIG += --with-zlib-lib=$(PWD)/$(ZLIBDIR) --with-zlib-include=$(PWD)/$(ZLIBDIR) zlib
128 endif
129
130 #### The directories where the OpenSSL include and library files are located.
131 # The recommended usage here is to use the Sysinternals junction tool
132 # to create a hard link between an "openssl-1.x" sub-directory of the
133 # Fossil source code directory and the target OpenSSL source directory.
@@ -340,10 +357,11 @@
357 $(SRCDIR)/bisect.c \
358 $(SRCDIR)/blob.c \
359 $(SRCDIR)/branch.c \
360 $(SRCDIR)/browse.c \
361 $(SRCDIR)/builtin.c \
362 $(SRCDIR)/bundle.c \
363 $(SRCDIR)/cache.c \
364 $(SRCDIR)/captcha.c \
365 $(SRCDIR)/cgi.c \
366 $(SRCDIR)/checkin.c \
367 $(SRCDIR)/checkout.c \
@@ -362,10 +380,11 @@
380 $(SRCDIR)/encode.c \
381 $(SRCDIR)/event.c \
382 $(SRCDIR)/export.c \
383 $(SRCDIR)/file.c \
384 $(SRCDIR)/finfo.c \
385 $(SRCDIR)/foci.c \
386 $(SRCDIR)/fusefs.c \
387 $(SRCDIR)/glob.c \
388 $(SRCDIR)/graph.c \
389 $(SRCDIR)/gzip.c \
390 $(SRCDIR)/http.c \
@@ -405,10 +424,12 @@
424 $(SRCDIR)/path.c \
425 $(SRCDIR)/pivot.c \
426 $(SRCDIR)/popen.c \
427 $(SRCDIR)/pqueue.c \
428 $(SRCDIR)/printf.c \
429 $(SRCDIR)/publish.c \
430 $(SRCDIR)/purge.c \
431 $(SRCDIR)/rebuild.c \
432 $(SRCDIR)/regexp.c \
433 $(SRCDIR)/report.c \
434 $(SRCDIR)/rss.c \
435 $(SRCDIR)/schema.c \
@@ -457,10 +478,11 @@
478 $(OBJDIR)/bisect_.c \
479 $(OBJDIR)/blob_.c \
480 $(OBJDIR)/branch_.c \
481 $(OBJDIR)/browse_.c \
482 $(OBJDIR)/builtin_.c \
483 $(OBJDIR)/bundle_.c \
484 $(OBJDIR)/cache_.c \
485 $(OBJDIR)/captcha_.c \
486 $(OBJDIR)/cgi_.c \
487 $(OBJDIR)/checkin_.c \
488 $(OBJDIR)/checkout_.c \
@@ -479,10 +501,11 @@
501 $(OBJDIR)/encode_.c \
502 $(OBJDIR)/event_.c \
503 $(OBJDIR)/export_.c \
504 $(OBJDIR)/file_.c \
505 $(OBJDIR)/finfo_.c \
506 $(OBJDIR)/foci_.c \
507 $(OBJDIR)/fusefs_.c \
508 $(OBJDIR)/glob_.c \
509 $(OBJDIR)/graph_.c \
510 $(OBJDIR)/gzip_.c \
511 $(OBJDIR)/http_.c \
@@ -522,10 +545,12 @@
545 $(OBJDIR)/path_.c \
546 $(OBJDIR)/pivot_.c \
547 $(OBJDIR)/popen_.c \
548 $(OBJDIR)/pqueue_.c \
549 $(OBJDIR)/printf_.c \
550 $(OBJDIR)/publish_.c \
551 $(OBJDIR)/purge_.c \
552 $(OBJDIR)/rebuild_.c \
553 $(OBJDIR)/regexp_.c \
554 $(OBJDIR)/report_.c \
555 $(OBJDIR)/rss_.c \
556 $(OBJDIR)/schema_.c \
@@ -571,10 +596,11 @@
596 $(OBJDIR)/bisect.o \
597 $(OBJDIR)/blob.o \
598 $(OBJDIR)/branch.o \
599 $(OBJDIR)/browse.o \
600 $(OBJDIR)/builtin.o \
601 $(OBJDIR)/bundle.o \
602 $(OBJDIR)/cache.o \
603 $(OBJDIR)/captcha.o \
604 $(OBJDIR)/cgi.o \
605 $(OBJDIR)/checkin.o \
606 $(OBJDIR)/checkout.o \
@@ -593,10 +619,11 @@
619 $(OBJDIR)/encode.o \
620 $(OBJDIR)/event.o \
621 $(OBJDIR)/export.o \
622 $(OBJDIR)/file.o \
623 $(OBJDIR)/finfo.o \
624 $(OBJDIR)/foci.o \
625 $(OBJDIR)/fusefs.o \
626 $(OBJDIR)/glob.o \
627 $(OBJDIR)/graph.o \
628 $(OBJDIR)/gzip.o \
629 $(OBJDIR)/http.o \
@@ -636,10 +663,12 @@
663 $(OBJDIR)/path.o \
664 $(OBJDIR)/pivot.o \
665 $(OBJDIR)/popen.o \
666 $(OBJDIR)/pqueue.o \
667 $(OBJDIR)/printf.o \
668 $(OBJDIR)/publish.o \
669 $(OBJDIR)/purge.o \
670 $(OBJDIR)/rebuild.o \
671 $(OBJDIR)/regexp.o \
672 $(OBJDIR)/report.o \
673 $(OBJDIR)/rss.o \
674 $(OBJDIR)/schema.o \
@@ -677,11 +706,10 @@
706 $(OBJDIR)/xfersetup.o \
707 $(OBJDIR)/zip.o
708
709 APPNAME = fossil.exe
710 APPTARGETS =
 
711
712 #### If the USE_WINDOWS variable exists, it is assumed that we are building
713 # inside of a Windows-style shell; otherwise, it is assumed that we are
714 # building inside of a Unix-style shell. Note that the "move" command is
715 # broken when attempting to use it from the Windows shell via MinGW make
@@ -749,35 +777,35 @@
777 else
778 $(MKDIR) $(OBJDIR)
779 endif
780
781 $(TRANSLATE): $(SRCDIR)/translate.c
782 $(BCC) -o $@ $(SRCDIR)/translate.c
783
784 $(MAKEHEADERS): $(SRCDIR)/makeheaders.c
785 $(BCC) -o $@ $(SRCDIR)/makeheaders.c
786
787 $(MKINDEX): $(SRCDIR)/mkindex.c
788 $(BCC) -o $@ $(SRCDIR)/mkindex.c
789
790 $(MKBUILTIN): $(SRCDIR)/mkbuiltin.c
791 $(BCC) -o $@ $(SRCDIR)/mkbuiltin.c
792
793 $(MKVERSION): $(SRCDIR)/mkversion.c
794 $(BCC) -o $@ $(SRCDIR)/mkversion.c
795
796 $(CODECHECK1): $(SRCDIR)/codecheck1.c
797 $(BCC) -o $@ $(SRCDIR)/codecheck1.c
798
799 # WARNING. DANGER. Running the test suite modifies the repository the
800 # build is done from, i.e. the checkout belongs to. Do not sync/push
801 # the repository after running the tests.
802 test: $(OBJDIR) $(APPNAME)
803 $(TCLSH) $(SRCDIR)/../test/tester.tcl $(APPNAME)
804
805 $(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(MKVERSION)
806 $(MKVERSION) $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION >$@
807
808 # The USE_SYSTEM_SQLITE variable may be undefined, set to 0, or set
809 # to 1. If it is set to 1, then there is no need to build or link
810 # the sqlite3.o object. Instead, the system SQLite will be linked
811 # using -lsqlite3.
@@ -802,14 +830,21 @@
830 $(OBJDIR)/th_tcl.o \
831 $(OBJDIR)/cson_amalgamation.o
832
833
834 zlib:
835 $(MAKE) -C $(ZLIBDIR) PREFIX=$(PREFIX) $(ZLIBCONFIG) -f win32/Makefile.gcc libz.a
836
837 clean-zlib:
838 $(MAKE) -C $(ZLIBDIR) PREFIX=$(PREFIX) -f win32/Makefile.gcc clean
839
840 $(ZLIBDIR)/inffas86.o:
841 $(TCC) -c -o $@ -DASMINF -I$(ZLIBDIR) -O3 $(ZLIBDIR)/contrib/inflate86/inffas86.c
842
843 $(ZLIBDIR)/match.o:
844 $(TCC) -c -o $@ -DASMV $(ZLIBDIR)/contrib/asm686/match.S
845
846
847 ifndef FOSSIL_ENABLE_MINIZ
848 LIBTARGETS += zlib
849 endif
850
@@ -833,11 +868,11 @@
868 APPTARGETS += openssl
869 endif
870
871 $(APPNAME): $(OBJDIR)/headers $(CODECHECK1) $(OBJ) $(EXTRAOBJ) $(OBJDIR)/fossil.o $(APPTARGETS)
872 $(CODECHECK1) $(TRANS_SRC)
873 $(TCC) -o $@ $(OBJ) $(EXTRAOBJ) $(LIB) $(OBJDIR)/fossil.o
874
875 # This rule prevents make from using its default rules to try build
876 # an executable named "manifest" out of the file named "manifest.c"
877 #
878 $(SRCDIR)/../manifest:
@@ -872,10 +907,11 @@
907 $(OBJDIR)/bisect_.c:$(OBJDIR)/bisect.h \
908 $(OBJDIR)/blob_.c:$(OBJDIR)/blob.h \
909 $(OBJDIR)/branch_.c:$(OBJDIR)/branch.h \
910 $(OBJDIR)/browse_.c:$(OBJDIR)/browse.h \
911 $(OBJDIR)/builtin_.c:$(OBJDIR)/builtin.h \
912 $(OBJDIR)/bundle_.c:$(OBJDIR)/bundle.h \
913 $(OBJDIR)/cache_.c:$(OBJDIR)/cache.h \
914 $(OBJDIR)/captcha_.c:$(OBJDIR)/captcha.h \
915 $(OBJDIR)/cgi_.c:$(OBJDIR)/cgi.h \
916 $(OBJDIR)/checkin_.c:$(OBJDIR)/checkin.h \
917 $(OBJDIR)/checkout_.c:$(OBJDIR)/checkout.h \
@@ -894,10 +930,11 @@
930 $(OBJDIR)/encode_.c:$(OBJDIR)/encode.h \
931 $(OBJDIR)/event_.c:$(OBJDIR)/event.h \
932 $(OBJDIR)/export_.c:$(OBJDIR)/export.h \
933 $(OBJDIR)/file_.c:$(OBJDIR)/file.h \
934 $(OBJDIR)/finfo_.c:$(OBJDIR)/finfo.h \
935 $(OBJDIR)/foci_.c:$(OBJDIR)/foci.h \
936 $(OBJDIR)/fusefs_.c:$(OBJDIR)/fusefs.h \
937 $(OBJDIR)/glob_.c:$(OBJDIR)/glob.h \
938 $(OBJDIR)/graph_.c:$(OBJDIR)/graph.h \
939 $(OBJDIR)/gzip_.c:$(OBJDIR)/gzip.h \
940 $(OBJDIR)/http_.c:$(OBJDIR)/http.h \
@@ -937,10 +974,12 @@
974 $(OBJDIR)/path_.c:$(OBJDIR)/path.h \
975 $(OBJDIR)/pivot_.c:$(OBJDIR)/pivot.h \
976 $(OBJDIR)/popen_.c:$(OBJDIR)/popen.h \
977 $(OBJDIR)/pqueue_.c:$(OBJDIR)/pqueue.h \
978 $(OBJDIR)/printf_.c:$(OBJDIR)/printf.h \
979 $(OBJDIR)/publish_.c:$(OBJDIR)/publish.h \
980 $(OBJDIR)/purge_.c:$(OBJDIR)/purge.h \
981 $(OBJDIR)/rebuild_.c:$(OBJDIR)/rebuild.h \
982 $(OBJDIR)/regexp_.c:$(OBJDIR)/regexp.h \
983 $(OBJDIR)/report_.c:$(OBJDIR)/report.h \
984 $(OBJDIR)/rss_.c:$(OBJDIR)/rss.h \
985 $(OBJDIR)/schema_.c:$(OBJDIR)/schema.h \
@@ -985,899 +1024,931 @@
1024 $(OBJDIR)/headers: Makefile
1025
1026 Makefile:
1027
1028 $(OBJDIR)/add_.c: $(SRCDIR)/add.c $(TRANSLATE)
1029 $(TRANSLATE) $(SRCDIR)/add.c >$@
1030
1031 $(OBJDIR)/add.o: $(OBJDIR)/add_.c $(OBJDIR)/add.h $(SRCDIR)/config.h
1032 $(XTCC) -o $(OBJDIR)/add.o -c $(OBJDIR)/add_.c
1033
1034 $(OBJDIR)/add.h: $(OBJDIR)/headers
1035
1036 $(OBJDIR)/allrepo_.c: $(SRCDIR)/allrepo.c $(TRANSLATE)
1037 $(TRANSLATE) $(SRCDIR)/allrepo.c >$@
1038
1039 $(OBJDIR)/allrepo.o: $(OBJDIR)/allrepo_.c $(OBJDIR)/allrepo.h $(SRCDIR)/config.h
1040 $(XTCC) -o $(OBJDIR)/allrepo.o -c $(OBJDIR)/allrepo_.c
1041
1042 $(OBJDIR)/allrepo.h: $(OBJDIR)/headers
1043
1044 $(OBJDIR)/attach_.c: $(SRCDIR)/attach.c $(TRANSLATE)
1045 $(TRANSLATE) $(SRCDIR)/attach.c >$@
1046
1047 $(OBJDIR)/attach.o: $(OBJDIR)/attach_.c $(OBJDIR)/attach.h $(SRCDIR)/config.h
1048 $(XTCC) -o $(OBJDIR)/attach.o -c $(OBJDIR)/attach_.c
1049
1050 $(OBJDIR)/attach.h: $(OBJDIR)/headers
1051
1052 $(OBJDIR)/bag_.c: $(SRCDIR)/bag.c $(TRANSLATE)
1053 $(TRANSLATE) $(SRCDIR)/bag.c >$@
1054
1055 $(OBJDIR)/bag.o: $(OBJDIR)/bag_.c $(OBJDIR)/bag.h $(SRCDIR)/config.h
1056 $(XTCC) -o $(OBJDIR)/bag.o -c $(OBJDIR)/bag_.c
1057
1058 $(OBJDIR)/bag.h: $(OBJDIR)/headers
1059
1060 $(OBJDIR)/bisect_.c: $(SRCDIR)/bisect.c $(TRANSLATE)
1061 $(TRANSLATE) $(SRCDIR)/bisect.c >$@
1062
1063 $(OBJDIR)/bisect.o: $(OBJDIR)/bisect_.c $(OBJDIR)/bisect.h $(SRCDIR)/config.h
1064 $(XTCC) -o $(OBJDIR)/bisect.o -c $(OBJDIR)/bisect_.c
1065
1066 $(OBJDIR)/bisect.h: $(OBJDIR)/headers
1067
1068 $(OBJDIR)/blob_.c: $(SRCDIR)/blob.c $(TRANSLATE)
1069 $(TRANSLATE) $(SRCDIR)/blob.c >$@
1070
1071 $(OBJDIR)/blob.o: $(OBJDIR)/blob_.c $(OBJDIR)/blob.h $(SRCDIR)/config.h
1072 $(XTCC) -o $(OBJDIR)/blob.o -c $(OBJDIR)/blob_.c
1073
1074 $(OBJDIR)/blob.h: $(OBJDIR)/headers
1075
1076 $(OBJDIR)/branch_.c: $(SRCDIR)/branch.c $(TRANSLATE)
1077 $(TRANSLATE) $(SRCDIR)/branch.c >$@
1078
1079 $(OBJDIR)/branch.o: $(OBJDIR)/branch_.c $(OBJDIR)/branch.h $(SRCDIR)/config.h
1080 $(XTCC) -o $(OBJDIR)/branch.o -c $(OBJDIR)/branch_.c
1081
1082 $(OBJDIR)/branch.h: $(OBJDIR)/headers
1083
1084 $(OBJDIR)/browse_.c: $(SRCDIR)/browse.c $(TRANSLATE)
1085 $(TRANSLATE) $(SRCDIR)/browse.c >$@
1086
1087 $(OBJDIR)/browse.o: $(OBJDIR)/browse_.c $(OBJDIR)/browse.h $(SRCDIR)/config.h
1088 $(XTCC) -o $(OBJDIR)/browse.o -c $(OBJDIR)/browse_.c
1089
1090 $(OBJDIR)/browse.h: $(OBJDIR)/headers
1091
1092 $(OBJDIR)/builtin_.c: $(SRCDIR)/builtin.c $(TRANSLATE)
1093 $(TRANSLATE) $(SRCDIR)/builtin.c >$@
1094
1095 $(OBJDIR)/builtin.o: $(OBJDIR)/builtin_.c $(OBJDIR)/builtin.h $(OBJDIR)/builtin_data.h $(SRCDIR)/config.h
1096 $(XTCC) -o $(OBJDIR)/builtin.o -c $(OBJDIR)/builtin_.c
1097
1098 $(OBJDIR)/builtin.h: $(OBJDIR)/headers
1099
1100 $(OBJDIR)/bundle_.c: $(SRCDIR)/bundle.c $(TRANSLATE)
1101 $(TRANSLATE) $(SRCDIR)/bundle.c >$@
1102
1103 $(OBJDIR)/bundle.o: $(OBJDIR)/bundle_.c $(OBJDIR)/bundle.h $(SRCDIR)/config.h
1104 $(XTCC) -o $(OBJDIR)/bundle.o -c $(OBJDIR)/bundle_.c
1105
1106 $(OBJDIR)/bundle.h: $(OBJDIR)/headers
1107
1108 $(OBJDIR)/cache_.c: $(SRCDIR)/cache.c $(TRANSLATE)
1109 $(TRANSLATE) $(SRCDIR)/cache.c >$@
1110
1111 $(OBJDIR)/cache.o: $(OBJDIR)/cache_.c $(OBJDIR)/cache.h $(SRCDIR)/config.h
1112 $(XTCC) -o $(OBJDIR)/cache.o -c $(OBJDIR)/cache_.c
1113
1114 $(OBJDIR)/cache.h: $(OBJDIR)/headers
1115
1116 $(OBJDIR)/captcha_.c: $(SRCDIR)/captcha.c $(TRANSLATE)
1117 $(TRANSLATE) $(SRCDIR)/captcha.c >$@
1118
1119 $(OBJDIR)/captcha.o: $(OBJDIR)/captcha_.c $(OBJDIR)/captcha.h $(SRCDIR)/config.h
1120 $(XTCC) -o $(OBJDIR)/captcha.o -c $(OBJDIR)/captcha_.c
1121
1122 $(OBJDIR)/captcha.h: $(OBJDIR)/headers
1123
1124 $(OBJDIR)/cgi_.c: $(SRCDIR)/cgi.c $(TRANSLATE)
1125 $(TRANSLATE) $(SRCDIR)/cgi.c >$@
1126
1127 $(OBJDIR)/cgi.o: $(OBJDIR)/cgi_.c $(OBJDIR)/cgi.h $(SRCDIR)/config.h
1128 $(XTCC) -o $(OBJDIR)/cgi.o -c $(OBJDIR)/cgi_.c
1129
1130 $(OBJDIR)/cgi.h: $(OBJDIR)/headers
1131
1132 $(OBJDIR)/checkin_.c: $(SRCDIR)/checkin.c $(TRANSLATE)
1133 $(TRANSLATE) $(SRCDIR)/checkin.c >$@
1134
1135 $(OBJDIR)/checkin.o: $(OBJDIR)/checkin_.c $(OBJDIR)/checkin.h $(SRCDIR)/config.h
1136 $(XTCC) -o $(OBJDIR)/checkin.o -c $(OBJDIR)/checkin_.c
1137
1138 $(OBJDIR)/checkin.h: $(OBJDIR)/headers
1139
1140 $(OBJDIR)/checkout_.c: $(SRCDIR)/checkout.c $(TRANSLATE)
1141 $(TRANSLATE) $(SRCDIR)/checkout.c >$@
1142
1143 $(OBJDIR)/checkout.o: $(OBJDIR)/checkout_.c $(OBJDIR)/checkout.h $(SRCDIR)/config.h
1144 $(XTCC) -o $(OBJDIR)/checkout.o -c $(OBJDIR)/checkout_.c
1145
1146 $(OBJDIR)/checkout.h: $(OBJDIR)/headers
1147
1148 $(OBJDIR)/clearsign_.c: $(SRCDIR)/clearsign.c $(TRANSLATE)
1149 $(TRANSLATE) $(SRCDIR)/clearsign.c >$@
1150
1151 $(OBJDIR)/clearsign.o: $(OBJDIR)/clearsign_.c $(OBJDIR)/clearsign.h $(SRCDIR)/config.h
1152 $(XTCC) -o $(OBJDIR)/clearsign.o -c $(OBJDIR)/clearsign_.c
1153
1154 $(OBJDIR)/clearsign.h: $(OBJDIR)/headers
1155
1156 $(OBJDIR)/clone_.c: $(SRCDIR)/clone.c $(TRANSLATE)
1157 $(TRANSLATE) $(SRCDIR)/clone.c >$@
1158
1159 $(OBJDIR)/clone.o: $(OBJDIR)/clone_.c $(OBJDIR)/clone.h $(SRCDIR)/config.h
1160 $(XTCC) -o $(OBJDIR)/clone.o -c $(OBJDIR)/clone_.c
1161
1162 $(OBJDIR)/clone.h: $(OBJDIR)/headers
1163
1164 $(OBJDIR)/comformat_.c: $(SRCDIR)/comformat.c $(TRANSLATE)
1165 $(TRANSLATE) $(SRCDIR)/comformat.c >$@
1166
1167 $(OBJDIR)/comformat.o: $(OBJDIR)/comformat_.c $(OBJDIR)/comformat.h $(SRCDIR)/config.h
1168 $(XTCC) -o $(OBJDIR)/comformat.o -c $(OBJDIR)/comformat_.c
1169
1170 $(OBJDIR)/comformat.h: $(OBJDIR)/headers
1171
1172 $(OBJDIR)/configure_.c: $(SRCDIR)/configure.c $(TRANSLATE)
1173 $(TRANSLATE) $(SRCDIR)/configure.c >$@
1174
1175 $(OBJDIR)/configure.o: $(OBJDIR)/configure_.c $(OBJDIR)/configure.h $(SRCDIR)/config.h
1176 $(XTCC) -o $(OBJDIR)/configure.o -c $(OBJDIR)/configure_.c
1177
1178 $(OBJDIR)/configure.h: $(OBJDIR)/headers
1179
1180 $(OBJDIR)/content_.c: $(SRCDIR)/content.c $(TRANSLATE)
1181 $(TRANSLATE) $(SRCDIR)/content.c >$@
1182
1183 $(OBJDIR)/content.o: $(OBJDIR)/content_.c $(OBJDIR)/content.h $(SRCDIR)/config.h
1184 $(XTCC) -o $(OBJDIR)/content.o -c $(OBJDIR)/content_.c
1185
1186 $(OBJDIR)/content.h: $(OBJDIR)/headers
1187
1188 $(OBJDIR)/db_.c: $(SRCDIR)/db.c $(TRANSLATE)
1189 $(TRANSLATE) $(SRCDIR)/db.c >$@
1190
1191 $(OBJDIR)/db.o: $(OBJDIR)/db_.c $(OBJDIR)/db.h $(SRCDIR)/config.h
1192 $(XTCC) -o $(OBJDIR)/db.o -c $(OBJDIR)/db_.c
1193
1194 $(OBJDIR)/db.h: $(OBJDIR)/headers
1195
1196 $(OBJDIR)/delta_.c: $(SRCDIR)/delta.c $(TRANSLATE)
1197 $(TRANSLATE) $(SRCDIR)/delta.c >$@
1198
1199 $(OBJDIR)/delta.o: $(OBJDIR)/delta_.c $(OBJDIR)/delta.h $(SRCDIR)/config.h
1200 $(XTCC) -o $(OBJDIR)/delta.o -c $(OBJDIR)/delta_.c
1201
1202 $(OBJDIR)/delta.h: $(OBJDIR)/headers
1203
1204 $(OBJDIR)/deltacmd_.c: $(SRCDIR)/deltacmd.c $(TRANSLATE)
1205 $(TRANSLATE) $(SRCDIR)/deltacmd.c >$@
1206
1207 $(OBJDIR)/deltacmd.o: $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h $(SRCDIR)/config.h
1208 $(XTCC) -o $(OBJDIR)/deltacmd.o -c $(OBJDIR)/deltacmd_.c
1209
1210 $(OBJDIR)/deltacmd.h: $(OBJDIR)/headers
1211
1212 $(OBJDIR)/descendants_.c: $(SRCDIR)/descendants.c $(TRANSLATE)
1213 $(TRANSLATE) $(SRCDIR)/descendants.c >$@
1214
1215 $(OBJDIR)/descendants.o: $(OBJDIR)/descendants_.c $(OBJDIR)/descendants.h $(SRCDIR)/config.h
1216 $(XTCC) -o $(OBJDIR)/descendants.o -c $(OBJDIR)/descendants_.c
1217
1218 $(OBJDIR)/descendants.h: $(OBJDIR)/headers
1219
1220 $(OBJDIR)/diff_.c: $(SRCDIR)/diff.c $(TRANSLATE)
1221 $(TRANSLATE) $(SRCDIR)/diff.c >$@
1222
1223 $(OBJDIR)/diff.o: $(OBJDIR)/diff_.c $(OBJDIR)/diff.h $(SRCDIR)/config.h
1224 $(XTCC) -o $(OBJDIR)/diff.o -c $(OBJDIR)/diff_.c
1225
1226 $(OBJDIR)/diff.h: $(OBJDIR)/headers
1227
1228 $(OBJDIR)/diffcmd_.c: $(SRCDIR)/diffcmd.c $(TRANSLATE)
1229 $(TRANSLATE) $(SRCDIR)/diffcmd.c >$@
1230
1231 $(OBJDIR)/diffcmd.o: $(OBJDIR)/diffcmd_.c $(OBJDIR)/diffcmd.h $(SRCDIR)/config.h
1232 $(XTCC) -o $(OBJDIR)/diffcmd.o -c $(OBJDIR)/diffcmd_.c
1233
1234 $(OBJDIR)/diffcmd.h: $(OBJDIR)/headers
1235
1236 $(OBJDIR)/doc_.c: $(SRCDIR)/doc.c $(TRANSLATE)
1237 $(TRANSLATE) $(SRCDIR)/doc.c >$@
1238
1239 $(OBJDIR)/doc.o: $(OBJDIR)/doc_.c $(OBJDIR)/doc.h $(SRCDIR)/config.h
1240 $(XTCC) -o $(OBJDIR)/doc.o -c $(OBJDIR)/doc_.c
1241
1242 $(OBJDIR)/doc.h: $(OBJDIR)/headers
1243
1244 $(OBJDIR)/encode_.c: $(SRCDIR)/encode.c $(TRANSLATE)
1245 $(TRANSLATE) $(SRCDIR)/encode.c >$@
1246
1247 $(OBJDIR)/encode.o: $(OBJDIR)/encode_.c $(OBJDIR)/encode.h $(SRCDIR)/config.h
1248 $(XTCC) -o $(OBJDIR)/encode.o -c $(OBJDIR)/encode_.c
1249
1250 $(OBJDIR)/encode.h: $(OBJDIR)/headers
1251
1252 $(OBJDIR)/event_.c: $(SRCDIR)/event.c $(TRANSLATE)
1253 $(TRANSLATE) $(SRCDIR)/event.c >$@
1254
1255 $(OBJDIR)/event.o: $(OBJDIR)/event_.c $(OBJDIR)/event.h $(SRCDIR)/config.h
1256 $(XTCC) -o $(OBJDIR)/event.o -c $(OBJDIR)/event_.c
1257
1258 $(OBJDIR)/event.h: $(OBJDIR)/headers
1259
1260 $(OBJDIR)/export_.c: $(SRCDIR)/export.c $(TRANSLATE)
1261 $(TRANSLATE) $(SRCDIR)/export.c >$@
1262
1263 $(OBJDIR)/export.o: $(OBJDIR)/export_.c $(OBJDIR)/export.h $(SRCDIR)/config.h
1264 $(XTCC) -o $(OBJDIR)/export.o -c $(OBJDIR)/export_.c
1265
1266 $(OBJDIR)/export.h: $(OBJDIR)/headers
1267
1268 $(OBJDIR)/file_.c: $(SRCDIR)/file.c $(TRANSLATE)
1269 $(TRANSLATE) $(SRCDIR)/file.c >$@
1270
1271 $(OBJDIR)/file.o: $(OBJDIR)/file_.c $(OBJDIR)/file.h $(SRCDIR)/config.h
1272 $(XTCC) -o $(OBJDIR)/file.o -c $(OBJDIR)/file_.c
1273
1274 $(OBJDIR)/file.h: $(OBJDIR)/headers
1275
1276 $(OBJDIR)/finfo_.c: $(SRCDIR)/finfo.c $(TRANSLATE)
1277 $(TRANSLATE) $(SRCDIR)/finfo.c >$@
1278
1279 $(OBJDIR)/finfo.o: $(OBJDIR)/finfo_.c $(OBJDIR)/finfo.h $(SRCDIR)/config.h
1280 $(XTCC) -o $(OBJDIR)/finfo.o -c $(OBJDIR)/finfo_.c
1281
1282 $(OBJDIR)/finfo.h: $(OBJDIR)/headers
1283
1284 $(OBJDIR)/foci_.c: $(SRCDIR)/foci.c $(TRANSLATE)
1285 $(TRANSLATE) $(SRCDIR)/foci.c >$@
1286
1287 $(OBJDIR)/foci.o: $(OBJDIR)/foci_.c $(OBJDIR)/foci.h $(SRCDIR)/config.h
1288 $(XTCC) -o $(OBJDIR)/foci.o -c $(OBJDIR)/foci_.c
1289
1290 $(OBJDIR)/foci.h: $(OBJDIR)/headers
1291
1292 $(OBJDIR)/fusefs_.c: $(SRCDIR)/fusefs.c $(TRANSLATE)
1293 $(TRANSLATE) $(SRCDIR)/fusefs.c >$@
1294
1295 $(OBJDIR)/fusefs.o: $(OBJDIR)/fusefs_.c $(OBJDIR)/fusefs.h $(SRCDIR)/config.h
1296 $(XTCC) -o $(OBJDIR)/fusefs.o -c $(OBJDIR)/fusefs_.c
1297
1298 $(OBJDIR)/fusefs.h: $(OBJDIR)/headers
1299
1300 $(OBJDIR)/glob_.c: $(SRCDIR)/glob.c $(TRANSLATE)
1301 $(TRANSLATE) $(SRCDIR)/glob.c >$@
1302
1303 $(OBJDIR)/glob.o: $(OBJDIR)/glob_.c $(OBJDIR)/glob.h $(SRCDIR)/config.h
1304 $(XTCC) -o $(OBJDIR)/glob.o -c $(OBJDIR)/glob_.c
1305
1306 $(OBJDIR)/glob.h: $(OBJDIR)/headers
1307
1308 $(OBJDIR)/graph_.c: $(SRCDIR)/graph.c $(TRANSLATE)
1309 $(TRANSLATE) $(SRCDIR)/graph.c >$@
1310
1311 $(OBJDIR)/graph.o: $(OBJDIR)/graph_.c $(OBJDIR)/graph.h $(SRCDIR)/config.h
1312 $(XTCC) -o $(OBJDIR)/graph.o -c $(OBJDIR)/graph_.c
1313
1314 $(OBJDIR)/graph.h: $(OBJDIR)/headers
1315
1316 $(OBJDIR)/gzip_.c: $(SRCDIR)/gzip.c $(TRANSLATE)
1317 $(TRANSLATE) $(SRCDIR)/gzip.c >$@
1318
1319 $(OBJDIR)/gzip.o: $(OBJDIR)/gzip_.c $(OBJDIR)/gzip.h $(SRCDIR)/config.h
1320 $(XTCC) -o $(OBJDIR)/gzip.o -c $(OBJDIR)/gzip_.c
1321
1322 $(OBJDIR)/gzip.h: $(OBJDIR)/headers
1323
1324 $(OBJDIR)/http_.c: $(SRCDIR)/http.c $(TRANSLATE)
1325 $(TRANSLATE) $(SRCDIR)/http.c >$@
1326
1327 $(OBJDIR)/http.o: $(OBJDIR)/http_.c $(OBJDIR)/http.h $(SRCDIR)/config.h
1328 $(XTCC) -o $(OBJDIR)/http.o -c $(OBJDIR)/http_.c
1329
1330 $(OBJDIR)/http.h: $(OBJDIR)/headers
1331
1332 $(OBJDIR)/http_socket_.c: $(SRCDIR)/http_socket.c $(TRANSLATE)
1333 $(TRANSLATE) $(SRCDIR)/http_socket.c >$@
1334
1335 $(OBJDIR)/http_socket.o: $(OBJDIR)/http_socket_.c $(OBJDIR)/http_socket.h $(SRCDIR)/config.h
1336 $(XTCC) -o $(OBJDIR)/http_socket.o -c $(OBJDIR)/http_socket_.c
1337
1338 $(OBJDIR)/http_socket.h: $(OBJDIR)/headers
1339
1340 $(OBJDIR)/http_ssl_.c: $(SRCDIR)/http_ssl.c $(TRANSLATE)
1341 $(TRANSLATE) $(SRCDIR)/http_ssl.c >$@
1342
1343 $(OBJDIR)/http_ssl.o: $(OBJDIR)/http_ssl_.c $(OBJDIR)/http_ssl.h $(SRCDIR)/config.h
1344 $(XTCC) -o $(OBJDIR)/http_ssl.o -c $(OBJDIR)/http_ssl_.c
1345
1346 $(OBJDIR)/http_ssl.h: $(OBJDIR)/headers
1347
1348 $(OBJDIR)/http_transport_.c: $(SRCDIR)/http_transport.c $(TRANSLATE)
1349 $(TRANSLATE) $(SRCDIR)/http_transport.c >$@
1350
1351 $(OBJDIR)/http_transport.o: $(OBJDIR)/http_transport_.c $(OBJDIR)/http_transport.h $(SRCDIR)/config.h
1352 $(XTCC) -o $(OBJDIR)/http_transport.o -c $(OBJDIR)/http_transport_.c
1353
1354 $(OBJDIR)/http_transport.h: $(OBJDIR)/headers
1355
1356 $(OBJDIR)/import_.c: $(SRCDIR)/import.c $(TRANSLATE)
1357 $(TRANSLATE) $(SRCDIR)/import.c >$@
1358
1359 $(OBJDIR)/import.o: $(OBJDIR)/import_.c $(OBJDIR)/import.h $(SRCDIR)/config.h
1360 $(XTCC) -o $(OBJDIR)/import.o -c $(OBJDIR)/import_.c
1361
1362 $(OBJDIR)/import.h: $(OBJDIR)/headers
1363
1364 $(OBJDIR)/info_.c: $(SRCDIR)/info.c $(TRANSLATE)
1365 $(TRANSLATE) $(SRCDIR)/info.c >$@
1366
1367 $(OBJDIR)/info.o: $(OBJDIR)/info_.c $(OBJDIR)/info.h $(SRCDIR)/config.h
1368 $(XTCC) -o $(OBJDIR)/info.o -c $(OBJDIR)/info_.c
1369
1370 $(OBJDIR)/info.h: $(OBJDIR)/headers
1371
1372 $(OBJDIR)/json_.c: $(SRCDIR)/json.c $(TRANSLATE)
1373 $(TRANSLATE) $(SRCDIR)/json.c >$@
1374
1375 $(OBJDIR)/json.o: $(OBJDIR)/json_.c $(OBJDIR)/json.h $(SRCDIR)/config.h
1376 $(XTCC) -o $(OBJDIR)/json.o -c $(OBJDIR)/json_.c
1377
1378 $(OBJDIR)/json.h: $(OBJDIR)/headers
1379
1380 $(OBJDIR)/json_artifact_.c: $(SRCDIR)/json_artifact.c $(TRANSLATE)
1381 $(TRANSLATE) $(SRCDIR)/json_artifact.c >$@
1382
1383 $(OBJDIR)/json_artifact.o: $(OBJDIR)/json_artifact_.c $(OBJDIR)/json_artifact.h $(SRCDIR)/config.h
1384 $(XTCC) -o $(OBJDIR)/json_artifact.o -c $(OBJDIR)/json_artifact_.c
1385
1386 $(OBJDIR)/json_artifact.h: $(OBJDIR)/headers
1387
1388 $(OBJDIR)/json_branch_.c: $(SRCDIR)/json_branch.c $(TRANSLATE)
1389 $(TRANSLATE) $(SRCDIR)/json_branch.c >$@
1390
1391 $(OBJDIR)/json_branch.o: $(OBJDIR)/json_branch_.c $(OBJDIR)/json_branch.h $(SRCDIR)/config.h
1392 $(XTCC) -o $(OBJDIR)/json_branch.o -c $(OBJDIR)/json_branch_.c
1393
1394 $(OBJDIR)/json_branch.h: $(OBJDIR)/headers
1395
1396 $(OBJDIR)/json_config_.c: $(SRCDIR)/json_config.c $(TRANSLATE)
1397 $(TRANSLATE) $(SRCDIR)/json_config.c >$@
1398
1399 $(OBJDIR)/json_config.o: $(OBJDIR)/json_config_.c $(OBJDIR)/json_config.h $(SRCDIR)/config.h
1400 $(XTCC) -o $(OBJDIR)/json_config.o -c $(OBJDIR)/json_config_.c
1401
1402 $(OBJDIR)/json_config.h: $(OBJDIR)/headers
1403
1404 $(OBJDIR)/json_diff_.c: $(SRCDIR)/json_diff.c $(TRANSLATE)
1405 $(TRANSLATE) $(SRCDIR)/json_diff.c >$@
1406
1407 $(OBJDIR)/json_diff.o: $(OBJDIR)/json_diff_.c $(OBJDIR)/json_diff.h $(SRCDIR)/config.h
1408 $(XTCC) -o $(OBJDIR)/json_diff.o -c $(OBJDIR)/json_diff_.c
1409
1410 $(OBJDIR)/json_diff.h: $(OBJDIR)/headers
1411
1412 $(OBJDIR)/json_dir_.c: $(SRCDIR)/json_dir.c $(TRANSLATE)
1413 $(TRANSLATE) $(SRCDIR)/json_dir.c >$@
1414
1415 $(OBJDIR)/json_dir.o: $(OBJDIR)/json_dir_.c $(OBJDIR)/json_dir.h $(SRCDIR)/config.h
1416 $(XTCC) -o $(OBJDIR)/json_dir.o -c $(OBJDIR)/json_dir_.c
1417
1418 $(OBJDIR)/json_dir.h: $(OBJDIR)/headers
1419
1420 $(OBJDIR)/json_finfo_.c: $(SRCDIR)/json_finfo.c $(TRANSLATE)
1421 $(TRANSLATE) $(SRCDIR)/json_finfo.c >$@
1422
1423 $(OBJDIR)/json_finfo.o: $(OBJDIR)/json_finfo_.c $(OBJDIR)/json_finfo.h $(SRCDIR)/config.h
1424 $(XTCC) -o $(OBJDIR)/json_finfo.o -c $(OBJDIR)/json_finfo_.c
1425
1426 $(OBJDIR)/json_finfo.h: $(OBJDIR)/headers
1427
1428 $(OBJDIR)/json_login_.c: $(SRCDIR)/json_login.c $(TRANSLATE)
1429 $(TRANSLATE) $(SRCDIR)/json_login.c >$@
1430
1431 $(OBJDIR)/json_login.o: $(OBJDIR)/json_login_.c $(OBJDIR)/json_login.h $(SRCDIR)/config.h
1432 $(XTCC) -o $(OBJDIR)/json_login.o -c $(OBJDIR)/json_login_.c
1433
1434 $(OBJDIR)/json_login.h: $(OBJDIR)/headers
1435
1436 $(OBJDIR)/json_query_.c: $(SRCDIR)/json_query.c $(TRANSLATE)
1437 $(TRANSLATE) $(SRCDIR)/json_query.c >$@
1438
1439 $(OBJDIR)/json_query.o: $(OBJDIR)/json_query_.c $(OBJDIR)/json_query.h $(SRCDIR)/config.h
1440 $(XTCC) -o $(OBJDIR)/json_query.o -c $(OBJDIR)/json_query_.c
1441
1442 $(OBJDIR)/json_query.h: $(OBJDIR)/headers
1443
1444 $(OBJDIR)/json_report_.c: $(SRCDIR)/json_report.c $(TRANSLATE)
1445 $(TRANSLATE) $(SRCDIR)/json_report.c >$@
1446
1447 $(OBJDIR)/json_report.o: $(OBJDIR)/json_report_.c $(OBJDIR)/json_report.h $(SRCDIR)/config.h
1448 $(XTCC) -o $(OBJDIR)/json_report.o -c $(OBJDIR)/json_report_.c
1449
1450 $(OBJDIR)/json_report.h: $(OBJDIR)/headers
1451
1452 $(OBJDIR)/json_status_.c: $(SRCDIR)/json_status.c $(TRANSLATE)
1453 $(TRANSLATE) $(SRCDIR)/json_status.c >$@
1454
1455 $(OBJDIR)/json_status.o: $(OBJDIR)/json_status_.c $(OBJDIR)/json_status.h $(SRCDIR)/config.h
1456 $(XTCC) -o $(OBJDIR)/json_status.o -c $(OBJDIR)/json_status_.c
1457
1458 $(OBJDIR)/json_status.h: $(OBJDIR)/headers
1459
1460 $(OBJDIR)/json_tag_.c: $(SRCDIR)/json_tag.c $(TRANSLATE)
1461 $(TRANSLATE) $(SRCDIR)/json_tag.c >$@
1462
1463 $(OBJDIR)/json_tag.o: $(OBJDIR)/json_tag_.c $(OBJDIR)/json_tag.h $(SRCDIR)/config.h
1464 $(XTCC) -o $(OBJDIR)/json_tag.o -c $(OBJDIR)/json_tag_.c
1465
1466 $(OBJDIR)/json_tag.h: $(OBJDIR)/headers
1467
1468 $(OBJDIR)/json_timeline_.c: $(SRCDIR)/json_timeline.c $(TRANSLATE)
1469 $(TRANSLATE) $(SRCDIR)/json_timeline.c >$@
1470
1471 $(OBJDIR)/json_timeline.o: $(OBJDIR)/json_timeline_.c $(OBJDIR)/json_timeline.h $(SRCDIR)/config.h
1472 $(XTCC) -o $(OBJDIR)/json_timeline.o -c $(OBJDIR)/json_timeline_.c
1473
1474 $(OBJDIR)/json_timeline.h: $(OBJDIR)/headers
1475
1476 $(OBJDIR)/json_user_.c: $(SRCDIR)/json_user.c $(TRANSLATE)
1477 $(TRANSLATE) $(SRCDIR)/json_user.c >$@
1478
1479 $(OBJDIR)/json_user.o: $(OBJDIR)/json_user_.c $(OBJDIR)/json_user.h $(SRCDIR)/config.h
1480 $(XTCC) -o $(OBJDIR)/json_user.o -c $(OBJDIR)/json_user_.c
1481
1482 $(OBJDIR)/json_user.h: $(OBJDIR)/headers
1483
1484 $(OBJDIR)/json_wiki_.c: $(SRCDIR)/json_wiki.c $(TRANSLATE)
1485 $(TRANSLATE) $(SRCDIR)/json_wiki.c >$@
1486
1487 $(OBJDIR)/json_wiki.o: $(OBJDIR)/json_wiki_.c $(OBJDIR)/json_wiki.h $(SRCDIR)/config.h
1488 $(XTCC) -o $(OBJDIR)/json_wiki.o -c $(OBJDIR)/json_wiki_.c
1489
1490 $(OBJDIR)/json_wiki.h: $(OBJDIR)/headers
1491
1492 $(OBJDIR)/leaf_.c: $(SRCDIR)/leaf.c $(TRANSLATE)
1493 $(TRANSLATE) $(SRCDIR)/leaf.c >$@
1494
1495 $(OBJDIR)/leaf.o: $(OBJDIR)/leaf_.c $(OBJDIR)/leaf.h $(SRCDIR)/config.h
1496 $(XTCC) -o $(OBJDIR)/leaf.o -c $(OBJDIR)/leaf_.c
1497
1498 $(OBJDIR)/leaf.h: $(OBJDIR)/headers
1499
1500 $(OBJDIR)/loadctrl_.c: $(SRCDIR)/loadctrl.c $(TRANSLATE)
1501 $(TRANSLATE) $(SRCDIR)/loadctrl.c >$@
1502
1503 $(OBJDIR)/loadctrl.o: $(OBJDIR)/loadctrl_.c $(OBJDIR)/loadctrl.h $(SRCDIR)/config.h
1504 $(XTCC) -o $(OBJDIR)/loadctrl.o -c $(OBJDIR)/loadctrl_.c
1505
1506 $(OBJDIR)/loadctrl.h: $(OBJDIR)/headers
1507
1508 $(OBJDIR)/login_.c: $(SRCDIR)/login.c $(TRANSLATE)
1509 $(TRANSLATE) $(SRCDIR)/login.c >$@
1510
1511 $(OBJDIR)/login.o: $(OBJDIR)/login_.c $(OBJDIR)/login.h $(SRCDIR)/config.h
1512 $(XTCC) -o $(OBJDIR)/login.o -c $(OBJDIR)/login_.c
1513
1514 $(OBJDIR)/login.h: $(OBJDIR)/headers
1515
1516 $(OBJDIR)/lookslike_.c: $(SRCDIR)/lookslike.c $(TRANSLATE)
1517 $(TRANSLATE) $(SRCDIR)/lookslike.c >$@
1518
1519 $(OBJDIR)/lookslike.o: $(OBJDIR)/lookslike_.c $(OBJDIR)/lookslike.h $(SRCDIR)/config.h
1520 $(XTCC) -o $(OBJDIR)/lookslike.o -c $(OBJDIR)/lookslike_.c
1521
1522 $(OBJDIR)/lookslike.h: $(OBJDIR)/headers
1523
1524 $(OBJDIR)/main_.c: $(SRCDIR)/main.c $(TRANSLATE)
1525 $(TRANSLATE) $(SRCDIR)/main.c >$@
1526
1527 $(OBJDIR)/main.o: $(OBJDIR)/main_.c $(OBJDIR)/main.h $(OBJDIR)/page_index.h $(SRCDIR)/config.h
1528 $(XTCC) -o $(OBJDIR)/main.o -c $(OBJDIR)/main_.c
1529
1530 $(OBJDIR)/main.h: $(OBJDIR)/headers
1531
1532 $(OBJDIR)/manifest_.c: $(SRCDIR)/manifest.c $(TRANSLATE)
1533 $(TRANSLATE) $(SRCDIR)/manifest.c >$@
1534
1535 $(OBJDIR)/manifest.o: $(OBJDIR)/manifest_.c $(OBJDIR)/manifest.h $(SRCDIR)/config.h
1536 $(XTCC) -o $(OBJDIR)/manifest.o -c $(OBJDIR)/manifest_.c
1537
1538 $(OBJDIR)/manifest.h: $(OBJDIR)/headers
1539
1540 $(OBJDIR)/markdown_.c: $(SRCDIR)/markdown.c $(TRANSLATE)
1541 $(TRANSLATE) $(SRCDIR)/markdown.c >$@
1542
1543 $(OBJDIR)/markdown.o: $(OBJDIR)/markdown_.c $(OBJDIR)/markdown.h $(SRCDIR)/config.h
1544 $(XTCC) -o $(OBJDIR)/markdown.o -c $(OBJDIR)/markdown_.c
1545
1546 $(OBJDIR)/markdown.h: $(OBJDIR)/headers
1547
1548 $(OBJDIR)/markdown_html_.c: $(SRCDIR)/markdown_html.c $(TRANSLATE)
1549 $(TRANSLATE) $(SRCDIR)/markdown_html.c >$@
1550
1551 $(OBJDIR)/markdown_html.o: $(OBJDIR)/markdown_html_.c $(OBJDIR)/markdown_html.h $(SRCDIR)/config.h
1552 $(XTCC) -o $(OBJDIR)/markdown_html.o -c $(OBJDIR)/markdown_html_.c
1553
1554 $(OBJDIR)/markdown_html.h: $(OBJDIR)/headers
1555
1556 $(OBJDIR)/md5_.c: $(SRCDIR)/md5.c $(TRANSLATE)
1557 $(TRANSLATE) $(SRCDIR)/md5.c >$@
1558
1559 $(OBJDIR)/md5.o: $(OBJDIR)/md5_.c $(OBJDIR)/md5.h $(SRCDIR)/config.h
1560 $(XTCC) -o $(OBJDIR)/md5.o -c $(OBJDIR)/md5_.c
1561
1562 $(OBJDIR)/md5.h: $(OBJDIR)/headers
1563
1564 $(OBJDIR)/merge_.c: $(SRCDIR)/merge.c $(TRANSLATE)
1565 $(TRANSLATE) $(SRCDIR)/merge.c >$@
1566
1567 $(OBJDIR)/merge.o: $(OBJDIR)/merge_.c $(OBJDIR)/merge.h $(SRCDIR)/config.h
1568 $(XTCC) -o $(OBJDIR)/merge.o -c $(OBJDIR)/merge_.c
1569
1570 $(OBJDIR)/merge.h: $(OBJDIR)/headers
1571
1572 $(OBJDIR)/merge3_.c: $(SRCDIR)/merge3.c $(TRANSLATE)
1573 $(TRANSLATE) $(SRCDIR)/merge3.c >$@
1574
1575 $(OBJDIR)/merge3.o: $(OBJDIR)/merge3_.c $(OBJDIR)/merge3.h $(SRCDIR)/config.h
1576 $(XTCC) -o $(OBJDIR)/merge3.o -c $(OBJDIR)/merge3_.c
1577
1578 $(OBJDIR)/merge3.h: $(OBJDIR)/headers
1579
1580 $(OBJDIR)/moderate_.c: $(SRCDIR)/moderate.c $(TRANSLATE)
1581 $(TRANSLATE) $(SRCDIR)/moderate.c >$@
1582
1583 $(OBJDIR)/moderate.o: $(OBJDIR)/moderate_.c $(OBJDIR)/moderate.h $(SRCDIR)/config.h
1584 $(XTCC) -o $(OBJDIR)/moderate.o -c $(OBJDIR)/moderate_.c
1585
1586 $(OBJDIR)/moderate.h: $(OBJDIR)/headers
1587
1588 $(OBJDIR)/name_.c: $(SRCDIR)/name.c $(TRANSLATE)
1589 $(TRANSLATE) $(SRCDIR)/name.c >$@
1590
1591 $(OBJDIR)/name.o: $(OBJDIR)/name_.c $(OBJDIR)/name.h $(SRCDIR)/config.h
1592 $(XTCC) -o $(OBJDIR)/name.o -c $(OBJDIR)/name_.c
1593
1594 $(OBJDIR)/name.h: $(OBJDIR)/headers
1595
1596 $(OBJDIR)/path_.c: $(SRCDIR)/path.c $(TRANSLATE)
1597 $(TRANSLATE) $(SRCDIR)/path.c >$@
1598
1599 $(OBJDIR)/path.o: $(OBJDIR)/path_.c $(OBJDIR)/path.h $(SRCDIR)/config.h
1600 $(XTCC) -o $(OBJDIR)/path.o -c $(OBJDIR)/path_.c
1601
1602 $(OBJDIR)/path.h: $(OBJDIR)/headers
1603
1604 $(OBJDIR)/pivot_.c: $(SRCDIR)/pivot.c $(TRANSLATE)
1605 $(TRANSLATE) $(SRCDIR)/pivot.c >$@
1606
1607 $(OBJDIR)/pivot.o: $(OBJDIR)/pivot_.c $(OBJDIR)/pivot.h $(SRCDIR)/config.h
1608 $(XTCC) -o $(OBJDIR)/pivot.o -c $(OBJDIR)/pivot_.c
1609
1610 $(OBJDIR)/pivot.h: $(OBJDIR)/headers
1611
1612 $(OBJDIR)/popen_.c: $(SRCDIR)/popen.c $(TRANSLATE)
1613 $(TRANSLATE) $(SRCDIR)/popen.c >$@
1614
1615 $(OBJDIR)/popen.o: $(OBJDIR)/popen_.c $(OBJDIR)/popen.h $(SRCDIR)/config.h
1616 $(XTCC) -o $(OBJDIR)/popen.o -c $(OBJDIR)/popen_.c
1617
1618 $(OBJDIR)/popen.h: $(OBJDIR)/headers
1619
1620 $(OBJDIR)/pqueue_.c: $(SRCDIR)/pqueue.c $(TRANSLATE)
1621 $(TRANSLATE) $(SRCDIR)/pqueue.c >$@
1622
1623 $(OBJDIR)/pqueue.o: $(OBJDIR)/pqueue_.c $(OBJDIR)/pqueue.h $(SRCDIR)/config.h
1624 $(XTCC) -o $(OBJDIR)/pqueue.o -c $(OBJDIR)/pqueue_.c
1625
1626 $(OBJDIR)/pqueue.h: $(OBJDIR)/headers
1627
1628 $(OBJDIR)/printf_.c: $(SRCDIR)/printf.c $(TRANSLATE)
1629 $(TRANSLATE) $(SRCDIR)/printf.c >$@
1630
1631 $(OBJDIR)/printf.o: $(OBJDIR)/printf_.c $(OBJDIR)/printf.h $(SRCDIR)/config.h
1632 $(XTCC) -o $(OBJDIR)/printf.o -c $(OBJDIR)/printf_.c
1633
1634 $(OBJDIR)/printf.h: $(OBJDIR)/headers
1635
1636 $(OBJDIR)/publish_.c: $(SRCDIR)/publish.c $(TRANSLATE)
1637 $(TRANSLATE) $(SRCDIR)/publish.c >$@
1638
1639 $(OBJDIR)/publish.o: $(OBJDIR)/publish_.c $(OBJDIR)/publish.h $(SRCDIR)/config.h
1640 $(XTCC) -o $(OBJDIR)/publish.o -c $(OBJDIR)/publish_.c
1641
1642 $(OBJDIR)/publish.h: $(OBJDIR)/headers
1643
1644 $(OBJDIR)/purge_.c: $(SRCDIR)/purge.c $(TRANSLATE)
1645 $(TRANSLATE) $(SRCDIR)/purge.c >$@
1646
1647 $(OBJDIR)/purge.o: $(OBJDIR)/purge_.c $(OBJDIR)/purge.h $(SRCDIR)/config.h
1648 $(XTCC) -o $(OBJDIR)/purge.o -c $(OBJDIR)/purge_.c
1649
1650 $(OBJDIR)/purge.h: $(OBJDIR)/headers
1651
1652 $(OBJDIR)/rebuild_.c: $(SRCDIR)/rebuild.c $(TRANSLATE)
1653 $(TRANSLATE) $(SRCDIR)/rebuild.c >$@
1654
1655 $(OBJDIR)/rebuild.o: $(OBJDIR)/rebuild_.c $(OBJDIR)/rebuild.h $(SRCDIR)/config.h
1656 $(XTCC) -o $(OBJDIR)/rebuild.o -c $(OBJDIR)/rebuild_.c
1657
1658 $(OBJDIR)/rebuild.h: $(OBJDIR)/headers
1659
1660 $(OBJDIR)/regexp_.c: $(SRCDIR)/regexp.c $(TRANSLATE)
1661 $(TRANSLATE) $(SRCDIR)/regexp.c >$@
1662
1663 $(OBJDIR)/regexp.o: $(OBJDIR)/regexp_.c $(OBJDIR)/regexp.h $(SRCDIR)/config.h
1664 $(XTCC) -o $(OBJDIR)/regexp.o -c $(OBJDIR)/regexp_.c
1665
1666 $(OBJDIR)/regexp.h: $(OBJDIR)/headers
1667
1668 $(OBJDIR)/report_.c: $(SRCDIR)/report.c $(TRANSLATE)
1669 $(TRANSLATE) $(SRCDIR)/report.c >$@
1670
1671 $(OBJDIR)/report.o: $(OBJDIR)/report_.c $(OBJDIR)/report.h $(SRCDIR)/config.h
1672 $(XTCC) -o $(OBJDIR)/report.o -c $(OBJDIR)/report_.c
1673
1674 $(OBJDIR)/report.h: $(OBJDIR)/headers
1675
1676 $(OBJDIR)/rss_.c: $(SRCDIR)/rss.c $(TRANSLATE)
1677 $(TRANSLATE) $(SRCDIR)/rss.c >$@
1678
1679 $(OBJDIR)/rss.o: $(OBJDIR)/rss_.c $(OBJDIR)/rss.h $(SRCDIR)/config.h
1680 $(XTCC) -o $(OBJDIR)/rss.o -c $(OBJDIR)/rss_.c
1681
1682 $(OBJDIR)/rss.h: $(OBJDIR)/headers
1683
1684 $(OBJDIR)/schema_.c: $(SRCDIR)/schema.c $(TRANSLATE)
1685 $(TRANSLATE) $(SRCDIR)/schema.c >$@
1686
1687 $(OBJDIR)/schema.o: $(OBJDIR)/schema_.c $(OBJDIR)/schema.h $(SRCDIR)/config.h
1688 $(XTCC) -o $(OBJDIR)/schema.o -c $(OBJDIR)/schema_.c
1689
1690 $(OBJDIR)/schema.h: $(OBJDIR)/headers
1691
1692 $(OBJDIR)/search_.c: $(SRCDIR)/search.c $(TRANSLATE)
1693 $(TRANSLATE) $(SRCDIR)/search.c >$@
1694
1695 $(OBJDIR)/search.o: $(OBJDIR)/search_.c $(OBJDIR)/search.h $(SRCDIR)/config.h
1696 $(XTCC) -o $(OBJDIR)/search.o -c $(OBJDIR)/search_.c
1697
1698 $(OBJDIR)/search.h: $(OBJDIR)/headers
1699
1700 $(OBJDIR)/setup_.c: $(SRCDIR)/setup.c $(TRANSLATE)
1701 $(TRANSLATE) $(SRCDIR)/setup.c >$@
1702
1703 $(OBJDIR)/setup.o: $(OBJDIR)/setup_.c $(OBJDIR)/setup.h $(SRCDIR)/config.h
1704 $(XTCC) -o $(OBJDIR)/setup.o -c $(OBJDIR)/setup_.c
1705
1706 $(OBJDIR)/setup.h: $(OBJDIR)/headers
1707
1708 $(OBJDIR)/sha1_.c: $(SRCDIR)/sha1.c $(TRANSLATE)
1709 $(TRANSLATE) $(SRCDIR)/sha1.c >$@
1710
1711 $(OBJDIR)/sha1.o: $(OBJDIR)/sha1_.c $(OBJDIR)/sha1.h $(SRCDIR)/config.h
1712 $(XTCC) -o $(OBJDIR)/sha1.o -c $(OBJDIR)/sha1_.c
1713
1714 $(OBJDIR)/sha1.h: $(OBJDIR)/headers
1715
1716 $(OBJDIR)/shun_.c: $(SRCDIR)/shun.c $(TRANSLATE)
1717 $(TRANSLATE) $(SRCDIR)/shun.c >$@
1718
1719 $(OBJDIR)/shun.o: $(OBJDIR)/shun_.c $(OBJDIR)/shun.h $(SRCDIR)/config.h
1720 $(XTCC) -o $(OBJDIR)/shun.o -c $(OBJDIR)/shun_.c
1721
1722 $(OBJDIR)/shun.h: $(OBJDIR)/headers
1723
1724 $(OBJDIR)/skins_.c: $(SRCDIR)/skins.c $(TRANSLATE)
1725 $(TRANSLATE) $(SRCDIR)/skins.c >$@
1726
1727 $(OBJDIR)/skins.o: $(OBJDIR)/skins_.c $(OBJDIR)/skins.h $(SRCDIR)/config.h
1728 $(XTCC) -o $(OBJDIR)/skins.o -c $(OBJDIR)/skins_.c
1729
1730 $(OBJDIR)/skins.h: $(OBJDIR)/headers
1731
1732 $(OBJDIR)/sqlcmd_.c: $(SRCDIR)/sqlcmd.c $(TRANSLATE)
1733 $(TRANSLATE) $(SRCDIR)/sqlcmd.c >$@
1734
1735 $(OBJDIR)/sqlcmd.o: $(OBJDIR)/sqlcmd_.c $(OBJDIR)/sqlcmd.h $(SRCDIR)/config.h
1736 $(XTCC) -o $(OBJDIR)/sqlcmd.o -c $(OBJDIR)/sqlcmd_.c
1737
1738 $(OBJDIR)/sqlcmd.h: $(OBJDIR)/headers
1739
1740 $(OBJDIR)/stash_.c: $(SRCDIR)/stash.c $(TRANSLATE)
1741 $(TRANSLATE) $(SRCDIR)/stash.c >$@
1742
1743 $(OBJDIR)/stash.o: $(OBJDIR)/stash_.c $(OBJDIR)/stash.h $(SRCDIR)/config.h
1744 $(XTCC) -o $(OBJDIR)/stash.o -c $(OBJDIR)/stash_.c
1745
1746 $(OBJDIR)/stash.h: $(OBJDIR)/headers
1747
1748 $(OBJDIR)/stat_.c: $(SRCDIR)/stat.c $(TRANSLATE)
1749 $(TRANSLATE) $(SRCDIR)/stat.c >$@
1750
1751 $(OBJDIR)/stat.o: $(OBJDIR)/stat_.c $(OBJDIR)/stat.h $(SRCDIR)/config.h
1752 $(XTCC) -o $(OBJDIR)/stat.o -c $(OBJDIR)/stat_.c
1753
1754 $(OBJDIR)/stat.h: $(OBJDIR)/headers
1755
1756 $(OBJDIR)/style_.c: $(SRCDIR)/style.c $(TRANSLATE)
1757 $(TRANSLATE) $(SRCDIR)/style.c >$@
1758
1759 $(OBJDIR)/style.o: $(OBJDIR)/style_.c $(OBJDIR)/style.h $(SRCDIR)/config.h
1760 $(XTCC) -o $(OBJDIR)/style.o -c $(OBJDIR)/style_.c
1761
1762 $(OBJDIR)/style.h: $(OBJDIR)/headers
1763
1764 $(OBJDIR)/sync_.c: $(SRCDIR)/sync.c $(TRANSLATE)
1765 $(TRANSLATE) $(SRCDIR)/sync.c >$@
1766
1767 $(OBJDIR)/sync.o: $(OBJDIR)/sync_.c $(OBJDIR)/sync.h $(SRCDIR)/config.h
1768 $(XTCC) -o $(OBJDIR)/sync.o -c $(OBJDIR)/sync_.c
1769
1770 $(OBJDIR)/sync.h: $(OBJDIR)/headers
1771
1772 $(OBJDIR)/tag_.c: $(SRCDIR)/tag.c $(TRANSLATE)
1773 $(TRANSLATE) $(SRCDIR)/tag.c >$@
1774
1775 $(OBJDIR)/tag.o: $(OBJDIR)/tag_.c $(OBJDIR)/tag.h $(SRCDIR)/config.h
1776 $(XTCC) -o $(OBJDIR)/tag.o -c $(OBJDIR)/tag_.c
1777
1778 $(OBJDIR)/tag.h: $(OBJDIR)/headers
1779
1780 $(OBJDIR)/tar_.c: $(SRCDIR)/tar.c $(TRANSLATE)
1781 $(TRANSLATE) $(SRCDIR)/tar.c >$@
1782
1783 $(OBJDIR)/tar.o: $(OBJDIR)/tar_.c $(OBJDIR)/tar.h $(SRCDIR)/config.h
1784 $(XTCC) -o $(OBJDIR)/tar.o -c $(OBJDIR)/tar_.c
1785
1786 $(OBJDIR)/tar.h: $(OBJDIR)/headers
1787
1788 $(OBJDIR)/th_main_.c: $(SRCDIR)/th_main.c $(TRANSLATE)
1789 $(TRANSLATE) $(SRCDIR)/th_main.c >$@
1790
1791 $(OBJDIR)/th_main.o: $(OBJDIR)/th_main_.c $(OBJDIR)/th_main.h $(SRCDIR)/config.h
1792 $(XTCC) -o $(OBJDIR)/th_main.o -c $(OBJDIR)/th_main_.c
1793
1794 $(OBJDIR)/th_main.h: $(OBJDIR)/headers
1795
1796 $(OBJDIR)/timeline_.c: $(SRCDIR)/timeline.c $(TRANSLATE)
1797 $(TRANSLATE) $(SRCDIR)/timeline.c >$@
1798
1799 $(OBJDIR)/timeline.o: $(OBJDIR)/timeline_.c $(OBJDIR)/timeline.h $(SRCDIR)/config.h
1800 $(XTCC) -o $(OBJDIR)/timeline.o -c $(OBJDIR)/timeline_.c
1801
1802 $(OBJDIR)/timeline.h: $(OBJDIR)/headers
1803
1804 $(OBJDIR)/tkt_.c: $(SRCDIR)/tkt.c $(TRANSLATE)
1805 $(TRANSLATE) $(SRCDIR)/tkt.c >$@
1806
1807 $(OBJDIR)/tkt.o: $(OBJDIR)/tkt_.c $(OBJDIR)/tkt.h $(SRCDIR)/config.h
1808 $(XTCC) -o $(OBJDIR)/tkt.o -c $(OBJDIR)/tkt_.c
1809
1810 $(OBJDIR)/tkt.h: $(OBJDIR)/headers
1811
1812 $(OBJDIR)/tktsetup_.c: $(SRCDIR)/tktsetup.c $(TRANSLATE)
1813 $(TRANSLATE) $(SRCDIR)/tktsetup.c >$@
1814
1815 $(OBJDIR)/tktsetup.o: $(OBJDIR)/tktsetup_.c $(OBJDIR)/tktsetup.h $(SRCDIR)/config.h
1816 $(XTCC) -o $(OBJDIR)/tktsetup.o -c $(OBJDIR)/tktsetup_.c
1817
1818 $(OBJDIR)/tktsetup.h: $(OBJDIR)/headers
1819
1820 $(OBJDIR)/undo_.c: $(SRCDIR)/undo.c $(TRANSLATE)
1821 $(TRANSLATE) $(SRCDIR)/undo.c >$@
1822
1823 $(OBJDIR)/undo.o: $(OBJDIR)/undo_.c $(OBJDIR)/undo.h $(SRCDIR)/config.h
1824 $(XTCC) -o $(OBJDIR)/undo.o -c $(OBJDIR)/undo_.c
1825
1826 $(OBJDIR)/undo.h: $(OBJDIR)/headers
1827
1828 $(OBJDIR)/unicode_.c: $(SRCDIR)/unicode.c $(TRANSLATE)
1829 $(TRANSLATE) $(SRCDIR)/unicode.c >$@
1830
1831 $(OBJDIR)/unicode.o: $(OBJDIR)/unicode_.c $(OBJDIR)/unicode.h $(SRCDIR)/config.h
1832 $(XTCC) -o $(OBJDIR)/unicode.o -c $(OBJDIR)/unicode_.c
1833
1834 $(OBJDIR)/unicode.h: $(OBJDIR)/headers
1835
1836 $(OBJDIR)/update_.c: $(SRCDIR)/update.c $(TRANSLATE)
1837 $(TRANSLATE) $(SRCDIR)/update.c >$@
1838
1839 $(OBJDIR)/update.o: $(OBJDIR)/update_.c $(OBJDIR)/update.h $(SRCDIR)/config.h
1840 $(XTCC) -o $(OBJDIR)/update.o -c $(OBJDIR)/update_.c
1841
1842 $(OBJDIR)/update.h: $(OBJDIR)/headers
1843
1844 $(OBJDIR)/url_.c: $(SRCDIR)/url.c $(TRANSLATE)
1845 $(TRANSLATE) $(SRCDIR)/url.c >$@
1846
1847 $(OBJDIR)/url.o: $(OBJDIR)/url_.c $(OBJDIR)/url.h $(SRCDIR)/config.h
1848 $(XTCC) -o $(OBJDIR)/url.o -c $(OBJDIR)/url_.c
1849
1850 $(OBJDIR)/url.h: $(OBJDIR)/headers
1851
1852 $(OBJDIR)/user_.c: $(SRCDIR)/user.c $(TRANSLATE)
1853 $(TRANSLATE) $(SRCDIR)/user.c >$@
1854
1855 $(OBJDIR)/user.o: $(OBJDIR)/user_.c $(OBJDIR)/user.h $(SRCDIR)/config.h
1856 $(XTCC) -o $(OBJDIR)/user.o -c $(OBJDIR)/user_.c
1857
1858 $(OBJDIR)/user.h: $(OBJDIR)/headers
1859
1860 $(OBJDIR)/utf8_.c: $(SRCDIR)/utf8.c $(TRANSLATE)
1861 $(TRANSLATE) $(SRCDIR)/utf8.c >$@
1862
1863 $(OBJDIR)/utf8.o: $(OBJDIR)/utf8_.c $(OBJDIR)/utf8.h $(SRCDIR)/config.h
1864 $(XTCC) -o $(OBJDIR)/utf8.o -c $(OBJDIR)/utf8_.c
1865
1866 $(OBJDIR)/utf8.h: $(OBJDIR)/headers
1867
1868 $(OBJDIR)/util_.c: $(SRCDIR)/util.c $(TRANSLATE)
1869 $(TRANSLATE) $(SRCDIR)/util.c >$@
1870
1871 $(OBJDIR)/util.o: $(OBJDIR)/util_.c $(OBJDIR)/util.h $(SRCDIR)/config.h
1872 $(XTCC) -o $(OBJDIR)/util.o -c $(OBJDIR)/util_.c
1873
1874 $(OBJDIR)/util.h: $(OBJDIR)/headers
1875
1876 $(OBJDIR)/verify_.c: $(SRCDIR)/verify.c $(TRANSLATE)
1877 $(TRANSLATE) $(SRCDIR)/verify.c >$@
1878
1879 $(OBJDIR)/verify.o: $(OBJDIR)/verify_.c $(OBJDIR)/verify.h $(SRCDIR)/config.h
1880 $(XTCC) -o $(OBJDIR)/verify.o -c $(OBJDIR)/verify_.c
1881
1882 $(OBJDIR)/verify.h: $(OBJDIR)/headers
1883
1884 $(OBJDIR)/vfile_.c: $(SRCDIR)/vfile.c $(TRANSLATE)
1885 $(TRANSLATE) $(SRCDIR)/vfile.c >$@
1886
1887 $(OBJDIR)/vfile.o: $(OBJDIR)/vfile_.c $(OBJDIR)/vfile.h $(SRCDIR)/config.h
1888 $(XTCC) -o $(OBJDIR)/vfile.o -c $(OBJDIR)/vfile_.c
1889
1890 $(OBJDIR)/vfile.h: $(OBJDIR)/headers
1891
1892 $(OBJDIR)/wiki_.c: $(SRCDIR)/wiki.c $(TRANSLATE)
1893 $(TRANSLATE) $(SRCDIR)/wiki.c >$@
1894
1895 $(OBJDIR)/wiki.o: $(OBJDIR)/wiki_.c $(OBJDIR)/wiki.h $(SRCDIR)/config.h
1896 $(XTCC) -o $(OBJDIR)/wiki.o -c $(OBJDIR)/wiki_.c
1897
1898 $(OBJDIR)/wiki.h: $(OBJDIR)/headers
1899
1900 $(OBJDIR)/wikiformat_.c: $(SRCDIR)/wikiformat.c $(TRANSLATE)
1901 $(TRANSLATE) $(SRCDIR)/wikiformat.c >$@
1902
1903 $(OBJDIR)/wikiformat.o: $(OBJDIR)/wikiformat_.c $(OBJDIR)/wikiformat.h $(SRCDIR)/config.h
1904 $(XTCC) -o $(OBJDIR)/wikiformat.o -c $(OBJDIR)/wikiformat_.c
1905
1906 $(OBJDIR)/wikiformat.h: $(OBJDIR)/headers
1907
1908 $(OBJDIR)/winfile_.c: $(SRCDIR)/winfile.c $(TRANSLATE)
1909 $(TRANSLATE) $(SRCDIR)/winfile.c >$@
1910
1911 $(OBJDIR)/winfile.o: $(OBJDIR)/winfile_.c $(OBJDIR)/winfile.h $(SRCDIR)/config.h
1912 $(XTCC) -o $(OBJDIR)/winfile.o -c $(OBJDIR)/winfile_.c
1913
1914 $(OBJDIR)/winfile.h: $(OBJDIR)/headers
1915
1916 $(OBJDIR)/winhttp_.c: $(SRCDIR)/winhttp.c $(TRANSLATE)
1917 $(TRANSLATE) $(SRCDIR)/winhttp.c >$@
1918
1919 $(OBJDIR)/winhttp.o: $(OBJDIR)/winhttp_.c $(OBJDIR)/winhttp.h $(SRCDIR)/config.h
1920 $(XTCC) -o $(OBJDIR)/winhttp.o -c $(OBJDIR)/winhttp_.c
1921
1922 $(OBJDIR)/winhttp.h: $(OBJDIR)/headers
1923
1924 $(OBJDIR)/wysiwyg_.c: $(SRCDIR)/wysiwyg.c $(TRANSLATE)
1925 $(TRANSLATE) $(SRCDIR)/wysiwyg.c >$@
1926
1927 $(OBJDIR)/wysiwyg.o: $(OBJDIR)/wysiwyg_.c $(OBJDIR)/wysiwyg.h $(SRCDIR)/config.h
1928 $(XTCC) -o $(OBJDIR)/wysiwyg.o -c $(OBJDIR)/wysiwyg_.c
1929
1930 $(OBJDIR)/wysiwyg.h: $(OBJDIR)/headers
1931
1932 $(OBJDIR)/xfer_.c: $(SRCDIR)/xfer.c $(TRANSLATE)
1933 $(TRANSLATE) $(SRCDIR)/xfer.c >$@
1934
1935 $(OBJDIR)/xfer.o: $(OBJDIR)/xfer_.c $(OBJDIR)/xfer.h $(SRCDIR)/config.h
1936 $(XTCC) -o $(OBJDIR)/xfer.o -c $(OBJDIR)/xfer_.c
1937
1938 $(OBJDIR)/xfer.h: $(OBJDIR)/headers
1939
1940 $(OBJDIR)/xfersetup_.c: $(SRCDIR)/xfersetup.c $(TRANSLATE)
1941 $(TRANSLATE) $(SRCDIR)/xfersetup.c >$@
1942
1943 $(OBJDIR)/xfersetup.o: $(OBJDIR)/xfersetup_.c $(OBJDIR)/xfersetup.h $(SRCDIR)/config.h
1944 $(XTCC) -o $(OBJDIR)/xfersetup.o -c $(OBJDIR)/xfersetup_.c
1945
1946 $(OBJDIR)/xfersetup.h: $(OBJDIR)/headers
1947
1948 $(OBJDIR)/zip_.c: $(SRCDIR)/zip.c $(TRANSLATE)
1949 $(TRANSLATE) $(SRCDIR)/zip.c >$@
1950
1951 $(OBJDIR)/zip.o: $(OBJDIR)/zip_.c $(OBJDIR)/zip.h $(SRCDIR)/config.h
1952 $(XTCC) -o $(OBJDIR)/zip.o -c $(OBJDIR)/zip_.c
1953
1954 $(OBJDIR)/zip.h: $(OBJDIR)/headers
@@ -1906,27 +1977,27 @@
1977 MINIZ_OPTIONS = -DMINIZ_NO_STDIO \
1978 -DMINIZ_NO_TIME \
1979 -DMINIZ_NO_ARCHIVE_APIS
1980
1981 $(OBJDIR)/sqlite3.o: $(SRCDIR)/sqlite3.c $(SRCDIR)/../win/Makefile.mingw
1982 $(XTCC) $(SQLITE_OPTIONS) $(SQLITE_CFLAGS) -c $(SRCDIR)/sqlite3.c -o $@
1983
1984 $(OBJDIR)/cson_amalgamation.o: $(SRCDIR)/cson_amalgamation.c
1985 $(XTCC) -c $(SRCDIR)/cson_amalgamation.c -o $@
1986
1987 $(OBJDIR)/json.o $(OBJDIR)/json_artifact.o $(OBJDIR)/json_branch.o $(OBJDIR)/json_config.o $(OBJDIR)/json_diff.o $(OBJDIR)/json_dir.o $(OBJDIR)/jsos_finfo.o $(OBJDIR)/json_login.o $(OBJDIR)/json_query.o $(OBJDIR)/json_report.o $(OBJDIR)/json_status.o $(OBJDIR)/json_tag.o $(OBJDIR)/json_timeline.o $(OBJDIR)/json_user.o $(OBJDIR)/json_wiki.o : $(SRCDIR)/json_detail.h
1988
1989 $(OBJDIR)/shell.o: $(SRCDIR)/shell.c $(SRCDIR)/sqlite3.h $(SRCDIR)/../win/Makefile.mingw
1990 $(XTCC) $(SHELL_OPTIONS) $(SHELL_CFLAGS) -c $(SRCDIR)/shell.c -o $@
1991
1992 $(OBJDIR)/th.o: $(SRCDIR)/th.c
1993 $(XTCC) -c $(SRCDIR)/th.c -o $@
1994
1995 $(OBJDIR)/th_lang.o: $(SRCDIR)/th_lang.c
1996 $(XTCC) -c $(SRCDIR)/th_lang.c -o $@
1997
1998 $(OBJDIR)/th_tcl.o: $(SRCDIR)/th_tcl.c
1999 $(XTCC) -c $(SRCDIR)/th_tcl.c -o $@
2000
2001 $(OBJDIR)/miniz.o: $(SRCDIR)/miniz.c
2002 $(XTCC) $(MINIZ_OPTIONS) -c $(SRCDIR)/miniz.c -o $@
2003
2004
--- win/Makefile.mingw.mistachkin
+++ win/Makefile.mingw.mistachkin
@@ -94,23 +94,35 @@
9494
ifndef MINGW_IS_32BIT_ONLY
9595
ifeq (,$(findstring w64-mingw32,$(PREFIX)))
9696
MINGW_IS_32BIT_ONLY = 1
9797
endif
9898
endif
99
-ifeq (,$(findstring x86_64-w64-mingw32,$(PREFIX)))
100
-SSLCONFIG = mingw
101
-else
102
-SSLCONFIG = mingw64
103
-endif
104
-ifndef FOSSIL_ENABLE_MINIZ
105
-SSLCONFIG += --with-zlib-lib=$(PWD)/$(ZLIBDIR) --with-zlib-include=$(PWD)/$(ZLIBDIR) zlib
106
-endif
10799
108100
#### The directories where the zlib include and library files are located.
109101
#
110102
ZINCDIR = $(SRCDIR)/../compat/zlib
111103
ZLIBDIR = $(SRCDIR)/../compat/zlib
104
+
105
+ifndef X64
106
+ifneq (,$(findstring x86_64-w64-mingw32,$(PREFIX)))
107
+X64 = 1
108
+endif
109
+endif
110
+
111
+ifndef X64
112
+SSLCONFIG = mingw
113
+ZLIBCONFIG = LOC="-DASMV -DASMINF" OBJA="inffas86.o match.o"
114
+LIBTARGETS = $(ZLIBDIR)/inffas86.o $(ZLIBDIR)/match.o
115
+else
116
+SSLCONFIG = mingw64
117
+ZLIBCONFIG =
118
+LIBTARGETS =
119
+endif
120
+
121
+ifndef FOSSIL_ENABLE_MINIZ
122
+SSLCONFIG += --with-zlib-lib=$(PWD)/$(ZLIBDIR) --with-zlib-include=$(PWD)/$(ZLIBDIR) zlib
123
+endif
112124
113125
#### The directories where the OpenSSL include and library files are located.
114126
# The recommended usage here is to use the Sysinternals junction tool
115127
# to create a hard link between an "openssl-1.x" sub-directory of the
116128
# Fossil source code directory and the target OpenSSL source directory.
@@ -677,11 +689,10 @@
677689
$(OBJDIR)/xfersetup.o \
678690
$(OBJDIR)/zip.o
679691
680692
APPNAME = fossil.exe
681693
APPTARGETS =
682
-LIBTARGETS =
683694
684695
#### If the USE_WINDOWS variable exists, it is assumed that we are building
685696
# inside of a Windows-style shell; otherwise, it is assumed that we are
686697
# building inside of a Unix-style shell. Note that the "move" command is
687698
# broken when attempting to use it from the Windows shell via MinGW make
@@ -749,35 +760,35 @@
749760
else
750761
$(MKDIR) $(OBJDIR)
751762
endif
752763
753764
$(TRANSLATE): $(SRCDIR)/translate.c
754
- $(BCC) -o $(TRANSLATE) $(SRCDIR)/translate.c
765
+ $(BCC) -o $@ $(SRCDIR)/translate.c
755766
756767
$(MAKEHEADERS): $(SRCDIR)/makeheaders.c
757
- $(BCC) -o $(MAKEHEADERS) $(SRCDIR)/makeheaders.c
768
+ $(BCC) -o $@ $(SRCDIR)/makeheaders.c
758769
759770
$(MKINDEX): $(SRCDIR)/mkindex.c
760
- $(BCC) -o $(MKINDEX) $(SRCDIR)/mkindex.c
771
+ $(BCC) -o $@ $(SRCDIR)/mkindex.c
761772
762773
$(MKBUILTIN): $(SRCDIR)/mkbuiltin.c
763
- $(BCC) -o $(MKBUILTIN) $(SRCDIR)/mkbuiltin.c
774
+ $(BCC) -o $@ $(SRCDIR)/mkbuiltin.c
764775
765776
$(MKVERSION): $(SRCDIR)/mkversion.c
766
- $(BCC) -o $(MKVERSION) $(SRCDIR)/mkversion.c
777
+ $(BCC) -o $@ $(SRCDIR)/mkversion.c
767778
768779
$(CODECHECK1): $(SRCDIR)/codecheck1.c
769
- $(BCC) -o $(CODECHECK1) $(SRCDIR)/codecheck1.c
780
+ $(BCC) -o $@ $(SRCDIR)/codecheck1.c
770781
771782
# WARNING. DANGER. Running the test suite modifies the repository the
772783
# build is done from, i.e. the checkout belongs to. Do not sync/push
773784
# the repository after running the tests.
774785
test: $(OBJDIR) $(APPNAME)
775786
$(TCLSH) $(SRCDIR)/../test/tester.tcl $(APPNAME)
776787
777788
$(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(MKVERSION)
778
- $(MKVERSION) $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION >$(OBJDIR)/VERSION.h
789
+ $(MKVERSION) $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION >$@
779790
780791
# The USE_SYSTEM_SQLITE variable may be undefined, set to 0, or set
781792
# to 1. If it is set to 1, then there is no need to build or link
782793
# the sqlite3.o object. Instead, the system SQLite will be linked
783794
# using -lsqlite3.
@@ -802,14 +813,21 @@
802813
$(OBJDIR)/th_tcl.o \
803814
$(OBJDIR)/cson_amalgamation.o
804815
805816
806817
zlib:
807
- $(MAKE) -C $(ZLIBDIR) PREFIX=$(PREFIX) -f win32/Makefile.gcc libz.a
818
+ $(MAKE) -C $(ZLIBDIR) PREFIX=$(PREFIX) $(ZLIBCONFIG) -f win32/Makefile.gcc libz.a
808819
809820
clean-zlib:
810821
$(MAKE) -C $(ZLIBDIR) PREFIX=$(PREFIX) -f win32/Makefile.gcc clean
822
+
823
+$(ZLIBDIR)/inffas86.o:
824
+ $(TCC) -c -o $@ -DASMINF -I$(ZLIBDIR) -O3 $(ZLIBDIR)/contrib/inflate86/inffas86.c
825
+
826
+$(ZLIBDIR)/match.o:
827
+ $(TCC) -c -o $@ -DASMV $(ZLIBDIR)/contrib/asm686/match.S
828
+
811829
812830
ifndef FOSSIL_ENABLE_MINIZ
813831
LIBTARGETS += zlib
814832
endif
815833
@@ -833,11 +851,11 @@
833851
APPTARGETS += openssl
834852
endif
835853
836854
$(APPNAME): $(OBJDIR)/headers $(CODECHECK1) $(OBJ) $(EXTRAOBJ) $(OBJDIR)/fossil.o $(APPTARGETS)
837855
$(CODECHECK1) $(TRANS_SRC)
838
- $(TCC) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB) $(OBJDIR)/fossil.o
856
+ $(TCC) -o $@ $(OBJ) $(EXTRAOBJ) $(LIB) $(OBJDIR)/fossil.o
839857
840858
# This rule prevents make from using its default rules to try build
841859
# an executable named "manifest" out of the file named "manifest.c"
842860
#
843861
$(SRCDIR)/../manifest:
@@ -985,899 +1003,899 @@
9851003
$(OBJDIR)/headers: Makefile
9861004
9871005
Makefile:
9881006
9891007
$(OBJDIR)/add_.c: $(SRCDIR)/add.c $(TRANSLATE)
990
- $(TRANSLATE) $(SRCDIR)/add.c >$(OBJDIR)/add_.c
1008
+ $(TRANSLATE) $(SRCDIR)/add.c >$@
9911009
9921010
$(OBJDIR)/add.o: $(OBJDIR)/add_.c $(OBJDIR)/add.h $(SRCDIR)/config.h
9931011
$(XTCC) -o $(OBJDIR)/add.o -c $(OBJDIR)/add_.c
9941012
9951013
$(OBJDIR)/add.h: $(OBJDIR)/headers
9961014
9971015
$(OBJDIR)/allrepo_.c: $(SRCDIR)/allrepo.c $(TRANSLATE)
998
- $(TRANSLATE) $(SRCDIR)/allrepo.c >$(OBJDIR)/allrepo_.c
1016
+ $(TRANSLATE) $(SRCDIR)/allrepo.c >$@
9991017
10001018
$(OBJDIR)/allrepo.o: $(OBJDIR)/allrepo_.c $(OBJDIR)/allrepo.h $(SRCDIR)/config.h
10011019
$(XTCC) -o $(OBJDIR)/allrepo.o -c $(OBJDIR)/allrepo_.c
10021020
10031021
$(OBJDIR)/allrepo.h: $(OBJDIR)/headers
10041022
10051023
$(OBJDIR)/attach_.c: $(SRCDIR)/attach.c $(TRANSLATE)
1006
- $(TRANSLATE) $(SRCDIR)/attach.c >$(OBJDIR)/attach_.c
1024
+ $(TRANSLATE) $(SRCDIR)/attach.c >$@
10071025
10081026
$(OBJDIR)/attach.o: $(OBJDIR)/attach_.c $(OBJDIR)/attach.h $(SRCDIR)/config.h
10091027
$(XTCC) -o $(OBJDIR)/attach.o -c $(OBJDIR)/attach_.c
10101028
10111029
$(OBJDIR)/attach.h: $(OBJDIR)/headers
10121030
10131031
$(OBJDIR)/bag_.c: $(SRCDIR)/bag.c $(TRANSLATE)
1014
- $(TRANSLATE) $(SRCDIR)/bag.c >$(OBJDIR)/bag_.c
1032
+ $(TRANSLATE) $(SRCDIR)/bag.c >$@
10151033
10161034
$(OBJDIR)/bag.o: $(OBJDIR)/bag_.c $(OBJDIR)/bag.h $(SRCDIR)/config.h
10171035
$(XTCC) -o $(OBJDIR)/bag.o -c $(OBJDIR)/bag_.c
10181036
10191037
$(OBJDIR)/bag.h: $(OBJDIR)/headers
10201038
10211039
$(OBJDIR)/bisect_.c: $(SRCDIR)/bisect.c $(TRANSLATE)
1022
- $(TRANSLATE) $(SRCDIR)/bisect.c >$(OBJDIR)/bisect_.c
1040
+ $(TRANSLATE) $(SRCDIR)/bisect.c >$@
10231041
10241042
$(OBJDIR)/bisect.o: $(OBJDIR)/bisect_.c $(OBJDIR)/bisect.h $(SRCDIR)/config.h
10251043
$(XTCC) -o $(OBJDIR)/bisect.o -c $(OBJDIR)/bisect_.c
10261044
10271045
$(OBJDIR)/bisect.h: $(OBJDIR)/headers
10281046
10291047
$(OBJDIR)/blob_.c: $(SRCDIR)/blob.c $(TRANSLATE)
1030
- $(TRANSLATE) $(SRCDIR)/blob.c >$(OBJDIR)/blob_.c
1048
+ $(TRANSLATE) $(SRCDIR)/blob.c >$@
10311049
10321050
$(OBJDIR)/blob.o: $(OBJDIR)/blob_.c $(OBJDIR)/blob.h $(SRCDIR)/config.h
10331051
$(XTCC) -o $(OBJDIR)/blob.o -c $(OBJDIR)/blob_.c
10341052
10351053
$(OBJDIR)/blob.h: $(OBJDIR)/headers
10361054
10371055
$(OBJDIR)/branch_.c: $(SRCDIR)/branch.c $(TRANSLATE)
1038
- $(TRANSLATE) $(SRCDIR)/branch.c >$(OBJDIR)/branch_.c
1056
+ $(TRANSLATE) $(SRCDIR)/branch.c >$@
10391057
10401058
$(OBJDIR)/branch.o: $(OBJDIR)/branch_.c $(OBJDIR)/branch.h $(SRCDIR)/config.h
10411059
$(XTCC) -o $(OBJDIR)/branch.o -c $(OBJDIR)/branch_.c
10421060
10431061
$(OBJDIR)/branch.h: $(OBJDIR)/headers
10441062
10451063
$(OBJDIR)/browse_.c: $(SRCDIR)/browse.c $(TRANSLATE)
1046
- $(TRANSLATE) $(SRCDIR)/browse.c >$(OBJDIR)/browse_.c
1064
+ $(TRANSLATE) $(SRCDIR)/browse.c >$@
10471065
10481066
$(OBJDIR)/browse.o: $(OBJDIR)/browse_.c $(OBJDIR)/browse.h $(SRCDIR)/config.h
10491067
$(XTCC) -o $(OBJDIR)/browse.o -c $(OBJDIR)/browse_.c
10501068
10511069
$(OBJDIR)/browse.h: $(OBJDIR)/headers
10521070
10531071
$(OBJDIR)/builtin_.c: $(SRCDIR)/builtin.c $(TRANSLATE)
1054
- $(TRANSLATE) $(SRCDIR)/builtin.c >$(OBJDIR)/builtin_.c
1072
+ $(TRANSLATE) $(SRCDIR)/builtin.c >$@
10551073
10561074
$(OBJDIR)/builtin.o: $(OBJDIR)/builtin_.c $(OBJDIR)/builtin.h $(OBJDIR)/builtin_data.h $(SRCDIR)/config.h
10571075
$(XTCC) -o $(OBJDIR)/builtin.o -c $(OBJDIR)/builtin_.c
10581076
10591077
$(OBJDIR)/builtin.h: $(OBJDIR)/headers
10601078
10611079
$(OBJDIR)/cache_.c: $(SRCDIR)/cache.c $(TRANSLATE)
1062
- $(TRANSLATE) $(SRCDIR)/cache.c >$(OBJDIR)/cache_.c
1080
+ $(TRANSLATE) $(SRCDIR)/cache.c >$@
10631081
10641082
$(OBJDIR)/cache.o: $(OBJDIR)/cache_.c $(OBJDIR)/cache.h $(SRCDIR)/config.h
10651083
$(XTCC) -o $(OBJDIR)/cache.o -c $(OBJDIR)/cache_.c
10661084
10671085
$(OBJDIR)/cache.h: $(OBJDIR)/headers
10681086
10691087
$(OBJDIR)/captcha_.c: $(SRCDIR)/captcha.c $(TRANSLATE)
1070
- $(TRANSLATE) $(SRCDIR)/captcha.c >$(OBJDIR)/captcha_.c
1088
+ $(TRANSLATE) $(SRCDIR)/captcha.c >$@
10711089
10721090
$(OBJDIR)/captcha.o: $(OBJDIR)/captcha_.c $(OBJDIR)/captcha.h $(SRCDIR)/config.h
10731091
$(XTCC) -o $(OBJDIR)/captcha.o -c $(OBJDIR)/captcha_.c
10741092
10751093
$(OBJDIR)/captcha.h: $(OBJDIR)/headers
10761094
10771095
$(OBJDIR)/cgi_.c: $(SRCDIR)/cgi.c $(TRANSLATE)
1078
- $(TRANSLATE) $(SRCDIR)/cgi.c >$(OBJDIR)/cgi_.c
1096
+ $(TRANSLATE) $(SRCDIR)/cgi.c >$@
10791097
10801098
$(OBJDIR)/cgi.o: $(OBJDIR)/cgi_.c $(OBJDIR)/cgi.h $(SRCDIR)/config.h
10811099
$(XTCC) -o $(OBJDIR)/cgi.o -c $(OBJDIR)/cgi_.c
10821100
10831101
$(OBJDIR)/cgi.h: $(OBJDIR)/headers
10841102
10851103
$(OBJDIR)/checkin_.c: $(SRCDIR)/checkin.c $(TRANSLATE)
1086
- $(TRANSLATE) $(SRCDIR)/checkin.c >$(OBJDIR)/checkin_.c
1104
+ $(TRANSLATE) $(SRCDIR)/checkin.c >$@
10871105
10881106
$(OBJDIR)/checkin.o: $(OBJDIR)/checkin_.c $(OBJDIR)/checkin.h $(SRCDIR)/config.h
10891107
$(XTCC) -o $(OBJDIR)/checkin.o -c $(OBJDIR)/checkin_.c
10901108
10911109
$(OBJDIR)/checkin.h: $(OBJDIR)/headers
10921110
10931111
$(OBJDIR)/checkout_.c: $(SRCDIR)/checkout.c $(TRANSLATE)
1094
- $(TRANSLATE) $(SRCDIR)/checkout.c >$(OBJDIR)/checkout_.c
1112
+ $(TRANSLATE) $(SRCDIR)/checkout.c >$@
10951113
10961114
$(OBJDIR)/checkout.o: $(OBJDIR)/checkout_.c $(OBJDIR)/checkout.h $(SRCDIR)/config.h
10971115
$(XTCC) -o $(OBJDIR)/checkout.o -c $(OBJDIR)/checkout_.c
10981116
10991117
$(OBJDIR)/checkout.h: $(OBJDIR)/headers
11001118
11011119
$(OBJDIR)/clearsign_.c: $(SRCDIR)/clearsign.c $(TRANSLATE)
1102
- $(TRANSLATE) $(SRCDIR)/clearsign.c >$(OBJDIR)/clearsign_.c
1120
+ $(TRANSLATE) $(SRCDIR)/clearsign.c >$@
11031121
11041122
$(OBJDIR)/clearsign.o: $(OBJDIR)/clearsign_.c $(OBJDIR)/clearsign.h $(SRCDIR)/config.h
11051123
$(XTCC) -o $(OBJDIR)/clearsign.o -c $(OBJDIR)/clearsign_.c
11061124
11071125
$(OBJDIR)/clearsign.h: $(OBJDIR)/headers
11081126
11091127
$(OBJDIR)/clone_.c: $(SRCDIR)/clone.c $(TRANSLATE)
1110
- $(TRANSLATE) $(SRCDIR)/clone.c >$(OBJDIR)/clone_.c
1128
+ $(TRANSLATE) $(SRCDIR)/clone.c >$@
11111129
11121130
$(OBJDIR)/clone.o: $(OBJDIR)/clone_.c $(OBJDIR)/clone.h $(SRCDIR)/config.h
11131131
$(XTCC) -o $(OBJDIR)/clone.o -c $(OBJDIR)/clone_.c
11141132
11151133
$(OBJDIR)/clone.h: $(OBJDIR)/headers
11161134
11171135
$(OBJDIR)/comformat_.c: $(SRCDIR)/comformat.c $(TRANSLATE)
1118
- $(TRANSLATE) $(SRCDIR)/comformat.c >$(OBJDIR)/comformat_.c
1136
+ $(TRANSLATE) $(SRCDIR)/comformat.c >$@
11191137
11201138
$(OBJDIR)/comformat.o: $(OBJDIR)/comformat_.c $(OBJDIR)/comformat.h $(SRCDIR)/config.h
11211139
$(XTCC) -o $(OBJDIR)/comformat.o -c $(OBJDIR)/comformat_.c
11221140
11231141
$(OBJDIR)/comformat.h: $(OBJDIR)/headers
11241142
11251143
$(OBJDIR)/configure_.c: $(SRCDIR)/configure.c $(TRANSLATE)
1126
- $(TRANSLATE) $(SRCDIR)/configure.c >$(OBJDIR)/configure_.c
1144
+ $(TRANSLATE) $(SRCDIR)/configure.c >$@
11271145
11281146
$(OBJDIR)/configure.o: $(OBJDIR)/configure_.c $(OBJDIR)/configure.h $(SRCDIR)/config.h
11291147
$(XTCC) -o $(OBJDIR)/configure.o -c $(OBJDIR)/configure_.c
11301148
11311149
$(OBJDIR)/configure.h: $(OBJDIR)/headers
11321150
11331151
$(OBJDIR)/content_.c: $(SRCDIR)/content.c $(TRANSLATE)
1134
- $(TRANSLATE) $(SRCDIR)/content.c >$(OBJDIR)/content_.c
1152
+ $(TRANSLATE) $(SRCDIR)/content.c >$@
11351153
11361154
$(OBJDIR)/content.o: $(OBJDIR)/content_.c $(OBJDIR)/content.h $(SRCDIR)/config.h
11371155
$(XTCC) -o $(OBJDIR)/content.o -c $(OBJDIR)/content_.c
11381156
11391157
$(OBJDIR)/content.h: $(OBJDIR)/headers
11401158
11411159
$(OBJDIR)/db_.c: $(SRCDIR)/db.c $(TRANSLATE)
1142
- $(TRANSLATE) $(SRCDIR)/db.c >$(OBJDIR)/db_.c
1160
+ $(TRANSLATE) $(SRCDIR)/db.c >$@
11431161
11441162
$(OBJDIR)/db.o: $(OBJDIR)/db_.c $(OBJDIR)/db.h $(SRCDIR)/config.h
11451163
$(XTCC) -o $(OBJDIR)/db.o -c $(OBJDIR)/db_.c
11461164
11471165
$(OBJDIR)/db.h: $(OBJDIR)/headers
11481166
11491167
$(OBJDIR)/delta_.c: $(SRCDIR)/delta.c $(TRANSLATE)
1150
- $(TRANSLATE) $(SRCDIR)/delta.c >$(OBJDIR)/delta_.c
1168
+ $(TRANSLATE) $(SRCDIR)/delta.c >$@
11511169
11521170
$(OBJDIR)/delta.o: $(OBJDIR)/delta_.c $(OBJDIR)/delta.h $(SRCDIR)/config.h
11531171
$(XTCC) -o $(OBJDIR)/delta.o -c $(OBJDIR)/delta_.c
11541172
11551173
$(OBJDIR)/delta.h: $(OBJDIR)/headers
11561174
11571175
$(OBJDIR)/deltacmd_.c: $(SRCDIR)/deltacmd.c $(TRANSLATE)
1158
- $(TRANSLATE) $(SRCDIR)/deltacmd.c >$(OBJDIR)/deltacmd_.c
1176
+ $(TRANSLATE) $(SRCDIR)/deltacmd.c >$@
11591177
11601178
$(OBJDIR)/deltacmd.o: $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h $(SRCDIR)/config.h
11611179
$(XTCC) -o $(OBJDIR)/deltacmd.o -c $(OBJDIR)/deltacmd_.c
11621180
11631181
$(OBJDIR)/deltacmd.h: $(OBJDIR)/headers
11641182
11651183
$(OBJDIR)/descendants_.c: $(SRCDIR)/descendants.c $(TRANSLATE)
1166
- $(TRANSLATE) $(SRCDIR)/descendants.c >$(OBJDIR)/descendants_.c
1184
+ $(TRANSLATE) $(SRCDIR)/descendants.c >$@
11671185
11681186
$(OBJDIR)/descendants.o: $(OBJDIR)/descendants_.c $(OBJDIR)/descendants.h $(SRCDIR)/config.h
11691187
$(XTCC) -o $(OBJDIR)/descendants.o -c $(OBJDIR)/descendants_.c
11701188
11711189
$(OBJDIR)/descendants.h: $(OBJDIR)/headers
11721190
11731191
$(OBJDIR)/diff_.c: $(SRCDIR)/diff.c $(TRANSLATE)
1174
- $(TRANSLATE) $(SRCDIR)/diff.c >$(OBJDIR)/diff_.c
1192
+ $(TRANSLATE) $(SRCDIR)/diff.c >$@
11751193
11761194
$(OBJDIR)/diff.o: $(OBJDIR)/diff_.c $(OBJDIR)/diff.h $(SRCDIR)/config.h
11771195
$(XTCC) -o $(OBJDIR)/diff.o -c $(OBJDIR)/diff_.c
11781196
11791197
$(OBJDIR)/diff.h: $(OBJDIR)/headers
11801198
11811199
$(OBJDIR)/diffcmd_.c: $(SRCDIR)/diffcmd.c $(TRANSLATE)
1182
- $(TRANSLATE) $(SRCDIR)/diffcmd.c >$(OBJDIR)/diffcmd_.c
1200
+ $(TRANSLATE) $(SRCDIR)/diffcmd.c >$@
11831201
11841202
$(OBJDIR)/diffcmd.o: $(OBJDIR)/diffcmd_.c $(OBJDIR)/diffcmd.h $(SRCDIR)/config.h
11851203
$(XTCC) -o $(OBJDIR)/diffcmd.o -c $(OBJDIR)/diffcmd_.c
11861204
11871205
$(OBJDIR)/diffcmd.h: $(OBJDIR)/headers
11881206
11891207
$(OBJDIR)/doc_.c: $(SRCDIR)/doc.c $(TRANSLATE)
1190
- $(TRANSLATE) $(SRCDIR)/doc.c >$(OBJDIR)/doc_.c
1208
+ $(TRANSLATE) $(SRCDIR)/doc.c >$@
11911209
11921210
$(OBJDIR)/doc.o: $(OBJDIR)/doc_.c $(OBJDIR)/doc.h $(SRCDIR)/config.h
11931211
$(XTCC) -o $(OBJDIR)/doc.o -c $(OBJDIR)/doc_.c
11941212
11951213
$(OBJDIR)/doc.h: $(OBJDIR)/headers
11961214
11971215
$(OBJDIR)/encode_.c: $(SRCDIR)/encode.c $(TRANSLATE)
1198
- $(TRANSLATE) $(SRCDIR)/encode.c >$(OBJDIR)/encode_.c
1216
+ $(TRANSLATE) $(SRCDIR)/encode.c >$@
11991217
12001218
$(OBJDIR)/encode.o: $(OBJDIR)/encode_.c $(OBJDIR)/encode.h $(SRCDIR)/config.h
12011219
$(XTCC) -o $(OBJDIR)/encode.o -c $(OBJDIR)/encode_.c
12021220
12031221
$(OBJDIR)/encode.h: $(OBJDIR)/headers
12041222
12051223
$(OBJDIR)/event_.c: $(SRCDIR)/event.c $(TRANSLATE)
1206
- $(TRANSLATE) $(SRCDIR)/event.c >$(OBJDIR)/event_.c
1224
+ $(TRANSLATE) $(SRCDIR)/event.c >$@
12071225
12081226
$(OBJDIR)/event.o: $(OBJDIR)/event_.c $(OBJDIR)/event.h $(SRCDIR)/config.h
12091227
$(XTCC) -o $(OBJDIR)/event.o -c $(OBJDIR)/event_.c
12101228
12111229
$(OBJDIR)/event.h: $(OBJDIR)/headers
12121230
12131231
$(OBJDIR)/export_.c: $(SRCDIR)/export.c $(TRANSLATE)
1214
- $(TRANSLATE) $(SRCDIR)/export.c >$(OBJDIR)/export_.c
1232
+ $(TRANSLATE) $(SRCDIR)/export.c >$@
12151233
12161234
$(OBJDIR)/export.o: $(OBJDIR)/export_.c $(OBJDIR)/export.h $(SRCDIR)/config.h
12171235
$(XTCC) -o $(OBJDIR)/export.o -c $(OBJDIR)/export_.c
12181236
12191237
$(OBJDIR)/export.h: $(OBJDIR)/headers
12201238
12211239
$(OBJDIR)/file_.c: $(SRCDIR)/file.c $(TRANSLATE)
1222
- $(TRANSLATE) $(SRCDIR)/file.c >$(OBJDIR)/file_.c
1240
+ $(TRANSLATE) $(SRCDIR)/file.c >$@
12231241
12241242
$(OBJDIR)/file.o: $(OBJDIR)/file_.c $(OBJDIR)/file.h $(SRCDIR)/config.h
12251243
$(XTCC) -o $(OBJDIR)/file.o -c $(OBJDIR)/file_.c
12261244
12271245
$(OBJDIR)/file.h: $(OBJDIR)/headers
12281246
12291247
$(OBJDIR)/finfo_.c: $(SRCDIR)/finfo.c $(TRANSLATE)
1230
- $(TRANSLATE) $(SRCDIR)/finfo.c >$(OBJDIR)/finfo_.c
1248
+ $(TRANSLATE) $(SRCDIR)/finfo.c >$@
12311249
12321250
$(OBJDIR)/finfo.o: $(OBJDIR)/finfo_.c $(OBJDIR)/finfo.h $(SRCDIR)/config.h
12331251
$(XTCC) -o $(OBJDIR)/finfo.o -c $(OBJDIR)/finfo_.c
12341252
12351253
$(OBJDIR)/finfo.h: $(OBJDIR)/headers
12361254
12371255
$(OBJDIR)/fusefs_.c: $(SRCDIR)/fusefs.c $(TRANSLATE)
1238
- $(TRANSLATE) $(SRCDIR)/fusefs.c >$(OBJDIR)/fusefs_.c
1256
+ $(TRANSLATE) $(SRCDIR)/fusefs.c >$@
12391257
12401258
$(OBJDIR)/fusefs.o: $(OBJDIR)/fusefs_.c $(OBJDIR)/fusefs.h $(SRCDIR)/config.h
12411259
$(XTCC) -o $(OBJDIR)/fusefs.o -c $(OBJDIR)/fusefs_.c
12421260
12431261
$(OBJDIR)/fusefs.h: $(OBJDIR)/headers
12441262
12451263
$(OBJDIR)/glob_.c: $(SRCDIR)/glob.c $(TRANSLATE)
1246
- $(TRANSLATE) $(SRCDIR)/glob.c >$(OBJDIR)/glob_.c
1264
+ $(TRANSLATE) $(SRCDIR)/glob.c >$@
12471265
12481266
$(OBJDIR)/glob.o: $(OBJDIR)/glob_.c $(OBJDIR)/glob.h $(SRCDIR)/config.h
12491267
$(XTCC) -o $(OBJDIR)/glob.o -c $(OBJDIR)/glob_.c
12501268
12511269
$(OBJDIR)/glob.h: $(OBJDIR)/headers
12521270
12531271
$(OBJDIR)/graph_.c: $(SRCDIR)/graph.c $(TRANSLATE)
1254
- $(TRANSLATE) $(SRCDIR)/graph.c >$(OBJDIR)/graph_.c
1272
+ $(TRANSLATE) $(SRCDIR)/graph.c >$@
12551273
12561274
$(OBJDIR)/graph.o: $(OBJDIR)/graph_.c $(OBJDIR)/graph.h $(SRCDIR)/config.h
12571275
$(XTCC) -o $(OBJDIR)/graph.o -c $(OBJDIR)/graph_.c
12581276
12591277
$(OBJDIR)/graph.h: $(OBJDIR)/headers
12601278
12611279
$(OBJDIR)/gzip_.c: $(SRCDIR)/gzip.c $(TRANSLATE)
1262
- $(TRANSLATE) $(SRCDIR)/gzip.c >$(OBJDIR)/gzip_.c
1280
+ $(TRANSLATE) $(SRCDIR)/gzip.c >$@
12631281
12641282
$(OBJDIR)/gzip.o: $(OBJDIR)/gzip_.c $(OBJDIR)/gzip.h $(SRCDIR)/config.h
12651283
$(XTCC) -o $(OBJDIR)/gzip.o -c $(OBJDIR)/gzip_.c
12661284
12671285
$(OBJDIR)/gzip.h: $(OBJDIR)/headers
12681286
12691287
$(OBJDIR)/http_.c: $(SRCDIR)/http.c $(TRANSLATE)
1270
- $(TRANSLATE) $(SRCDIR)/http.c >$(OBJDIR)/http_.c
1288
+ $(TRANSLATE) $(SRCDIR)/http.c >$@
12711289
12721290
$(OBJDIR)/http.o: $(OBJDIR)/http_.c $(OBJDIR)/http.h $(SRCDIR)/config.h
12731291
$(XTCC) -o $(OBJDIR)/http.o -c $(OBJDIR)/http_.c
12741292
12751293
$(OBJDIR)/http.h: $(OBJDIR)/headers
12761294
12771295
$(OBJDIR)/http_socket_.c: $(SRCDIR)/http_socket.c $(TRANSLATE)
1278
- $(TRANSLATE) $(SRCDIR)/http_socket.c >$(OBJDIR)/http_socket_.c
1296
+ $(TRANSLATE) $(SRCDIR)/http_socket.c >$@
12791297
12801298
$(OBJDIR)/http_socket.o: $(OBJDIR)/http_socket_.c $(OBJDIR)/http_socket.h $(SRCDIR)/config.h
12811299
$(XTCC) -o $(OBJDIR)/http_socket.o -c $(OBJDIR)/http_socket_.c
12821300
12831301
$(OBJDIR)/http_socket.h: $(OBJDIR)/headers
12841302
12851303
$(OBJDIR)/http_ssl_.c: $(SRCDIR)/http_ssl.c $(TRANSLATE)
1286
- $(TRANSLATE) $(SRCDIR)/http_ssl.c >$(OBJDIR)/http_ssl_.c
1304
+ $(TRANSLATE) $(SRCDIR)/http_ssl.c >$@
12871305
12881306
$(OBJDIR)/http_ssl.o: $(OBJDIR)/http_ssl_.c $(OBJDIR)/http_ssl.h $(SRCDIR)/config.h
12891307
$(XTCC) -o $(OBJDIR)/http_ssl.o -c $(OBJDIR)/http_ssl_.c
12901308
12911309
$(OBJDIR)/http_ssl.h: $(OBJDIR)/headers
12921310
12931311
$(OBJDIR)/http_transport_.c: $(SRCDIR)/http_transport.c $(TRANSLATE)
1294
- $(TRANSLATE) $(SRCDIR)/http_transport.c >$(OBJDIR)/http_transport_.c
1312
+ $(TRANSLATE) $(SRCDIR)/http_transport.c >$@
12951313
12961314
$(OBJDIR)/http_transport.o: $(OBJDIR)/http_transport_.c $(OBJDIR)/http_transport.h $(SRCDIR)/config.h
12971315
$(XTCC) -o $(OBJDIR)/http_transport.o -c $(OBJDIR)/http_transport_.c
12981316
12991317
$(OBJDIR)/http_transport.h: $(OBJDIR)/headers
13001318
13011319
$(OBJDIR)/import_.c: $(SRCDIR)/import.c $(TRANSLATE)
1302
- $(TRANSLATE) $(SRCDIR)/import.c >$(OBJDIR)/import_.c
1320
+ $(TRANSLATE) $(SRCDIR)/import.c >$@
13031321
13041322
$(OBJDIR)/import.o: $(OBJDIR)/import_.c $(OBJDIR)/import.h $(SRCDIR)/config.h
13051323
$(XTCC) -o $(OBJDIR)/import.o -c $(OBJDIR)/import_.c
13061324
13071325
$(OBJDIR)/import.h: $(OBJDIR)/headers
13081326
13091327
$(OBJDIR)/info_.c: $(SRCDIR)/info.c $(TRANSLATE)
1310
- $(TRANSLATE) $(SRCDIR)/info.c >$(OBJDIR)/info_.c
1328
+ $(TRANSLATE) $(SRCDIR)/info.c >$@
13111329
13121330
$(OBJDIR)/info.o: $(OBJDIR)/info_.c $(OBJDIR)/info.h $(SRCDIR)/config.h
13131331
$(XTCC) -o $(OBJDIR)/info.o -c $(OBJDIR)/info_.c
13141332
13151333
$(OBJDIR)/info.h: $(OBJDIR)/headers
13161334
13171335
$(OBJDIR)/json_.c: $(SRCDIR)/json.c $(TRANSLATE)
1318
- $(TRANSLATE) $(SRCDIR)/json.c >$(OBJDIR)/json_.c
1336
+ $(TRANSLATE) $(SRCDIR)/json.c >$@
13191337
13201338
$(OBJDIR)/json.o: $(OBJDIR)/json_.c $(OBJDIR)/json.h $(SRCDIR)/config.h
13211339
$(XTCC) -o $(OBJDIR)/json.o -c $(OBJDIR)/json_.c
13221340
13231341
$(OBJDIR)/json.h: $(OBJDIR)/headers
13241342
13251343
$(OBJDIR)/json_artifact_.c: $(SRCDIR)/json_artifact.c $(TRANSLATE)
1326
- $(TRANSLATE) $(SRCDIR)/json_artifact.c >$(OBJDIR)/json_artifact_.c
1344
+ $(TRANSLATE) $(SRCDIR)/json_artifact.c >$@
13271345
13281346
$(OBJDIR)/json_artifact.o: $(OBJDIR)/json_artifact_.c $(OBJDIR)/json_artifact.h $(SRCDIR)/config.h
13291347
$(XTCC) -o $(OBJDIR)/json_artifact.o -c $(OBJDIR)/json_artifact_.c
13301348
13311349
$(OBJDIR)/json_artifact.h: $(OBJDIR)/headers
13321350
13331351
$(OBJDIR)/json_branch_.c: $(SRCDIR)/json_branch.c $(TRANSLATE)
1334
- $(TRANSLATE) $(SRCDIR)/json_branch.c >$(OBJDIR)/json_branch_.c
1352
+ $(TRANSLATE) $(SRCDIR)/json_branch.c >$@
13351353
13361354
$(OBJDIR)/json_branch.o: $(OBJDIR)/json_branch_.c $(OBJDIR)/json_branch.h $(SRCDIR)/config.h
13371355
$(XTCC) -o $(OBJDIR)/json_branch.o -c $(OBJDIR)/json_branch_.c
13381356
13391357
$(OBJDIR)/json_branch.h: $(OBJDIR)/headers
13401358
13411359
$(OBJDIR)/json_config_.c: $(SRCDIR)/json_config.c $(TRANSLATE)
1342
- $(TRANSLATE) $(SRCDIR)/json_config.c >$(OBJDIR)/json_config_.c
1360
+ $(TRANSLATE) $(SRCDIR)/json_config.c >$@
13431361
13441362
$(OBJDIR)/json_config.o: $(OBJDIR)/json_config_.c $(OBJDIR)/json_config.h $(SRCDIR)/config.h
13451363
$(XTCC) -o $(OBJDIR)/json_config.o -c $(OBJDIR)/json_config_.c
13461364
13471365
$(OBJDIR)/json_config.h: $(OBJDIR)/headers
13481366
13491367
$(OBJDIR)/json_diff_.c: $(SRCDIR)/json_diff.c $(TRANSLATE)
1350
- $(TRANSLATE) $(SRCDIR)/json_diff.c >$(OBJDIR)/json_diff_.c
1368
+ $(TRANSLATE) $(SRCDIR)/json_diff.c >$@
13511369
13521370
$(OBJDIR)/json_diff.o: $(OBJDIR)/json_diff_.c $(OBJDIR)/json_diff.h $(SRCDIR)/config.h
13531371
$(XTCC) -o $(OBJDIR)/json_diff.o -c $(OBJDIR)/json_diff_.c
13541372
13551373
$(OBJDIR)/json_diff.h: $(OBJDIR)/headers
13561374
13571375
$(OBJDIR)/json_dir_.c: $(SRCDIR)/json_dir.c $(TRANSLATE)
1358
- $(TRANSLATE) $(SRCDIR)/json_dir.c >$(OBJDIR)/json_dir_.c
1376
+ $(TRANSLATE) $(SRCDIR)/json_dir.c >$@
13591377
13601378
$(OBJDIR)/json_dir.o: $(OBJDIR)/json_dir_.c $(OBJDIR)/json_dir.h $(SRCDIR)/config.h
13611379
$(XTCC) -o $(OBJDIR)/json_dir.o -c $(OBJDIR)/json_dir_.c
13621380
13631381
$(OBJDIR)/json_dir.h: $(OBJDIR)/headers
13641382
13651383
$(OBJDIR)/json_finfo_.c: $(SRCDIR)/json_finfo.c $(TRANSLATE)
1366
- $(TRANSLATE) $(SRCDIR)/json_finfo.c >$(OBJDIR)/json_finfo_.c
1384
+ $(TRANSLATE) $(SRCDIR)/json_finfo.c >$@
13671385
13681386
$(OBJDIR)/json_finfo.o: $(OBJDIR)/json_finfo_.c $(OBJDIR)/json_finfo.h $(SRCDIR)/config.h
13691387
$(XTCC) -o $(OBJDIR)/json_finfo.o -c $(OBJDIR)/json_finfo_.c
13701388
13711389
$(OBJDIR)/json_finfo.h: $(OBJDIR)/headers
13721390
13731391
$(OBJDIR)/json_login_.c: $(SRCDIR)/json_login.c $(TRANSLATE)
1374
- $(TRANSLATE) $(SRCDIR)/json_login.c >$(OBJDIR)/json_login_.c
1392
+ $(TRANSLATE) $(SRCDIR)/json_login.c >$@
13751393
13761394
$(OBJDIR)/json_login.o: $(OBJDIR)/json_login_.c $(OBJDIR)/json_login.h $(SRCDIR)/config.h
13771395
$(XTCC) -o $(OBJDIR)/json_login.o -c $(OBJDIR)/json_login_.c
13781396
13791397
$(OBJDIR)/json_login.h: $(OBJDIR)/headers
13801398
13811399
$(OBJDIR)/json_query_.c: $(SRCDIR)/json_query.c $(TRANSLATE)
1382
- $(TRANSLATE) $(SRCDIR)/json_query.c >$(OBJDIR)/json_query_.c
1400
+ $(TRANSLATE) $(SRCDIR)/json_query.c >$@
13831401
13841402
$(OBJDIR)/json_query.o: $(OBJDIR)/json_query_.c $(OBJDIR)/json_query.h $(SRCDIR)/config.h
13851403
$(XTCC) -o $(OBJDIR)/json_query.o -c $(OBJDIR)/json_query_.c
13861404
13871405
$(OBJDIR)/json_query.h: $(OBJDIR)/headers
13881406
13891407
$(OBJDIR)/json_report_.c: $(SRCDIR)/json_report.c $(TRANSLATE)
1390
- $(TRANSLATE) $(SRCDIR)/json_report.c >$(OBJDIR)/json_report_.c
1408
+ $(TRANSLATE) $(SRCDIR)/json_report.c >$@
13911409
13921410
$(OBJDIR)/json_report.o: $(OBJDIR)/json_report_.c $(OBJDIR)/json_report.h $(SRCDIR)/config.h
13931411
$(XTCC) -o $(OBJDIR)/json_report.o -c $(OBJDIR)/json_report_.c
13941412
13951413
$(OBJDIR)/json_report.h: $(OBJDIR)/headers
13961414
13971415
$(OBJDIR)/json_status_.c: $(SRCDIR)/json_status.c $(TRANSLATE)
1398
- $(TRANSLATE) $(SRCDIR)/json_status.c >$(OBJDIR)/json_status_.c
1416
+ $(TRANSLATE) $(SRCDIR)/json_status.c >$@
13991417
14001418
$(OBJDIR)/json_status.o: $(OBJDIR)/json_status_.c $(OBJDIR)/json_status.h $(SRCDIR)/config.h
14011419
$(XTCC) -o $(OBJDIR)/json_status.o -c $(OBJDIR)/json_status_.c
14021420
14031421
$(OBJDIR)/json_status.h: $(OBJDIR)/headers
14041422
14051423
$(OBJDIR)/json_tag_.c: $(SRCDIR)/json_tag.c $(TRANSLATE)
1406
- $(TRANSLATE) $(SRCDIR)/json_tag.c >$(OBJDIR)/json_tag_.c
1424
+ $(TRANSLATE) $(SRCDIR)/json_tag.c >$@
14071425
14081426
$(OBJDIR)/json_tag.o: $(OBJDIR)/json_tag_.c $(OBJDIR)/json_tag.h $(SRCDIR)/config.h
14091427
$(XTCC) -o $(OBJDIR)/json_tag.o -c $(OBJDIR)/json_tag_.c
14101428
14111429
$(OBJDIR)/json_tag.h: $(OBJDIR)/headers
14121430
14131431
$(OBJDIR)/json_timeline_.c: $(SRCDIR)/json_timeline.c $(TRANSLATE)
1414
- $(TRANSLATE) $(SRCDIR)/json_timeline.c >$(OBJDIR)/json_timeline_.c
1432
+ $(TRANSLATE) $(SRCDIR)/json_timeline.c >$@
14151433
14161434
$(OBJDIR)/json_timeline.o: $(OBJDIR)/json_timeline_.c $(OBJDIR)/json_timeline.h $(SRCDIR)/config.h
14171435
$(XTCC) -o $(OBJDIR)/json_timeline.o -c $(OBJDIR)/json_timeline_.c
14181436
14191437
$(OBJDIR)/json_timeline.h: $(OBJDIR)/headers
14201438
14211439
$(OBJDIR)/json_user_.c: $(SRCDIR)/json_user.c $(TRANSLATE)
1422
- $(TRANSLATE) $(SRCDIR)/json_user.c >$(OBJDIR)/json_user_.c
1440
+ $(TRANSLATE) $(SRCDIR)/json_user.c >$@
14231441
14241442
$(OBJDIR)/json_user.o: $(OBJDIR)/json_user_.c $(OBJDIR)/json_user.h $(SRCDIR)/config.h
14251443
$(XTCC) -o $(OBJDIR)/json_user.o -c $(OBJDIR)/json_user_.c
14261444
14271445
$(OBJDIR)/json_user.h: $(OBJDIR)/headers
14281446
14291447
$(OBJDIR)/json_wiki_.c: $(SRCDIR)/json_wiki.c $(TRANSLATE)
1430
- $(TRANSLATE) $(SRCDIR)/json_wiki.c >$(OBJDIR)/json_wiki_.c
1448
+ $(TRANSLATE) $(SRCDIR)/json_wiki.c >$@
14311449
14321450
$(OBJDIR)/json_wiki.o: $(OBJDIR)/json_wiki_.c $(OBJDIR)/json_wiki.h $(SRCDIR)/config.h
14331451
$(XTCC) -o $(OBJDIR)/json_wiki.o -c $(OBJDIR)/json_wiki_.c
14341452
14351453
$(OBJDIR)/json_wiki.h: $(OBJDIR)/headers
14361454
14371455
$(OBJDIR)/leaf_.c: $(SRCDIR)/leaf.c $(TRANSLATE)
1438
- $(TRANSLATE) $(SRCDIR)/leaf.c >$(OBJDIR)/leaf_.c
1456
+ $(TRANSLATE) $(SRCDIR)/leaf.c >$@
14391457
14401458
$(OBJDIR)/leaf.o: $(OBJDIR)/leaf_.c $(OBJDIR)/leaf.h $(SRCDIR)/config.h
14411459
$(XTCC) -o $(OBJDIR)/leaf.o -c $(OBJDIR)/leaf_.c
14421460
14431461
$(OBJDIR)/leaf.h: $(OBJDIR)/headers
14441462
14451463
$(OBJDIR)/loadctrl_.c: $(SRCDIR)/loadctrl.c $(TRANSLATE)
1446
- $(TRANSLATE) $(SRCDIR)/loadctrl.c >$(OBJDIR)/loadctrl_.c
1464
+ $(TRANSLATE) $(SRCDIR)/loadctrl.c >$@
14471465
14481466
$(OBJDIR)/loadctrl.o: $(OBJDIR)/loadctrl_.c $(OBJDIR)/loadctrl.h $(SRCDIR)/config.h
14491467
$(XTCC) -o $(OBJDIR)/loadctrl.o -c $(OBJDIR)/loadctrl_.c
14501468
14511469
$(OBJDIR)/loadctrl.h: $(OBJDIR)/headers
14521470
14531471
$(OBJDIR)/login_.c: $(SRCDIR)/login.c $(TRANSLATE)
1454
- $(TRANSLATE) $(SRCDIR)/login.c >$(OBJDIR)/login_.c
1472
+ $(TRANSLATE) $(SRCDIR)/login.c >$@
14551473
14561474
$(OBJDIR)/login.o: $(OBJDIR)/login_.c $(OBJDIR)/login.h $(SRCDIR)/config.h
14571475
$(XTCC) -o $(OBJDIR)/login.o -c $(OBJDIR)/login_.c
14581476
14591477
$(OBJDIR)/login.h: $(OBJDIR)/headers
14601478
14611479
$(OBJDIR)/lookslike_.c: $(SRCDIR)/lookslike.c $(TRANSLATE)
1462
- $(TRANSLATE) $(SRCDIR)/lookslike.c >$(OBJDIR)/lookslike_.c
1480
+ $(TRANSLATE) $(SRCDIR)/lookslike.c >$@
14631481
14641482
$(OBJDIR)/lookslike.o: $(OBJDIR)/lookslike_.c $(OBJDIR)/lookslike.h $(SRCDIR)/config.h
14651483
$(XTCC) -o $(OBJDIR)/lookslike.o -c $(OBJDIR)/lookslike_.c
14661484
14671485
$(OBJDIR)/lookslike.h: $(OBJDIR)/headers
14681486
14691487
$(OBJDIR)/main_.c: $(SRCDIR)/main.c $(TRANSLATE)
1470
- $(TRANSLATE) $(SRCDIR)/main.c >$(OBJDIR)/main_.c
1488
+ $(TRANSLATE) $(SRCDIR)/main.c >$@
14711489
14721490
$(OBJDIR)/main.o: $(OBJDIR)/main_.c $(OBJDIR)/main.h $(OBJDIR)/page_index.h $(SRCDIR)/config.h
14731491
$(XTCC) -o $(OBJDIR)/main.o -c $(OBJDIR)/main_.c
14741492
14751493
$(OBJDIR)/main.h: $(OBJDIR)/headers
14761494
14771495
$(OBJDIR)/manifest_.c: $(SRCDIR)/manifest.c $(TRANSLATE)
1478
- $(TRANSLATE) $(SRCDIR)/manifest.c >$(OBJDIR)/manifest_.c
1496
+ $(TRANSLATE) $(SRCDIR)/manifest.c >$@
14791497
14801498
$(OBJDIR)/manifest.o: $(OBJDIR)/manifest_.c $(OBJDIR)/manifest.h $(SRCDIR)/config.h
14811499
$(XTCC) -o $(OBJDIR)/manifest.o -c $(OBJDIR)/manifest_.c
14821500
14831501
$(OBJDIR)/manifest.h: $(OBJDIR)/headers
14841502
14851503
$(OBJDIR)/markdown_.c: $(SRCDIR)/markdown.c $(TRANSLATE)
1486
- $(TRANSLATE) $(SRCDIR)/markdown.c >$(OBJDIR)/markdown_.c
1504
+ $(TRANSLATE) $(SRCDIR)/markdown.c >$@
14871505
14881506
$(OBJDIR)/markdown.o: $(OBJDIR)/markdown_.c $(OBJDIR)/markdown.h $(SRCDIR)/config.h
14891507
$(XTCC) -o $(OBJDIR)/markdown.o -c $(OBJDIR)/markdown_.c
14901508
14911509
$(OBJDIR)/markdown.h: $(OBJDIR)/headers
14921510
14931511
$(OBJDIR)/markdown_html_.c: $(SRCDIR)/markdown_html.c $(TRANSLATE)
1494
- $(TRANSLATE) $(SRCDIR)/markdown_html.c >$(OBJDIR)/markdown_html_.c
1512
+ $(TRANSLATE) $(SRCDIR)/markdown_html.c >$@
14951513
14961514
$(OBJDIR)/markdown_html.o: $(OBJDIR)/markdown_html_.c $(OBJDIR)/markdown_html.h $(SRCDIR)/config.h
14971515
$(XTCC) -o $(OBJDIR)/markdown_html.o -c $(OBJDIR)/markdown_html_.c
14981516
14991517
$(OBJDIR)/markdown_html.h: $(OBJDIR)/headers
15001518
15011519
$(OBJDIR)/md5_.c: $(SRCDIR)/md5.c $(TRANSLATE)
1502
- $(TRANSLATE) $(SRCDIR)/md5.c >$(OBJDIR)/md5_.c
1520
+ $(TRANSLATE) $(SRCDIR)/md5.c >$@
15031521
15041522
$(OBJDIR)/md5.o: $(OBJDIR)/md5_.c $(OBJDIR)/md5.h $(SRCDIR)/config.h
15051523
$(XTCC) -o $(OBJDIR)/md5.o -c $(OBJDIR)/md5_.c
15061524
15071525
$(OBJDIR)/md5.h: $(OBJDIR)/headers
15081526
15091527
$(OBJDIR)/merge_.c: $(SRCDIR)/merge.c $(TRANSLATE)
1510
- $(TRANSLATE) $(SRCDIR)/merge.c >$(OBJDIR)/merge_.c
1528
+ $(TRANSLATE) $(SRCDIR)/merge.c >$@
15111529
15121530
$(OBJDIR)/merge.o: $(OBJDIR)/merge_.c $(OBJDIR)/merge.h $(SRCDIR)/config.h
15131531
$(XTCC) -o $(OBJDIR)/merge.o -c $(OBJDIR)/merge_.c
15141532
15151533
$(OBJDIR)/merge.h: $(OBJDIR)/headers
15161534
15171535
$(OBJDIR)/merge3_.c: $(SRCDIR)/merge3.c $(TRANSLATE)
1518
- $(TRANSLATE) $(SRCDIR)/merge3.c >$(OBJDIR)/merge3_.c
1536
+ $(TRANSLATE) $(SRCDIR)/merge3.c >$@
15191537
15201538
$(OBJDIR)/merge3.o: $(OBJDIR)/merge3_.c $(OBJDIR)/merge3.h $(SRCDIR)/config.h
15211539
$(XTCC) -o $(OBJDIR)/merge3.o -c $(OBJDIR)/merge3_.c
15221540
15231541
$(OBJDIR)/merge3.h: $(OBJDIR)/headers
15241542
15251543
$(OBJDIR)/moderate_.c: $(SRCDIR)/moderate.c $(TRANSLATE)
1526
- $(TRANSLATE) $(SRCDIR)/moderate.c >$(OBJDIR)/moderate_.c
1544
+ $(TRANSLATE) $(SRCDIR)/moderate.c >$@
15271545
15281546
$(OBJDIR)/moderate.o: $(OBJDIR)/moderate_.c $(OBJDIR)/moderate.h $(SRCDIR)/config.h
15291547
$(XTCC) -o $(OBJDIR)/moderate.o -c $(OBJDIR)/moderate_.c
15301548
15311549
$(OBJDIR)/moderate.h: $(OBJDIR)/headers
15321550
15331551
$(OBJDIR)/name_.c: $(SRCDIR)/name.c $(TRANSLATE)
1534
- $(TRANSLATE) $(SRCDIR)/name.c >$(OBJDIR)/name_.c
1552
+ $(TRANSLATE) $(SRCDIR)/name.c >$@
15351553
15361554
$(OBJDIR)/name.o: $(OBJDIR)/name_.c $(OBJDIR)/name.h $(SRCDIR)/config.h
15371555
$(XTCC) -o $(OBJDIR)/name.o -c $(OBJDIR)/name_.c
15381556
15391557
$(OBJDIR)/name.h: $(OBJDIR)/headers
15401558
15411559
$(OBJDIR)/path_.c: $(SRCDIR)/path.c $(TRANSLATE)
1542
- $(TRANSLATE) $(SRCDIR)/path.c >$(OBJDIR)/path_.c
1560
+ $(TRANSLATE) $(SRCDIR)/path.c >$@
15431561
15441562
$(OBJDIR)/path.o: $(OBJDIR)/path_.c $(OBJDIR)/path.h $(SRCDIR)/config.h
15451563
$(XTCC) -o $(OBJDIR)/path.o -c $(OBJDIR)/path_.c
15461564
15471565
$(OBJDIR)/path.h: $(OBJDIR)/headers
15481566
15491567
$(OBJDIR)/pivot_.c: $(SRCDIR)/pivot.c $(TRANSLATE)
1550
- $(TRANSLATE) $(SRCDIR)/pivot.c >$(OBJDIR)/pivot_.c
1568
+ $(TRANSLATE) $(SRCDIR)/pivot.c >$@
15511569
15521570
$(OBJDIR)/pivot.o: $(OBJDIR)/pivot_.c $(OBJDIR)/pivot.h $(SRCDIR)/config.h
15531571
$(XTCC) -o $(OBJDIR)/pivot.o -c $(OBJDIR)/pivot_.c
15541572
15551573
$(OBJDIR)/pivot.h: $(OBJDIR)/headers
15561574
15571575
$(OBJDIR)/popen_.c: $(SRCDIR)/popen.c $(TRANSLATE)
1558
- $(TRANSLATE) $(SRCDIR)/popen.c >$(OBJDIR)/popen_.c
1576
+ $(TRANSLATE) $(SRCDIR)/popen.c >$@
15591577
15601578
$(OBJDIR)/popen.o: $(OBJDIR)/popen_.c $(OBJDIR)/popen.h $(SRCDIR)/config.h
15611579
$(XTCC) -o $(OBJDIR)/popen.o -c $(OBJDIR)/popen_.c
15621580
15631581
$(OBJDIR)/popen.h: $(OBJDIR)/headers
15641582
15651583
$(OBJDIR)/pqueue_.c: $(SRCDIR)/pqueue.c $(TRANSLATE)
1566
- $(TRANSLATE) $(SRCDIR)/pqueue.c >$(OBJDIR)/pqueue_.c
1584
+ $(TRANSLATE) $(SRCDIR)/pqueue.c >$@
15671585
15681586
$(OBJDIR)/pqueue.o: $(OBJDIR)/pqueue_.c $(OBJDIR)/pqueue.h $(SRCDIR)/config.h
15691587
$(XTCC) -o $(OBJDIR)/pqueue.o -c $(OBJDIR)/pqueue_.c
15701588
15711589
$(OBJDIR)/pqueue.h: $(OBJDIR)/headers
15721590
15731591
$(OBJDIR)/printf_.c: $(SRCDIR)/printf.c $(TRANSLATE)
1574
- $(TRANSLATE) $(SRCDIR)/printf.c >$(OBJDIR)/printf_.c
1592
+ $(TRANSLATE) $(SRCDIR)/printf.c >$@
15751593
15761594
$(OBJDIR)/printf.o: $(OBJDIR)/printf_.c $(OBJDIR)/printf.h $(SRCDIR)/config.h
15771595
$(XTCC) -o $(OBJDIR)/printf.o -c $(OBJDIR)/printf_.c
15781596
15791597
$(OBJDIR)/printf.h: $(OBJDIR)/headers
15801598
15811599
$(OBJDIR)/rebuild_.c: $(SRCDIR)/rebuild.c $(TRANSLATE)
1582
- $(TRANSLATE) $(SRCDIR)/rebuild.c >$(OBJDIR)/rebuild_.c
1600
+ $(TRANSLATE) $(SRCDIR)/rebuild.c >$@
15831601
15841602
$(OBJDIR)/rebuild.o: $(OBJDIR)/rebuild_.c $(OBJDIR)/rebuild.h $(SRCDIR)/config.h
15851603
$(XTCC) -o $(OBJDIR)/rebuild.o -c $(OBJDIR)/rebuild_.c
15861604
15871605
$(OBJDIR)/rebuild.h: $(OBJDIR)/headers
15881606
15891607
$(OBJDIR)/regexp_.c: $(SRCDIR)/regexp.c $(TRANSLATE)
1590
- $(TRANSLATE) $(SRCDIR)/regexp.c >$(OBJDIR)/regexp_.c
1608
+ $(TRANSLATE) $(SRCDIR)/regexp.c >$@
15911609
15921610
$(OBJDIR)/regexp.o: $(OBJDIR)/regexp_.c $(OBJDIR)/regexp.h $(SRCDIR)/config.h
15931611
$(XTCC) -o $(OBJDIR)/regexp.o -c $(OBJDIR)/regexp_.c
15941612
15951613
$(OBJDIR)/regexp.h: $(OBJDIR)/headers
15961614
15971615
$(OBJDIR)/report_.c: $(SRCDIR)/report.c $(TRANSLATE)
1598
- $(TRANSLATE) $(SRCDIR)/report.c >$(OBJDIR)/report_.c
1616
+ $(TRANSLATE) $(SRCDIR)/report.c >$@
15991617
16001618
$(OBJDIR)/report.o: $(OBJDIR)/report_.c $(OBJDIR)/report.h $(SRCDIR)/config.h
16011619
$(XTCC) -o $(OBJDIR)/report.o -c $(OBJDIR)/report_.c
16021620
16031621
$(OBJDIR)/report.h: $(OBJDIR)/headers
16041622
16051623
$(OBJDIR)/rss_.c: $(SRCDIR)/rss.c $(TRANSLATE)
1606
- $(TRANSLATE) $(SRCDIR)/rss.c >$(OBJDIR)/rss_.c
1624
+ $(TRANSLATE) $(SRCDIR)/rss.c >$@
16071625
16081626
$(OBJDIR)/rss.o: $(OBJDIR)/rss_.c $(OBJDIR)/rss.h $(SRCDIR)/config.h
16091627
$(XTCC) -o $(OBJDIR)/rss.o -c $(OBJDIR)/rss_.c
16101628
16111629
$(OBJDIR)/rss.h: $(OBJDIR)/headers
16121630
16131631
$(OBJDIR)/schema_.c: $(SRCDIR)/schema.c $(TRANSLATE)
1614
- $(TRANSLATE) $(SRCDIR)/schema.c >$(OBJDIR)/schema_.c
1632
+ $(TRANSLATE) $(SRCDIR)/schema.c >$@
16151633
16161634
$(OBJDIR)/schema.o: $(OBJDIR)/schema_.c $(OBJDIR)/schema.h $(SRCDIR)/config.h
16171635
$(XTCC) -o $(OBJDIR)/schema.o -c $(OBJDIR)/schema_.c
16181636
16191637
$(OBJDIR)/schema.h: $(OBJDIR)/headers
16201638
16211639
$(OBJDIR)/search_.c: $(SRCDIR)/search.c $(TRANSLATE)
1622
- $(TRANSLATE) $(SRCDIR)/search.c >$(OBJDIR)/search_.c
1640
+ $(TRANSLATE) $(SRCDIR)/search.c >$@
16231641
16241642
$(OBJDIR)/search.o: $(OBJDIR)/search_.c $(OBJDIR)/search.h $(SRCDIR)/config.h
16251643
$(XTCC) -o $(OBJDIR)/search.o -c $(OBJDIR)/search_.c
16261644
16271645
$(OBJDIR)/search.h: $(OBJDIR)/headers
16281646
16291647
$(OBJDIR)/setup_.c: $(SRCDIR)/setup.c $(TRANSLATE)
1630
- $(TRANSLATE) $(SRCDIR)/setup.c >$(OBJDIR)/setup_.c
1648
+ $(TRANSLATE) $(SRCDIR)/setup.c >$@
16311649
16321650
$(OBJDIR)/setup.o: $(OBJDIR)/setup_.c $(OBJDIR)/setup.h $(SRCDIR)/config.h
16331651
$(XTCC) -o $(OBJDIR)/setup.o -c $(OBJDIR)/setup_.c
16341652
16351653
$(OBJDIR)/setup.h: $(OBJDIR)/headers
16361654
16371655
$(OBJDIR)/sha1_.c: $(SRCDIR)/sha1.c $(TRANSLATE)
1638
- $(TRANSLATE) $(SRCDIR)/sha1.c >$(OBJDIR)/sha1_.c
1656
+ $(TRANSLATE) $(SRCDIR)/sha1.c >$@
16391657
16401658
$(OBJDIR)/sha1.o: $(OBJDIR)/sha1_.c $(OBJDIR)/sha1.h $(SRCDIR)/config.h
16411659
$(XTCC) -o $(OBJDIR)/sha1.o -c $(OBJDIR)/sha1_.c
16421660
16431661
$(OBJDIR)/sha1.h: $(OBJDIR)/headers
16441662
16451663
$(OBJDIR)/shun_.c: $(SRCDIR)/shun.c $(TRANSLATE)
1646
- $(TRANSLATE) $(SRCDIR)/shun.c >$(OBJDIR)/shun_.c
1664
+ $(TRANSLATE) $(SRCDIR)/shun.c >$@
16471665
16481666
$(OBJDIR)/shun.o: $(OBJDIR)/shun_.c $(OBJDIR)/shun.h $(SRCDIR)/config.h
16491667
$(XTCC) -o $(OBJDIR)/shun.o -c $(OBJDIR)/shun_.c
16501668
16511669
$(OBJDIR)/shun.h: $(OBJDIR)/headers
16521670
16531671
$(OBJDIR)/skins_.c: $(SRCDIR)/skins.c $(TRANSLATE)
1654
- $(TRANSLATE) $(SRCDIR)/skins.c >$(OBJDIR)/skins_.c
1672
+ $(TRANSLATE) $(SRCDIR)/skins.c >$@
16551673
16561674
$(OBJDIR)/skins.o: $(OBJDIR)/skins_.c $(OBJDIR)/skins.h $(SRCDIR)/config.h
16571675
$(XTCC) -o $(OBJDIR)/skins.o -c $(OBJDIR)/skins_.c
16581676
16591677
$(OBJDIR)/skins.h: $(OBJDIR)/headers
16601678
16611679
$(OBJDIR)/sqlcmd_.c: $(SRCDIR)/sqlcmd.c $(TRANSLATE)
1662
- $(TRANSLATE) $(SRCDIR)/sqlcmd.c >$(OBJDIR)/sqlcmd_.c
1680
+ $(TRANSLATE) $(SRCDIR)/sqlcmd.c >$@
16631681
16641682
$(OBJDIR)/sqlcmd.o: $(OBJDIR)/sqlcmd_.c $(OBJDIR)/sqlcmd.h $(SRCDIR)/config.h
16651683
$(XTCC) -o $(OBJDIR)/sqlcmd.o -c $(OBJDIR)/sqlcmd_.c
16661684
16671685
$(OBJDIR)/sqlcmd.h: $(OBJDIR)/headers
16681686
16691687
$(OBJDIR)/stash_.c: $(SRCDIR)/stash.c $(TRANSLATE)
1670
- $(TRANSLATE) $(SRCDIR)/stash.c >$(OBJDIR)/stash_.c
1688
+ $(TRANSLATE) $(SRCDIR)/stash.c >$@
16711689
16721690
$(OBJDIR)/stash.o: $(OBJDIR)/stash_.c $(OBJDIR)/stash.h $(SRCDIR)/config.h
16731691
$(XTCC) -o $(OBJDIR)/stash.o -c $(OBJDIR)/stash_.c
16741692
16751693
$(OBJDIR)/stash.h: $(OBJDIR)/headers
16761694
16771695
$(OBJDIR)/stat_.c: $(SRCDIR)/stat.c $(TRANSLATE)
1678
- $(TRANSLATE) $(SRCDIR)/stat.c >$(OBJDIR)/stat_.c
1696
+ $(TRANSLATE) $(SRCDIR)/stat.c >$@
16791697
16801698
$(OBJDIR)/stat.o: $(OBJDIR)/stat_.c $(OBJDIR)/stat.h $(SRCDIR)/config.h
16811699
$(XTCC) -o $(OBJDIR)/stat.o -c $(OBJDIR)/stat_.c
16821700
16831701
$(OBJDIR)/stat.h: $(OBJDIR)/headers
16841702
16851703
$(OBJDIR)/style_.c: $(SRCDIR)/style.c $(TRANSLATE)
1686
- $(TRANSLATE) $(SRCDIR)/style.c >$(OBJDIR)/style_.c
1704
+ $(TRANSLATE) $(SRCDIR)/style.c >$@
16871705
16881706
$(OBJDIR)/style.o: $(OBJDIR)/style_.c $(OBJDIR)/style.h $(SRCDIR)/config.h
16891707
$(XTCC) -o $(OBJDIR)/style.o -c $(OBJDIR)/style_.c
16901708
16911709
$(OBJDIR)/style.h: $(OBJDIR)/headers
16921710
16931711
$(OBJDIR)/sync_.c: $(SRCDIR)/sync.c $(TRANSLATE)
1694
- $(TRANSLATE) $(SRCDIR)/sync.c >$(OBJDIR)/sync_.c
1712
+ $(TRANSLATE) $(SRCDIR)/sync.c >$@
16951713
16961714
$(OBJDIR)/sync.o: $(OBJDIR)/sync_.c $(OBJDIR)/sync.h $(SRCDIR)/config.h
16971715
$(XTCC) -o $(OBJDIR)/sync.o -c $(OBJDIR)/sync_.c
16981716
16991717
$(OBJDIR)/sync.h: $(OBJDIR)/headers
17001718
17011719
$(OBJDIR)/tag_.c: $(SRCDIR)/tag.c $(TRANSLATE)
1702
- $(TRANSLATE) $(SRCDIR)/tag.c >$(OBJDIR)/tag_.c
1720
+ $(TRANSLATE) $(SRCDIR)/tag.c >$@
17031721
17041722
$(OBJDIR)/tag.o: $(OBJDIR)/tag_.c $(OBJDIR)/tag.h $(SRCDIR)/config.h
17051723
$(XTCC) -o $(OBJDIR)/tag.o -c $(OBJDIR)/tag_.c
17061724
17071725
$(OBJDIR)/tag.h: $(OBJDIR)/headers
17081726
17091727
$(OBJDIR)/tar_.c: $(SRCDIR)/tar.c $(TRANSLATE)
1710
- $(TRANSLATE) $(SRCDIR)/tar.c >$(OBJDIR)/tar_.c
1728
+ $(TRANSLATE) $(SRCDIR)/tar.c >$@
17111729
17121730
$(OBJDIR)/tar.o: $(OBJDIR)/tar_.c $(OBJDIR)/tar.h $(SRCDIR)/config.h
17131731
$(XTCC) -o $(OBJDIR)/tar.o -c $(OBJDIR)/tar_.c
17141732
17151733
$(OBJDIR)/tar.h: $(OBJDIR)/headers
17161734
17171735
$(OBJDIR)/th_main_.c: $(SRCDIR)/th_main.c $(TRANSLATE)
1718
- $(TRANSLATE) $(SRCDIR)/th_main.c >$(OBJDIR)/th_main_.c
1736
+ $(TRANSLATE) $(SRCDIR)/th_main.c >$@
17191737
17201738
$(OBJDIR)/th_main.o: $(OBJDIR)/th_main_.c $(OBJDIR)/th_main.h $(SRCDIR)/config.h
17211739
$(XTCC) -o $(OBJDIR)/th_main.o -c $(OBJDIR)/th_main_.c
17221740
17231741
$(OBJDIR)/th_main.h: $(OBJDIR)/headers
17241742
17251743
$(OBJDIR)/timeline_.c: $(SRCDIR)/timeline.c $(TRANSLATE)
1726
- $(TRANSLATE) $(SRCDIR)/timeline.c >$(OBJDIR)/timeline_.c
1744
+ $(TRANSLATE) $(SRCDIR)/timeline.c >$@
17271745
17281746
$(OBJDIR)/timeline.o: $(OBJDIR)/timeline_.c $(OBJDIR)/timeline.h $(SRCDIR)/config.h
17291747
$(XTCC) -o $(OBJDIR)/timeline.o -c $(OBJDIR)/timeline_.c
17301748
17311749
$(OBJDIR)/timeline.h: $(OBJDIR)/headers
17321750
17331751
$(OBJDIR)/tkt_.c: $(SRCDIR)/tkt.c $(TRANSLATE)
1734
- $(TRANSLATE) $(SRCDIR)/tkt.c >$(OBJDIR)/tkt_.c
1752
+ $(TRANSLATE) $(SRCDIR)/tkt.c >$@
17351753
17361754
$(OBJDIR)/tkt.o: $(OBJDIR)/tkt_.c $(OBJDIR)/tkt.h $(SRCDIR)/config.h
17371755
$(XTCC) -o $(OBJDIR)/tkt.o -c $(OBJDIR)/tkt_.c
17381756
17391757
$(OBJDIR)/tkt.h: $(OBJDIR)/headers
17401758
17411759
$(OBJDIR)/tktsetup_.c: $(SRCDIR)/tktsetup.c $(TRANSLATE)
1742
- $(TRANSLATE) $(SRCDIR)/tktsetup.c >$(OBJDIR)/tktsetup_.c
1760
+ $(TRANSLATE) $(SRCDIR)/tktsetup.c >$@
17431761
17441762
$(OBJDIR)/tktsetup.o: $(OBJDIR)/tktsetup_.c $(OBJDIR)/tktsetup.h $(SRCDIR)/config.h
17451763
$(XTCC) -o $(OBJDIR)/tktsetup.o -c $(OBJDIR)/tktsetup_.c
17461764
17471765
$(OBJDIR)/tktsetup.h: $(OBJDIR)/headers
17481766
17491767
$(OBJDIR)/undo_.c: $(SRCDIR)/undo.c $(TRANSLATE)
1750
- $(TRANSLATE) $(SRCDIR)/undo.c >$(OBJDIR)/undo_.c
1768
+ $(TRANSLATE) $(SRCDIR)/undo.c >$@
17511769
17521770
$(OBJDIR)/undo.o: $(OBJDIR)/undo_.c $(OBJDIR)/undo.h $(SRCDIR)/config.h
17531771
$(XTCC) -o $(OBJDIR)/undo.o -c $(OBJDIR)/undo_.c
17541772
17551773
$(OBJDIR)/undo.h: $(OBJDIR)/headers
17561774
17571775
$(OBJDIR)/unicode_.c: $(SRCDIR)/unicode.c $(TRANSLATE)
1758
- $(TRANSLATE) $(SRCDIR)/unicode.c >$(OBJDIR)/unicode_.c
1776
+ $(TRANSLATE) $(SRCDIR)/unicode.c >$@
17591777
17601778
$(OBJDIR)/unicode.o: $(OBJDIR)/unicode_.c $(OBJDIR)/unicode.h $(SRCDIR)/config.h
17611779
$(XTCC) -o $(OBJDIR)/unicode.o -c $(OBJDIR)/unicode_.c
17621780
17631781
$(OBJDIR)/unicode.h: $(OBJDIR)/headers
17641782
17651783
$(OBJDIR)/update_.c: $(SRCDIR)/update.c $(TRANSLATE)
1766
- $(TRANSLATE) $(SRCDIR)/update.c >$(OBJDIR)/update_.c
1784
+ $(TRANSLATE) $(SRCDIR)/update.c >$@
17671785
17681786
$(OBJDIR)/update.o: $(OBJDIR)/update_.c $(OBJDIR)/update.h $(SRCDIR)/config.h
17691787
$(XTCC) -o $(OBJDIR)/update.o -c $(OBJDIR)/update_.c
17701788
17711789
$(OBJDIR)/update.h: $(OBJDIR)/headers
17721790
17731791
$(OBJDIR)/url_.c: $(SRCDIR)/url.c $(TRANSLATE)
1774
- $(TRANSLATE) $(SRCDIR)/url.c >$(OBJDIR)/url_.c
1792
+ $(TRANSLATE) $(SRCDIR)/url.c >$@
17751793
17761794
$(OBJDIR)/url.o: $(OBJDIR)/url_.c $(OBJDIR)/url.h $(SRCDIR)/config.h
17771795
$(XTCC) -o $(OBJDIR)/url.o -c $(OBJDIR)/url_.c
17781796
17791797
$(OBJDIR)/url.h: $(OBJDIR)/headers
17801798
17811799
$(OBJDIR)/user_.c: $(SRCDIR)/user.c $(TRANSLATE)
1782
- $(TRANSLATE) $(SRCDIR)/user.c >$(OBJDIR)/user_.c
1800
+ $(TRANSLATE) $(SRCDIR)/user.c >$@
17831801
17841802
$(OBJDIR)/user.o: $(OBJDIR)/user_.c $(OBJDIR)/user.h $(SRCDIR)/config.h
17851803
$(XTCC) -o $(OBJDIR)/user.o -c $(OBJDIR)/user_.c
17861804
17871805
$(OBJDIR)/user.h: $(OBJDIR)/headers
17881806
17891807
$(OBJDIR)/utf8_.c: $(SRCDIR)/utf8.c $(TRANSLATE)
1790
- $(TRANSLATE) $(SRCDIR)/utf8.c >$(OBJDIR)/utf8_.c
1808
+ $(TRANSLATE) $(SRCDIR)/utf8.c >$@
17911809
17921810
$(OBJDIR)/utf8.o: $(OBJDIR)/utf8_.c $(OBJDIR)/utf8.h $(SRCDIR)/config.h
17931811
$(XTCC) -o $(OBJDIR)/utf8.o -c $(OBJDIR)/utf8_.c
17941812
17951813
$(OBJDIR)/utf8.h: $(OBJDIR)/headers
17961814
17971815
$(OBJDIR)/util_.c: $(SRCDIR)/util.c $(TRANSLATE)
1798
- $(TRANSLATE) $(SRCDIR)/util.c >$(OBJDIR)/util_.c
1816
+ $(TRANSLATE) $(SRCDIR)/util.c >$@
17991817
18001818
$(OBJDIR)/util.o: $(OBJDIR)/util_.c $(OBJDIR)/util.h $(SRCDIR)/config.h
18011819
$(XTCC) -o $(OBJDIR)/util.o -c $(OBJDIR)/util_.c
18021820
18031821
$(OBJDIR)/util.h: $(OBJDIR)/headers
18041822
18051823
$(OBJDIR)/verify_.c: $(SRCDIR)/verify.c $(TRANSLATE)
1806
- $(TRANSLATE) $(SRCDIR)/verify.c >$(OBJDIR)/verify_.c
1824
+ $(TRANSLATE) $(SRCDIR)/verify.c >$@
18071825
18081826
$(OBJDIR)/verify.o: $(OBJDIR)/verify_.c $(OBJDIR)/verify.h $(SRCDIR)/config.h
18091827
$(XTCC) -o $(OBJDIR)/verify.o -c $(OBJDIR)/verify_.c
18101828
18111829
$(OBJDIR)/verify.h: $(OBJDIR)/headers
18121830
18131831
$(OBJDIR)/vfile_.c: $(SRCDIR)/vfile.c $(TRANSLATE)
1814
- $(TRANSLATE) $(SRCDIR)/vfile.c >$(OBJDIR)/vfile_.c
1832
+ $(TRANSLATE) $(SRCDIR)/vfile.c >$@
18151833
18161834
$(OBJDIR)/vfile.o: $(OBJDIR)/vfile_.c $(OBJDIR)/vfile.h $(SRCDIR)/config.h
18171835
$(XTCC) -o $(OBJDIR)/vfile.o -c $(OBJDIR)/vfile_.c
18181836
18191837
$(OBJDIR)/vfile.h: $(OBJDIR)/headers
18201838
18211839
$(OBJDIR)/wiki_.c: $(SRCDIR)/wiki.c $(TRANSLATE)
1822
- $(TRANSLATE) $(SRCDIR)/wiki.c >$(OBJDIR)/wiki_.c
1840
+ $(TRANSLATE) $(SRCDIR)/wiki.c >$@
18231841
18241842
$(OBJDIR)/wiki.o: $(OBJDIR)/wiki_.c $(OBJDIR)/wiki.h $(SRCDIR)/config.h
18251843
$(XTCC) -o $(OBJDIR)/wiki.o -c $(OBJDIR)/wiki_.c
18261844
18271845
$(OBJDIR)/wiki.h: $(OBJDIR)/headers
18281846
18291847
$(OBJDIR)/wikiformat_.c: $(SRCDIR)/wikiformat.c $(TRANSLATE)
1830
- $(TRANSLATE) $(SRCDIR)/wikiformat.c >$(OBJDIR)/wikiformat_.c
1848
+ $(TRANSLATE) $(SRCDIR)/wikiformat.c >$@
18311849
18321850
$(OBJDIR)/wikiformat.o: $(OBJDIR)/wikiformat_.c $(OBJDIR)/wikiformat.h $(SRCDIR)/config.h
18331851
$(XTCC) -o $(OBJDIR)/wikiformat.o -c $(OBJDIR)/wikiformat_.c
18341852
18351853
$(OBJDIR)/wikiformat.h: $(OBJDIR)/headers
18361854
18371855
$(OBJDIR)/winfile_.c: $(SRCDIR)/winfile.c $(TRANSLATE)
1838
- $(TRANSLATE) $(SRCDIR)/winfile.c >$(OBJDIR)/winfile_.c
1856
+ $(TRANSLATE) $(SRCDIR)/winfile.c >$@
18391857
18401858
$(OBJDIR)/winfile.o: $(OBJDIR)/winfile_.c $(OBJDIR)/winfile.h $(SRCDIR)/config.h
18411859
$(XTCC) -o $(OBJDIR)/winfile.o -c $(OBJDIR)/winfile_.c
18421860
18431861
$(OBJDIR)/winfile.h: $(OBJDIR)/headers
18441862
18451863
$(OBJDIR)/winhttp_.c: $(SRCDIR)/winhttp.c $(TRANSLATE)
1846
- $(TRANSLATE) $(SRCDIR)/winhttp.c >$(OBJDIR)/winhttp_.c
1864
+ $(TRANSLATE) $(SRCDIR)/winhttp.c >$@
18471865
18481866
$(OBJDIR)/winhttp.o: $(OBJDIR)/winhttp_.c $(OBJDIR)/winhttp.h $(SRCDIR)/config.h
18491867
$(XTCC) -o $(OBJDIR)/winhttp.o -c $(OBJDIR)/winhttp_.c
18501868
18511869
$(OBJDIR)/winhttp.h: $(OBJDIR)/headers
18521870
18531871
$(OBJDIR)/wysiwyg_.c: $(SRCDIR)/wysiwyg.c $(TRANSLATE)
1854
- $(TRANSLATE) $(SRCDIR)/wysiwyg.c >$(OBJDIR)/wysiwyg_.c
1872
+ $(TRANSLATE) $(SRCDIR)/wysiwyg.c >$@
18551873
18561874
$(OBJDIR)/wysiwyg.o: $(OBJDIR)/wysiwyg_.c $(OBJDIR)/wysiwyg.h $(SRCDIR)/config.h
18571875
$(XTCC) -o $(OBJDIR)/wysiwyg.o -c $(OBJDIR)/wysiwyg_.c
18581876
18591877
$(OBJDIR)/wysiwyg.h: $(OBJDIR)/headers
18601878
18611879
$(OBJDIR)/xfer_.c: $(SRCDIR)/xfer.c $(TRANSLATE)
1862
- $(TRANSLATE) $(SRCDIR)/xfer.c >$(OBJDIR)/xfer_.c
1880
+ $(TRANSLATE) $(SRCDIR)/xfer.c >$@
18631881
18641882
$(OBJDIR)/xfer.o: $(OBJDIR)/xfer_.c $(OBJDIR)/xfer.h $(SRCDIR)/config.h
18651883
$(XTCC) -o $(OBJDIR)/xfer.o -c $(OBJDIR)/xfer_.c
18661884
18671885
$(OBJDIR)/xfer.h: $(OBJDIR)/headers
18681886
18691887
$(OBJDIR)/xfersetup_.c: $(SRCDIR)/xfersetup.c $(TRANSLATE)
1870
- $(TRANSLATE) $(SRCDIR)/xfersetup.c >$(OBJDIR)/xfersetup_.c
1888
+ $(TRANSLATE) $(SRCDIR)/xfersetup.c >$@
18711889
18721890
$(OBJDIR)/xfersetup.o: $(OBJDIR)/xfersetup_.c $(OBJDIR)/xfersetup.h $(SRCDIR)/config.h
18731891
$(XTCC) -o $(OBJDIR)/xfersetup.o -c $(OBJDIR)/xfersetup_.c
18741892
18751893
$(OBJDIR)/xfersetup.h: $(OBJDIR)/headers
18761894
18771895
$(OBJDIR)/zip_.c: $(SRCDIR)/zip.c $(TRANSLATE)
1878
- $(TRANSLATE) $(SRCDIR)/zip.c >$(OBJDIR)/zip_.c
1896
+ $(TRANSLATE) $(SRCDIR)/zip.c >$@
18791897
18801898
$(OBJDIR)/zip.o: $(OBJDIR)/zip_.c $(OBJDIR)/zip.h $(SRCDIR)/config.h
18811899
$(XTCC) -o $(OBJDIR)/zip.o -c $(OBJDIR)/zip_.c
18821900
18831901
$(OBJDIR)/zip.h: $(OBJDIR)/headers
@@ -1906,27 +1924,27 @@
19061924
MINIZ_OPTIONS = -DMINIZ_NO_STDIO \
19071925
-DMINIZ_NO_TIME \
19081926
-DMINIZ_NO_ARCHIVE_APIS
19091927
19101928
$(OBJDIR)/sqlite3.o: $(SRCDIR)/sqlite3.c $(SRCDIR)/../win/Makefile.mingw.mistachkin
1911
- $(XTCC) $(SQLITE_OPTIONS) $(SQLITE_CFLAGS) -c $(SRCDIR)/sqlite3.c -o $(OBJDIR)/sqlite3.o
1929
+ $(XTCC) $(SQLITE_OPTIONS) $(SQLITE_CFLAGS) -c $(SRCDIR)/sqlite3.c -o $@
19121930
19131931
$(OBJDIR)/cson_amalgamation.o: $(SRCDIR)/cson_amalgamation.c
1914
- $(XTCC) -c $(SRCDIR)/cson_amalgamation.c -o $(OBJDIR)/cson_amalgamation.o
1932
+ $(XTCC) -c $(SRCDIR)/cson_amalgamation.c -o $@
19151933
19161934
$(OBJDIR)/json.o $(OBJDIR)/json_artifact.o $(OBJDIR)/json_branch.o $(OBJDIR)/json_config.o $(OBJDIR)/json_diff.o $(OBJDIR)/json_dir.o $(OBJDIR)/jsos_finfo.o $(OBJDIR)/json_login.o $(OBJDIR)/json_query.o $(OBJDIR)/json_report.o $(OBJDIR)/json_status.o $(OBJDIR)/json_tag.o $(OBJDIR)/json_timeline.o $(OBJDIR)/json_user.o $(OBJDIR)/json_wiki.o : $(SRCDIR)/json_detail.h
19171935
19181936
$(OBJDIR)/shell.o: $(SRCDIR)/shell.c $(SRCDIR)/sqlite3.h $(SRCDIR)/../win/Makefile.mingw.mistachkin
1919
- $(XTCC) $(SHELL_OPTIONS) $(SHELL_CFLAGS) -c $(SRCDIR)/shell.c -o $(OBJDIR)/shell.o
1937
+ $(XTCC) $(SHELL_OPTIONS) $(SHELL_CFLAGS) -c $(SRCDIR)/shell.c -o $@
19201938
19211939
$(OBJDIR)/th.o: $(SRCDIR)/th.c
1922
- $(XTCC) -c $(SRCDIR)/th.c -o $(OBJDIR)/th.o
1940
+ $(XTCC) -c $(SRCDIR)/th.c -o $@
19231941
19241942
$(OBJDIR)/th_lang.o: $(SRCDIR)/th_lang.c
1925
- $(XTCC) -c $(SRCDIR)/th_lang.c -o $(OBJDIR)/th_lang.o
1943
+ $(XTCC) -c $(SRCDIR)/th_lang.c -o $@
19261944
19271945
$(OBJDIR)/th_tcl.o: $(SRCDIR)/th_tcl.c
1928
- $(XTCC) -c $(SRCDIR)/th_tcl.c -o $(OBJDIR)/th_tcl.o
1946
+ $(XTCC) -c $(SRCDIR)/th_tcl.c -o $@
19291947
19301948
$(OBJDIR)/miniz.o: $(SRCDIR)/miniz.c
1931
- $(XTCC) $(MINIZ_OPTIONS) -c $(SRCDIR)/miniz.c -o $(OBJDIR)/miniz.o
1949
+ $(XTCC) $(MINIZ_OPTIONS) -c $(SRCDIR)/miniz.c -o $@
19321950
19331951
--- win/Makefile.mingw.mistachkin
+++ win/Makefile.mingw.mistachkin
@@ -94,23 +94,35 @@
94 ifndef MINGW_IS_32BIT_ONLY
95 ifeq (,$(findstring w64-mingw32,$(PREFIX)))
96 MINGW_IS_32BIT_ONLY = 1
97 endif
98 endif
99 ifeq (,$(findstring x86_64-w64-mingw32,$(PREFIX)))
100 SSLCONFIG = mingw
101 else
102 SSLCONFIG = mingw64
103 endif
104 ifndef FOSSIL_ENABLE_MINIZ
105 SSLCONFIG += --with-zlib-lib=$(PWD)/$(ZLIBDIR) --with-zlib-include=$(PWD)/$(ZLIBDIR) zlib
106 endif
107
108 #### The directories where the zlib include and library files are located.
109 #
110 ZINCDIR = $(SRCDIR)/../compat/zlib
111 ZLIBDIR = $(SRCDIR)/../compat/zlib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
113 #### The directories where the OpenSSL include and library files are located.
114 # The recommended usage here is to use the Sysinternals junction tool
115 # to create a hard link between an "openssl-1.x" sub-directory of the
116 # Fossil source code directory and the target OpenSSL source directory.
@@ -677,11 +689,10 @@
677 $(OBJDIR)/xfersetup.o \
678 $(OBJDIR)/zip.o
679
680 APPNAME = fossil.exe
681 APPTARGETS =
682 LIBTARGETS =
683
684 #### If the USE_WINDOWS variable exists, it is assumed that we are building
685 # inside of a Windows-style shell; otherwise, it is assumed that we are
686 # building inside of a Unix-style shell. Note that the "move" command is
687 # broken when attempting to use it from the Windows shell via MinGW make
@@ -749,35 +760,35 @@
749 else
750 $(MKDIR) $(OBJDIR)
751 endif
752
753 $(TRANSLATE): $(SRCDIR)/translate.c
754 $(BCC) -o $(TRANSLATE) $(SRCDIR)/translate.c
755
756 $(MAKEHEADERS): $(SRCDIR)/makeheaders.c
757 $(BCC) -o $(MAKEHEADERS) $(SRCDIR)/makeheaders.c
758
759 $(MKINDEX): $(SRCDIR)/mkindex.c
760 $(BCC) -o $(MKINDEX) $(SRCDIR)/mkindex.c
761
762 $(MKBUILTIN): $(SRCDIR)/mkbuiltin.c
763 $(BCC) -o $(MKBUILTIN) $(SRCDIR)/mkbuiltin.c
764
765 $(MKVERSION): $(SRCDIR)/mkversion.c
766 $(BCC) -o $(MKVERSION) $(SRCDIR)/mkversion.c
767
768 $(CODECHECK1): $(SRCDIR)/codecheck1.c
769 $(BCC) -o $(CODECHECK1) $(SRCDIR)/codecheck1.c
770
771 # WARNING. DANGER. Running the test suite modifies the repository the
772 # build is done from, i.e. the checkout belongs to. Do not sync/push
773 # the repository after running the tests.
774 test: $(OBJDIR) $(APPNAME)
775 $(TCLSH) $(SRCDIR)/../test/tester.tcl $(APPNAME)
776
777 $(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(MKVERSION)
778 $(MKVERSION) $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION >$(OBJDIR)/VERSION.h
779
780 # The USE_SYSTEM_SQLITE variable may be undefined, set to 0, or set
781 # to 1. If it is set to 1, then there is no need to build or link
782 # the sqlite3.o object. Instead, the system SQLite will be linked
783 # using -lsqlite3.
@@ -802,14 +813,21 @@
802 $(OBJDIR)/th_tcl.o \
803 $(OBJDIR)/cson_amalgamation.o
804
805
806 zlib:
807 $(MAKE) -C $(ZLIBDIR) PREFIX=$(PREFIX) -f win32/Makefile.gcc libz.a
808
809 clean-zlib:
810 $(MAKE) -C $(ZLIBDIR) PREFIX=$(PREFIX) -f win32/Makefile.gcc clean
 
 
 
 
 
 
 
811
812 ifndef FOSSIL_ENABLE_MINIZ
813 LIBTARGETS += zlib
814 endif
815
@@ -833,11 +851,11 @@
833 APPTARGETS += openssl
834 endif
835
836 $(APPNAME): $(OBJDIR)/headers $(CODECHECK1) $(OBJ) $(EXTRAOBJ) $(OBJDIR)/fossil.o $(APPTARGETS)
837 $(CODECHECK1) $(TRANS_SRC)
838 $(TCC) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB) $(OBJDIR)/fossil.o
839
840 # This rule prevents make from using its default rules to try build
841 # an executable named "manifest" out of the file named "manifest.c"
842 #
843 $(SRCDIR)/../manifest:
@@ -985,899 +1003,899 @@
985 $(OBJDIR)/headers: Makefile
986
987 Makefile:
988
989 $(OBJDIR)/add_.c: $(SRCDIR)/add.c $(TRANSLATE)
990 $(TRANSLATE) $(SRCDIR)/add.c >$(OBJDIR)/add_.c
991
992 $(OBJDIR)/add.o: $(OBJDIR)/add_.c $(OBJDIR)/add.h $(SRCDIR)/config.h
993 $(XTCC) -o $(OBJDIR)/add.o -c $(OBJDIR)/add_.c
994
995 $(OBJDIR)/add.h: $(OBJDIR)/headers
996
997 $(OBJDIR)/allrepo_.c: $(SRCDIR)/allrepo.c $(TRANSLATE)
998 $(TRANSLATE) $(SRCDIR)/allrepo.c >$(OBJDIR)/allrepo_.c
999
1000 $(OBJDIR)/allrepo.o: $(OBJDIR)/allrepo_.c $(OBJDIR)/allrepo.h $(SRCDIR)/config.h
1001 $(XTCC) -o $(OBJDIR)/allrepo.o -c $(OBJDIR)/allrepo_.c
1002
1003 $(OBJDIR)/allrepo.h: $(OBJDIR)/headers
1004
1005 $(OBJDIR)/attach_.c: $(SRCDIR)/attach.c $(TRANSLATE)
1006 $(TRANSLATE) $(SRCDIR)/attach.c >$(OBJDIR)/attach_.c
1007
1008 $(OBJDIR)/attach.o: $(OBJDIR)/attach_.c $(OBJDIR)/attach.h $(SRCDIR)/config.h
1009 $(XTCC) -o $(OBJDIR)/attach.o -c $(OBJDIR)/attach_.c
1010
1011 $(OBJDIR)/attach.h: $(OBJDIR)/headers
1012
1013 $(OBJDIR)/bag_.c: $(SRCDIR)/bag.c $(TRANSLATE)
1014 $(TRANSLATE) $(SRCDIR)/bag.c >$(OBJDIR)/bag_.c
1015
1016 $(OBJDIR)/bag.o: $(OBJDIR)/bag_.c $(OBJDIR)/bag.h $(SRCDIR)/config.h
1017 $(XTCC) -o $(OBJDIR)/bag.o -c $(OBJDIR)/bag_.c
1018
1019 $(OBJDIR)/bag.h: $(OBJDIR)/headers
1020
1021 $(OBJDIR)/bisect_.c: $(SRCDIR)/bisect.c $(TRANSLATE)
1022 $(TRANSLATE) $(SRCDIR)/bisect.c >$(OBJDIR)/bisect_.c
1023
1024 $(OBJDIR)/bisect.o: $(OBJDIR)/bisect_.c $(OBJDIR)/bisect.h $(SRCDIR)/config.h
1025 $(XTCC) -o $(OBJDIR)/bisect.o -c $(OBJDIR)/bisect_.c
1026
1027 $(OBJDIR)/bisect.h: $(OBJDIR)/headers
1028
1029 $(OBJDIR)/blob_.c: $(SRCDIR)/blob.c $(TRANSLATE)
1030 $(TRANSLATE) $(SRCDIR)/blob.c >$(OBJDIR)/blob_.c
1031
1032 $(OBJDIR)/blob.o: $(OBJDIR)/blob_.c $(OBJDIR)/blob.h $(SRCDIR)/config.h
1033 $(XTCC) -o $(OBJDIR)/blob.o -c $(OBJDIR)/blob_.c
1034
1035 $(OBJDIR)/blob.h: $(OBJDIR)/headers
1036
1037 $(OBJDIR)/branch_.c: $(SRCDIR)/branch.c $(TRANSLATE)
1038 $(TRANSLATE) $(SRCDIR)/branch.c >$(OBJDIR)/branch_.c
1039
1040 $(OBJDIR)/branch.o: $(OBJDIR)/branch_.c $(OBJDIR)/branch.h $(SRCDIR)/config.h
1041 $(XTCC) -o $(OBJDIR)/branch.o -c $(OBJDIR)/branch_.c
1042
1043 $(OBJDIR)/branch.h: $(OBJDIR)/headers
1044
1045 $(OBJDIR)/browse_.c: $(SRCDIR)/browse.c $(TRANSLATE)
1046 $(TRANSLATE) $(SRCDIR)/browse.c >$(OBJDIR)/browse_.c
1047
1048 $(OBJDIR)/browse.o: $(OBJDIR)/browse_.c $(OBJDIR)/browse.h $(SRCDIR)/config.h
1049 $(XTCC) -o $(OBJDIR)/browse.o -c $(OBJDIR)/browse_.c
1050
1051 $(OBJDIR)/browse.h: $(OBJDIR)/headers
1052
1053 $(OBJDIR)/builtin_.c: $(SRCDIR)/builtin.c $(TRANSLATE)
1054 $(TRANSLATE) $(SRCDIR)/builtin.c >$(OBJDIR)/builtin_.c
1055
1056 $(OBJDIR)/builtin.o: $(OBJDIR)/builtin_.c $(OBJDIR)/builtin.h $(OBJDIR)/builtin_data.h $(SRCDIR)/config.h
1057 $(XTCC) -o $(OBJDIR)/builtin.o -c $(OBJDIR)/builtin_.c
1058
1059 $(OBJDIR)/builtin.h: $(OBJDIR)/headers
1060
1061 $(OBJDIR)/cache_.c: $(SRCDIR)/cache.c $(TRANSLATE)
1062 $(TRANSLATE) $(SRCDIR)/cache.c >$(OBJDIR)/cache_.c
1063
1064 $(OBJDIR)/cache.o: $(OBJDIR)/cache_.c $(OBJDIR)/cache.h $(SRCDIR)/config.h
1065 $(XTCC) -o $(OBJDIR)/cache.o -c $(OBJDIR)/cache_.c
1066
1067 $(OBJDIR)/cache.h: $(OBJDIR)/headers
1068
1069 $(OBJDIR)/captcha_.c: $(SRCDIR)/captcha.c $(TRANSLATE)
1070 $(TRANSLATE) $(SRCDIR)/captcha.c >$(OBJDIR)/captcha_.c
1071
1072 $(OBJDIR)/captcha.o: $(OBJDIR)/captcha_.c $(OBJDIR)/captcha.h $(SRCDIR)/config.h
1073 $(XTCC) -o $(OBJDIR)/captcha.o -c $(OBJDIR)/captcha_.c
1074
1075 $(OBJDIR)/captcha.h: $(OBJDIR)/headers
1076
1077 $(OBJDIR)/cgi_.c: $(SRCDIR)/cgi.c $(TRANSLATE)
1078 $(TRANSLATE) $(SRCDIR)/cgi.c >$(OBJDIR)/cgi_.c
1079
1080 $(OBJDIR)/cgi.o: $(OBJDIR)/cgi_.c $(OBJDIR)/cgi.h $(SRCDIR)/config.h
1081 $(XTCC) -o $(OBJDIR)/cgi.o -c $(OBJDIR)/cgi_.c
1082
1083 $(OBJDIR)/cgi.h: $(OBJDIR)/headers
1084
1085 $(OBJDIR)/checkin_.c: $(SRCDIR)/checkin.c $(TRANSLATE)
1086 $(TRANSLATE) $(SRCDIR)/checkin.c >$(OBJDIR)/checkin_.c
1087
1088 $(OBJDIR)/checkin.o: $(OBJDIR)/checkin_.c $(OBJDIR)/checkin.h $(SRCDIR)/config.h
1089 $(XTCC) -o $(OBJDIR)/checkin.o -c $(OBJDIR)/checkin_.c
1090
1091 $(OBJDIR)/checkin.h: $(OBJDIR)/headers
1092
1093 $(OBJDIR)/checkout_.c: $(SRCDIR)/checkout.c $(TRANSLATE)
1094 $(TRANSLATE) $(SRCDIR)/checkout.c >$(OBJDIR)/checkout_.c
1095
1096 $(OBJDIR)/checkout.o: $(OBJDIR)/checkout_.c $(OBJDIR)/checkout.h $(SRCDIR)/config.h
1097 $(XTCC) -o $(OBJDIR)/checkout.o -c $(OBJDIR)/checkout_.c
1098
1099 $(OBJDIR)/checkout.h: $(OBJDIR)/headers
1100
1101 $(OBJDIR)/clearsign_.c: $(SRCDIR)/clearsign.c $(TRANSLATE)
1102 $(TRANSLATE) $(SRCDIR)/clearsign.c >$(OBJDIR)/clearsign_.c
1103
1104 $(OBJDIR)/clearsign.o: $(OBJDIR)/clearsign_.c $(OBJDIR)/clearsign.h $(SRCDIR)/config.h
1105 $(XTCC) -o $(OBJDIR)/clearsign.o -c $(OBJDIR)/clearsign_.c
1106
1107 $(OBJDIR)/clearsign.h: $(OBJDIR)/headers
1108
1109 $(OBJDIR)/clone_.c: $(SRCDIR)/clone.c $(TRANSLATE)
1110 $(TRANSLATE) $(SRCDIR)/clone.c >$(OBJDIR)/clone_.c
1111
1112 $(OBJDIR)/clone.o: $(OBJDIR)/clone_.c $(OBJDIR)/clone.h $(SRCDIR)/config.h
1113 $(XTCC) -o $(OBJDIR)/clone.o -c $(OBJDIR)/clone_.c
1114
1115 $(OBJDIR)/clone.h: $(OBJDIR)/headers
1116
1117 $(OBJDIR)/comformat_.c: $(SRCDIR)/comformat.c $(TRANSLATE)
1118 $(TRANSLATE) $(SRCDIR)/comformat.c >$(OBJDIR)/comformat_.c
1119
1120 $(OBJDIR)/comformat.o: $(OBJDIR)/comformat_.c $(OBJDIR)/comformat.h $(SRCDIR)/config.h
1121 $(XTCC) -o $(OBJDIR)/comformat.o -c $(OBJDIR)/comformat_.c
1122
1123 $(OBJDIR)/comformat.h: $(OBJDIR)/headers
1124
1125 $(OBJDIR)/configure_.c: $(SRCDIR)/configure.c $(TRANSLATE)
1126 $(TRANSLATE) $(SRCDIR)/configure.c >$(OBJDIR)/configure_.c
1127
1128 $(OBJDIR)/configure.o: $(OBJDIR)/configure_.c $(OBJDIR)/configure.h $(SRCDIR)/config.h
1129 $(XTCC) -o $(OBJDIR)/configure.o -c $(OBJDIR)/configure_.c
1130
1131 $(OBJDIR)/configure.h: $(OBJDIR)/headers
1132
1133 $(OBJDIR)/content_.c: $(SRCDIR)/content.c $(TRANSLATE)
1134 $(TRANSLATE) $(SRCDIR)/content.c >$(OBJDIR)/content_.c
1135
1136 $(OBJDIR)/content.o: $(OBJDIR)/content_.c $(OBJDIR)/content.h $(SRCDIR)/config.h
1137 $(XTCC) -o $(OBJDIR)/content.o -c $(OBJDIR)/content_.c
1138
1139 $(OBJDIR)/content.h: $(OBJDIR)/headers
1140
1141 $(OBJDIR)/db_.c: $(SRCDIR)/db.c $(TRANSLATE)
1142 $(TRANSLATE) $(SRCDIR)/db.c >$(OBJDIR)/db_.c
1143
1144 $(OBJDIR)/db.o: $(OBJDIR)/db_.c $(OBJDIR)/db.h $(SRCDIR)/config.h
1145 $(XTCC) -o $(OBJDIR)/db.o -c $(OBJDIR)/db_.c
1146
1147 $(OBJDIR)/db.h: $(OBJDIR)/headers
1148
1149 $(OBJDIR)/delta_.c: $(SRCDIR)/delta.c $(TRANSLATE)
1150 $(TRANSLATE) $(SRCDIR)/delta.c >$(OBJDIR)/delta_.c
1151
1152 $(OBJDIR)/delta.o: $(OBJDIR)/delta_.c $(OBJDIR)/delta.h $(SRCDIR)/config.h
1153 $(XTCC) -o $(OBJDIR)/delta.o -c $(OBJDIR)/delta_.c
1154
1155 $(OBJDIR)/delta.h: $(OBJDIR)/headers
1156
1157 $(OBJDIR)/deltacmd_.c: $(SRCDIR)/deltacmd.c $(TRANSLATE)
1158 $(TRANSLATE) $(SRCDIR)/deltacmd.c >$(OBJDIR)/deltacmd_.c
1159
1160 $(OBJDIR)/deltacmd.o: $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h $(SRCDIR)/config.h
1161 $(XTCC) -o $(OBJDIR)/deltacmd.o -c $(OBJDIR)/deltacmd_.c
1162
1163 $(OBJDIR)/deltacmd.h: $(OBJDIR)/headers
1164
1165 $(OBJDIR)/descendants_.c: $(SRCDIR)/descendants.c $(TRANSLATE)
1166 $(TRANSLATE) $(SRCDIR)/descendants.c >$(OBJDIR)/descendants_.c
1167
1168 $(OBJDIR)/descendants.o: $(OBJDIR)/descendants_.c $(OBJDIR)/descendants.h $(SRCDIR)/config.h
1169 $(XTCC) -o $(OBJDIR)/descendants.o -c $(OBJDIR)/descendants_.c
1170
1171 $(OBJDIR)/descendants.h: $(OBJDIR)/headers
1172
1173 $(OBJDIR)/diff_.c: $(SRCDIR)/diff.c $(TRANSLATE)
1174 $(TRANSLATE) $(SRCDIR)/diff.c >$(OBJDIR)/diff_.c
1175
1176 $(OBJDIR)/diff.o: $(OBJDIR)/diff_.c $(OBJDIR)/diff.h $(SRCDIR)/config.h
1177 $(XTCC) -o $(OBJDIR)/diff.o -c $(OBJDIR)/diff_.c
1178
1179 $(OBJDIR)/diff.h: $(OBJDIR)/headers
1180
1181 $(OBJDIR)/diffcmd_.c: $(SRCDIR)/diffcmd.c $(TRANSLATE)
1182 $(TRANSLATE) $(SRCDIR)/diffcmd.c >$(OBJDIR)/diffcmd_.c
1183
1184 $(OBJDIR)/diffcmd.o: $(OBJDIR)/diffcmd_.c $(OBJDIR)/diffcmd.h $(SRCDIR)/config.h
1185 $(XTCC) -o $(OBJDIR)/diffcmd.o -c $(OBJDIR)/diffcmd_.c
1186
1187 $(OBJDIR)/diffcmd.h: $(OBJDIR)/headers
1188
1189 $(OBJDIR)/doc_.c: $(SRCDIR)/doc.c $(TRANSLATE)
1190 $(TRANSLATE) $(SRCDIR)/doc.c >$(OBJDIR)/doc_.c
1191
1192 $(OBJDIR)/doc.o: $(OBJDIR)/doc_.c $(OBJDIR)/doc.h $(SRCDIR)/config.h
1193 $(XTCC) -o $(OBJDIR)/doc.o -c $(OBJDIR)/doc_.c
1194
1195 $(OBJDIR)/doc.h: $(OBJDIR)/headers
1196
1197 $(OBJDIR)/encode_.c: $(SRCDIR)/encode.c $(TRANSLATE)
1198 $(TRANSLATE) $(SRCDIR)/encode.c >$(OBJDIR)/encode_.c
1199
1200 $(OBJDIR)/encode.o: $(OBJDIR)/encode_.c $(OBJDIR)/encode.h $(SRCDIR)/config.h
1201 $(XTCC) -o $(OBJDIR)/encode.o -c $(OBJDIR)/encode_.c
1202
1203 $(OBJDIR)/encode.h: $(OBJDIR)/headers
1204
1205 $(OBJDIR)/event_.c: $(SRCDIR)/event.c $(TRANSLATE)
1206 $(TRANSLATE) $(SRCDIR)/event.c >$(OBJDIR)/event_.c
1207
1208 $(OBJDIR)/event.o: $(OBJDIR)/event_.c $(OBJDIR)/event.h $(SRCDIR)/config.h
1209 $(XTCC) -o $(OBJDIR)/event.o -c $(OBJDIR)/event_.c
1210
1211 $(OBJDIR)/event.h: $(OBJDIR)/headers
1212
1213 $(OBJDIR)/export_.c: $(SRCDIR)/export.c $(TRANSLATE)
1214 $(TRANSLATE) $(SRCDIR)/export.c >$(OBJDIR)/export_.c
1215
1216 $(OBJDIR)/export.o: $(OBJDIR)/export_.c $(OBJDIR)/export.h $(SRCDIR)/config.h
1217 $(XTCC) -o $(OBJDIR)/export.o -c $(OBJDIR)/export_.c
1218
1219 $(OBJDIR)/export.h: $(OBJDIR)/headers
1220
1221 $(OBJDIR)/file_.c: $(SRCDIR)/file.c $(TRANSLATE)
1222 $(TRANSLATE) $(SRCDIR)/file.c >$(OBJDIR)/file_.c
1223
1224 $(OBJDIR)/file.o: $(OBJDIR)/file_.c $(OBJDIR)/file.h $(SRCDIR)/config.h
1225 $(XTCC) -o $(OBJDIR)/file.o -c $(OBJDIR)/file_.c
1226
1227 $(OBJDIR)/file.h: $(OBJDIR)/headers
1228
1229 $(OBJDIR)/finfo_.c: $(SRCDIR)/finfo.c $(TRANSLATE)
1230 $(TRANSLATE) $(SRCDIR)/finfo.c >$(OBJDIR)/finfo_.c
1231
1232 $(OBJDIR)/finfo.o: $(OBJDIR)/finfo_.c $(OBJDIR)/finfo.h $(SRCDIR)/config.h
1233 $(XTCC) -o $(OBJDIR)/finfo.o -c $(OBJDIR)/finfo_.c
1234
1235 $(OBJDIR)/finfo.h: $(OBJDIR)/headers
1236
1237 $(OBJDIR)/fusefs_.c: $(SRCDIR)/fusefs.c $(TRANSLATE)
1238 $(TRANSLATE) $(SRCDIR)/fusefs.c >$(OBJDIR)/fusefs_.c
1239
1240 $(OBJDIR)/fusefs.o: $(OBJDIR)/fusefs_.c $(OBJDIR)/fusefs.h $(SRCDIR)/config.h
1241 $(XTCC) -o $(OBJDIR)/fusefs.o -c $(OBJDIR)/fusefs_.c
1242
1243 $(OBJDIR)/fusefs.h: $(OBJDIR)/headers
1244
1245 $(OBJDIR)/glob_.c: $(SRCDIR)/glob.c $(TRANSLATE)
1246 $(TRANSLATE) $(SRCDIR)/glob.c >$(OBJDIR)/glob_.c
1247
1248 $(OBJDIR)/glob.o: $(OBJDIR)/glob_.c $(OBJDIR)/glob.h $(SRCDIR)/config.h
1249 $(XTCC) -o $(OBJDIR)/glob.o -c $(OBJDIR)/glob_.c
1250
1251 $(OBJDIR)/glob.h: $(OBJDIR)/headers
1252
1253 $(OBJDIR)/graph_.c: $(SRCDIR)/graph.c $(TRANSLATE)
1254 $(TRANSLATE) $(SRCDIR)/graph.c >$(OBJDIR)/graph_.c
1255
1256 $(OBJDIR)/graph.o: $(OBJDIR)/graph_.c $(OBJDIR)/graph.h $(SRCDIR)/config.h
1257 $(XTCC) -o $(OBJDIR)/graph.o -c $(OBJDIR)/graph_.c
1258
1259 $(OBJDIR)/graph.h: $(OBJDIR)/headers
1260
1261 $(OBJDIR)/gzip_.c: $(SRCDIR)/gzip.c $(TRANSLATE)
1262 $(TRANSLATE) $(SRCDIR)/gzip.c >$(OBJDIR)/gzip_.c
1263
1264 $(OBJDIR)/gzip.o: $(OBJDIR)/gzip_.c $(OBJDIR)/gzip.h $(SRCDIR)/config.h
1265 $(XTCC) -o $(OBJDIR)/gzip.o -c $(OBJDIR)/gzip_.c
1266
1267 $(OBJDIR)/gzip.h: $(OBJDIR)/headers
1268
1269 $(OBJDIR)/http_.c: $(SRCDIR)/http.c $(TRANSLATE)
1270 $(TRANSLATE) $(SRCDIR)/http.c >$(OBJDIR)/http_.c
1271
1272 $(OBJDIR)/http.o: $(OBJDIR)/http_.c $(OBJDIR)/http.h $(SRCDIR)/config.h
1273 $(XTCC) -o $(OBJDIR)/http.o -c $(OBJDIR)/http_.c
1274
1275 $(OBJDIR)/http.h: $(OBJDIR)/headers
1276
1277 $(OBJDIR)/http_socket_.c: $(SRCDIR)/http_socket.c $(TRANSLATE)
1278 $(TRANSLATE) $(SRCDIR)/http_socket.c >$(OBJDIR)/http_socket_.c
1279
1280 $(OBJDIR)/http_socket.o: $(OBJDIR)/http_socket_.c $(OBJDIR)/http_socket.h $(SRCDIR)/config.h
1281 $(XTCC) -o $(OBJDIR)/http_socket.o -c $(OBJDIR)/http_socket_.c
1282
1283 $(OBJDIR)/http_socket.h: $(OBJDIR)/headers
1284
1285 $(OBJDIR)/http_ssl_.c: $(SRCDIR)/http_ssl.c $(TRANSLATE)
1286 $(TRANSLATE) $(SRCDIR)/http_ssl.c >$(OBJDIR)/http_ssl_.c
1287
1288 $(OBJDIR)/http_ssl.o: $(OBJDIR)/http_ssl_.c $(OBJDIR)/http_ssl.h $(SRCDIR)/config.h
1289 $(XTCC) -o $(OBJDIR)/http_ssl.o -c $(OBJDIR)/http_ssl_.c
1290
1291 $(OBJDIR)/http_ssl.h: $(OBJDIR)/headers
1292
1293 $(OBJDIR)/http_transport_.c: $(SRCDIR)/http_transport.c $(TRANSLATE)
1294 $(TRANSLATE) $(SRCDIR)/http_transport.c >$(OBJDIR)/http_transport_.c
1295
1296 $(OBJDIR)/http_transport.o: $(OBJDIR)/http_transport_.c $(OBJDIR)/http_transport.h $(SRCDIR)/config.h
1297 $(XTCC) -o $(OBJDIR)/http_transport.o -c $(OBJDIR)/http_transport_.c
1298
1299 $(OBJDIR)/http_transport.h: $(OBJDIR)/headers
1300
1301 $(OBJDIR)/import_.c: $(SRCDIR)/import.c $(TRANSLATE)
1302 $(TRANSLATE) $(SRCDIR)/import.c >$(OBJDIR)/import_.c
1303
1304 $(OBJDIR)/import.o: $(OBJDIR)/import_.c $(OBJDIR)/import.h $(SRCDIR)/config.h
1305 $(XTCC) -o $(OBJDIR)/import.o -c $(OBJDIR)/import_.c
1306
1307 $(OBJDIR)/import.h: $(OBJDIR)/headers
1308
1309 $(OBJDIR)/info_.c: $(SRCDIR)/info.c $(TRANSLATE)
1310 $(TRANSLATE) $(SRCDIR)/info.c >$(OBJDIR)/info_.c
1311
1312 $(OBJDIR)/info.o: $(OBJDIR)/info_.c $(OBJDIR)/info.h $(SRCDIR)/config.h
1313 $(XTCC) -o $(OBJDIR)/info.o -c $(OBJDIR)/info_.c
1314
1315 $(OBJDIR)/info.h: $(OBJDIR)/headers
1316
1317 $(OBJDIR)/json_.c: $(SRCDIR)/json.c $(TRANSLATE)
1318 $(TRANSLATE) $(SRCDIR)/json.c >$(OBJDIR)/json_.c
1319
1320 $(OBJDIR)/json.o: $(OBJDIR)/json_.c $(OBJDIR)/json.h $(SRCDIR)/config.h
1321 $(XTCC) -o $(OBJDIR)/json.o -c $(OBJDIR)/json_.c
1322
1323 $(OBJDIR)/json.h: $(OBJDIR)/headers
1324
1325 $(OBJDIR)/json_artifact_.c: $(SRCDIR)/json_artifact.c $(TRANSLATE)
1326 $(TRANSLATE) $(SRCDIR)/json_artifact.c >$(OBJDIR)/json_artifact_.c
1327
1328 $(OBJDIR)/json_artifact.o: $(OBJDIR)/json_artifact_.c $(OBJDIR)/json_artifact.h $(SRCDIR)/config.h
1329 $(XTCC) -o $(OBJDIR)/json_artifact.o -c $(OBJDIR)/json_artifact_.c
1330
1331 $(OBJDIR)/json_artifact.h: $(OBJDIR)/headers
1332
1333 $(OBJDIR)/json_branch_.c: $(SRCDIR)/json_branch.c $(TRANSLATE)
1334 $(TRANSLATE) $(SRCDIR)/json_branch.c >$(OBJDIR)/json_branch_.c
1335
1336 $(OBJDIR)/json_branch.o: $(OBJDIR)/json_branch_.c $(OBJDIR)/json_branch.h $(SRCDIR)/config.h
1337 $(XTCC) -o $(OBJDIR)/json_branch.o -c $(OBJDIR)/json_branch_.c
1338
1339 $(OBJDIR)/json_branch.h: $(OBJDIR)/headers
1340
1341 $(OBJDIR)/json_config_.c: $(SRCDIR)/json_config.c $(TRANSLATE)
1342 $(TRANSLATE) $(SRCDIR)/json_config.c >$(OBJDIR)/json_config_.c
1343
1344 $(OBJDIR)/json_config.o: $(OBJDIR)/json_config_.c $(OBJDIR)/json_config.h $(SRCDIR)/config.h
1345 $(XTCC) -o $(OBJDIR)/json_config.o -c $(OBJDIR)/json_config_.c
1346
1347 $(OBJDIR)/json_config.h: $(OBJDIR)/headers
1348
1349 $(OBJDIR)/json_diff_.c: $(SRCDIR)/json_diff.c $(TRANSLATE)
1350 $(TRANSLATE) $(SRCDIR)/json_diff.c >$(OBJDIR)/json_diff_.c
1351
1352 $(OBJDIR)/json_diff.o: $(OBJDIR)/json_diff_.c $(OBJDIR)/json_diff.h $(SRCDIR)/config.h
1353 $(XTCC) -o $(OBJDIR)/json_diff.o -c $(OBJDIR)/json_diff_.c
1354
1355 $(OBJDIR)/json_diff.h: $(OBJDIR)/headers
1356
1357 $(OBJDIR)/json_dir_.c: $(SRCDIR)/json_dir.c $(TRANSLATE)
1358 $(TRANSLATE) $(SRCDIR)/json_dir.c >$(OBJDIR)/json_dir_.c
1359
1360 $(OBJDIR)/json_dir.o: $(OBJDIR)/json_dir_.c $(OBJDIR)/json_dir.h $(SRCDIR)/config.h
1361 $(XTCC) -o $(OBJDIR)/json_dir.o -c $(OBJDIR)/json_dir_.c
1362
1363 $(OBJDIR)/json_dir.h: $(OBJDIR)/headers
1364
1365 $(OBJDIR)/json_finfo_.c: $(SRCDIR)/json_finfo.c $(TRANSLATE)
1366 $(TRANSLATE) $(SRCDIR)/json_finfo.c >$(OBJDIR)/json_finfo_.c
1367
1368 $(OBJDIR)/json_finfo.o: $(OBJDIR)/json_finfo_.c $(OBJDIR)/json_finfo.h $(SRCDIR)/config.h
1369 $(XTCC) -o $(OBJDIR)/json_finfo.o -c $(OBJDIR)/json_finfo_.c
1370
1371 $(OBJDIR)/json_finfo.h: $(OBJDIR)/headers
1372
1373 $(OBJDIR)/json_login_.c: $(SRCDIR)/json_login.c $(TRANSLATE)
1374 $(TRANSLATE) $(SRCDIR)/json_login.c >$(OBJDIR)/json_login_.c
1375
1376 $(OBJDIR)/json_login.o: $(OBJDIR)/json_login_.c $(OBJDIR)/json_login.h $(SRCDIR)/config.h
1377 $(XTCC) -o $(OBJDIR)/json_login.o -c $(OBJDIR)/json_login_.c
1378
1379 $(OBJDIR)/json_login.h: $(OBJDIR)/headers
1380
1381 $(OBJDIR)/json_query_.c: $(SRCDIR)/json_query.c $(TRANSLATE)
1382 $(TRANSLATE) $(SRCDIR)/json_query.c >$(OBJDIR)/json_query_.c
1383
1384 $(OBJDIR)/json_query.o: $(OBJDIR)/json_query_.c $(OBJDIR)/json_query.h $(SRCDIR)/config.h
1385 $(XTCC) -o $(OBJDIR)/json_query.o -c $(OBJDIR)/json_query_.c
1386
1387 $(OBJDIR)/json_query.h: $(OBJDIR)/headers
1388
1389 $(OBJDIR)/json_report_.c: $(SRCDIR)/json_report.c $(TRANSLATE)
1390 $(TRANSLATE) $(SRCDIR)/json_report.c >$(OBJDIR)/json_report_.c
1391
1392 $(OBJDIR)/json_report.o: $(OBJDIR)/json_report_.c $(OBJDIR)/json_report.h $(SRCDIR)/config.h
1393 $(XTCC) -o $(OBJDIR)/json_report.o -c $(OBJDIR)/json_report_.c
1394
1395 $(OBJDIR)/json_report.h: $(OBJDIR)/headers
1396
1397 $(OBJDIR)/json_status_.c: $(SRCDIR)/json_status.c $(TRANSLATE)
1398 $(TRANSLATE) $(SRCDIR)/json_status.c >$(OBJDIR)/json_status_.c
1399
1400 $(OBJDIR)/json_status.o: $(OBJDIR)/json_status_.c $(OBJDIR)/json_status.h $(SRCDIR)/config.h
1401 $(XTCC) -o $(OBJDIR)/json_status.o -c $(OBJDIR)/json_status_.c
1402
1403 $(OBJDIR)/json_status.h: $(OBJDIR)/headers
1404
1405 $(OBJDIR)/json_tag_.c: $(SRCDIR)/json_tag.c $(TRANSLATE)
1406 $(TRANSLATE) $(SRCDIR)/json_tag.c >$(OBJDIR)/json_tag_.c
1407
1408 $(OBJDIR)/json_tag.o: $(OBJDIR)/json_tag_.c $(OBJDIR)/json_tag.h $(SRCDIR)/config.h
1409 $(XTCC) -o $(OBJDIR)/json_tag.o -c $(OBJDIR)/json_tag_.c
1410
1411 $(OBJDIR)/json_tag.h: $(OBJDIR)/headers
1412
1413 $(OBJDIR)/json_timeline_.c: $(SRCDIR)/json_timeline.c $(TRANSLATE)
1414 $(TRANSLATE) $(SRCDIR)/json_timeline.c >$(OBJDIR)/json_timeline_.c
1415
1416 $(OBJDIR)/json_timeline.o: $(OBJDIR)/json_timeline_.c $(OBJDIR)/json_timeline.h $(SRCDIR)/config.h
1417 $(XTCC) -o $(OBJDIR)/json_timeline.o -c $(OBJDIR)/json_timeline_.c
1418
1419 $(OBJDIR)/json_timeline.h: $(OBJDIR)/headers
1420
1421 $(OBJDIR)/json_user_.c: $(SRCDIR)/json_user.c $(TRANSLATE)
1422 $(TRANSLATE) $(SRCDIR)/json_user.c >$(OBJDIR)/json_user_.c
1423
1424 $(OBJDIR)/json_user.o: $(OBJDIR)/json_user_.c $(OBJDIR)/json_user.h $(SRCDIR)/config.h
1425 $(XTCC) -o $(OBJDIR)/json_user.o -c $(OBJDIR)/json_user_.c
1426
1427 $(OBJDIR)/json_user.h: $(OBJDIR)/headers
1428
1429 $(OBJDIR)/json_wiki_.c: $(SRCDIR)/json_wiki.c $(TRANSLATE)
1430 $(TRANSLATE) $(SRCDIR)/json_wiki.c >$(OBJDIR)/json_wiki_.c
1431
1432 $(OBJDIR)/json_wiki.o: $(OBJDIR)/json_wiki_.c $(OBJDIR)/json_wiki.h $(SRCDIR)/config.h
1433 $(XTCC) -o $(OBJDIR)/json_wiki.o -c $(OBJDIR)/json_wiki_.c
1434
1435 $(OBJDIR)/json_wiki.h: $(OBJDIR)/headers
1436
1437 $(OBJDIR)/leaf_.c: $(SRCDIR)/leaf.c $(TRANSLATE)
1438 $(TRANSLATE) $(SRCDIR)/leaf.c >$(OBJDIR)/leaf_.c
1439
1440 $(OBJDIR)/leaf.o: $(OBJDIR)/leaf_.c $(OBJDIR)/leaf.h $(SRCDIR)/config.h
1441 $(XTCC) -o $(OBJDIR)/leaf.o -c $(OBJDIR)/leaf_.c
1442
1443 $(OBJDIR)/leaf.h: $(OBJDIR)/headers
1444
1445 $(OBJDIR)/loadctrl_.c: $(SRCDIR)/loadctrl.c $(TRANSLATE)
1446 $(TRANSLATE) $(SRCDIR)/loadctrl.c >$(OBJDIR)/loadctrl_.c
1447
1448 $(OBJDIR)/loadctrl.o: $(OBJDIR)/loadctrl_.c $(OBJDIR)/loadctrl.h $(SRCDIR)/config.h
1449 $(XTCC) -o $(OBJDIR)/loadctrl.o -c $(OBJDIR)/loadctrl_.c
1450
1451 $(OBJDIR)/loadctrl.h: $(OBJDIR)/headers
1452
1453 $(OBJDIR)/login_.c: $(SRCDIR)/login.c $(TRANSLATE)
1454 $(TRANSLATE) $(SRCDIR)/login.c >$(OBJDIR)/login_.c
1455
1456 $(OBJDIR)/login.o: $(OBJDIR)/login_.c $(OBJDIR)/login.h $(SRCDIR)/config.h
1457 $(XTCC) -o $(OBJDIR)/login.o -c $(OBJDIR)/login_.c
1458
1459 $(OBJDIR)/login.h: $(OBJDIR)/headers
1460
1461 $(OBJDIR)/lookslike_.c: $(SRCDIR)/lookslike.c $(TRANSLATE)
1462 $(TRANSLATE) $(SRCDIR)/lookslike.c >$(OBJDIR)/lookslike_.c
1463
1464 $(OBJDIR)/lookslike.o: $(OBJDIR)/lookslike_.c $(OBJDIR)/lookslike.h $(SRCDIR)/config.h
1465 $(XTCC) -o $(OBJDIR)/lookslike.o -c $(OBJDIR)/lookslike_.c
1466
1467 $(OBJDIR)/lookslike.h: $(OBJDIR)/headers
1468
1469 $(OBJDIR)/main_.c: $(SRCDIR)/main.c $(TRANSLATE)
1470 $(TRANSLATE) $(SRCDIR)/main.c >$(OBJDIR)/main_.c
1471
1472 $(OBJDIR)/main.o: $(OBJDIR)/main_.c $(OBJDIR)/main.h $(OBJDIR)/page_index.h $(SRCDIR)/config.h
1473 $(XTCC) -o $(OBJDIR)/main.o -c $(OBJDIR)/main_.c
1474
1475 $(OBJDIR)/main.h: $(OBJDIR)/headers
1476
1477 $(OBJDIR)/manifest_.c: $(SRCDIR)/manifest.c $(TRANSLATE)
1478 $(TRANSLATE) $(SRCDIR)/manifest.c >$(OBJDIR)/manifest_.c
1479
1480 $(OBJDIR)/manifest.o: $(OBJDIR)/manifest_.c $(OBJDIR)/manifest.h $(SRCDIR)/config.h
1481 $(XTCC) -o $(OBJDIR)/manifest.o -c $(OBJDIR)/manifest_.c
1482
1483 $(OBJDIR)/manifest.h: $(OBJDIR)/headers
1484
1485 $(OBJDIR)/markdown_.c: $(SRCDIR)/markdown.c $(TRANSLATE)
1486 $(TRANSLATE) $(SRCDIR)/markdown.c >$(OBJDIR)/markdown_.c
1487
1488 $(OBJDIR)/markdown.o: $(OBJDIR)/markdown_.c $(OBJDIR)/markdown.h $(SRCDIR)/config.h
1489 $(XTCC) -o $(OBJDIR)/markdown.o -c $(OBJDIR)/markdown_.c
1490
1491 $(OBJDIR)/markdown.h: $(OBJDIR)/headers
1492
1493 $(OBJDIR)/markdown_html_.c: $(SRCDIR)/markdown_html.c $(TRANSLATE)
1494 $(TRANSLATE) $(SRCDIR)/markdown_html.c >$(OBJDIR)/markdown_html_.c
1495
1496 $(OBJDIR)/markdown_html.o: $(OBJDIR)/markdown_html_.c $(OBJDIR)/markdown_html.h $(SRCDIR)/config.h
1497 $(XTCC) -o $(OBJDIR)/markdown_html.o -c $(OBJDIR)/markdown_html_.c
1498
1499 $(OBJDIR)/markdown_html.h: $(OBJDIR)/headers
1500
1501 $(OBJDIR)/md5_.c: $(SRCDIR)/md5.c $(TRANSLATE)
1502 $(TRANSLATE) $(SRCDIR)/md5.c >$(OBJDIR)/md5_.c
1503
1504 $(OBJDIR)/md5.o: $(OBJDIR)/md5_.c $(OBJDIR)/md5.h $(SRCDIR)/config.h
1505 $(XTCC) -o $(OBJDIR)/md5.o -c $(OBJDIR)/md5_.c
1506
1507 $(OBJDIR)/md5.h: $(OBJDIR)/headers
1508
1509 $(OBJDIR)/merge_.c: $(SRCDIR)/merge.c $(TRANSLATE)
1510 $(TRANSLATE) $(SRCDIR)/merge.c >$(OBJDIR)/merge_.c
1511
1512 $(OBJDIR)/merge.o: $(OBJDIR)/merge_.c $(OBJDIR)/merge.h $(SRCDIR)/config.h
1513 $(XTCC) -o $(OBJDIR)/merge.o -c $(OBJDIR)/merge_.c
1514
1515 $(OBJDIR)/merge.h: $(OBJDIR)/headers
1516
1517 $(OBJDIR)/merge3_.c: $(SRCDIR)/merge3.c $(TRANSLATE)
1518 $(TRANSLATE) $(SRCDIR)/merge3.c >$(OBJDIR)/merge3_.c
1519
1520 $(OBJDIR)/merge3.o: $(OBJDIR)/merge3_.c $(OBJDIR)/merge3.h $(SRCDIR)/config.h
1521 $(XTCC) -o $(OBJDIR)/merge3.o -c $(OBJDIR)/merge3_.c
1522
1523 $(OBJDIR)/merge3.h: $(OBJDIR)/headers
1524
1525 $(OBJDIR)/moderate_.c: $(SRCDIR)/moderate.c $(TRANSLATE)
1526 $(TRANSLATE) $(SRCDIR)/moderate.c >$(OBJDIR)/moderate_.c
1527
1528 $(OBJDIR)/moderate.o: $(OBJDIR)/moderate_.c $(OBJDIR)/moderate.h $(SRCDIR)/config.h
1529 $(XTCC) -o $(OBJDIR)/moderate.o -c $(OBJDIR)/moderate_.c
1530
1531 $(OBJDIR)/moderate.h: $(OBJDIR)/headers
1532
1533 $(OBJDIR)/name_.c: $(SRCDIR)/name.c $(TRANSLATE)
1534 $(TRANSLATE) $(SRCDIR)/name.c >$(OBJDIR)/name_.c
1535
1536 $(OBJDIR)/name.o: $(OBJDIR)/name_.c $(OBJDIR)/name.h $(SRCDIR)/config.h
1537 $(XTCC) -o $(OBJDIR)/name.o -c $(OBJDIR)/name_.c
1538
1539 $(OBJDIR)/name.h: $(OBJDIR)/headers
1540
1541 $(OBJDIR)/path_.c: $(SRCDIR)/path.c $(TRANSLATE)
1542 $(TRANSLATE) $(SRCDIR)/path.c >$(OBJDIR)/path_.c
1543
1544 $(OBJDIR)/path.o: $(OBJDIR)/path_.c $(OBJDIR)/path.h $(SRCDIR)/config.h
1545 $(XTCC) -o $(OBJDIR)/path.o -c $(OBJDIR)/path_.c
1546
1547 $(OBJDIR)/path.h: $(OBJDIR)/headers
1548
1549 $(OBJDIR)/pivot_.c: $(SRCDIR)/pivot.c $(TRANSLATE)
1550 $(TRANSLATE) $(SRCDIR)/pivot.c >$(OBJDIR)/pivot_.c
1551
1552 $(OBJDIR)/pivot.o: $(OBJDIR)/pivot_.c $(OBJDIR)/pivot.h $(SRCDIR)/config.h
1553 $(XTCC) -o $(OBJDIR)/pivot.o -c $(OBJDIR)/pivot_.c
1554
1555 $(OBJDIR)/pivot.h: $(OBJDIR)/headers
1556
1557 $(OBJDIR)/popen_.c: $(SRCDIR)/popen.c $(TRANSLATE)
1558 $(TRANSLATE) $(SRCDIR)/popen.c >$(OBJDIR)/popen_.c
1559
1560 $(OBJDIR)/popen.o: $(OBJDIR)/popen_.c $(OBJDIR)/popen.h $(SRCDIR)/config.h
1561 $(XTCC) -o $(OBJDIR)/popen.o -c $(OBJDIR)/popen_.c
1562
1563 $(OBJDIR)/popen.h: $(OBJDIR)/headers
1564
1565 $(OBJDIR)/pqueue_.c: $(SRCDIR)/pqueue.c $(TRANSLATE)
1566 $(TRANSLATE) $(SRCDIR)/pqueue.c >$(OBJDIR)/pqueue_.c
1567
1568 $(OBJDIR)/pqueue.o: $(OBJDIR)/pqueue_.c $(OBJDIR)/pqueue.h $(SRCDIR)/config.h
1569 $(XTCC) -o $(OBJDIR)/pqueue.o -c $(OBJDIR)/pqueue_.c
1570
1571 $(OBJDIR)/pqueue.h: $(OBJDIR)/headers
1572
1573 $(OBJDIR)/printf_.c: $(SRCDIR)/printf.c $(TRANSLATE)
1574 $(TRANSLATE) $(SRCDIR)/printf.c >$(OBJDIR)/printf_.c
1575
1576 $(OBJDIR)/printf.o: $(OBJDIR)/printf_.c $(OBJDIR)/printf.h $(SRCDIR)/config.h
1577 $(XTCC) -o $(OBJDIR)/printf.o -c $(OBJDIR)/printf_.c
1578
1579 $(OBJDIR)/printf.h: $(OBJDIR)/headers
1580
1581 $(OBJDIR)/rebuild_.c: $(SRCDIR)/rebuild.c $(TRANSLATE)
1582 $(TRANSLATE) $(SRCDIR)/rebuild.c >$(OBJDIR)/rebuild_.c
1583
1584 $(OBJDIR)/rebuild.o: $(OBJDIR)/rebuild_.c $(OBJDIR)/rebuild.h $(SRCDIR)/config.h
1585 $(XTCC) -o $(OBJDIR)/rebuild.o -c $(OBJDIR)/rebuild_.c
1586
1587 $(OBJDIR)/rebuild.h: $(OBJDIR)/headers
1588
1589 $(OBJDIR)/regexp_.c: $(SRCDIR)/regexp.c $(TRANSLATE)
1590 $(TRANSLATE) $(SRCDIR)/regexp.c >$(OBJDIR)/regexp_.c
1591
1592 $(OBJDIR)/regexp.o: $(OBJDIR)/regexp_.c $(OBJDIR)/regexp.h $(SRCDIR)/config.h
1593 $(XTCC) -o $(OBJDIR)/regexp.o -c $(OBJDIR)/regexp_.c
1594
1595 $(OBJDIR)/regexp.h: $(OBJDIR)/headers
1596
1597 $(OBJDIR)/report_.c: $(SRCDIR)/report.c $(TRANSLATE)
1598 $(TRANSLATE) $(SRCDIR)/report.c >$(OBJDIR)/report_.c
1599
1600 $(OBJDIR)/report.o: $(OBJDIR)/report_.c $(OBJDIR)/report.h $(SRCDIR)/config.h
1601 $(XTCC) -o $(OBJDIR)/report.o -c $(OBJDIR)/report_.c
1602
1603 $(OBJDIR)/report.h: $(OBJDIR)/headers
1604
1605 $(OBJDIR)/rss_.c: $(SRCDIR)/rss.c $(TRANSLATE)
1606 $(TRANSLATE) $(SRCDIR)/rss.c >$(OBJDIR)/rss_.c
1607
1608 $(OBJDIR)/rss.o: $(OBJDIR)/rss_.c $(OBJDIR)/rss.h $(SRCDIR)/config.h
1609 $(XTCC) -o $(OBJDIR)/rss.o -c $(OBJDIR)/rss_.c
1610
1611 $(OBJDIR)/rss.h: $(OBJDIR)/headers
1612
1613 $(OBJDIR)/schema_.c: $(SRCDIR)/schema.c $(TRANSLATE)
1614 $(TRANSLATE) $(SRCDIR)/schema.c >$(OBJDIR)/schema_.c
1615
1616 $(OBJDIR)/schema.o: $(OBJDIR)/schema_.c $(OBJDIR)/schema.h $(SRCDIR)/config.h
1617 $(XTCC) -o $(OBJDIR)/schema.o -c $(OBJDIR)/schema_.c
1618
1619 $(OBJDIR)/schema.h: $(OBJDIR)/headers
1620
1621 $(OBJDIR)/search_.c: $(SRCDIR)/search.c $(TRANSLATE)
1622 $(TRANSLATE) $(SRCDIR)/search.c >$(OBJDIR)/search_.c
1623
1624 $(OBJDIR)/search.o: $(OBJDIR)/search_.c $(OBJDIR)/search.h $(SRCDIR)/config.h
1625 $(XTCC) -o $(OBJDIR)/search.o -c $(OBJDIR)/search_.c
1626
1627 $(OBJDIR)/search.h: $(OBJDIR)/headers
1628
1629 $(OBJDIR)/setup_.c: $(SRCDIR)/setup.c $(TRANSLATE)
1630 $(TRANSLATE) $(SRCDIR)/setup.c >$(OBJDIR)/setup_.c
1631
1632 $(OBJDIR)/setup.o: $(OBJDIR)/setup_.c $(OBJDIR)/setup.h $(SRCDIR)/config.h
1633 $(XTCC) -o $(OBJDIR)/setup.o -c $(OBJDIR)/setup_.c
1634
1635 $(OBJDIR)/setup.h: $(OBJDIR)/headers
1636
1637 $(OBJDIR)/sha1_.c: $(SRCDIR)/sha1.c $(TRANSLATE)
1638 $(TRANSLATE) $(SRCDIR)/sha1.c >$(OBJDIR)/sha1_.c
1639
1640 $(OBJDIR)/sha1.o: $(OBJDIR)/sha1_.c $(OBJDIR)/sha1.h $(SRCDIR)/config.h
1641 $(XTCC) -o $(OBJDIR)/sha1.o -c $(OBJDIR)/sha1_.c
1642
1643 $(OBJDIR)/sha1.h: $(OBJDIR)/headers
1644
1645 $(OBJDIR)/shun_.c: $(SRCDIR)/shun.c $(TRANSLATE)
1646 $(TRANSLATE) $(SRCDIR)/shun.c >$(OBJDIR)/shun_.c
1647
1648 $(OBJDIR)/shun.o: $(OBJDIR)/shun_.c $(OBJDIR)/shun.h $(SRCDIR)/config.h
1649 $(XTCC) -o $(OBJDIR)/shun.o -c $(OBJDIR)/shun_.c
1650
1651 $(OBJDIR)/shun.h: $(OBJDIR)/headers
1652
1653 $(OBJDIR)/skins_.c: $(SRCDIR)/skins.c $(TRANSLATE)
1654 $(TRANSLATE) $(SRCDIR)/skins.c >$(OBJDIR)/skins_.c
1655
1656 $(OBJDIR)/skins.o: $(OBJDIR)/skins_.c $(OBJDIR)/skins.h $(SRCDIR)/config.h
1657 $(XTCC) -o $(OBJDIR)/skins.o -c $(OBJDIR)/skins_.c
1658
1659 $(OBJDIR)/skins.h: $(OBJDIR)/headers
1660
1661 $(OBJDIR)/sqlcmd_.c: $(SRCDIR)/sqlcmd.c $(TRANSLATE)
1662 $(TRANSLATE) $(SRCDIR)/sqlcmd.c >$(OBJDIR)/sqlcmd_.c
1663
1664 $(OBJDIR)/sqlcmd.o: $(OBJDIR)/sqlcmd_.c $(OBJDIR)/sqlcmd.h $(SRCDIR)/config.h
1665 $(XTCC) -o $(OBJDIR)/sqlcmd.o -c $(OBJDIR)/sqlcmd_.c
1666
1667 $(OBJDIR)/sqlcmd.h: $(OBJDIR)/headers
1668
1669 $(OBJDIR)/stash_.c: $(SRCDIR)/stash.c $(TRANSLATE)
1670 $(TRANSLATE) $(SRCDIR)/stash.c >$(OBJDIR)/stash_.c
1671
1672 $(OBJDIR)/stash.o: $(OBJDIR)/stash_.c $(OBJDIR)/stash.h $(SRCDIR)/config.h
1673 $(XTCC) -o $(OBJDIR)/stash.o -c $(OBJDIR)/stash_.c
1674
1675 $(OBJDIR)/stash.h: $(OBJDIR)/headers
1676
1677 $(OBJDIR)/stat_.c: $(SRCDIR)/stat.c $(TRANSLATE)
1678 $(TRANSLATE) $(SRCDIR)/stat.c >$(OBJDIR)/stat_.c
1679
1680 $(OBJDIR)/stat.o: $(OBJDIR)/stat_.c $(OBJDIR)/stat.h $(SRCDIR)/config.h
1681 $(XTCC) -o $(OBJDIR)/stat.o -c $(OBJDIR)/stat_.c
1682
1683 $(OBJDIR)/stat.h: $(OBJDIR)/headers
1684
1685 $(OBJDIR)/style_.c: $(SRCDIR)/style.c $(TRANSLATE)
1686 $(TRANSLATE) $(SRCDIR)/style.c >$(OBJDIR)/style_.c
1687
1688 $(OBJDIR)/style.o: $(OBJDIR)/style_.c $(OBJDIR)/style.h $(SRCDIR)/config.h
1689 $(XTCC) -o $(OBJDIR)/style.o -c $(OBJDIR)/style_.c
1690
1691 $(OBJDIR)/style.h: $(OBJDIR)/headers
1692
1693 $(OBJDIR)/sync_.c: $(SRCDIR)/sync.c $(TRANSLATE)
1694 $(TRANSLATE) $(SRCDIR)/sync.c >$(OBJDIR)/sync_.c
1695
1696 $(OBJDIR)/sync.o: $(OBJDIR)/sync_.c $(OBJDIR)/sync.h $(SRCDIR)/config.h
1697 $(XTCC) -o $(OBJDIR)/sync.o -c $(OBJDIR)/sync_.c
1698
1699 $(OBJDIR)/sync.h: $(OBJDIR)/headers
1700
1701 $(OBJDIR)/tag_.c: $(SRCDIR)/tag.c $(TRANSLATE)
1702 $(TRANSLATE) $(SRCDIR)/tag.c >$(OBJDIR)/tag_.c
1703
1704 $(OBJDIR)/tag.o: $(OBJDIR)/tag_.c $(OBJDIR)/tag.h $(SRCDIR)/config.h
1705 $(XTCC) -o $(OBJDIR)/tag.o -c $(OBJDIR)/tag_.c
1706
1707 $(OBJDIR)/tag.h: $(OBJDIR)/headers
1708
1709 $(OBJDIR)/tar_.c: $(SRCDIR)/tar.c $(TRANSLATE)
1710 $(TRANSLATE) $(SRCDIR)/tar.c >$(OBJDIR)/tar_.c
1711
1712 $(OBJDIR)/tar.o: $(OBJDIR)/tar_.c $(OBJDIR)/tar.h $(SRCDIR)/config.h
1713 $(XTCC) -o $(OBJDIR)/tar.o -c $(OBJDIR)/tar_.c
1714
1715 $(OBJDIR)/tar.h: $(OBJDIR)/headers
1716
1717 $(OBJDIR)/th_main_.c: $(SRCDIR)/th_main.c $(TRANSLATE)
1718 $(TRANSLATE) $(SRCDIR)/th_main.c >$(OBJDIR)/th_main_.c
1719
1720 $(OBJDIR)/th_main.o: $(OBJDIR)/th_main_.c $(OBJDIR)/th_main.h $(SRCDIR)/config.h
1721 $(XTCC) -o $(OBJDIR)/th_main.o -c $(OBJDIR)/th_main_.c
1722
1723 $(OBJDIR)/th_main.h: $(OBJDIR)/headers
1724
1725 $(OBJDIR)/timeline_.c: $(SRCDIR)/timeline.c $(TRANSLATE)
1726 $(TRANSLATE) $(SRCDIR)/timeline.c >$(OBJDIR)/timeline_.c
1727
1728 $(OBJDIR)/timeline.o: $(OBJDIR)/timeline_.c $(OBJDIR)/timeline.h $(SRCDIR)/config.h
1729 $(XTCC) -o $(OBJDIR)/timeline.o -c $(OBJDIR)/timeline_.c
1730
1731 $(OBJDIR)/timeline.h: $(OBJDIR)/headers
1732
1733 $(OBJDIR)/tkt_.c: $(SRCDIR)/tkt.c $(TRANSLATE)
1734 $(TRANSLATE) $(SRCDIR)/tkt.c >$(OBJDIR)/tkt_.c
1735
1736 $(OBJDIR)/tkt.o: $(OBJDIR)/tkt_.c $(OBJDIR)/tkt.h $(SRCDIR)/config.h
1737 $(XTCC) -o $(OBJDIR)/tkt.o -c $(OBJDIR)/tkt_.c
1738
1739 $(OBJDIR)/tkt.h: $(OBJDIR)/headers
1740
1741 $(OBJDIR)/tktsetup_.c: $(SRCDIR)/tktsetup.c $(TRANSLATE)
1742 $(TRANSLATE) $(SRCDIR)/tktsetup.c >$(OBJDIR)/tktsetup_.c
1743
1744 $(OBJDIR)/tktsetup.o: $(OBJDIR)/tktsetup_.c $(OBJDIR)/tktsetup.h $(SRCDIR)/config.h
1745 $(XTCC) -o $(OBJDIR)/tktsetup.o -c $(OBJDIR)/tktsetup_.c
1746
1747 $(OBJDIR)/tktsetup.h: $(OBJDIR)/headers
1748
1749 $(OBJDIR)/undo_.c: $(SRCDIR)/undo.c $(TRANSLATE)
1750 $(TRANSLATE) $(SRCDIR)/undo.c >$(OBJDIR)/undo_.c
1751
1752 $(OBJDIR)/undo.o: $(OBJDIR)/undo_.c $(OBJDIR)/undo.h $(SRCDIR)/config.h
1753 $(XTCC) -o $(OBJDIR)/undo.o -c $(OBJDIR)/undo_.c
1754
1755 $(OBJDIR)/undo.h: $(OBJDIR)/headers
1756
1757 $(OBJDIR)/unicode_.c: $(SRCDIR)/unicode.c $(TRANSLATE)
1758 $(TRANSLATE) $(SRCDIR)/unicode.c >$(OBJDIR)/unicode_.c
1759
1760 $(OBJDIR)/unicode.o: $(OBJDIR)/unicode_.c $(OBJDIR)/unicode.h $(SRCDIR)/config.h
1761 $(XTCC) -o $(OBJDIR)/unicode.o -c $(OBJDIR)/unicode_.c
1762
1763 $(OBJDIR)/unicode.h: $(OBJDIR)/headers
1764
1765 $(OBJDIR)/update_.c: $(SRCDIR)/update.c $(TRANSLATE)
1766 $(TRANSLATE) $(SRCDIR)/update.c >$(OBJDIR)/update_.c
1767
1768 $(OBJDIR)/update.o: $(OBJDIR)/update_.c $(OBJDIR)/update.h $(SRCDIR)/config.h
1769 $(XTCC) -o $(OBJDIR)/update.o -c $(OBJDIR)/update_.c
1770
1771 $(OBJDIR)/update.h: $(OBJDIR)/headers
1772
1773 $(OBJDIR)/url_.c: $(SRCDIR)/url.c $(TRANSLATE)
1774 $(TRANSLATE) $(SRCDIR)/url.c >$(OBJDIR)/url_.c
1775
1776 $(OBJDIR)/url.o: $(OBJDIR)/url_.c $(OBJDIR)/url.h $(SRCDIR)/config.h
1777 $(XTCC) -o $(OBJDIR)/url.o -c $(OBJDIR)/url_.c
1778
1779 $(OBJDIR)/url.h: $(OBJDIR)/headers
1780
1781 $(OBJDIR)/user_.c: $(SRCDIR)/user.c $(TRANSLATE)
1782 $(TRANSLATE) $(SRCDIR)/user.c >$(OBJDIR)/user_.c
1783
1784 $(OBJDIR)/user.o: $(OBJDIR)/user_.c $(OBJDIR)/user.h $(SRCDIR)/config.h
1785 $(XTCC) -o $(OBJDIR)/user.o -c $(OBJDIR)/user_.c
1786
1787 $(OBJDIR)/user.h: $(OBJDIR)/headers
1788
1789 $(OBJDIR)/utf8_.c: $(SRCDIR)/utf8.c $(TRANSLATE)
1790 $(TRANSLATE) $(SRCDIR)/utf8.c >$(OBJDIR)/utf8_.c
1791
1792 $(OBJDIR)/utf8.o: $(OBJDIR)/utf8_.c $(OBJDIR)/utf8.h $(SRCDIR)/config.h
1793 $(XTCC) -o $(OBJDIR)/utf8.o -c $(OBJDIR)/utf8_.c
1794
1795 $(OBJDIR)/utf8.h: $(OBJDIR)/headers
1796
1797 $(OBJDIR)/util_.c: $(SRCDIR)/util.c $(TRANSLATE)
1798 $(TRANSLATE) $(SRCDIR)/util.c >$(OBJDIR)/util_.c
1799
1800 $(OBJDIR)/util.o: $(OBJDIR)/util_.c $(OBJDIR)/util.h $(SRCDIR)/config.h
1801 $(XTCC) -o $(OBJDIR)/util.o -c $(OBJDIR)/util_.c
1802
1803 $(OBJDIR)/util.h: $(OBJDIR)/headers
1804
1805 $(OBJDIR)/verify_.c: $(SRCDIR)/verify.c $(TRANSLATE)
1806 $(TRANSLATE) $(SRCDIR)/verify.c >$(OBJDIR)/verify_.c
1807
1808 $(OBJDIR)/verify.o: $(OBJDIR)/verify_.c $(OBJDIR)/verify.h $(SRCDIR)/config.h
1809 $(XTCC) -o $(OBJDIR)/verify.o -c $(OBJDIR)/verify_.c
1810
1811 $(OBJDIR)/verify.h: $(OBJDIR)/headers
1812
1813 $(OBJDIR)/vfile_.c: $(SRCDIR)/vfile.c $(TRANSLATE)
1814 $(TRANSLATE) $(SRCDIR)/vfile.c >$(OBJDIR)/vfile_.c
1815
1816 $(OBJDIR)/vfile.o: $(OBJDIR)/vfile_.c $(OBJDIR)/vfile.h $(SRCDIR)/config.h
1817 $(XTCC) -o $(OBJDIR)/vfile.o -c $(OBJDIR)/vfile_.c
1818
1819 $(OBJDIR)/vfile.h: $(OBJDIR)/headers
1820
1821 $(OBJDIR)/wiki_.c: $(SRCDIR)/wiki.c $(TRANSLATE)
1822 $(TRANSLATE) $(SRCDIR)/wiki.c >$(OBJDIR)/wiki_.c
1823
1824 $(OBJDIR)/wiki.o: $(OBJDIR)/wiki_.c $(OBJDIR)/wiki.h $(SRCDIR)/config.h
1825 $(XTCC) -o $(OBJDIR)/wiki.o -c $(OBJDIR)/wiki_.c
1826
1827 $(OBJDIR)/wiki.h: $(OBJDIR)/headers
1828
1829 $(OBJDIR)/wikiformat_.c: $(SRCDIR)/wikiformat.c $(TRANSLATE)
1830 $(TRANSLATE) $(SRCDIR)/wikiformat.c >$(OBJDIR)/wikiformat_.c
1831
1832 $(OBJDIR)/wikiformat.o: $(OBJDIR)/wikiformat_.c $(OBJDIR)/wikiformat.h $(SRCDIR)/config.h
1833 $(XTCC) -o $(OBJDIR)/wikiformat.o -c $(OBJDIR)/wikiformat_.c
1834
1835 $(OBJDIR)/wikiformat.h: $(OBJDIR)/headers
1836
1837 $(OBJDIR)/winfile_.c: $(SRCDIR)/winfile.c $(TRANSLATE)
1838 $(TRANSLATE) $(SRCDIR)/winfile.c >$(OBJDIR)/winfile_.c
1839
1840 $(OBJDIR)/winfile.o: $(OBJDIR)/winfile_.c $(OBJDIR)/winfile.h $(SRCDIR)/config.h
1841 $(XTCC) -o $(OBJDIR)/winfile.o -c $(OBJDIR)/winfile_.c
1842
1843 $(OBJDIR)/winfile.h: $(OBJDIR)/headers
1844
1845 $(OBJDIR)/winhttp_.c: $(SRCDIR)/winhttp.c $(TRANSLATE)
1846 $(TRANSLATE) $(SRCDIR)/winhttp.c >$(OBJDIR)/winhttp_.c
1847
1848 $(OBJDIR)/winhttp.o: $(OBJDIR)/winhttp_.c $(OBJDIR)/winhttp.h $(SRCDIR)/config.h
1849 $(XTCC) -o $(OBJDIR)/winhttp.o -c $(OBJDIR)/winhttp_.c
1850
1851 $(OBJDIR)/winhttp.h: $(OBJDIR)/headers
1852
1853 $(OBJDIR)/wysiwyg_.c: $(SRCDIR)/wysiwyg.c $(TRANSLATE)
1854 $(TRANSLATE) $(SRCDIR)/wysiwyg.c >$(OBJDIR)/wysiwyg_.c
1855
1856 $(OBJDIR)/wysiwyg.o: $(OBJDIR)/wysiwyg_.c $(OBJDIR)/wysiwyg.h $(SRCDIR)/config.h
1857 $(XTCC) -o $(OBJDIR)/wysiwyg.o -c $(OBJDIR)/wysiwyg_.c
1858
1859 $(OBJDIR)/wysiwyg.h: $(OBJDIR)/headers
1860
1861 $(OBJDIR)/xfer_.c: $(SRCDIR)/xfer.c $(TRANSLATE)
1862 $(TRANSLATE) $(SRCDIR)/xfer.c >$(OBJDIR)/xfer_.c
1863
1864 $(OBJDIR)/xfer.o: $(OBJDIR)/xfer_.c $(OBJDIR)/xfer.h $(SRCDIR)/config.h
1865 $(XTCC) -o $(OBJDIR)/xfer.o -c $(OBJDIR)/xfer_.c
1866
1867 $(OBJDIR)/xfer.h: $(OBJDIR)/headers
1868
1869 $(OBJDIR)/xfersetup_.c: $(SRCDIR)/xfersetup.c $(TRANSLATE)
1870 $(TRANSLATE) $(SRCDIR)/xfersetup.c >$(OBJDIR)/xfersetup_.c
1871
1872 $(OBJDIR)/xfersetup.o: $(OBJDIR)/xfersetup_.c $(OBJDIR)/xfersetup.h $(SRCDIR)/config.h
1873 $(XTCC) -o $(OBJDIR)/xfersetup.o -c $(OBJDIR)/xfersetup_.c
1874
1875 $(OBJDIR)/xfersetup.h: $(OBJDIR)/headers
1876
1877 $(OBJDIR)/zip_.c: $(SRCDIR)/zip.c $(TRANSLATE)
1878 $(TRANSLATE) $(SRCDIR)/zip.c >$(OBJDIR)/zip_.c
1879
1880 $(OBJDIR)/zip.o: $(OBJDIR)/zip_.c $(OBJDIR)/zip.h $(SRCDIR)/config.h
1881 $(XTCC) -o $(OBJDIR)/zip.o -c $(OBJDIR)/zip_.c
1882
1883 $(OBJDIR)/zip.h: $(OBJDIR)/headers
@@ -1906,27 +1924,27 @@
1906 MINIZ_OPTIONS = -DMINIZ_NO_STDIO \
1907 -DMINIZ_NO_TIME \
1908 -DMINIZ_NO_ARCHIVE_APIS
1909
1910 $(OBJDIR)/sqlite3.o: $(SRCDIR)/sqlite3.c $(SRCDIR)/../win/Makefile.mingw.mistachkin
1911 $(XTCC) $(SQLITE_OPTIONS) $(SQLITE_CFLAGS) -c $(SRCDIR)/sqlite3.c -o $(OBJDIR)/sqlite3.o
1912
1913 $(OBJDIR)/cson_amalgamation.o: $(SRCDIR)/cson_amalgamation.c
1914 $(XTCC) -c $(SRCDIR)/cson_amalgamation.c -o $(OBJDIR)/cson_amalgamation.o
1915
1916 $(OBJDIR)/json.o $(OBJDIR)/json_artifact.o $(OBJDIR)/json_branch.o $(OBJDIR)/json_config.o $(OBJDIR)/json_diff.o $(OBJDIR)/json_dir.o $(OBJDIR)/jsos_finfo.o $(OBJDIR)/json_login.o $(OBJDIR)/json_query.o $(OBJDIR)/json_report.o $(OBJDIR)/json_status.o $(OBJDIR)/json_tag.o $(OBJDIR)/json_timeline.o $(OBJDIR)/json_user.o $(OBJDIR)/json_wiki.o : $(SRCDIR)/json_detail.h
1917
1918 $(OBJDIR)/shell.o: $(SRCDIR)/shell.c $(SRCDIR)/sqlite3.h $(SRCDIR)/../win/Makefile.mingw.mistachkin
1919 $(XTCC) $(SHELL_OPTIONS) $(SHELL_CFLAGS) -c $(SRCDIR)/shell.c -o $(OBJDIR)/shell.o
1920
1921 $(OBJDIR)/th.o: $(SRCDIR)/th.c
1922 $(XTCC) -c $(SRCDIR)/th.c -o $(OBJDIR)/th.o
1923
1924 $(OBJDIR)/th_lang.o: $(SRCDIR)/th_lang.c
1925 $(XTCC) -c $(SRCDIR)/th_lang.c -o $(OBJDIR)/th_lang.o
1926
1927 $(OBJDIR)/th_tcl.o: $(SRCDIR)/th_tcl.c
1928 $(XTCC) -c $(SRCDIR)/th_tcl.c -o $(OBJDIR)/th_tcl.o
1929
1930 $(OBJDIR)/miniz.o: $(SRCDIR)/miniz.c
1931 $(XTCC) $(MINIZ_OPTIONS) -c $(SRCDIR)/miniz.c -o $(OBJDIR)/miniz.o
1932
1933
--- win/Makefile.mingw.mistachkin
+++ win/Makefile.mingw.mistachkin
@@ -94,23 +94,35 @@
94 ifndef MINGW_IS_32BIT_ONLY
95 ifeq (,$(findstring w64-mingw32,$(PREFIX)))
96 MINGW_IS_32BIT_ONLY = 1
97 endif
98 endif
 
 
 
 
 
 
 
 
99
100 #### The directories where the zlib include and library files are located.
101 #
102 ZINCDIR = $(SRCDIR)/../compat/zlib
103 ZLIBDIR = $(SRCDIR)/../compat/zlib
104
105 ifndef X64
106 ifneq (,$(findstring x86_64-w64-mingw32,$(PREFIX)))
107 X64 = 1
108 endif
109 endif
110
111 ifndef X64
112 SSLCONFIG = mingw
113 ZLIBCONFIG = LOC="-DASMV -DASMINF" OBJA="inffas86.o match.o"
114 LIBTARGETS = $(ZLIBDIR)/inffas86.o $(ZLIBDIR)/match.o
115 else
116 SSLCONFIG = mingw64
117 ZLIBCONFIG =
118 LIBTARGETS =
119 endif
120
121 ifndef FOSSIL_ENABLE_MINIZ
122 SSLCONFIG += --with-zlib-lib=$(PWD)/$(ZLIBDIR) --with-zlib-include=$(PWD)/$(ZLIBDIR) zlib
123 endif
124
125 #### The directories where the OpenSSL include and library files are located.
126 # The recommended usage here is to use the Sysinternals junction tool
127 # to create a hard link between an "openssl-1.x" sub-directory of the
128 # Fossil source code directory and the target OpenSSL source directory.
@@ -677,11 +689,10 @@
689 $(OBJDIR)/xfersetup.o \
690 $(OBJDIR)/zip.o
691
692 APPNAME = fossil.exe
693 APPTARGETS =
 
694
695 #### If the USE_WINDOWS variable exists, it is assumed that we are building
696 # inside of a Windows-style shell; otherwise, it is assumed that we are
697 # building inside of a Unix-style shell. Note that the "move" command is
698 # broken when attempting to use it from the Windows shell via MinGW make
@@ -749,35 +760,35 @@
760 else
761 $(MKDIR) $(OBJDIR)
762 endif
763
764 $(TRANSLATE): $(SRCDIR)/translate.c
765 $(BCC) -o $@ $(SRCDIR)/translate.c
766
767 $(MAKEHEADERS): $(SRCDIR)/makeheaders.c
768 $(BCC) -o $@ $(SRCDIR)/makeheaders.c
769
770 $(MKINDEX): $(SRCDIR)/mkindex.c
771 $(BCC) -o $@ $(SRCDIR)/mkindex.c
772
773 $(MKBUILTIN): $(SRCDIR)/mkbuiltin.c
774 $(BCC) -o $@ $(SRCDIR)/mkbuiltin.c
775
776 $(MKVERSION): $(SRCDIR)/mkversion.c
777 $(BCC) -o $@ $(SRCDIR)/mkversion.c
778
779 $(CODECHECK1): $(SRCDIR)/codecheck1.c
780 $(BCC) -o $@ $(SRCDIR)/codecheck1.c
781
782 # WARNING. DANGER. Running the test suite modifies the repository the
783 # build is done from, i.e. the checkout belongs to. Do not sync/push
784 # the repository after running the tests.
785 test: $(OBJDIR) $(APPNAME)
786 $(TCLSH) $(SRCDIR)/../test/tester.tcl $(APPNAME)
787
788 $(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(MKVERSION)
789 $(MKVERSION) $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION >$@
790
791 # The USE_SYSTEM_SQLITE variable may be undefined, set to 0, or set
792 # to 1. If it is set to 1, then there is no need to build or link
793 # the sqlite3.o object. Instead, the system SQLite will be linked
794 # using -lsqlite3.
@@ -802,14 +813,21 @@
813 $(OBJDIR)/th_tcl.o \
814 $(OBJDIR)/cson_amalgamation.o
815
816
817 zlib:
818 $(MAKE) -C $(ZLIBDIR) PREFIX=$(PREFIX) $(ZLIBCONFIG) -f win32/Makefile.gcc libz.a
819
820 clean-zlib:
821 $(MAKE) -C $(ZLIBDIR) PREFIX=$(PREFIX) -f win32/Makefile.gcc clean
822
823 $(ZLIBDIR)/inffas86.o:
824 $(TCC) -c -o $@ -DASMINF -I$(ZLIBDIR) -O3 $(ZLIBDIR)/contrib/inflate86/inffas86.c
825
826 $(ZLIBDIR)/match.o:
827 $(TCC) -c -o $@ -DASMV $(ZLIBDIR)/contrib/asm686/match.S
828
829
830 ifndef FOSSIL_ENABLE_MINIZ
831 LIBTARGETS += zlib
832 endif
833
@@ -833,11 +851,11 @@
851 APPTARGETS += openssl
852 endif
853
854 $(APPNAME): $(OBJDIR)/headers $(CODECHECK1) $(OBJ) $(EXTRAOBJ) $(OBJDIR)/fossil.o $(APPTARGETS)
855 $(CODECHECK1) $(TRANS_SRC)
856 $(TCC) -o $@ $(OBJ) $(EXTRAOBJ) $(LIB) $(OBJDIR)/fossil.o
857
858 # This rule prevents make from using its default rules to try build
859 # an executable named "manifest" out of the file named "manifest.c"
860 #
861 $(SRCDIR)/../manifest:
@@ -985,899 +1003,899 @@
1003 $(OBJDIR)/headers: Makefile
1004
1005 Makefile:
1006
1007 $(OBJDIR)/add_.c: $(SRCDIR)/add.c $(TRANSLATE)
1008 $(TRANSLATE) $(SRCDIR)/add.c >$@
1009
1010 $(OBJDIR)/add.o: $(OBJDIR)/add_.c $(OBJDIR)/add.h $(SRCDIR)/config.h
1011 $(XTCC) -o $(OBJDIR)/add.o -c $(OBJDIR)/add_.c
1012
1013 $(OBJDIR)/add.h: $(OBJDIR)/headers
1014
1015 $(OBJDIR)/allrepo_.c: $(SRCDIR)/allrepo.c $(TRANSLATE)
1016 $(TRANSLATE) $(SRCDIR)/allrepo.c >$@
1017
1018 $(OBJDIR)/allrepo.o: $(OBJDIR)/allrepo_.c $(OBJDIR)/allrepo.h $(SRCDIR)/config.h
1019 $(XTCC) -o $(OBJDIR)/allrepo.o -c $(OBJDIR)/allrepo_.c
1020
1021 $(OBJDIR)/allrepo.h: $(OBJDIR)/headers
1022
1023 $(OBJDIR)/attach_.c: $(SRCDIR)/attach.c $(TRANSLATE)
1024 $(TRANSLATE) $(SRCDIR)/attach.c >$@
1025
1026 $(OBJDIR)/attach.o: $(OBJDIR)/attach_.c $(OBJDIR)/attach.h $(SRCDIR)/config.h
1027 $(XTCC) -o $(OBJDIR)/attach.o -c $(OBJDIR)/attach_.c
1028
1029 $(OBJDIR)/attach.h: $(OBJDIR)/headers
1030
1031 $(OBJDIR)/bag_.c: $(SRCDIR)/bag.c $(TRANSLATE)
1032 $(TRANSLATE) $(SRCDIR)/bag.c >$@
1033
1034 $(OBJDIR)/bag.o: $(OBJDIR)/bag_.c $(OBJDIR)/bag.h $(SRCDIR)/config.h
1035 $(XTCC) -o $(OBJDIR)/bag.o -c $(OBJDIR)/bag_.c
1036
1037 $(OBJDIR)/bag.h: $(OBJDIR)/headers
1038
1039 $(OBJDIR)/bisect_.c: $(SRCDIR)/bisect.c $(TRANSLATE)
1040 $(TRANSLATE) $(SRCDIR)/bisect.c >$@
1041
1042 $(OBJDIR)/bisect.o: $(OBJDIR)/bisect_.c $(OBJDIR)/bisect.h $(SRCDIR)/config.h
1043 $(XTCC) -o $(OBJDIR)/bisect.o -c $(OBJDIR)/bisect_.c
1044
1045 $(OBJDIR)/bisect.h: $(OBJDIR)/headers
1046
1047 $(OBJDIR)/blob_.c: $(SRCDIR)/blob.c $(TRANSLATE)
1048 $(TRANSLATE) $(SRCDIR)/blob.c >$@
1049
1050 $(OBJDIR)/blob.o: $(OBJDIR)/blob_.c $(OBJDIR)/blob.h $(SRCDIR)/config.h
1051 $(XTCC) -o $(OBJDIR)/blob.o -c $(OBJDIR)/blob_.c
1052
1053 $(OBJDIR)/blob.h: $(OBJDIR)/headers
1054
1055 $(OBJDIR)/branch_.c: $(SRCDIR)/branch.c $(TRANSLATE)
1056 $(TRANSLATE) $(SRCDIR)/branch.c >$@
1057
1058 $(OBJDIR)/branch.o: $(OBJDIR)/branch_.c $(OBJDIR)/branch.h $(SRCDIR)/config.h
1059 $(XTCC) -o $(OBJDIR)/branch.o -c $(OBJDIR)/branch_.c
1060
1061 $(OBJDIR)/branch.h: $(OBJDIR)/headers
1062
1063 $(OBJDIR)/browse_.c: $(SRCDIR)/browse.c $(TRANSLATE)
1064 $(TRANSLATE) $(SRCDIR)/browse.c >$@
1065
1066 $(OBJDIR)/browse.o: $(OBJDIR)/browse_.c $(OBJDIR)/browse.h $(SRCDIR)/config.h
1067 $(XTCC) -o $(OBJDIR)/browse.o -c $(OBJDIR)/browse_.c
1068
1069 $(OBJDIR)/browse.h: $(OBJDIR)/headers
1070
1071 $(OBJDIR)/builtin_.c: $(SRCDIR)/builtin.c $(TRANSLATE)
1072 $(TRANSLATE) $(SRCDIR)/builtin.c >$@
1073
1074 $(OBJDIR)/builtin.o: $(OBJDIR)/builtin_.c $(OBJDIR)/builtin.h $(OBJDIR)/builtin_data.h $(SRCDIR)/config.h
1075 $(XTCC) -o $(OBJDIR)/builtin.o -c $(OBJDIR)/builtin_.c
1076
1077 $(OBJDIR)/builtin.h: $(OBJDIR)/headers
1078
1079 $(OBJDIR)/cache_.c: $(SRCDIR)/cache.c $(TRANSLATE)
1080 $(TRANSLATE) $(SRCDIR)/cache.c >$@
1081
1082 $(OBJDIR)/cache.o: $(OBJDIR)/cache_.c $(OBJDIR)/cache.h $(SRCDIR)/config.h
1083 $(XTCC) -o $(OBJDIR)/cache.o -c $(OBJDIR)/cache_.c
1084
1085 $(OBJDIR)/cache.h: $(OBJDIR)/headers
1086
1087 $(OBJDIR)/captcha_.c: $(SRCDIR)/captcha.c $(TRANSLATE)
1088 $(TRANSLATE) $(SRCDIR)/captcha.c >$@
1089
1090 $(OBJDIR)/captcha.o: $(OBJDIR)/captcha_.c $(OBJDIR)/captcha.h $(SRCDIR)/config.h
1091 $(XTCC) -o $(OBJDIR)/captcha.o -c $(OBJDIR)/captcha_.c
1092
1093 $(OBJDIR)/captcha.h: $(OBJDIR)/headers
1094
1095 $(OBJDIR)/cgi_.c: $(SRCDIR)/cgi.c $(TRANSLATE)
1096 $(TRANSLATE) $(SRCDIR)/cgi.c >$@
1097
1098 $(OBJDIR)/cgi.o: $(OBJDIR)/cgi_.c $(OBJDIR)/cgi.h $(SRCDIR)/config.h
1099 $(XTCC) -o $(OBJDIR)/cgi.o -c $(OBJDIR)/cgi_.c
1100
1101 $(OBJDIR)/cgi.h: $(OBJDIR)/headers
1102
1103 $(OBJDIR)/checkin_.c: $(SRCDIR)/checkin.c $(TRANSLATE)
1104 $(TRANSLATE) $(SRCDIR)/checkin.c >$@
1105
1106 $(OBJDIR)/checkin.o: $(OBJDIR)/checkin_.c $(OBJDIR)/checkin.h $(SRCDIR)/config.h
1107 $(XTCC) -o $(OBJDIR)/checkin.o -c $(OBJDIR)/checkin_.c
1108
1109 $(OBJDIR)/checkin.h: $(OBJDIR)/headers
1110
1111 $(OBJDIR)/checkout_.c: $(SRCDIR)/checkout.c $(TRANSLATE)
1112 $(TRANSLATE) $(SRCDIR)/checkout.c >$@
1113
1114 $(OBJDIR)/checkout.o: $(OBJDIR)/checkout_.c $(OBJDIR)/checkout.h $(SRCDIR)/config.h
1115 $(XTCC) -o $(OBJDIR)/checkout.o -c $(OBJDIR)/checkout_.c
1116
1117 $(OBJDIR)/checkout.h: $(OBJDIR)/headers
1118
1119 $(OBJDIR)/clearsign_.c: $(SRCDIR)/clearsign.c $(TRANSLATE)
1120 $(TRANSLATE) $(SRCDIR)/clearsign.c >$@
1121
1122 $(OBJDIR)/clearsign.o: $(OBJDIR)/clearsign_.c $(OBJDIR)/clearsign.h $(SRCDIR)/config.h
1123 $(XTCC) -o $(OBJDIR)/clearsign.o -c $(OBJDIR)/clearsign_.c
1124
1125 $(OBJDIR)/clearsign.h: $(OBJDIR)/headers
1126
1127 $(OBJDIR)/clone_.c: $(SRCDIR)/clone.c $(TRANSLATE)
1128 $(TRANSLATE) $(SRCDIR)/clone.c >$@
1129
1130 $(OBJDIR)/clone.o: $(OBJDIR)/clone_.c $(OBJDIR)/clone.h $(SRCDIR)/config.h
1131 $(XTCC) -o $(OBJDIR)/clone.o -c $(OBJDIR)/clone_.c
1132
1133 $(OBJDIR)/clone.h: $(OBJDIR)/headers
1134
1135 $(OBJDIR)/comformat_.c: $(SRCDIR)/comformat.c $(TRANSLATE)
1136 $(TRANSLATE) $(SRCDIR)/comformat.c >$@
1137
1138 $(OBJDIR)/comformat.o: $(OBJDIR)/comformat_.c $(OBJDIR)/comformat.h $(SRCDIR)/config.h
1139 $(XTCC) -o $(OBJDIR)/comformat.o -c $(OBJDIR)/comformat_.c
1140
1141 $(OBJDIR)/comformat.h: $(OBJDIR)/headers
1142
1143 $(OBJDIR)/configure_.c: $(SRCDIR)/configure.c $(TRANSLATE)
1144 $(TRANSLATE) $(SRCDIR)/configure.c >$@
1145
1146 $(OBJDIR)/configure.o: $(OBJDIR)/configure_.c $(OBJDIR)/configure.h $(SRCDIR)/config.h
1147 $(XTCC) -o $(OBJDIR)/configure.o -c $(OBJDIR)/configure_.c
1148
1149 $(OBJDIR)/configure.h: $(OBJDIR)/headers
1150
1151 $(OBJDIR)/content_.c: $(SRCDIR)/content.c $(TRANSLATE)
1152 $(TRANSLATE) $(SRCDIR)/content.c >$@
1153
1154 $(OBJDIR)/content.o: $(OBJDIR)/content_.c $(OBJDIR)/content.h $(SRCDIR)/config.h
1155 $(XTCC) -o $(OBJDIR)/content.o -c $(OBJDIR)/content_.c
1156
1157 $(OBJDIR)/content.h: $(OBJDIR)/headers
1158
1159 $(OBJDIR)/db_.c: $(SRCDIR)/db.c $(TRANSLATE)
1160 $(TRANSLATE) $(SRCDIR)/db.c >$@
1161
1162 $(OBJDIR)/db.o: $(OBJDIR)/db_.c $(OBJDIR)/db.h $(SRCDIR)/config.h
1163 $(XTCC) -o $(OBJDIR)/db.o -c $(OBJDIR)/db_.c
1164
1165 $(OBJDIR)/db.h: $(OBJDIR)/headers
1166
1167 $(OBJDIR)/delta_.c: $(SRCDIR)/delta.c $(TRANSLATE)
1168 $(TRANSLATE) $(SRCDIR)/delta.c >$@
1169
1170 $(OBJDIR)/delta.o: $(OBJDIR)/delta_.c $(OBJDIR)/delta.h $(SRCDIR)/config.h
1171 $(XTCC) -o $(OBJDIR)/delta.o -c $(OBJDIR)/delta_.c
1172
1173 $(OBJDIR)/delta.h: $(OBJDIR)/headers
1174
1175 $(OBJDIR)/deltacmd_.c: $(SRCDIR)/deltacmd.c $(TRANSLATE)
1176 $(TRANSLATE) $(SRCDIR)/deltacmd.c >$@
1177
1178 $(OBJDIR)/deltacmd.o: $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h $(SRCDIR)/config.h
1179 $(XTCC) -o $(OBJDIR)/deltacmd.o -c $(OBJDIR)/deltacmd_.c
1180
1181 $(OBJDIR)/deltacmd.h: $(OBJDIR)/headers
1182
1183 $(OBJDIR)/descendants_.c: $(SRCDIR)/descendants.c $(TRANSLATE)
1184 $(TRANSLATE) $(SRCDIR)/descendants.c >$@
1185
1186 $(OBJDIR)/descendants.o: $(OBJDIR)/descendants_.c $(OBJDIR)/descendants.h $(SRCDIR)/config.h
1187 $(XTCC) -o $(OBJDIR)/descendants.o -c $(OBJDIR)/descendants_.c
1188
1189 $(OBJDIR)/descendants.h: $(OBJDIR)/headers
1190
1191 $(OBJDIR)/diff_.c: $(SRCDIR)/diff.c $(TRANSLATE)
1192 $(TRANSLATE) $(SRCDIR)/diff.c >$@
1193
1194 $(OBJDIR)/diff.o: $(OBJDIR)/diff_.c $(OBJDIR)/diff.h $(SRCDIR)/config.h
1195 $(XTCC) -o $(OBJDIR)/diff.o -c $(OBJDIR)/diff_.c
1196
1197 $(OBJDIR)/diff.h: $(OBJDIR)/headers
1198
1199 $(OBJDIR)/diffcmd_.c: $(SRCDIR)/diffcmd.c $(TRANSLATE)
1200 $(TRANSLATE) $(SRCDIR)/diffcmd.c >$@
1201
1202 $(OBJDIR)/diffcmd.o: $(OBJDIR)/diffcmd_.c $(OBJDIR)/diffcmd.h $(SRCDIR)/config.h
1203 $(XTCC) -o $(OBJDIR)/diffcmd.o -c $(OBJDIR)/diffcmd_.c
1204
1205 $(OBJDIR)/diffcmd.h: $(OBJDIR)/headers
1206
1207 $(OBJDIR)/doc_.c: $(SRCDIR)/doc.c $(TRANSLATE)
1208 $(TRANSLATE) $(SRCDIR)/doc.c >$@
1209
1210 $(OBJDIR)/doc.o: $(OBJDIR)/doc_.c $(OBJDIR)/doc.h $(SRCDIR)/config.h
1211 $(XTCC) -o $(OBJDIR)/doc.o -c $(OBJDIR)/doc_.c
1212
1213 $(OBJDIR)/doc.h: $(OBJDIR)/headers
1214
1215 $(OBJDIR)/encode_.c: $(SRCDIR)/encode.c $(TRANSLATE)
1216 $(TRANSLATE) $(SRCDIR)/encode.c >$@
1217
1218 $(OBJDIR)/encode.o: $(OBJDIR)/encode_.c $(OBJDIR)/encode.h $(SRCDIR)/config.h
1219 $(XTCC) -o $(OBJDIR)/encode.o -c $(OBJDIR)/encode_.c
1220
1221 $(OBJDIR)/encode.h: $(OBJDIR)/headers
1222
1223 $(OBJDIR)/event_.c: $(SRCDIR)/event.c $(TRANSLATE)
1224 $(TRANSLATE) $(SRCDIR)/event.c >$@
1225
1226 $(OBJDIR)/event.o: $(OBJDIR)/event_.c $(OBJDIR)/event.h $(SRCDIR)/config.h
1227 $(XTCC) -o $(OBJDIR)/event.o -c $(OBJDIR)/event_.c
1228
1229 $(OBJDIR)/event.h: $(OBJDIR)/headers
1230
1231 $(OBJDIR)/export_.c: $(SRCDIR)/export.c $(TRANSLATE)
1232 $(TRANSLATE) $(SRCDIR)/export.c >$@
1233
1234 $(OBJDIR)/export.o: $(OBJDIR)/export_.c $(OBJDIR)/export.h $(SRCDIR)/config.h
1235 $(XTCC) -o $(OBJDIR)/export.o -c $(OBJDIR)/export_.c
1236
1237 $(OBJDIR)/export.h: $(OBJDIR)/headers
1238
1239 $(OBJDIR)/file_.c: $(SRCDIR)/file.c $(TRANSLATE)
1240 $(TRANSLATE) $(SRCDIR)/file.c >$@
1241
1242 $(OBJDIR)/file.o: $(OBJDIR)/file_.c $(OBJDIR)/file.h $(SRCDIR)/config.h
1243 $(XTCC) -o $(OBJDIR)/file.o -c $(OBJDIR)/file_.c
1244
1245 $(OBJDIR)/file.h: $(OBJDIR)/headers
1246
1247 $(OBJDIR)/finfo_.c: $(SRCDIR)/finfo.c $(TRANSLATE)
1248 $(TRANSLATE) $(SRCDIR)/finfo.c >$@
1249
1250 $(OBJDIR)/finfo.o: $(OBJDIR)/finfo_.c $(OBJDIR)/finfo.h $(SRCDIR)/config.h
1251 $(XTCC) -o $(OBJDIR)/finfo.o -c $(OBJDIR)/finfo_.c
1252
1253 $(OBJDIR)/finfo.h: $(OBJDIR)/headers
1254
1255 $(OBJDIR)/fusefs_.c: $(SRCDIR)/fusefs.c $(TRANSLATE)
1256 $(TRANSLATE) $(SRCDIR)/fusefs.c >$@
1257
1258 $(OBJDIR)/fusefs.o: $(OBJDIR)/fusefs_.c $(OBJDIR)/fusefs.h $(SRCDIR)/config.h
1259 $(XTCC) -o $(OBJDIR)/fusefs.o -c $(OBJDIR)/fusefs_.c
1260
1261 $(OBJDIR)/fusefs.h: $(OBJDIR)/headers
1262
1263 $(OBJDIR)/glob_.c: $(SRCDIR)/glob.c $(TRANSLATE)
1264 $(TRANSLATE) $(SRCDIR)/glob.c >$@
1265
1266 $(OBJDIR)/glob.o: $(OBJDIR)/glob_.c $(OBJDIR)/glob.h $(SRCDIR)/config.h
1267 $(XTCC) -o $(OBJDIR)/glob.o -c $(OBJDIR)/glob_.c
1268
1269 $(OBJDIR)/glob.h: $(OBJDIR)/headers
1270
1271 $(OBJDIR)/graph_.c: $(SRCDIR)/graph.c $(TRANSLATE)
1272 $(TRANSLATE) $(SRCDIR)/graph.c >$@
1273
1274 $(OBJDIR)/graph.o: $(OBJDIR)/graph_.c $(OBJDIR)/graph.h $(SRCDIR)/config.h
1275 $(XTCC) -o $(OBJDIR)/graph.o -c $(OBJDIR)/graph_.c
1276
1277 $(OBJDIR)/graph.h: $(OBJDIR)/headers
1278
1279 $(OBJDIR)/gzip_.c: $(SRCDIR)/gzip.c $(TRANSLATE)
1280 $(TRANSLATE) $(SRCDIR)/gzip.c >$@
1281
1282 $(OBJDIR)/gzip.o: $(OBJDIR)/gzip_.c $(OBJDIR)/gzip.h $(SRCDIR)/config.h
1283 $(XTCC) -o $(OBJDIR)/gzip.o -c $(OBJDIR)/gzip_.c
1284
1285 $(OBJDIR)/gzip.h: $(OBJDIR)/headers
1286
1287 $(OBJDIR)/http_.c: $(SRCDIR)/http.c $(TRANSLATE)
1288 $(TRANSLATE) $(SRCDIR)/http.c >$@
1289
1290 $(OBJDIR)/http.o: $(OBJDIR)/http_.c $(OBJDIR)/http.h $(SRCDIR)/config.h
1291 $(XTCC) -o $(OBJDIR)/http.o -c $(OBJDIR)/http_.c
1292
1293 $(OBJDIR)/http.h: $(OBJDIR)/headers
1294
1295 $(OBJDIR)/http_socket_.c: $(SRCDIR)/http_socket.c $(TRANSLATE)
1296 $(TRANSLATE) $(SRCDIR)/http_socket.c >$@
1297
1298 $(OBJDIR)/http_socket.o: $(OBJDIR)/http_socket_.c $(OBJDIR)/http_socket.h $(SRCDIR)/config.h
1299 $(XTCC) -o $(OBJDIR)/http_socket.o -c $(OBJDIR)/http_socket_.c
1300
1301 $(OBJDIR)/http_socket.h: $(OBJDIR)/headers
1302
1303 $(OBJDIR)/http_ssl_.c: $(SRCDIR)/http_ssl.c $(TRANSLATE)
1304 $(TRANSLATE) $(SRCDIR)/http_ssl.c >$@
1305
1306 $(OBJDIR)/http_ssl.o: $(OBJDIR)/http_ssl_.c $(OBJDIR)/http_ssl.h $(SRCDIR)/config.h
1307 $(XTCC) -o $(OBJDIR)/http_ssl.o -c $(OBJDIR)/http_ssl_.c
1308
1309 $(OBJDIR)/http_ssl.h: $(OBJDIR)/headers
1310
1311 $(OBJDIR)/http_transport_.c: $(SRCDIR)/http_transport.c $(TRANSLATE)
1312 $(TRANSLATE) $(SRCDIR)/http_transport.c >$@
1313
1314 $(OBJDIR)/http_transport.o: $(OBJDIR)/http_transport_.c $(OBJDIR)/http_transport.h $(SRCDIR)/config.h
1315 $(XTCC) -o $(OBJDIR)/http_transport.o -c $(OBJDIR)/http_transport_.c
1316
1317 $(OBJDIR)/http_transport.h: $(OBJDIR)/headers
1318
1319 $(OBJDIR)/import_.c: $(SRCDIR)/import.c $(TRANSLATE)
1320 $(TRANSLATE) $(SRCDIR)/import.c >$@
1321
1322 $(OBJDIR)/import.o: $(OBJDIR)/import_.c $(OBJDIR)/import.h $(SRCDIR)/config.h
1323 $(XTCC) -o $(OBJDIR)/import.o -c $(OBJDIR)/import_.c
1324
1325 $(OBJDIR)/import.h: $(OBJDIR)/headers
1326
1327 $(OBJDIR)/info_.c: $(SRCDIR)/info.c $(TRANSLATE)
1328 $(TRANSLATE) $(SRCDIR)/info.c >$@
1329
1330 $(OBJDIR)/info.o: $(OBJDIR)/info_.c $(OBJDIR)/info.h $(SRCDIR)/config.h
1331 $(XTCC) -o $(OBJDIR)/info.o -c $(OBJDIR)/info_.c
1332
1333 $(OBJDIR)/info.h: $(OBJDIR)/headers
1334
1335 $(OBJDIR)/json_.c: $(SRCDIR)/json.c $(TRANSLATE)
1336 $(TRANSLATE) $(SRCDIR)/json.c >$@
1337
1338 $(OBJDIR)/json.o: $(OBJDIR)/json_.c $(OBJDIR)/json.h $(SRCDIR)/config.h
1339 $(XTCC) -o $(OBJDIR)/json.o -c $(OBJDIR)/json_.c
1340
1341 $(OBJDIR)/json.h: $(OBJDIR)/headers
1342
1343 $(OBJDIR)/json_artifact_.c: $(SRCDIR)/json_artifact.c $(TRANSLATE)
1344 $(TRANSLATE) $(SRCDIR)/json_artifact.c >$@
1345
1346 $(OBJDIR)/json_artifact.o: $(OBJDIR)/json_artifact_.c $(OBJDIR)/json_artifact.h $(SRCDIR)/config.h
1347 $(XTCC) -o $(OBJDIR)/json_artifact.o -c $(OBJDIR)/json_artifact_.c
1348
1349 $(OBJDIR)/json_artifact.h: $(OBJDIR)/headers
1350
1351 $(OBJDIR)/json_branch_.c: $(SRCDIR)/json_branch.c $(TRANSLATE)
1352 $(TRANSLATE) $(SRCDIR)/json_branch.c >$@
1353
1354 $(OBJDIR)/json_branch.o: $(OBJDIR)/json_branch_.c $(OBJDIR)/json_branch.h $(SRCDIR)/config.h
1355 $(XTCC) -o $(OBJDIR)/json_branch.o -c $(OBJDIR)/json_branch_.c
1356
1357 $(OBJDIR)/json_branch.h: $(OBJDIR)/headers
1358
1359 $(OBJDIR)/json_config_.c: $(SRCDIR)/json_config.c $(TRANSLATE)
1360 $(TRANSLATE) $(SRCDIR)/json_config.c >$@
1361
1362 $(OBJDIR)/json_config.o: $(OBJDIR)/json_config_.c $(OBJDIR)/json_config.h $(SRCDIR)/config.h
1363 $(XTCC) -o $(OBJDIR)/json_config.o -c $(OBJDIR)/json_config_.c
1364
1365 $(OBJDIR)/json_config.h: $(OBJDIR)/headers
1366
1367 $(OBJDIR)/json_diff_.c: $(SRCDIR)/json_diff.c $(TRANSLATE)
1368 $(TRANSLATE) $(SRCDIR)/json_diff.c >$@
1369
1370 $(OBJDIR)/json_diff.o: $(OBJDIR)/json_diff_.c $(OBJDIR)/json_diff.h $(SRCDIR)/config.h
1371 $(XTCC) -o $(OBJDIR)/json_diff.o -c $(OBJDIR)/json_diff_.c
1372
1373 $(OBJDIR)/json_diff.h: $(OBJDIR)/headers
1374
1375 $(OBJDIR)/json_dir_.c: $(SRCDIR)/json_dir.c $(TRANSLATE)
1376 $(TRANSLATE) $(SRCDIR)/json_dir.c >$@
1377
1378 $(OBJDIR)/json_dir.o: $(OBJDIR)/json_dir_.c $(OBJDIR)/json_dir.h $(SRCDIR)/config.h
1379 $(XTCC) -o $(OBJDIR)/json_dir.o -c $(OBJDIR)/json_dir_.c
1380
1381 $(OBJDIR)/json_dir.h: $(OBJDIR)/headers
1382
1383 $(OBJDIR)/json_finfo_.c: $(SRCDIR)/json_finfo.c $(TRANSLATE)
1384 $(TRANSLATE) $(SRCDIR)/json_finfo.c >$@
1385
1386 $(OBJDIR)/json_finfo.o: $(OBJDIR)/json_finfo_.c $(OBJDIR)/json_finfo.h $(SRCDIR)/config.h
1387 $(XTCC) -o $(OBJDIR)/json_finfo.o -c $(OBJDIR)/json_finfo_.c
1388
1389 $(OBJDIR)/json_finfo.h: $(OBJDIR)/headers
1390
1391 $(OBJDIR)/json_login_.c: $(SRCDIR)/json_login.c $(TRANSLATE)
1392 $(TRANSLATE) $(SRCDIR)/json_login.c >$@
1393
1394 $(OBJDIR)/json_login.o: $(OBJDIR)/json_login_.c $(OBJDIR)/json_login.h $(SRCDIR)/config.h
1395 $(XTCC) -o $(OBJDIR)/json_login.o -c $(OBJDIR)/json_login_.c
1396
1397 $(OBJDIR)/json_login.h: $(OBJDIR)/headers
1398
1399 $(OBJDIR)/json_query_.c: $(SRCDIR)/json_query.c $(TRANSLATE)
1400 $(TRANSLATE) $(SRCDIR)/json_query.c >$@
1401
1402 $(OBJDIR)/json_query.o: $(OBJDIR)/json_query_.c $(OBJDIR)/json_query.h $(SRCDIR)/config.h
1403 $(XTCC) -o $(OBJDIR)/json_query.o -c $(OBJDIR)/json_query_.c
1404
1405 $(OBJDIR)/json_query.h: $(OBJDIR)/headers
1406
1407 $(OBJDIR)/json_report_.c: $(SRCDIR)/json_report.c $(TRANSLATE)
1408 $(TRANSLATE) $(SRCDIR)/json_report.c >$@
1409
1410 $(OBJDIR)/json_report.o: $(OBJDIR)/json_report_.c $(OBJDIR)/json_report.h $(SRCDIR)/config.h
1411 $(XTCC) -o $(OBJDIR)/json_report.o -c $(OBJDIR)/json_report_.c
1412
1413 $(OBJDIR)/json_report.h: $(OBJDIR)/headers
1414
1415 $(OBJDIR)/json_status_.c: $(SRCDIR)/json_status.c $(TRANSLATE)
1416 $(TRANSLATE) $(SRCDIR)/json_status.c >$@
1417
1418 $(OBJDIR)/json_status.o: $(OBJDIR)/json_status_.c $(OBJDIR)/json_status.h $(SRCDIR)/config.h
1419 $(XTCC) -o $(OBJDIR)/json_status.o -c $(OBJDIR)/json_status_.c
1420
1421 $(OBJDIR)/json_status.h: $(OBJDIR)/headers
1422
1423 $(OBJDIR)/json_tag_.c: $(SRCDIR)/json_tag.c $(TRANSLATE)
1424 $(TRANSLATE) $(SRCDIR)/json_tag.c >$@
1425
1426 $(OBJDIR)/json_tag.o: $(OBJDIR)/json_tag_.c $(OBJDIR)/json_tag.h $(SRCDIR)/config.h
1427 $(XTCC) -o $(OBJDIR)/json_tag.o -c $(OBJDIR)/json_tag_.c
1428
1429 $(OBJDIR)/json_tag.h: $(OBJDIR)/headers
1430
1431 $(OBJDIR)/json_timeline_.c: $(SRCDIR)/json_timeline.c $(TRANSLATE)
1432 $(TRANSLATE) $(SRCDIR)/json_timeline.c >$@
1433
1434 $(OBJDIR)/json_timeline.o: $(OBJDIR)/json_timeline_.c $(OBJDIR)/json_timeline.h $(SRCDIR)/config.h
1435 $(XTCC) -o $(OBJDIR)/json_timeline.o -c $(OBJDIR)/json_timeline_.c
1436
1437 $(OBJDIR)/json_timeline.h: $(OBJDIR)/headers
1438
1439 $(OBJDIR)/json_user_.c: $(SRCDIR)/json_user.c $(TRANSLATE)
1440 $(TRANSLATE) $(SRCDIR)/json_user.c >$@
1441
1442 $(OBJDIR)/json_user.o: $(OBJDIR)/json_user_.c $(OBJDIR)/json_user.h $(SRCDIR)/config.h
1443 $(XTCC) -o $(OBJDIR)/json_user.o -c $(OBJDIR)/json_user_.c
1444
1445 $(OBJDIR)/json_user.h: $(OBJDIR)/headers
1446
1447 $(OBJDIR)/json_wiki_.c: $(SRCDIR)/json_wiki.c $(TRANSLATE)
1448 $(TRANSLATE) $(SRCDIR)/json_wiki.c >$@
1449
1450 $(OBJDIR)/json_wiki.o: $(OBJDIR)/json_wiki_.c $(OBJDIR)/json_wiki.h $(SRCDIR)/config.h
1451 $(XTCC) -o $(OBJDIR)/json_wiki.o -c $(OBJDIR)/json_wiki_.c
1452
1453 $(OBJDIR)/json_wiki.h: $(OBJDIR)/headers
1454
1455 $(OBJDIR)/leaf_.c: $(SRCDIR)/leaf.c $(TRANSLATE)
1456 $(TRANSLATE) $(SRCDIR)/leaf.c >$@
1457
1458 $(OBJDIR)/leaf.o: $(OBJDIR)/leaf_.c $(OBJDIR)/leaf.h $(SRCDIR)/config.h
1459 $(XTCC) -o $(OBJDIR)/leaf.o -c $(OBJDIR)/leaf_.c
1460
1461 $(OBJDIR)/leaf.h: $(OBJDIR)/headers
1462
1463 $(OBJDIR)/loadctrl_.c: $(SRCDIR)/loadctrl.c $(TRANSLATE)
1464 $(TRANSLATE) $(SRCDIR)/loadctrl.c >$@
1465
1466 $(OBJDIR)/loadctrl.o: $(OBJDIR)/loadctrl_.c $(OBJDIR)/loadctrl.h $(SRCDIR)/config.h
1467 $(XTCC) -o $(OBJDIR)/loadctrl.o -c $(OBJDIR)/loadctrl_.c
1468
1469 $(OBJDIR)/loadctrl.h: $(OBJDIR)/headers
1470
1471 $(OBJDIR)/login_.c: $(SRCDIR)/login.c $(TRANSLATE)
1472 $(TRANSLATE) $(SRCDIR)/login.c >$@
1473
1474 $(OBJDIR)/login.o: $(OBJDIR)/login_.c $(OBJDIR)/login.h $(SRCDIR)/config.h
1475 $(XTCC) -o $(OBJDIR)/login.o -c $(OBJDIR)/login_.c
1476
1477 $(OBJDIR)/login.h: $(OBJDIR)/headers
1478
1479 $(OBJDIR)/lookslike_.c: $(SRCDIR)/lookslike.c $(TRANSLATE)
1480 $(TRANSLATE) $(SRCDIR)/lookslike.c >$@
1481
1482 $(OBJDIR)/lookslike.o: $(OBJDIR)/lookslike_.c $(OBJDIR)/lookslike.h $(SRCDIR)/config.h
1483 $(XTCC) -o $(OBJDIR)/lookslike.o -c $(OBJDIR)/lookslike_.c
1484
1485 $(OBJDIR)/lookslike.h: $(OBJDIR)/headers
1486
1487 $(OBJDIR)/main_.c: $(SRCDIR)/main.c $(TRANSLATE)
1488 $(TRANSLATE) $(SRCDIR)/main.c >$@
1489
1490 $(OBJDIR)/main.o: $(OBJDIR)/main_.c $(OBJDIR)/main.h $(OBJDIR)/page_index.h $(SRCDIR)/config.h
1491 $(XTCC) -o $(OBJDIR)/main.o -c $(OBJDIR)/main_.c
1492
1493 $(OBJDIR)/main.h: $(OBJDIR)/headers
1494
1495 $(OBJDIR)/manifest_.c: $(SRCDIR)/manifest.c $(TRANSLATE)
1496 $(TRANSLATE) $(SRCDIR)/manifest.c >$@
1497
1498 $(OBJDIR)/manifest.o: $(OBJDIR)/manifest_.c $(OBJDIR)/manifest.h $(SRCDIR)/config.h
1499 $(XTCC) -o $(OBJDIR)/manifest.o -c $(OBJDIR)/manifest_.c
1500
1501 $(OBJDIR)/manifest.h: $(OBJDIR)/headers
1502
1503 $(OBJDIR)/markdown_.c: $(SRCDIR)/markdown.c $(TRANSLATE)
1504 $(TRANSLATE) $(SRCDIR)/markdown.c >$@
1505
1506 $(OBJDIR)/markdown.o: $(OBJDIR)/markdown_.c $(OBJDIR)/markdown.h $(SRCDIR)/config.h
1507 $(XTCC) -o $(OBJDIR)/markdown.o -c $(OBJDIR)/markdown_.c
1508
1509 $(OBJDIR)/markdown.h: $(OBJDIR)/headers
1510
1511 $(OBJDIR)/markdown_html_.c: $(SRCDIR)/markdown_html.c $(TRANSLATE)
1512 $(TRANSLATE) $(SRCDIR)/markdown_html.c >$@
1513
1514 $(OBJDIR)/markdown_html.o: $(OBJDIR)/markdown_html_.c $(OBJDIR)/markdown_html.h $(SRCDIR)/config.h
1515 $(XTCC) -o $(OBJDIR)/markdown_html.o -c $(OBJDIR)/markdown_html_.c
1516
1517 $(OBJDIR)/markdown_html.h: $(OBJDIR)/headers
1518
1519 $(OBJDIR)/md5_.c: $(SRCDIR)/md5.c $(TRANSLATE)
1520 $(TRANSLATE) $(SRCDIR)/md5.c >$@
1521
1522 $(OBJDIR)/md5.o: $(OBJDIR)/md5_.c $(OBJDIR)/md5.h $(SRCDIR)/config.h
1523 $(XTCC) -o $(OBJDIR)/md5.o -c $(OBJDIR)/md5_.c
1524
1525 $(OBJDIR)/md5.h: $(OBJDIR)/headers
1526
1527 $(OBJDIR)/merge_.c: $(SRCDIR)/merge.c $(TRANSLATE)
1528 $(TRANSLATE) $(SRCDIR)/merge.c >$@
1529
1530 $(OBJDIR)/merge.o: $(OBJDIR)/merge_.c $(OBJDIR)/merge.h $(SRCDIR)/config.h
1531 $(XTCC) -o $(OBJDIR)/merge.o -c $(OBJDIR)/merge_.c
1532
1533 $(OBJDIR)/merge.h: $(OBJDIR)/headers
1534
1535 $(OBJDIR)/merge3_.c: $(SRCDIR)/merge3.c $(TRANSLATE)
1536 $(TRANSLATE) $(SRCDIR)/merge3.c >$@
1537
1538 $(OBJDIR)/merge3.o: $(OBJDIR)/merge3_.c $(OBJDIR)/merge3.h $(SRCDIR)/config.h
1539 $(XTCC) -o $(OBJDIR)/merge3.o -c $(OBJDIR)/merge3_.c
1540
1541 $(OBJDIR)/merge3.h: $(OBJDIR)/headers
1542
1543 $(OBJDIR)/moderate_.c: $(SRCDIR)/moderate.c $(TRANSLATE)
1544 $(TRANSLATE) $(SRCDIR)/moderate.c >$@
1545
1546 $(OBJDIR)/moderate.o: $(OBJDIR)/moderate_.c $(OBJDIR)/moderate.h $(SRCDIR)/config.h
1547 $(XTCC) -o $(OBJDIR)/moderate.o -c $(OBJDIR)/moderate_.c
1548
1549 $(OBJDIR)/moderate.h: $(OBJDIR)/headers
1550
1551 $(OBJDIR)/name_.c: $(SRCDIR)/name.c $(TRANSLATE)
1552 $(TRANSLATE) $(SRCDIR)/name.c >$@
1553
1554 $(OBJDIR)/name.o: $(OBJDIR)/name_.c $(OBJDIR)/name.h $(SRCDIR)/config.h
1555 $(XTCC) -o $(OBJDIR)/name.o -c $(OBJDIR)/name_.c
1556
1557 $(OBJDIR)/name.h: $(OBJDIR)/headers
1558
1559 $(OBJDIR)/path_.c: $(SRCDIR)/path.c $(TRANSLATE)
1560 $(TRANSLATE) $(SRCDIR)/path.c >$@
1561
1562 $(OBJDIR)/path.o: $(OBJDIR)/path_.c $(OBJDIR)/path.h $(SRCDIR)/config.h
1563 $(XTCC) -o $(OBJDIR)/path.o -c $(OBJDIR)/path_.c
1564
1565 $(OBJDIR)/path.h: $(OBJDIR)/headers
1566
1567 $(OBJDIR)/pivot_.c: $(SRCDIR)/pivot.c $(TRANSLATE)
1568 $(TRANSLATE) $(SRCDIR)/pivot.c >$@
1569
1570 $(OBJDIR)/pivot.o: $(OBJDIR)/pivot_.c $(OBJDIR)/pivot.h $(SRCDIR)/config.h
1571 $(XTCC) -o $(OBJDIR)/pivot.o -c $(OBJDIR)/pivot_.c
1572
1573 $(OBJDIR)/pivot.h: $(OBJDIR)/headers
1574
1575 $(OBJDIR)/popen_.c: $(SRCDIR)/popen.c $(TRANSLATE)
1576 $(TRANSLATE) $(SRCDIR)/popen.c >$@
1577
1578 $(OBJDIR)/popen.o: $(OBJDIR)/popen_.c $(OBJDIR)/popen.h $(SRCDIR)/config.h
1579 $(XTCC) -o $(OBJDIR)/popen.o -c $(OBJDIR)/popen_.c
1580
1581 $(OBJDIR)/popen.h: $(OBJDIR)/headers
1582
1583 $(OBJDIR)/pqueue_.c: $(SRCDIR)/pqueue.c $(TRANSLATE)
1584 $(TRANSLATE) $(SRCDIR)/pqueue.c >$@
1585
1586 $(OBJDIR)/pqueue.o: $(OBJDIR)/pqueue_.c $(OBJDIR)/pqueue.h $(SRCDIR)/config.h
1587 $(XTCC) -o $(OBJDIR)/pqueue.o -c $(OBJDIR)/pqueue_.c
1588
1589 $(OBJDIR)/pqueue.h: $(OBJDIR)/headers
1590
1591 $(OBJDIR)/printf_.c: $(SRCDIR)/printf.c $(TRANSLATE)
1592 $(TRANSLATE) $(SRCDIR)/printf.c >$@
1593
1594 $(OBJDIR)/printf.o: $(OBJDIR)/printf_.c $(OBJDIR)/printf.h $(SRCDIR)/config.h
1595 $(XTCC) -o $(OBJDIR)/printf.o -c $(OBJDIR)/printf_.c
1596
1597 $(OBJDIR)/printf.h: $(OBJDIR)/headers
1598
1599 $(OBJDIR)/rebuild_.c: $(SRCDIR)/rebuild.c $(TRANSLATE)
1600 $(TRANSLATE) $(SRCDIR)/rebuild.c >$@
1601
1602 $(OBJDIR)/rebuild.o: $(OBJDIR)/rebuild_.c $(OBJDIR)/rebuild.h $(SRCDIR)/config.h
1603 $(XTCC) -o $(OBJDIR)/rebuild.o -c $(OBJDIR)/rebuild_.c
1604
1605 $(OBJDIR)/rebuild.h: $(OBJDIR)/headers
1606
1607 $(OBJDIR)/regexp_.c: $(SRCDIR)/regexp.c $(TRANSLATE)
1608 $(TRANSLATE) $(SRCDIR)/regexp.c >$@
1609
1610 $(OBJDIR)/regexp.o: $(OBJDIR)/regexp_.c $(OBJDIR)/regexp.h $(SRCDIR)/config.h
1611 $(XTCC) -o $(OBJDIR)/regexp.o -c $(OBJDIR)/regexp_.c
1612
1613 $(OBJDIR)/regexp.h: $(OBJDIR)/headers
1614
1615 $(OBJDIR)/report_.c: $(SRCDIR)/report.c $(TRANSLATE)
1616 $(TRANSLATE) $(SRCDIR)/report.c >$@
1617
1618 $(OBJDIR)/report.o: $(OBJDIR)/report_.c $(OBJDIR)/report.h $(SRCDIR)/config.h
1619 $(XTCC) -o $(OBJDIR)/report.o -c $(OBJDIR)/report_.c
1620
1621 $(OBJDIR)/report.h: $(OBJDIR)/headers
1622
1623 $(OBJDIR)/rss_.c: $(SRCDIR)/rss.c $(TRANSLATE)
1624 $(TRANSLATE) $(SRCDIR)/rss.c >$@
1625
1626 $(OBJDIR)/rss.o: $(OBJDIR)/rss_.c $(OBJDIR)/rss.h $(SRCDIR)/config.h
1627 $(XTCC) -o $(OBJDIR)/rss.o -c $(OBJDIR)/rss_.c
1628
1629 $(OBJDIR)/rss.h: $(OBJDIR)/headers
1630
1631 $(OBJDIR)/schema_.c: $(SRCDIR)/schema.c $(TRANSLATE)
1632 $(TRANSLATE) $(SRCDIR)/schema.c >$@
1633
1634 $(OBJDIR)/schema.o: $(OBJDIR)/schema_.c $(OBJDIR)/schema.h $(SRCDIR)/config.h
1635 $(XTCC) -o $(OBJDIR)/schema.o -c $(OBJDIR)/schema_.c
1636
1637 $(OBJDIR)/schema.h: $(OBJDIR)/headers
1638
1639 $(OBJDIR)/search_.c: $(SRCDIR)/search.c $(TRANSLATE)
1640 $(TRANSLATE) $(SRCDIR)/search.c >$@
1641
1642 $(OBJDIR)/search.o: $(OBJDIR)/search_.c $(OBJDIR)/search.h $(SRCDIR)/config.h
1643 $(XTCC) -o $(OBJDIR)/search.o -c $(OBJDIR)/search_.c
1644
1645 $(OBJDIR)/search.h: $(OBJDIR)/headers
1646
1647 $(OBJDIR)/setup_.c: $(SRCDIR)/setup.c $(TRANSLATE)
1648 $(TRANSLATE) $(SRCDIR)/setup.c >$@
1649
1650 $(OBJDIR)/setup.o: $(OBJDIR)/setup_.c $(OBJDIR)/setup.h $(SRCDIR)/config.h
1651 $(XTCC) -o $(OBJDIR)/setup.o -c $(OBJDIR)/setup_.c
1652
1653 $(OBJDIR)/setup.h: $(OBJDIR)/headers
1654
1655 $(OBJDIR)/sha1_.c: $(SRCDIR)/sha1.c $(TRANSLATE)
1656 $(TRANSLATE) $(SRCDIR)/sha1.c >$@
1657
1658 $(OBJDIR)/sha1.o: $(OBJDIR)/sha1_.c $(OBJDIR)/sha1.h $(SRCDIR)/config.h
1659 $(XTCC) -o $(OBJDIR)/sha1.o -c $(OBJDIR)/sha1_.c
1660
1661 $(OBJDIR)/sha1.h: $(OBJDIR)/headers
1662
1663 $(OBJDIR)/shun_.c: $(SRCDIR)/shun.c $(TRANSLATE)
1664 $(TRANSLATE) $(SRCDIR)/shun.c >$@
1665
1666 $(OBJDIR)/shun.o: $(OBJDIR)/shun_.c $(OBJDIR)/shun.h $(SRCDIR)/config.h
1667 $(XTCC) -o $(OBJDIR)/shun.o -c $(OBJDIR)/shun_.c
1668
1669 $(OBJDIR)/shun.h: $(OBJDIR)/headers
1670
1671 $(OBJDIR)/skins_.c: $(SRCDIR)/skins.c $(TRANSLATE)
1672 $(TRANSLATE) $(SRCDIR)/skins.c >$@
1673
1674 $(OBJDIR)/skins.o: $(OBJDIR)/skins_.c $(OBJDIR)/skins.h $(SRCDIR)/config.h
1675 $(XTCC) -o $(OBJDIR)/skins.o -c $(OBJDIR)/skins_.c
1676
1677 $(OBJDIR)/skins.h: $(OBJDIR)/headers
1678
1679 $(OBJDIR)/sqlcmd_.c: $(SRCDIR)/sqlcmd.c $(TRANSLATE)
1680 $(TRANSLATE) $(SRCDIR)/sqlcmd.c >$@
1681
1682 $(OBJDIR)/sqlcmd.o: $(OBJDIR)/sqlcmd_.c $(OBJDIR)/sqlcmd.h $(SRCDIR)/config.h
1683 $(XTCC) -o $(OBJDIR)/sqlcmd.o -c $(OBJDIR)/sqlcmd_.c
1684
1685 $(OBJDIR)/sqlcmd.h: $(OBJDIR)/headers
1686
1687 $(OBJDIR)/stash_.c: $(SRCDIR)/stash.c $(TRANSLATE)
1688 $(TRANSLATE) $(SRCDIR)/stash.c >$@
1689
1690 $(OBJDIR)/stash.o: $(OBJDIR)/stash_.c $(OBJDIR)/stash.h $(SRCDIR)/config.h
1691 $(XTCC) -o $(OBJDIR)/stash.o -c $(OBJDIR)/stash_.c
1692
1693 $(OBJDIR)/stash.h: $(OBJDIR)/headers
1694
1695 $(OBJDIR)/stat_.c: $(SRCDIR)/stat.c $(TRANSLATE)
1696 $(TRANSLATE) $(SRCDIR)/stat.c >$@
1697
1698 $(OBJDIR)/stat.o: $(OBJDIR)/stat_.c $(OBJDIR)/stat.h $(SRCDIR)/config.h
1699 $(XTCC) -o $(OBJDIR)/stat.o -c $(OBJDIR)/stat_.c
1700
1701 $(OBJDIR)/stat.h: $(OBJDIR)/headers
1702
1703 $(OBJDIR)/style_.c: $(SRCDIR)/style.c $(TRANSLATE)
1704 $(TRANSLATE) $(SRCDIR)/style.c >$@
1705
1706 $(OBJDIR)/style.o: $(OBJDIR)/style_.c $(OBJDIR)/style.h $(SRCDIR)/config.h
1707 $(XTCC) -o $(OBJDIR)/style.o -c $(OBJDIR)/style_.c
1708
1709 $(OBJDIR)/style.h: $(OBJDIR)/headers
1710
1711 $(OBJDIR)/sync_.c: $(SRCDIR)/sync.c $(TRANSLATE)
1712 $(TRANSLATE) $(SRCDIR)/sync.c >$@
1713
1714 $(OBJDIR)/sync.o: $(OBJDIR)/sync_.c $(OBJDIR)/sync.h $(SRCDIR)/config.h
1715 $(XTCC) -o $(OBJDIR)/sync.o -c $(OBJDIR)/sync_.c
1716
1717 $(OBJDIR)/sync.h: $(OBJDIR)/headers
1718
1719 $(OBJDIR)/tag_.c: $(SRCDIR)/tag.c $(TRANSLATE)
1720 $(TRANSLATE) $(SRCDIR)/tag.c >$@
1721
1722 $(OBJDIR)/tag.o: $(OBJDIR)/tag_.c $(OBJDIR)/tag.h $(SRCDIR)/config.h
1723 $(XTCC) -o $(OBJDIR)/tag.o -c $(OBJDIR)/tag_.c
1724
1725 $(OBJDIR)/tag.h: $(OBJDIR)/headers
1726
1727 $(OBJDIR)/tar_.c: $(SRCDIR)/tar.c $(TRANSLATE)
1728 $(TRANSLATE) $(SRCDIR)/tar.c >$@
1729
1730 $(OBJDIR)/tar.o: $(OBJDIR)/tar_.c $(OBJDIR)/tar.h $(SRCDIR)/config.h
1731 $(XTCC) -o $(OBJDIR)/tar.o -c $(OBJDIR)/tar_.c
1732
1733 $(OBJDIR)/tar.h: $(OBJDIR)/headers
1734
1735 $(OBJDIR)/th_main_.c: $(SRCDIR)/th_main.c $(TRANSLATE)
1736 $(TRANSLATE) $(SRCDIR)/th_main.c >$@
1737
1738 $(OBJDIR)/th_main.o: $(OBJDIR)/th_main_.c $(OBJDIR)/th_main.h $(SRCDIR)/config.h
1739 $(XTCC) -o $(OBJDIR)/th_main.o -c $(OBJDIR)/th_main_.c
1740
1741 $(OBJDIR)/th_main.h: $(OBJDIR)/headers
1742
1743 $(OBJDIR)/timeline_.c: $(SRCDIR)/timeline.c $(TRANSLATE)
1744 $(TRANSLATE) $(SRCDIR)/timeline.c >$@
1745
1746 $(OBJDIR)/timeline.o: $(OBJDIR)/timeline_.c $(OBJDIR)/timeline.h $(SRCDIR)/config.h
1747 $(XTCC) -o $(OBJDIR)/timeline.o -c $(OBJDIR)/timeline_.c
1748
1749 $(OBJDIR)/timeline.h: $(OBJDIR)/headers
1750
1751 $(OBJDIR)/tkt_.c: $(SRCDIR)/tkt.c $(TRANSLATE)
1752 $(TRANSLATE) $(SRCDIR)/tkt.c >$@
1753
1754 $(OBJDIR)/tkt.o: $(OBJDIR)/tkt_.c $(OBJDIR)/tkt.h $(SRCDIR)/config.h
1755 $(XTCC) -o $(OBJDIR)/tkt.o -c $(OBJDIR)/tkt_.c
1756
1757 $(OBJDIR)/tkt.h: $(OBJDIR)/headers
1758
1759 $(OBJDIR)/tktsetup_.c: $(SRCDIR)/tktsetup.c $(TRANSLATE)
1760 $(TRANSLATE) $(SRCDIR)/tktsetup.c >$@
1761
1762 $(OBJDIR)/tktsetup.o: $(OBJDIR)/tktsetup_.c $(OBJDIR)/tktsetup.h $(SRCDIR)/config.h
1763 $(XTCC) -o $(OBJDIR)/tktsetup.o -c $(OBJDIR)/tktsetup_.c
1764
1765 $(OBJDIR)/tktsetup.h: $(OBJDIR)/headers
1766
1767 $(OBJDIR)/undo_.c: $(SRCDIR)/undo.c $(TRANSLATE)
1768 $(TRANSLATE) $(SRCDIR)/undo.c >$@
1769
1770 $(OBJDIR)/undo.o: $(OBJDIR)/undo_.c $(OBJDIR)/undo.h $(SRCDIR)/config.h
1771 $(XTCC) -o $(OBJDIR)/undo.o -c $(OBJDIR)/undo_.c
1772
1773 $(OBJDIR)/undo.h: $(OBJDIR)/headers
1774
1775 $(OBJDIR)/unicode_.c: $(SRCDIR)/unicode.c $(TRANSLATE)
1776 $(TRANSLATE) $(SRCDIR)/unicode.c >$@
1777
1778 $(OBJDIR)/unicode.o: $(OBJDIR)/unicode_.c $(OBJDIR)/unicode.h $(SRCDIR)/config.h
1779 $(XTCC) -o $(OBJDIR)/unicode.o -c $(OBJDIR)/unicode_.c
1780
1781 $(OBJDIR)/unicode.h: $(OBJDIR)/headers
1782
1783 $(OBJDIR)/update_.c: $(SRCDIR)/update.c $(TRANSLATE)
1784 $(TRANSLATE) $(SRCDIR)/update.c >$@
1785
1786 $(OBJDIR)/update.o: $(OBJDIR)/update_.c $(OBJDIR)/update.h $(SRCDIR)/config.h
1787 $(XTCC) -o $(OBJDIR)/update.o -c $(OBJDIR)/update_.c
1788
1789 $(OBJDIR)/update.h: $(OBJDIR)/headers
1790
1791 $(OBJDIR)/url_.c: $(SRCDIR)/url.c $(TRANSLATE)
1792 $(TRANSLATE) $(SRCDIR)/url.c >$@
1793
1794 $(OBJDIR)/url.o: $(OBJDIR)/url_.c $(OBJDIR)/url.h $(SRCDIR)/config.h
1795 $(XTCC) -o $(OBJDIR)/url.o -c $(OBJDIR)/url_.c
1796
1797 $(OBJDIR)/url.h: $(OBJDIR)/headers
1798
1799 $(OBJDIR)/user_.c: $(SRCDIR)/user.c $(TRANSLATE)
1800 $(TRANSLATE) $(SRCDIR)/user.c >$@
1801
1802 $(OBJDIR)/user.o: $(OBJDIR)/user_.c $(OBJDIR)/user.h $(SRCDIR)/config.h
1803 $(XTCC) -o $(OBJDIR)/user.o -c $(OBJDIR)/user_.c
1804
1805 $(OBJDIR)/user.h: $(OBJDIR)/headers
1806
1807 $(OBJDIR)/utf8_.c: $(SRCDIR)/utf8.c $(TRANSLATE)
1808 $(TRANSLATE) $(SRCDIR)/utf8.c >$@
1809
1810 $(OBJDIR)/utf8.o: $(OBJDIR)/utf8_.c $(OBJDIR)/utf8.h $(SRCDIR)/config.h
1811 $(XTCC) -o $(OBJDIR)/utf8.o -c $(OBJDIR)/utf8_.c
1812
1813 $(OBJDIR)/utf8.h: $(OBJDIR)/headers
1814
1815 $(OBJDIR)/util_.c: $(SRCDIR)/util.c $(TRANSLATE)
1816 $(TRANSLATE) $(SRCDIR)/util.c >$@
1817
1818 $(OBJDIR)/util.o: $(OBJDIR)/util_.c $(OBJDIR)/util.h $(SRCDIR)/config.h
1819 $(XTCC) -o $(OBJDIR)/util.o -c $(OBJDIR)/util_.c
1820
1821 $(OBJDIR)/util.h: $(OBJDIR)/headers
1822
1823 $(OBJDIR)/verify_.c: $(SRCDIR)/verify.c $(TRANSLATE)
1824 $(TRANSLATE) $(SRCDIR)/verify.c >$@
1825
1826 $(OBJDIR)/verify.o: $(OBJDIR)/verify_.c $(OBJDIR)/verify.h $(SRCDIR)/config.h
1827 $(XTCC) -o $(OBJDIR)/verify.o -c $(OBJDIR)/verify_.c
1828
1829 $(OBJDIR)/verify.h: $(OBJDIR)/headers
1830
1831 $(OBJDIR)/vfile_.c: $(SRCDIR)/vfile.c $(TRANSLATE)
1832 $(TRANSLATE) $(SRCDIR)/vfile.c >$@
1833
1834 $(OBJDIR)/vfile.o: $(OBJDIR)/vfile_.c $(OBJDIR)/vfile.h $(SRCDIR)/config.h
1835 $(XTCC) -o $(OBJDIR)/vfile.o -c $(OBJDIR)/vfile_.c
1836
1837 $(OBJDIR)/vfile.h: $(OBJDIR)/headers
1838
1839 $(OBJDIR)/wiki_.c: $(SRCDIR)/wiki.c $(TRANSLATE)
1840 $(TRANSLATE) $(SRCDIR)/wiki.c >$@
1841
1842 $(OBJDIR)/wiki.o: $(OBJDIR)/wiki_.c $(OBJDIR)/wiki.h $(SRCDIR)/config.h
1843 $(XTCC) -o $(OBJDIR)/wiki.o -c $(OBJDIR)/wiki_.c
1844
1845 $(OBJDIR)/wiki.h: $(OBJDIR)/headers
1846
1847 $(OBJDIR)/wikiformat_.c: $(SRCDIR)/wikiformat.c $(TRANSLATE)
1848 $(TRANSLATE) $(SRCDIR)/wikiformat.c >$@
1849
1850 $(OBJDIR)/wikiformat.o: $(OBJDIR)/wikiformat_.c $(OBJDIR)/wikiformat.h $(SRCDIR)/config.h
1851 $(XTCC) -o $(OBJDIR)/wikiformat.o -c $(OBJDIR)/wikiformat_.c
1852
1853 $(OBJDIR)/wikiformat.h: $(OBJDIR)/headers
1854
1855 $(OBJDIR)/winfile_.c: $(SRCDIR)/winfile.c $(TRANSLATE)
1856 $(TRANSLATE) $(SRCDIR)/winfile.c >$@
1857
1858 $(OBJDIR)/winfile.o: $(OBJDIR)/winfile_.c $(OBJDIR)/winfile.h $(SRCDIR)/config.h
1859 $(XTCC) -o $(OBJDIR)/winfile.o -c $(OBJDIR)/winfile_.c
1860
1861 $(OBJDIR)/winfile.h: $(OBJDIR)/headers
1862
1863 $(OBJDIR)/winhttp_.c: $(SRCDIR)/winhttp.c $(TRANSLATE)
1864 $(TRANSLATE) $(SRCDIR)/winhttp.c >$@
1865
1866 $(OBJDIR)/winhttp.o: $(OBJDIR)/winhttp_.c $(OBJDIR)/winhttp.h $(SRCDIR)/config.h
1867 $(XTCC) -o $(OBJDIR)/winhttp.o -c $(OBJDIR)/winhttp_.c
1868
1869 $(OBJDIR)/winhttp.h: $(OBJDIR)/headers
1870
1871 $(OBJDIR)/wysiwyg_.c: $(SRCDIR)/wysiwyg.c $(TRANSLATE)
1872 $(TRANSLATE) $(SRCDIR)/wysiwyg.c >$@
1873
1874 $(OBJDIR)/wysiwyg.o: $(OBJDIR)/wysiwyg_.c $(OBJDIR)/wysiwyg.h $(SRCDIR)/config.h
1875 $(XTCC) -o $(OBJDIR)/wysiwyg.o -c $(OBJDIR)/wysiwyg_.c
1876
1877 $(OBJDIR)/wysiwyg.h: $(OBJDIR)/headers
1878
1879 $(OBJDIR)/xfer_.c: $(SRCDIR)/xfer.c $(TRANSLATE)
1880 $(TRANSLATE) $(SRCDIR)/xfer.c >$@
1881
1882 $(OBJDIR)/xfer.o: $(OBJDIR)/xfer_.c $(OBJDIR)/xfer.h $(SRCDIR)/config.h
1883 $(XTCC) -o $(OBJDIR)/xfer.o -c $(OBJDIR)/xfer_.c
1884
1885 $(OBJDIR)/xfer.h: $(OBJDIR)/headers
1886
1887 $(OBJDIR)/xfersetup_.c: $(SRCDIR)/xfersetup.c $(TRANSLATE)
1888 $(TRANSLATE) $(SRCDIR)/xfersetup.c >$@
1889
1890 $(OBJDIR)/xfersetup.o: $(OBJDIR)/xfersetup_.c $(OBJDIR)/xfersetup.h $(SRCDIR)/config.h
1891 $(XTCC) -o $(OBJDIR)/xfersetup.o -c $(OBJDIR)/xfersetup_.c
1892
1893 $(OBJDIR)/xfersetup.h: $(OBJDIR)/headers
1894
1895 $(OBJDIR)/zip_.c: $(SRCDIR)/zip.c $(TRANSLATE)
1896 $(TRANSLATE) $(SRCDIR)/zip.c >$@
1897
1898 $(OBJDIR)/zip.o: $(OBJDIR)/zip_.c $(OBJDIR)/zip.h $(SRCDIR)/config.h
1899 $(XTCC) -o $(OBJDIR)/zip.o -c $(OBJDIR)/zip_.c
1900
1901 $(OBJDIR)/zip.h: $(OBJDIR)/headers
@@ -1906,27 +1924,27 @@
1924 MINIZ_OPTIONS = -DMINIZ_NO_STDIO \
1925 -DMINIZ_NO_TIME \
1926 -DMINIZ_NO_ARCHIVE_APIS
1927
1928 $(OBJDIR)/sqlite3.o: $(SRCDIR)/sqlite3.c $(SRCDIR)/../win/Makefile.mingw.mistachkin
1929 $(XTCC) $(SQLITE_OPTIONS) $(SQLITE_CFLAGS) -c $(SRCDIR)/sqlite3.c -o $@
1930
1931 $(OBJDIR)/cson_amalgamation.o: $(SRCDIR)/cson_amalgamation.c
1932 $(XTCC) -c $(SRCDIR)/cson_amalgamation.c -o $@
1933
1934 $(OBJDIR)/json.o $(OBJDIR)/json_artifact.o $(OBJDIR)/json_branch.o $(OBJDIR)/json_config.o $(OBJDIR)/json_diff.o $(OBJDIR)/json_dir.o $(OBJDIR)/jsos_finfo.o $(OBJDIR)/json_login.o $(OBJDIR)/json_query.o $(OBJDIR)/json_report.o $(OBJDIR)/json_status.o $(OBJDIR)/json_tag.o $(OBJDIR)/json_timeline.o $(OBJDIR)/json_user.o $(OBJDIR)/json_wiki.o : $(SRCDIR)/json_detail.h
1935
1936 $(OBJDIR)/shell.o: $(SRCDIR)/shell.c $(SRCDIR)/sqlite3.h $(SRCDIR)/../win/Makefile.mingw.mistachkin
1937 $(XTCC) $(SHELL_OPTIONS) $(SHELL_CFLAGS) -c $(SRCDIR)/shell.c -o $@
1938
1939 $(OBJDIR)/th.o: $(SRCDIR)/th.c
1940 $(XTCC) -c $(SRCDIR)/th.c -o $@
1941
1942 $(OBJDIR)/th_lang.o: $(SRCDIR)/th_lang.c
1943 $(XTCC) -c $(SRCDIR)/th_lang.c -o $@
1944
1945 $(OBJDIR)/th_tcl.o: $(SRCDIR)/th_tcl.c
1946 $(XTCC) -c $(SRCDIR)/th_tcl.c -o $@
1947
1948 $(OBJDIR)/miniz.o: $(SRCDIR)/miniz.c
1949 $(XTCC) $(MINIZ_OPTIONS) -c $(SRCDIR)/miniz.c -o $@
1950
1951
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -204,10 +204,11 @@
204204
bisect_.c \
205205
blob_.c \
206206
branch_.c \
207207
browse_.c \
208208
builtin_.c \
209
+ bundle_.c \
209210
cache_.c \
210211
captcha_.c \
211212
cgi_.c \
212213
checkin_.c \
213214
checkout_.c \
@@ -226,10 +227,11 @@
226227
encode_.c \
227228
event_.c \
228229
export_.c \
229230
file_.c \
230231
finfo_.c \
232
+ foci_.c \
231233
fusefs_.c \
232234
glob_.c \
233235
graph_.c \
234236
gzip_.c \
235237
http_.c \
@@ -269,10 +271,12 @@
269271
path_.c \
270272
pivot_.c \
271273
popen_.c \
272274
pqueue_.c \
273275
printf_.c \
276
+ publish_.c \
277
+ purge_.c \
274278
rebuild_.c \
275279
regexp_.c \
276280
report_.c \
277281
rss_.c \
278282
schema_.c \
@@ -319,10 +323,11 @@
319323
$(OX)\bisect$O \
320324
$(OX)\blob$O \
321325
$(OX)\branch$O \
322326
$(OX)\browse$O \
323327
$(OX)\builtin$O \
328
+ $(OX)\bundle$O \
324329
$(OX)\cache$O \
325330
$(OX)\captcha$O \
326331
$(OX)\cgi$O \
327332
$(OX)\checkin$O \
328333
$(OX)\checkout$O \
@@ -342,10 +347,11 @@
342347
$(OX)\encode$O \
343348
$(OX)\event$O \
344349
$(OX)\export$O \
345350
$(OX)\file$O \
346351
$(OX)\finfo$O \
352
+ $(OX)\foci$O \
347353
$(OX)\fusefs$O \
348354
$(OX)\glob$O \
349355
$(OX)\graph$O \
350356
$(OX)\gzip$O \
351357
$(OX)\http$O \
@@ -385,10 +391,12 @@
385391
$(OX)\path$O \
386392
$(OX)\pivot$O \
387393
$(OX)\popen$O \
388394
$(OX)\pqueue$O \
389395
$(OX)\printf$O \
396
+ $(OX)\publish$O \
397
+ $(OX)\purge$O \
390398
$(OX)\rebuild$O \
391399
$(OX)\regexp$O \
392400
$(OX)\report$O \
393401
$(OX)\rss$O \
394402
$(OX)\schema$O \
@@ -488,10 +496,11 @@
488496
echo $(OX)\bisect.obj >> $@
489497
echo $(OX)\blob.obj >> $@
490498
echo $(OX)\branch.obj >> $@
491499
echo $(OX)\browse.obj >> $@
492500
echo $(OX)\builtin.obj >> $@
501
+ echo $(OX)\bundle.obj >> $@
493502
echo $(OX)\cache.obj >> $@
494503
echo $(OX)\captcha.obj >> $@
495504
echo $(OX)\cgi.obj >> $@
496505
echo $(OX)\checkin.obj >> $@
497506
echo $(OX)\checkout.obj >> $@
@@ -511,10 +520,11 @@
511520
echo $(OX)\encode.obj >> $@
512521
echo $(OX)\event.obj >> $@
513522
echo $(OX)\export.obj >> $@
514523
echo $(OX)\file.obj >> $@
515524
echo $(OX)\finfo.obj >> $@
525
+ echo $(OX)\foci.obj >> $@
516526
echo $(OX)\fusefs.obj >> $@
517527
echo $(OX)\glob.obj >> $@
518528
echo $(OX)\graph.obj >> $@
519529
echo $(OX)\gzip.obj >> $@
520530
echo $(OX)\http.obj >> $@
@@ -554,10 +564,12 @@
554564
echo $(OX)\path.obj >> $@
555565
echo $(OX)\pivot.obj >> $@
556566
echo $(OX)\popen.obj >> $@
557567
echo $(OX)\pqueue.obj >> $@
558568
echo $(OX)\printf.obj >> $@
569
+ echo $(OX)\publish.obj >> $@
570
+ echo $(OX)\purge.obj >> $@
559571
echo $(OX)\rebuild.obj >> $@
560572
echo $(OX)\regexp.obj >> $@
561573
echo $(OX)\report.obj >> $@
562574
echo $(OX)\rss.obj >> $@
563575
echo $(OX)\schema.obj >> $@
@@ -749,10 +761,16 @@
749761
$(OX)\builtin$O : builtin_.c builtin.h
750762
$(TCC) /Fo$@ -c builtin_.c
751763
752764
builtin_.c : $(SRCDIR)\builtin.c
753765
translate$E $** > $@
766
+
767
+$(OX)\bundle$O : bundle_.c bundle.h
768
+ $(TCC) /Fo$@ -c bundle_.c
769
+
770
+bundle_.c : $(SRCDIR)\bundle.c
771
+ translate$E $** > $@
754772
755773
$(OX)\cache$O : cache_.c cache.h
756774
$(TCC) /Fo$@ -c cache_.c
757775
758776
cache_.c : $(SRCDIR)\cache.c
@@ -881,10 +899,16 @@
881899
$(OX)\finfo$O : finfo_.c finfo.h
882900
$(TCC) /Fo$@ -c finfo_.c
883901
884902
finfo_.c : $(SRCDIR)\finfo.c
885903
translate$E $** > $@
904
+
905
+$(OX)\foci$O : foci_.c foci.h
906
+ $(TCC) /Fo$@ -c foci_.c
907
+
908
+foci_.c : $(SRCDIR)\foci.c
909
+ translate$E $** > $@
886910
887911
$(OX)\fusefs$O : fusefs_.c fusefs.h
888912
$(TCC) /Fo$@ -c fusefs_.c
889913
890914
fusefs_.c : $(SRCDIR)\fusefs.c
@@ -1139,10 +1163,22 @@
11391163
$(OX)\printf$O : printf_.c printf.h
11401164
$(TCC) /Fo$@ -c printf_.c
11411165
11421166
printf_.c : $(SRCDIR)\printf.c
11431167
translate$E $** > $@
1168
+
1169
+$(OX)\publish$O : publish_.c publish.h
1170
+ $(TCC) /Fo$@ -c publish_.c
1171
+
1172
+publish_.c : $(SRCDIR)\publish.c
1173
+ translate$E $** > $@
1174
+
1175
+$(OX)\purge$O : purge_.c purge.h
1176
+ $(TCC) /Fo$@ -c purge_.c
1177
+
1178
+purge_.c : $(SRCDIR)\purge.c
1179
+ translate$E $** > $@
11441180
11451181
$(OX)\rebuild$O : rebuild_.c rebuild.h
11461182
$(TCC) /Fo$@ -c rebuild_.c
11471183
11481184
rebuild_.c : $(SRCDIR)\rebuild.c
@@ -1381,10 +1417,11 @@
13811417
bisect_.c:bisect.h \
13821418
blob_.c:blob.h \
13831419
branch_.c:branch.h \
13841420
browse_.c:browse.h \
13851421
builtin_.c:builtin.h \
1422
+ bundle_.c:bundle.h \
13861423
cache_.c:cache.h \
13871424
captcha_.c:captcha.h \
13881425
cgi_.c:cgi.h \
13891426
checkin_.c:checkin.h \
13901427
checkout_.c:checkout.h \
@@ -1403,10 +1440,11 @@
14031440
encode_.c:encode.h \
14041441
event_.c:event.h \
14051442
export_.c:export.h \
14061443
file_.c:file.h \
14071444
finfo_.c:finfo.h \
1445
+ foci_.c:foci.h \
14081446
fusefs_.c:fusefs.h \
14091447
glob_.c:glob.h \
14101448
graph_.c:graph.h \
14111449
gzip_.c:gzip.h \
14121450
http_.c:http.h \
@@ -1446,10 +1484,12 @@
14461484
path_.c:path.h \
14471485
pivot_.c:pivot.h \
14481486
popen_.c:popen.h \
14491487
pqueue_.c:pqueue.h \
14501488
printf_.c:printf.h \
1489
+ publish_.c:publish.h \
1490
+ purge_.c:purge.h \
14511491
rebuild_.c:rebuild.h \
14521492
regexp_.c:regexp.h \
14531493
report_.c:report.h \
14541494
rss_.c:rss.h \
14551495
schema_.c:schema.h \
14561496
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -204,10 +204,11 @@
204 bisect_.c \
205 blob_.c \
206 branch_.c \
207 browse_.c \
208 builtin_.c \
 
209 cache_.c \
210 captcha_.c \
211 cgi_.c \
212 checkin_.c \
213 checkout_.c \
@@ -226,10 +227,11 @@
226 encode_.c \
227 event_.c \
228 export_.c \
229 file_.c \
230 finfo_.c \
 
231 fusefs_.c \
232 glob_.c \
233 graph_.c \
234 gzip_.c \
235 http_.c \
@@ -269,10 +271,12 @@
269 path_.c \
270 pivot_.c \
271 popen_.c \
272 pqueue_.c \
273 printf_.c \
 
 
274 rebuild_.c \
275 regexp_.c \
276 report_.c \
277 rss_.c \
278 schema_.c \
@@ -319,10 +323,11 @@
319 $(OX)\bisect$O \
320 $(OX)\blob$O \
321 $(OX)\branch$O \
322 $(OX)\browse$O \
323 $(OX)\builtin$O \
 
324 $(OX)\cache$O \
325 $(OX)\captcha$O \
326 $(OX)\cgi$O \
327 $(OX)\checkin$O \
328 $(OX)\checkout$O \
@@ -342,10 +347,11 @@
342 $(OX)\encode$O \
343 $(OX)\event$O \
344 $(OX)\export$O \
345 $(OX)\file$O \
346 $(OX)\finfo$O \
 
347 $(OX)\fusefs$O \
348 $(OX)\glob$O \
349 $(OX)\graph$O \
350 $(OX)\gzip$O \
351 $(OX)\http$O \
@@ -385,10 +391,12 @@
385 $(OX)\path$O \
386 $(OX)\pivot$O \
387 $(OX)\popen$O \
388 $(OX)\pqueue$O \
389 $(OX)\printf$O \
 
 
390 $(OX)\rebuild$O \
391 $(OX)\regexp$O \
392 $(OX)\report$O \
393 $(OX)\rss$O \
394 $(OX)\schema$O \
@@ -488,10 +496,11 @@
488 echo $(OX)\bisect.obj >> $@
489 echo $(OX)\blob.obj >> $@
490 echo $(OX)\branch.obj >> $@
491 echo $(OX)\browse.obj >> $@
492 echo $(OX)\builtin.obj >> $@
 
493 echo $(OX)\cache.obj >> $@
494 echo $(OX)\captcha.obj >> $@
495 echo $(OX)\cgi.obj >> $@
496 echo $(OX)\checkin.obj >> $@
497 echo $(OX)\checkout.obj >> $@
@@ -511,10 +520,11 @@
511 echo $(OX)\encode.obj >> $@
512 echo $(OX)\event.obj >> $@
513 echo $(OX)\export.obj >> $@
514 echo $(OX)\file.obj >> $@
515 echo $(OX)\finfo.obj >> $@
 
516 echo $(OX)\fusefs.obj >> $@
517 echo $(OX)\glob.obj >> $@
518 echo $(OX)\graph.obj >> $@
519 echo $(OX)\gzip.obj >> $@
520 echo $(OX)\http.obj >> $@
@@ -554,10 +564,12 @@
554 echo $(OX)\path.obj >> $@
555 echo $(OX)\pivot.obj >> $@
556 echo $(OX)\popen.obj >> $@
557 echo $(OX)\pqueue.obj >> $@
558 echo $(OX)\printf.obj >> $@
 
 
559 echo $(OX)\rebuild.obj >> $@
560 echo $(OX)\regexp.obj >> $@
561 echo $(OX)\report.obj >> $@
562 echo $(OX)\rss.obj >> $@
563 echo $(OX)\schema.obj >> $@
@@ -749,10 +761,16 @@
749 $(OX)\builtin$O : builtin_.c builtin.h
750 $(TCC) /Fo$@ -c builtin_.c
751
752 builtin_.c : $(SRCDIR)\builtin.c
753 translate$E $** > $@
 
 
 
 
 
 
754
755 $(OX)\cache$O : cache_.c cache.h
756 $(TCC) /Fo$@ -c cache_.c
757
758 cache_.c : $(SRCDIR)\cache.c
@@ -881,10 +899,16 @@
881 $(OX)\finfo$O : finfo_.c finfo.h
882 $(TCC) /Fo$@ -c finfo_.c
883
884 finfo_.c : $(SRCDIR)\finfo.c
885 translate$E $** > $@
 
 
 
 
 
 
886
887 $(OX)\fusefs$O : fusefs_.c fusefs.h
888 $(TCC) /Fo$@ -c fusefs_.c
889
890 fusefs_.c : $(SRCDIR)\fusefs.c
@@ -1139,10 +1163,22 @@
1139 $(OX)\printf$O : printf_.c printf.h
1140 $(TCC) /Fo$@ -c printf_.c
1141
1142 printf_.c : $(SRCDIR)\printf.c
1143 translate$E $** > $@
 
 
 
 
 
 
 
 
 
 
 
 
1144
1145 $(OX)\rebuild$O : rebuild_.c rebuild.h
1146 $(TCC) /Fo$@ -c rebuild_.c
1147
1148 rebuild_.c : $(SRCDIR)\rebuild.c
@@ -1381,10 +1417,11 @@
1381 bisect_.c:bisect.h \
1382 blob_.c:blob.h \
1383 branch_.c:branch.h \
1384 browse_.c:browse.h \
1385 builtin_.c:builtin.h \
 
1386 cache_.c:cache.h \
1387 captcha_.c:captcha.h \
1388 cgi_.c:cgi.h \
1389 checkin_.c:checkin.h \
1390 checkout_.c:checkout.h \
@@ -1403,10 +1440,11 @@
1403 encode_.c:encode.h \
1404 event_.c:event.h \
1405 export_.c:export.h \
1406 file_.c:file.h \
1407 finfo_.c:finfo.h \
 
1408 fusefs_.c:fusefs.h \
1409 glob_.c:glob.h \
1410 graph_.c:graph.h \
1411 gzip_.c:gzip.h \
1412 http_.c:http.h \
@@ -1446,10 +1484,12 @@
1446 path_.c:path.h \
1447 pivot_.c:pivot.h \
1448 popen_.c:popen.h \
1449 pqueue_.c:pqueue.h \
1450 printf_.c:printf.h \
 
 
1451 rebuild_.c:rebuild.h \
1452 regexp_.c:regexp.h \
1453 report_.c:report.h \
1454 rss_.c:rss.h \
1455 schema_.c:schema.h \
1456
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -204,10 +204,11 @@
204 bisect_.c \
205 blob_.c \
206 branch_.c \
207 browse_.c \
208 builtin_.c \
209 bundle_.c \
210 cache_.c \
211 captcha_.c \
212 cgi_.c \
213 checkin_.c \
214 checkout_.c \
@@ -226,10 +227,11 @@
227 encode_.c \
228 event_.c \
229 export_.c \
230 file_.c \
231 finfo_.c \
232 foci_.c \
233 fusefs_.c \
234 glob_.c \
235 graph_.c \
236 gzip_.c \
237 http_.c \
@@ -269,10 +271,12 @@
271 path_.c \
272 pivot_.c \
273 popen_.c \
274 pqueue_.c \
275 printf_.c \
276 publish_.c \
277 purge_.c \
278 rebuild_.c \
279 regexp_.c \
280 report_.c \
281 rss_.c \
282 schema_.c \
@@ -319,10 +323,11 @@
323 $(OX)\bisect$O \
324 $(OX)\blob$O \
325 $(OX)\branch$O \
326 $(OX)\browse$O \
327 $(OX)\builtin$O \
328 $(OX)\bundle$O \
329 $(OX)\cache$O \
330 $(OX)\captcha$O \
331 $(OX)\cgi$O \
332 $(OX)\checkin$O \
333 $(OX)\checkout$O \
@@ -342,10 +347,11 @@
347 $(OX)\encode$O \
348 $(OX)\event$O \
349 $(OX)\export$O \
350 $(OX)\file$O \
351 $(OX)\finfo$O \
352 $(OX)\foci$O \
353 $(OX)\fusefs$O \
354 $(OX)\glob$O \
355 $(OX)\graph$O \
356 $(OX)\gzip$O \
357 $(OX)\http$O \
@@ -385,10 +391,12 @@
391 $(OX)\path$O \
392 $(OX)\pivot$O \
393 $(OX)\popen$O \
394 $(OX)\pqueue$O \
395 $(OX)\printf$O \
396 $(OX)\publish$O \
397 $(OX)\purge$O \
398 $(OX)\rebuild$O \
399 $(OX)\regexp$O \
400 $(OX)\report$O \
401 $(OX)\rss$O \
402 $(OX)\schema$O \
@@ -488,10 +496,11 @@
496 echo $(OX)\bisect.obj >> $@
497 echo $(OX)\blob.obj >> $@
498 echo $(OX)\branch.obj >> $@
499 echo $(OX)\browse.obj >> $@
500 echo $(OX)\builtin.obj >> $@
501 echo $(OX)\bundle.obj >> $@
502 echo $(OX)\cache.obj >> $@
503 echo $(OX)\captcha.obj >> $@
504 echo $(OX)\cgi.obj >> $@
505 echo $(OX)\checkin.obj >> $@
506 echo $(OX)\checkout.obj >> $@
@@ -511,10 +520,11 @@
520 echo $(OX)\encode.obj >> $@
521 echo $(OX)\event.obj >> $@
522 echo $(OX)\export.obj >> $@
523 echo $(OX)\file.obj >> $@
524 echo $(OX)\finfo.obj >> $@
525 echo $(OX)\foci.obj >> $@
526 echo $(OX)\fusefs.obj >> $@
527 echo $(OX)\glob.obj >> $@
528 echo $(OX)\graph.obj >> $@
529 echo $(OX)\gzip.obj >> $@
530 echo $(OX)\http.obj >> $@
@@ -554,10 +564,12 @@
564 echo $(OX)\path.obj >> $@
565 echo $(OX)\pivot.obj >> $@
566 echo $(OX)\popen.obj >> $@
567 echo $(OX)\pqueue.obj >> $@
568 echo $(OX)\printf.obj >> $@
569 echo $(OX)\publish.obj >> $@
570 echo $(OX)\purge.obj >> $@
571 echo $(OX)\rebuild.obj >> $@
572 echo $(OX)\regexp.obj >> $@
573 echo $(OX)\report.obj >> $@
574 echo $(OX)\rss.obj >> $@
575 echo $(OX)\schema.obj >> $@
@@ -749,10 +761,16 @@
761 $(OX)\builtin$O : builtin_.c builtin.h
762 $(TCC) /Fo$@ -c builtin_.c
763
764 builtin_.c : $(SRCDIR)\builtin.c
765 translate$E $** > $@
766
767 $(OX)\bundle$O : bundle_.c bundle.h
768 $(TCC) /Fo$@ -c bundle_.c
769
770 bundle_.c : $(SRCDIR)\bundle.c
771 translate$E $** > $@
772
773 $(OX)\cache$O : cache_.c cache.h
774 $(TCC) /Fo$@ -c cache_.c
775
776 cache_.c : $(SRCDIR)\cache.c
@@ -881,10 +899,16 @@
899 $(OX)\finfo$O : finfo_.c finfo.h
900 $(TCC) /Fo$@ -c finfo_.c
901
902 finfo_.c : $(SRCDIR)\finfo.c
903 translate$E $** > $@
904
905 $(OX)\foci$O : foci_.c foci.h
906 $(TCC) /Fo$@ -c foci_.c
907
908 foci_.c : $(SRCDIR)\foci.c
909 translate$E $** > $@
910
911 $(OX)\fusefs$O : fusefs_.c fusefs.h
912 $(TCC) /Fo$@ -c fusefs_.c
913
914 fusefs_.c : $(SRCDIR)\fusefs.c
@@ -1139,10 +1163,22 @@
1163 $(OX)\printf$O : printf_.c printf.h
1164 $(TCC) /Fo$@ -c printf_.c
1165
1166 printf_.c : $(SRCDIR)\printf.c
1167 translate$E $** > $@
1168
1169 $(OX)\publish$O : publish_.c publish.h
1170 $(TCC) /Fo$@ -c publish_.c
1171
1172 publish_.c : $(SRCDIR)\publish.c
1173 translate$E $** > $@
1174
1175 $(OX)\purge$O : purge_.c purge.h
1176 $(TCC) /Fo$@ -c purge_.c
1177
1178 purge_.c : $(SRCDIR)\purge.c
1179 translate$E $** > $@
1180
1181 $(OX)\rebuild$O : rebuild_.c rebuild.h
1182 $(TCC) /Fo$@ -c rebuild_.c
1183
1184 rebuild_.c : $(SRCDIR)\rebuild.c
@@ -1381,10 +1417,11 @@
1417 bisect_.c:bisect.h \
1418 blob_.c:blob.h \
1419 branch_.c:branch.h \
1420 browse_.c:browse.h \
1421 builtin_.c:builtin.h \
1422 bundle_.c:bundle.h \
1423 cache_.c:cache.h \
1424 captcha_.c:captcha.h \
1425 cgi_.c:cgi.h \
1426 checkin_.c:checkin.h \
1427 checkout_.c:checkout.h \
@@ -1403,10 +1440,11 @@
1440 encode_.c:encode.h \
1441 event_.c:event.h \
1442 export_.c:export.h \
1443 file_.c:file.h \
1444 finfo_.c:finfo.h \
1445 foci_.c:foci.h \
1446 fusefs_.c:fusefs.h \
1447 glob_.c:glob.h \
1448 graph_.c:graph.h \
1449 gzip_.c:gzip.h \
1450 http_.c:http.h \
@@ -1446,10 +1484,12 @@
1484 path_.c:path.h \
1485 pivot_.c:pivot.h \
1486 popen_.c:popen.h \
1487 pqueue_.c:pqueue.h \
1488 printf_.c:printf.h \
1489 publish_.c:publish.h \
1490 purge_.c:purge.h \
1491 rebuild_.c:rebuild.h \
1492 regexp_.c:regexp.h \
1493 report_.c:report.h \
1494 rss_.c:rss.h \
1495 schema_.c:schema.h \
1496
--- www/checkin_names.wiki
+++ www/checkin_names.wiki
@@ -115,10 +115,31 @@
115115
116116
The "tag:deed2" name will refer to the most recent check-in
117117
tagged with "deed2" not to the
118118
check-in whose canonical name begins with "deed2".
119119
120
+<h2>Whole Branches</h2>
121
+
122
+Usually whan a branch name is specified, it means the latest checkin on
123
+that branch. But for some commands (ex: [/help/purge|purge]) a branch name
124
+on the argument means the earliest connected checkin on the branch. This
125
+seems confusing when being explained here, but it works out to be intuitive
126
+in practice.
127
+
128
+For example, the command "fossil purge XYZ" means to purge the checkin XYZ
129
+and all of its descendents. But when XYZ is in the form of a branch name, one
130
+generally wants to purge the entire branch, not just the last checkin on the
131
+branch. And so for this reason, commands like purge will interpret a branch
132
+name to be the first checkin of the branch rather than the last. If there
133
+are two or more branches with the same name, then these commands will select
134
+the first check-in of the branch that has the most recent checkin. What
135
+happens is that Fossil searches for the most recent checkin with the given
136
+tag, just as it always does. But if that tag is a branch name, it then walks
137
+back down the branch looking for the first check-in of that branch.
138
+
139
+Again, this behavior only occurs on a few commands where it make sense.
140
+
120141
<h2>Timestamps</h2>
121142
122143
A timestamp in one of the formats shown below means the most recent
123144
check-in that occurs no later than the timestamp given:
124145
125146
--- www/checkin_names.wiki
+++ www/checkin_names.wiki
@@ -115,10 +115,31 @@
115
116 The "tag:deed2" name will refer to the most recent check-in
117 tagged with "deed2" not to the
118 check-in whose canonical name begins with "deed2".
119
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120 <h2>Timestamps</h2>
121
122 A timestamp in one of the formats shown below means the most recent
123 check-in that occurs no later than the timestamp given:
124
125
--- www/checkin_names.wiki
+++ www/checkin_names.wiki
@@ -115,10 +115,31 @@
115
116 The "tag:deed2" name will refer to the most recent check-in
117 tagged with "deed2" not to the
118 check-in whose canonical name begins with "deed2".
119
120 <h2>Whole Branches</h2>
121
122 Usually whan a branch name is specified, it means the latest checkin on
123 that branch. But for some commands (ex: [/help/purge|purge]) a branch name
124 on the argument means the earliest connected checkin on the branch. This
125 seems confusing when being explained here, but it works out to be intuitive
126 in practice.
127
128 For example, the command "fossil purge XYZ" means to purge the checkin XYZ
129 and all of its descendents. But when XYZ is in the form of a branch name, one
130 generally wants to purge the entire branch, not just the last checkin on the
131 branch. And so for this reason, commands like purge will interpret a branch
132 name to be the first checkin of the branch rather than the last. If there
133 are two or more branches with the same name, then these commands will select
134 the first check-in of the branch that has the most recent checkin. What
135 happens is that Fossil searches for the most recent checkin with the given
136 tag, just as it always does. But if that tag is a branch name, it then walks
137 back down the branch looking for the first check-in of that branch.
138
139 Again, this behavior only occurs on a few commands where it make sense.
140
141 <h2>Timestamps</h2>
142
143 A timestamp in one of the formats shown below means the most recent
144 check-in that occurs no later than the timestamp given:
145
146
--- www/makefile.wiki
+++ www/makefile.wiki
@@ -57,29 +57,36 @@
5757
5858
The VERSION.h header file is generated from other information sources
5959
using a small program called:
6060
6161
9. mkversion.c
62
+
63
+The builtin_data.h header file contains the definitions of C-language
64
+byte-array constants that contain various resources such as scripts and
65
+images. The builtin_data.h header file is generate from the original
66
+resource files using a small program called:
67
+
68
+ 10 mkbuiltin.c
6269
6370
The src/ subdirectory also contains documentation about the
6471
makeheaders preprocessor program:
6572
66
- 10. [../src/makeheaders.html | makeheaders.html]
73
+ 11. [../src/makeheaders.html | makeheaders.html]
6774
6875
Click on the link to read this documentation. In addition there is
6976
a [http://www.tcl.tk/ | Tcl] script used to build the various makefiles:
7077
71
- 11. makemake.tcl
78
+ 12. makemake.tcl
7279
7380
Running this Tcl script will automatically regenerate all makefiles.
7481
In order to add a new source file to the Fossil implementation, simply
7582
edit makemake.tcl to add the new filename, then rerun the script, and
7683
all of the makefiles for all targets will be rebuild.
7784
7885
Finally, there is one of the makefiles generated by makemake.tcl:
7986
80
- 12. main.mk
87
+ 13. main.mk
8188
8289
The main.mk makefile is invoked from the Makefile in the top-level
8390
directory. The main.mk is generated by makemake.tcl and should not
8491
be hand edited. Other makefiles generated by makemake.tcl are in
8592
other subdirectories (currently all in the win/ subdirectory).
@@ -105,11 +112,11 @@
105112
106113
The VERSION.h header file is generated by
107114
a C program: src/mkversion.c.
108115
To run the VERSION.h generator, first compile the src/mkversion.c
109116
source file into a command-line program (named "mkversion.exe")
110
-than run:
117
+then run:
111118
112119
<blockquote><pre>
113120
mkversion.exe manifest.uuid manifest VERSION &gt;VERSION.h
114121
</pre></blockquote>
115122
@@ -116,10 +123,24 @@
116123
The pathnames in the above command might need to be adjusted to get the
117124
directories right. The point is that the manifest.uuid, manifest, and
118125
VERSION files
119126
in the root of the source tree are the three arguments and
120127
the generated VERSION.h file appears on standard output.
128
+
129
+The builtin_data.h header file is generated by a C program: src/mkbuiltin.c.
130
+The builtin_data.h file contains C-langauge byte-array definitions for
131
+the content of resource files used by Fossil. To generate the
132
+builtin_data.h file, first compile the mkbuiltin.c program, then run:
133
+
134
+<blockquote><pre>
135
+mkbuiltin.exe diff.tcl <i>OtherFiles...</i> &gt;builtin_data.h
136
+</pre></blockquote>
137
+
138
+At the time of this writing, the "diff.tcl" script (a Tcl/Tk script used
139
+to generate implement --tk option on the diff command) is the only resource
140
+file processed using mkbuiltin.exe. However, new resources will likely be
141
+added using this facility in future versions of Fossil.
121142
122143
<a name="preprocessing"></a>
123144
<h1>4.0 Preprocessing</h1>
124145
125146
There are three preprocessors for the Fossil sources. The mkindex
126147
--- www/makefile.wiki
+++ www/makefile.wiki
@@ -57,29 +57,36 @@
57
58 The VERSION.h header file is generated from other information sources
59 using a small program called:
60
61 9. mkversion.c
 
 
 
 
 
 
 
62
63 The src/ subdirectory also contains documentation about the
64 makeheaders preprocessor program:
65
66 10. [../src/makeheaders.html | makeheaders.html]
67
68 Click on the link to read this documentation. In addition there is
69 a [http://www.tcl.tk/ | Tcl] script used to build the various makefiles:
70
71 11. makemake.tcl
72
73 Running this Tcl script will automatically regenerate all makefiles.
74 In order to add a new source file to the Fossil implementation, simply
75 edit makemake.tcl to add the new filename, then rerun the script, and
76 all of the makefiles for all targets will be rebuild.
77
78 Finally, there is one of the makefiles generated by makemake.tcl:
79
80 12. main.mk
81
82 The main.mk makefile is invoked from the Makefile in the top-level
83 directory. The main.mk is generated by makemake.tcl and should not
84 be hand edited. Other makefiles generated by makemake.tcl are in
85 other subdirectories (currently all in the win/ subdirectory).
@@ -105,11 +112,11 @@
105
106 The VERSION.h header file is generated by
107 a C program: src/mkversion.c.
108 To run the VERSION.h generator, first compile the src/mkversion.c
109 source file into a command-line program (named "mkversion.exe")
110 than run:
111
112 <blockquote><pre>
113 mkversion.exe manifest.uuid manifest VERSION &gt;VERSION.h
114 </pre></blockquote>
115
@@ -116,10 +123,24 @@
116 The pathnames in the above command might need to be adjusted to get the
117 directories right. The point is that the manifest.uuid, manifest, and
118 VERSION files
119 in the root of the source tree are the three arguments and
120 the generated VERSION.h file appears on standard output.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
122 <a name="preprocessing"></a>
123 <h1>4.0 Preprocessing</h1>
124
125 There are three preprocessors for the Fossil sources. The mkindex
126
--- www/makefile.wiki
+++ www/makefile.wiki
@@ -57,29 +57,36 @@
57
58 The VERSION.h header file is generated from other information sources
59 using a small program called:
60
61 9. mkversion.c
62
63 The builtin_data.h header file contains the definitions of C-language
64 byte-array constants that contain various resources such as scripts and
65 images. The builtin_data.h header file is generate from the original
66 resource files using a small program called:
67
68 10 mkbuiltin.c
69
70 The src/ subdirectory also contains documentation about the
71 makeheaders preprocessor program:
72
73 11. [../src/makeheaders.html | makeheaders.html]
74
75 Click on the link to read this documentation. In addition there is
76 a [http://www.tcl.tk/ | Tcl] script used to build the various makefiles:
77
78 12. makemake.tcl
79
80 Running this Tcl script will automatically regenerate all makefiles.
81 In order to add a new source file to the Fossil implementation, simply
82 edit makemake.tcl to add the new filename, then rerun the script, and
83 all of the makefiles for all targets will be rebuild.
84
85 Finally, there is one of the makefiles generated by makemake.tcl:
86
87 13. main.mk
88
89 The main.mk makefile is invoked from the Makefile in the top-level
90 directory. The main.mk is generated by makemake.tcl and should not
91 be hand edited. Other makefiles generated by makemake.tcl are in
92 other subdirectories (currently all in the win/ subdirectory).
@@ -105,11 +112,11 @@
112
113 The VERSION.h header file is generated by
114 a C program: src/mkversion.c.
115 To run the VERSION.h generator, first compile the src/mkversion.c
116 source file into a command-line program (named "mkversion.exe")
117 then run:
118
119 <blockquote><pre>
120 mkversion.exe manifest.uuid manifest VERSION &gt;VERSION.h
121 </pre></blockquote>
122
@@ -116,10 +123,24 @@
123 The pathnames in the above command might need to be adjusted to get the
124 directories right. The point is that the manifest.uuid, manifest, and
125 VERSION files
126 in the root of the source tree are the three arguments and
127 the generated VERSION.h file appears on standard output.
128
129 The builtin_data.h header file is generated by a C program: src/mkbuiltin.c.
130 The builtin_data.h file contains C-langauge byte-array definitions for
131 the content of resource files used by Fossil. To generate the
132 builtin_data.h file, first compile the mkbuiltin.c program, then run:
133
134 <blockquote><pre>
135 mkbuiltin.exe diff.tcl <i>OtherFiles...</i> &gt;builtin_data.h
136 </pre></blockquote>
137
138 At the time of this writing, the "diff.tcl" script (a Tcl/Tk script used
139 to generate implement --tk option on the diff command) is the only resource
140 file processed using mkbuiltin.exe. However, new resources will likely be
141 added using this facility in future versions of Fossil.
142
143 <a name="preprocessing"></a>
144 <h1>4.0 Preprocessing</h1>
145
146 There are three preprocessors for the Fossil sources. The mkindex
147

Keyboard Shortcuts

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